On Tue, 2016-01-19 at 10:39 +0000, Ian Campbell wrote:
> On Thu, 2015-11-26 at 15:16 +0000, Ian Campbell wrote:
> > anything better would need to be arranged upstream.
> 
> http://xenbits.xen.org/gitweb/?p=xen.git;a=commit;h=de858271c16851d662b26
> 13
> 699401df6ecec8ef8 has now landed upstream, which allows the leaf dir to
> be
> set at configure time and therefore allows the packaging to avoid
> patching
> some stuff.
> 
> HVM guests have been broken in Stretch for ages now, so I'm going to look
> at preparing an NMU based on that upstream fix + adding
> --with-libexec-leaf-dir=xen-$(VERSION) to the configure arguments. I
> expect
> some minor adjustments to debian/patches/config-prefix.diff will also be
> required.
> 
> An early version of that (based on the not-yet-upstream version of the
> patch) is in pkg-xen.git#feature/bug805508, I don't imagine the final
> result will look much different.
> 
> I'll post a debdiff here as well as updating that branch.

Now uploaded to delayed/5 (per-devref 5.11.2 since this is an important
bug, and I'm pretty sure it is actually RC but 2 days seemed too
aggressive).

Attached are full.debdiff and sanitized.debdiff, the latter removes the
noise from the automatic files (debian/control.md5sum and debian/.git-dpm)
as well as the noise (changed From <sha>) arising from the git-dpm
checkout-patched + git-rebase for more convenient review.

I've also pushed 2022aa90fac033bc5caa439f44b0443b6399930d to
feature/bug805508 in pkg-xen.git.

I also have a signed tag in my local repo, debian/4.6.0-1+nmu1, but I
didn't push that (seeing as how this is an NMU, I wasn't sure if I should
or not).

Ian.
diff -Nru xen-4.6.0/debian/changelog xen-4.6.0/debian/changelog
--- xen-4.6.0/debian/changelog	2015-11-01 20:52:20.000000000 +0000
+++ xen-4.6.0/debian/changelog	2016-01-19 14:11:24.000000000 +0000
@@ -1,3 +1,13 @@
+xen (4.6.0-1+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Drop unused patching in of $(PREFIX), $(SBINDIR) and $(BINDIR)
+    which are no longer used by the upstream build system.
+  * Use correct/consistent LIBEXEC dirs throughout build
+    (Closes: #805508).
+
+ -- Ian Campbell <[email protected]>  Tue, 19 Jan 2016 12:25:52 +0000
+
 xen (4.6.0-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru xen-4.6.0/debian/control.md5sum xen-4.6.0/debian/control.md5sum
--- xen-4.6.0/debian/control.md5sum	2015-11-01 20:50:00.000000000 +0000
+++ xen-4.6.0/debian/control.md5sum	2016-01-19 14:11:33.000000000 +0000
@@ -1,4 +1,4 @@
-f9c4be5a03ea0905f2a01d479c8206f2  debian/changelog
+ca3b023ce0e3d81c046ef57830e8b50f  debian/changelog
 dc7b5d9f0538e3180af4e9aff9b0bd57  debian/bin/gencontrol.py
 e8f2113c78600fc17eeae209c9fad062  debian/templates/control.main.in
 a15fa64ce6deead28d33c1581b14dba7  debian/templates/xen-hypervisor.postinst.in
diff -Nru xen-4.6.0/debian/.git-dpm xen-4.6.0/debian/.git-dpm
--- xen-4.6.0/debian/.git-dpm	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/.git-dpm	2016-01-19 14:11:24.000000000 +0000
@@ -1,6 +1,6 @@
 # see git-dpm(1) from git-dpm package
-2cc6e92b8046952534df6e27abc16740a0ce9b0d
-2cc6e92b8046952534df6e27abc16740a0ce9b0d
+bfef8af1dbdd3e12537a7379f057b35d006e0145
+bfef8af1dbdd3e12537a7379f057b35d006e0145
 9fafe903bcadf774d3eb5fbef4666166aa876d2d
 9fafe903bcadf774d3eb5fbef4666166aa876d2d
 xen_4.6.0.orig.tar.xz
diff -Nru xen-4.6.0/debian/patches/config-prefix.diff xen-4.6.0/debian/patches/config-prefix.diff
--- xen-4.6.0/debian/patches/config-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/config-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From a8f7ae30f31b8332e7a802c3b26f520e2a465ece Mon Sep 17 00:00:00 2001
+From 31f71ac1ceed8aa294479cd74c17524300a3b84e Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:45 +0200
 Subject: config-prefix.diff
@@ -6,8 +6,8 @@
 Patch-Name: config-prefix.diff
 ---
  Config.mk          | 2 +-
- config/Paths.mk.in | 9 +++++++--
- 2 files changed, 8 insertions(+), 3 deletions(-)
+ config/Paths.mk.in | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/Config.mk b/Config.mk
 index 54fbb9d..675bc18 100644
@@ -23,7 +23,7 @@
  # to permit the user to set PYTHON_PREFIX_ARG to '' to workaround this bug:
  #  https://bugs.launchpad.net/ubuntu/+bug/362570
 diff --git a/config/Paths.mk.in b/config/Paths.mk.in
-index d36504f..c3b043f 100644
+index 1c7afb4..848d243 100644
 --- a/config/Paths.mk.in
 +++ b/config/Paths.mk.in
 @@ -13,6 +13,7 @@
@@ -34,18 +34,3 @@
  prefix                   := @prefix@
  bindir                   := @bindir@
  sbindir                  := @sbindir@
-@@ -29,8 +30,12 @@ includedir               := @includedir@
- localstatedir            := @localstatedir@
- sysconfdir               := @sysconfdir@
- 
--LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
--LIBEXEC_BIN              := @LIBEXEC_BIN@
-+PREFIX                   := $(prefix)
-+
-+SBINDIR                  := $(sbindir)
-+BINDIR                   := $(bindir)
-+LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
-+LIBEXEC_BIN              := $(LIBEXEC)/bin
- LIBEXEC_LIB              := $(LIBEXEC)/lib
- LIBEXEC_INC              := $(LIBEXEC)/include
- 
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7812.diff xen-4.6.0/debian/patches/CVE-2015-7812.diff
--- xen-4.6.0/debian/patches/CVE-2015-7812.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7812.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 1440439d8552e98995b91234480505c5eb154eb5 Mon Sep 17 00:00:00 2001
+From 1cb31904e7ff1e56db0996c91b05d3771cf55d6e Mon Sep 17 00:00:00 2001
 From: Julien Grall <[email protected]>
 Date: Thu, 29 Oct 2015 13:46:45 +0100
 Subject: arm: Support hypercall_create_continuation for multicall
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7813.diff xen-4.6.0/debian/patches/CVE-2015-7813.diff
--- xen-4.6.0/debian/patches/CVE-2015-7813.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7813.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 2989d96e3d84f2e589133edf317b8aed2429f3c8 Mon Sep 17 00:00:00 2001
+From a04e7be8a95c45ebbbb21dedbc27d54debd0dd1a Mon Sep 17 00:00:00 2001
 From: Ian Campbell <[email protected]>
 Date: Thu, 29 Oct 2015 13:47:10 +0100
 Subject: arm: rate-limit logging from unimplemented PHYSDEVOP and HVMOP.
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7814.diff xen-4.6.0/debian/patches/CVE-2015-7814.diff
--- xen-4.6.0/debian/patches/CVE-2015-7814.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7814.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 0361df69e22ae145cfdd95b0a3ea75a858a4bc08 Mon Sep 17 00:00:00 2001
+From be3a93a1970b7e753cc9736d7c3e795fd8846b2b Mon Sep 17 00:00:00 2001
 From: Ian Campbell <[email protected]>
 Date: Thu, 29 Oct 2015 13:47:38 +0100
 Subject: arm: handle races between relinquish_memory and free_domheap_pages
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7835.diff xen-4.6.0/debian/patches/CVE-2015-7835.diff
--- xen-4.6.0/debian/patches/CVE-2015-7835.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7835.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From c270ef05942a8ce35d78064aaa82f4f8360aff27 Mon Sep 17 00:00:00 2001
+From e7a7fad12aef53df7e8c1188fec3644deb04da95 Mon Sep 17 00:00:00 2001
 From: Jan Beulich <[email protected]>
 Date: Thu, 29 Oct 2015 13:48:09 +0100
 Subject: x86: guard against undue super page PTE creation
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7969.1.diff xen-4.6.0/debian/patches/CVE-2015-7969.1.diff
--- xen-4.6.0/debian/patches/CVE-2015-7969.1.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7969.1.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 967130a6c0a919da36281b69f600a31c22715b8c Mon Sep 17 00:00:00 2001
+From a0b5a0f9489298581a06a5bc183777cee3a408af Mon Sep 17 00:00:00 2001
 From: Jan Beulich <[email protected]>
 Date: Thu, 29 Oct 2015 13:51:24 +0100
 Subject: xenoprof: free domain's vcpu array
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7969.diff xen-4.6.0/debian/patches/CVE-2015-7969.diff
--- xen-4.6.0/debian/patches/CVE-2015-7969.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7969.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 91af405ccfba7200fec38d5c2624798794a0eb76 Mon Sep 17 00:00:00 2001
+From 3013fbfe54dd378d88c01f8056a6c043208bf6d3 Mon Sep 17 00:00:00 2001
 From: Jan Beulich <[email protected]>
 Date: Thu, 29 Oct 2015 13:49:56 +0100
 Subject: free domain's vcpu array
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7970.diff xen-4.6.0/debian/patches/CVE-2015-7970.diff
--- xen-4.6.0/debian/patches/CVE-2015-7970.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7970.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 86a812432587c0a6c415f935de3fb9838c0d1098 Mon Sep 17 00:00:00 2001
+From 8f0e5e821940d5079eba34595bc897ac6b9ccd5c Mon Sep 17 00:00:00 2001
 From: Andrew Cooper <[email protected]>
 Date: Thu, 29 Oct 2015 13:50:59 +0100
 Subject: x86/PoD: Eager sweep for zeroed pages
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7971.diff xen-4.6.0/debian/patches/CVE-2015-7971.diff
--- xen-4.6.0/debian/patches/CVE-2015-7971.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7971.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 2c55f2480b83990081dc43541eebf391635014ca Mon Sep 17 00:00:00 2001
+From d954b6092311355c95af67d981bdd2491b3df66e Mon Sep 17 00:00:00 2001
 From: Jan Beulich <[email protected]>
 Date: Thu, 29 Oct 2015 13:52:02 +0100
 Subject: x86: rate-limit logging in do_xen{oprof,pmu}_op()
diff -Nru xen-4.6.0/debian/patches/CVE-2015-7972.diff xen-4.6.0/debian/patches/CVE-2015-7972.diff
--- xen-4.6.0/debian/patches/CVE-2015-7972.diff	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/CVE-2015-7972.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 2cc6e92b8046952534df6e27abc16740a0ce9b0d Mon Sep 17 00:00:00 2001
+From bfef8af1dbdd3e12537a7379f057b35d006e0145 Mon Sep 17 00:00:00 2001
 From: Ian Jackson <[email protected]>
 Date: Wed, 21 Oct 2015 16:18:30 +0100
 Subject: libxl: adjust PoD target by memory fudge, too
diff -Nru xen-4.6.0/debian/patches/series xen-4.6.0/debian/patches/series
--- xen-4.6.0/debian/patches/series	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/series	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,5 @@
 version.diff
+tools-allow-configure-time-choice-of-libexec-subdire.patch
 config-prefix.diff
 tools-libfsimage-abiname.diff
 tools-libxc-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch
--- xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch	1970-01-01 01:00:00.000000000 +0100
+++ xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch	2016-01-19 14:11:24.000000000 +0000
@@ -0,0 +1,233 @@
+From 493bf6ef4a8669b2dc53d7603de544135ad81b33 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <[email protected]>
+Date: Wed, 16 Dec 2015 15:06:35 +0000
+Subject: tools: allow configure time choice of libexec subdirectory.
+
+Currently we hardcode various paths such as $libexec/xen/{bin,boot},
+however some downstreams (notably Debian) would like instead to
+install things into $libexec/xen-X.Y/{bin,boot} as part of allowing
+multiple versions of the tools packages to be installed.
+
+Since this currently involves patching configure its a bit fiddly,
+provide a configure option for the leaf dir instead, name it
+--with-libexec-leaf-dir similar to the existing
+--with-sysconfig-leaf-dir.
+
+Rather than have the determination of the full path in both configure
+and config/Paths.mk.in move it into configure only. Also for
+consistency move the other LIBEXEC_* to configure, even though they
+are only substituted into Paths.mk.
+
+Signed-off-by: Ian Campbell <[email protected]>
+Reviewed-by: Doug Goldstein <[email protected]>
+Acked-by: Ian Jackson <[email protected]>
+Cc: [email protected]
+[ ijc -- removed stray ` ]
+
+(cherry picked from commit de858271c16851d662b2613699401df6ecec8ef8)
+
+Patch-Name: tools-allow-configure-time-choice-of-libexec-subdire.patch
+---
+ config/Paths.mk.in |  6 +++---
+ configure          | 26 +++++++++++++++++++++++---
+ m4/paths.m4        | 24 ++++++++++++++++++------
+ tools/configure    | 26 +++++++++++++++++++++++---
+ 4 files changed, 67 insertions(+), 15 deletions(-)
+
+diff --git a/config/Paths.mk.in b/config/Paths.mk.in
+index d36504f..1c7afb4 100644
+--- a/config/Paths.mk.in
++++ b/config/Paths.mk.in
+@@ -29,10 +29,10 @@ includedir               := @includedir@
+ localstatedir            := @localstatedir@
+ sysconfdir               := @sysconfdir@
+ 
+-LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
++LIBEXEC                  := @LIBEXEC@
+ LIBEXEC_BIN              := @LIBEXEC_BIN@
+-LIBEXEC_LIB              := $(LIBEXEC)/lib
+-LIBEXEC_INC              := $(LIBEXEC)/include
++LIBEXEC_LIB              := @LIBEXEC_LIB@
++LIBEXEC_INC              := @LIBEXEC_INC@
+ 
+ SHAREDIR                 := @SHAREDIR@
+ MAN1DIR                  := $(mandir)/man1
+diff --git a/configure b/configure
+index 80b27d6..5af40d6 100755
+--- a/configure
++++ b/configure
+@@ -606,7 +606,10 @@ XEN_LIB_STORED
+ XEN_LOG_DIR
+ XEN_RUN_DIR
+ XENFIRMWAREDIR
++LIBEXEC_INC
++LIBEXEC_LIB
+ LIBEXEC_BIN
++LIBEXEC
+ CONFIG_LEAF_DIR
+ host_os
+ host_vendor
+@@ -659,6 +662,7 @@ ac_user_opts='
+ enable_option_checking
+ with_initddir
+ with_sysconfig_leaf_dir
++with_libexec_leaf_dir
+ with_xen_dumpdir
+ enable_xen
+ enable_tools
+@@ -1299,6 +1303,8 @@ Optional Packages:
+                           options for runlevel scripts and daemons such as
+                           xenstored. This should be either "sysconfig" or
+                           "default". [sysconfig]
++  --with-libexec-leaf-dir=SUBDIR
++                          Name of subdirectory in libexecdir to use.
+   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
+                           [LOCALSTATEDIR/lib/xen/dump]
+ 
+@@ -1924,6 +1930,15 @@ CONFIG_LEAF_DIR=$config_leaf_dir
+ 
+ 
+ 
++# Check whether --with-libexec-leaf-dir was given.
++if test "${with_libexec_leaf_dir+set}" = set; then :
++  withval=$with_libexec_leaf_dir; libexec_subdir=$withval
++else
++  libexec_subdir=$PACKAGE_TARNAME
++fi
++
++
++
+ # Check whether --with-xen-dumpdir was given.
+ if test "${with_xen_dumpdir+set}" = set; then :
+   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
+@@ -1940,11 +1955,16 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+          ;;
+     esac
+ fi
+-libexecdir=`eval echo $libexecdir`
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++
++
++LIBEXEC_BIN=${LIBEXEC}/bin
++
++LIBEXEC_LIB=${LIBEXEC}/lib
+ 
++LIBEXEC_INC=${LIBEXEC}/include
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ 
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
+diff --git a/m4/paths.m4 b/m4/paths.m4
+index 63e0f6b..fa902bb 100644
+--- a/m4/paths.m4
++++ b/m4/paths.m4
+@@ -62,6 +62,14 @@ AC_ARG_WITH([sysconfig-leaf-dir],
+ CONFIG_LEAF_DIR=$config_leaf_dir
+ AC_SUBST(CONFIG_LEAF_DIR)
+ 
++dnl autoconf docs suggest to use a "package name" subdir. We make it
++dnl configurable for the benefit of those who want e.g. xen-X.Y instead.
++AC_ARG_WITH([libexec-leaf-dir],
++    AS_HELP_STRING([--with-libexec-leaf-dir=SUBDIR],
++    [Name of subdirectory in libexecdir to use.]),
++    [libexec_subdir=$withval],
++    [libexec_subdir=$PACKAGE_TARNAME])
++
+ AC_ARG_WITH([xen-dumpdir],
+     AS_HELP_STRING([--with-xen-dumpdir=DIR],
+     [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
+@@ -77,13 +85,17 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+     esac
+ fi
+ dnl expand exec_prefix or it will endup in substituted variables
+-libexecdir=`eval echo $libexecdir`
+-dnl autoconf doc suggest to use a "package name" subdir
+-dnl This variable will be substituted in various .in files
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
+-AC_SUBST(LIBEXEC_BIN)
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++AC_SUBST(LIBEXEC)
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++dnl These variables will be substituted in various .in files
++LIBEXEC_BIN=${LIBEXEC}/bin
++AC_SUBST(LIBEXEC_BIN)
++LIBEXEC_LIB=${LIBEXEC}/lib
++AC_SUBST(LIBEXEC_LIB)
++LIBEXEC_INC=${LIBEXEC}/include
++AC_SUBST(LIBEXEC_INC)
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ AC_SUBST(XENFIRMWAREDIR)
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
+diff --git a/tools/configure b/tools/configure
+index aa66876..c04b38a 100755
+--- a/tools/configure
++++ b/tools/configure
+@@ -726,7 +726,10 @@ XEN_LIB_STORED
+ XEN_LOG_DIR
+ XEN_RUN_DIR
+ XENFIRMWAREDIR
++LIBEXEC_INC
++LIBEXEC_LIB
+ LIBEXEC_BIN
++LIBEXEC
+ CONFIG_LEAF_DIR
+ FILE_OFFSET_BITS
+ OBJEXT
+@@ -789,6 +792,7 @@ enable_option_checking
+ enable_largefile
+ with_initddir
+ with_sysconfig_leaf_dir
++with_libexec_leaf_dir
+ with_xen_dumpdir
+ enable_rpath
+ enable_githttp
+@@ -1490,6 +1494,8 @@ Optional Packages:
+                           options for runlevel scripts and daemons such as
+                           xenstored. This should be either "sysconfig" or
+                           "default". [sysconfig]
++  --with-libexec-leaf-dir=SUBDIR
++                          Name of subdirectory in libexecdir to use.
+   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
+                           [LOCALSTATEDIR/lib/xen/dump]
+   --with-linux-backend-modules="mod1 mod2"
+@@ -3887,6 +3893,15 @@ CONFIG_LEAF_DIR=$config_leaf_dir
+ 
+ 
+ 
++# Check whether --with-libexec-leaf-dir was given.
++if test "${with_libexec_leaf_dir+set}" = set; then :
++  withval=$with_libexec_leaf_dir; libexec_subdir=$withval
++else
++  libexec_subdir=$PACKAGE_TARNAME
++fi
++
++
++
+ # Check whether --with-xen-dumpdir was given.
+ if test "${with_xen_dumpdir+set}" = set; then :
+   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
+@@ -3903,11 +3918,16 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+          ;;
+     esac
+ fi
+-libexecdir=`eval echo $libexecdir`
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++
++
++LIBEXEC_BIN=${LIBEXEC}/bin
++
++LIBEXEC_LIB=${LIBEXEC}/lib
+ 
++LIBEXEC_INC=${LIBEXEC}/include
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ 
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
diff -Nru xen-4.6.0/debian/patches/tools-blktap2-prefix.diff xen-4.6.0/debian/patches/tools-blktap2-prefix.diff
--- xen-4.6.0/debian/patches/tools-blktap2-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-blktap2-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 85fba7aaa37170064971807e1209b119b6b9cf0e Mon Sep 17 00:00:00 2001
+From 0217d57bce9dee21cd4b42319ecb734d7c508f29 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:53 +0200
 Subject: tools-blktap2-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-console-prefix.diff xen-4.6.0/debian/patches/tools-console-prefix.diff
--- xen-4.6.0/debian/patches/tools-console-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-console-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From e588b204f15e7a88b0cfdd4f34ebfa79aabfff76 Mon Sep 17 00:00:00 2001
+From 4a3eac9949ecbae3c0a57e079c150f026416babb Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:54 +0200
 Subject: tools-console-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-include-install.diff xen-4.6.0/debian/patches/tools-include-install.diff
--- xen-4.6.0/debian/patches/tools-include-install.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-include-install.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 4dfebbec5ff7d54473b56bd3cef0352802967294 Mon Sep 17 00:00:00 2001
+From 6b4ea81f9dbec5687d0d24b2036545653857a280 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:30 +0200
 Subject: tools-include-install.diff
diff -Nru xen-4.6.0/debian/patches/tools-libfsimage-abiname.diff xen-4.6.0/debian/patches/tools-libfsimage-abiname.diff
--- xen-4.6.0/debian/patches/tools-libfsimage-abiname.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-libfsimage-abiname.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 9cd5bad1a3bb72b5448c5767070160249c45c34e Mon Sep 17 00:00:00 2001
+From f1a46665ec9eaa57a6f6a7e0478f38a837133c4a Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:47 +0200
 Subject: tools-libfsimage-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-libfsimage-prefix.diff xen-4.6.0/debian/patches/tools-libfsimage-prefix.diff
--- xen-4.6.0/debian/patches/tools-libfsimage-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-libfsimage-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 4b86c760c09a8fa291cccfe60811ef53e87b896a Mon Sep 17 00:00:00 2001
+From bc0bf96348e2c683e2958453d837c45132671f96 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:55 +0200
 Subject: tools-libfsimage-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-libxc-abiname.diff xen-4.6.0/debian/patches/tools-libxc-abiname.diff
--- xen-4.6.0/debian/patches/tools-libxc-abiname.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-libxc-abiname.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 973db50d8c62f6fdc9ea25f65fa8bb8634a4771f Mon Sep 17 00:00:00 2001
+From 99ff210087538225d22019474430cb0fdae8986a Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:48 +0200
 Subject: tools-libxc-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-libxl-abiname.diff xen-4.6.0/debian/patches/tools-libxl-abiname.diff
--- xen-4.6.0/debian/patches/tools-libxl-abiname.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-libxl-abiname.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 2797781477ae40b32d561fbd318b0f44e722eedb Mon Sep 17 00:00:00 2001
+From 6b045729daf86c55440e0391bad4d981dbb2d805 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:49 +0200
 Subject: tools-libxl-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-libxl-prefix.diff xen-4.6.0/debian/patches/tools-libxl-prefix.diff
--- xen-4.6.0/debian/patches/tools-libxl-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-libxl-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From ca4a2ee9008f68c00fa2726a11e4c8c8bdff43b2 Mon Sep 17 00:00:00 2001
+From d8e7fa4b74ebc68d38bca0ca5de82addbed7caff Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:57 +0200
 Subject: tools-libxl-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-misc-prefix.diff xen-4.6.0/debian/patches/tools-misc-prefix.diff
--- xen-4.6.0/debian/patches/tools-misc-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-misc-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 0d261587a649543c5fc05013817e09bfd96a16df Mon Sep 17 00:00:00 2001
+From 9bff27bcfcad2bcba7b428e7199173be9a7bb202 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:59 +0200
 Subject: tools-misc-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-pygrub-prefix.diff xen-4.6.0/debian/patches/tools-pygrub-prefix.diff
--- xen-4.6.0/debian/patches/tools-pygrub-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-pygrub-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From d31889e05bb4483c52b51a54886fe1d5672fc72e Mon Sep 17 00:00:00 2001
+From 1b9302af0618b30e918ecbafdb51d2badd3e666e Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:01 +0200
 Subject: tools-pygrub-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-pygrub-remove-static-solaris-support xen-4.6.0/debian/patches/tools-pygrub-remove-static-solaris-support
--- xen-4.6.0/debian/patches/tools-pygrub-remove-static-solaris-support	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-pygrub-remove-static-solaris-support	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From e730f60f8001fb57e4018d961df07549615a9621 Mon Sep 17 00:00:00 2001
+From 21d1298418ec54f87a5dffe6857ab474b159d6dc Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:29 +0200
 Subject: Remove static solaris support from pygrub
diff -Nru xen-4.6.0/debian/patches/tools-python-prefix.diff xen-4.6.0/debian/patches/tools-python-prefix.diff
--- xen-4.6.0/debian/patches/tools-python-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-python-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From b18c27e57939f8a7d1b59234640d5fc0436811c5 Mon Sep 17 00:00:00 2001
+From 141cd0567fbcf98572e37a220c0c85d0dffc9b2b Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:02 +0200
 Subject: tools-python-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-rpath.diff xen-4.6.0/debian/patches/tools-rpath.diff
--- xen-4.6.0/debian/patches/tools-rpath.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-rpath.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From cdfa126024ef926d0e22d1ed5966917b863c972d Mon Sep 17 00:00:00 2001
+From d84837538defa41229bbc4507b76869778cba9f1 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:51 +0200
 Subject: tools-rpath.diff
diff -Nru xen-4.6.0/debian/patches/tools-xcutils-rpath.diff xen-4.6.0/debian/patches/tools-xcutils-rpath.diff
--- xen-4.6.0/debian/patches/tools-xcutils-rpath.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xcutils-rpath.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 49c46e9c43c267676a9dc70d664316d48df05851 Mon Sep 17 00:00:00 2001
+From 124316a08cf9154ce6809f61c5c56d1723364c82 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:05 +0200
 Subject: tools-xcutils-rpath.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenmon-install.diff xen-4.6.0/debian/patches/tools-xenmon-install.diff
--- xen-4.6.0/debian/patches/tools-xenmon-install.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenmon-install.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From f85560a654ad09dc421d4d5092df06634dca9e0c Mon Sep 17 00:00:00 2001
+From 1e891d48238987a735c7183a45822f68bcd00a56 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:31 +0200
 Subject: tools-xenmon-install.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenmon-prefix.diff xen-4.6.0/debian/patches/tools-xenmon-prefix.diff
--- xen-4.6.0/debian/patches/tools-xenmon-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenmon-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 45980ee259b429b29906f4737a6d809c64454500 Mon Sep 17 00:00:00 2001
+From 68f545c1e9227d64d47407a9f05d918a819f3733 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:06 +0200
 Subject: tools-xenmon-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenpaging-prefix.diff xen-4.6.0/debian/patches/tools-xenpaging-prefix.diff
--- xen-4.6.0/debian/patches/tools-xenpaging-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenpaging-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 96a45c8ccb73dc6763aca3f1233a79ab97fb0c88 Mon Sep 17 00:00:00 2001
+From b126461dd534c9ea60603e5680a1009fb7d8c57c Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:08 +0200
 Subject: tools-xenpaging-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenpmd-prefix.diff xen-4.6.0/debian/patches/tools-xenpmd-prefix.diff
--- xen-4.6.0/debian/patches/tools-xenpmd-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenpmd-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 1eb37137da67120b35218a9ad52c246afb109508 Mon Sep 17 00:00:00 2001
+From 4765ac594756870c30cf1963530b1f682035bc00 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 13 Dec 2014 19:37:02 +0100
 Subject: tools-xenpmd-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenstat-abiname.diff xen-4.6.0/debian/patches/tools-xenstat-abiname.diff
--- xen-4.6.0/debian/patches/tools-xenstat-abiname.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenstat-abiname.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 6d0ff0f7897f89ce62bb17e3bb7148d824ce2155 Mon Sep 17 00:00:00 2001
+From a3f4d066fa36b8dfcaab81e8e6fc7296a6927c67 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:46:50 +0200
 Subject: tools-xenstat-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenstat-prefix.diff xen-4.6.0/debian/patches/tools-xenstat-prefix.diff
--- xen-4.6.0/debian/patches/tools-xenstat-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenstat-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From fa1d487e1c8245cb886d6b69e27bf35319cc5c9c Mon Sep 17 00:00:00 2001
+From 86e02c8e08b9fd2164ce8b1f419156a9eba4cc24 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:09 +0200
 Subject: tools-xenstat-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenstore-compatibility.diff xen-4.6.0/debian/patches/tools-xenstore-compatibility.diff
--- xen-4.6.0/debian/patches/tools-xenstore-compatibility.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenstore-compatibility.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From b00b02f0283fa7536ab44264a21c2dcdaa22d631 Mon Sep 17 00:00:00 2001
+From 28d59f50f74be1598e306dccebbf037046452097 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:36 +0200
 Subject: tools-xenstore-compatibility.diff
diff -Nru xen-4.6.0/debian/patches/tools-xenstore-prefix.diff xen-4.6.0/debian/patches/tools-xenstore-prefix.diff
--- xen-4.6.0/debian/patches/tools-xenstore-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xenstore-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 93b026099b1360ad25a4bfb9dc258b848194f307 Mon Sep 17 00:00:00 2001
+From ae26990012e9cbbf3c49b4dd3c2a6df3b81d6019 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:12 +0200
 Subject: tools-xenstore-prefix.diff
diff -Nru xen-4.6.0/debian/patches/tools-xentrace-prefix.diff xen-4.6.0/debian/patches/tools-xentrace-prefix.diff
--- xen-4.6.0/debian/patches/tools-xentrace-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/tools-xentrace-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,4 @@
-From 7912cb831bac7eb34095049a470b5a2dab85cfe4 Mon Sep 17 00:00:00 2001
+From 94b9f1f7d68bd52d07a4709e7cc9c99cd7ab9647 Mon Sep 17 00:00:00 2001
 From: Bastian Blank <[email protected]>
 Date: Sat, 5 Jul 2014 11:47:14 +0200
 Subject: tools-xentrace-prefix.diff
diff -Nru xen-4.6.0/debian/rules.real xen-4.6.0/debian/rules.real
--- xen-4.6.0/debian/rules.real	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/rules.real	2016-01-19 14:11:24.000000000 +0000
@@ -67,6 +67,7 @@
 			--infodir=/usr/share/info \
 			--sysconfdir=/etc \
 			--localstatedir=/var \
+			--with-libexec-leaf-dir=xen-$(VERSION) \
 			--disable-blktap1 \
 			--disable-blktap2 \
 			--disable-ocamltools \
diff -Nru xen-4.6.0/debian/changelog xen-4.6.0/debian/changelog
--- xen-4.6.0/debian/changelog	2015-11-01 20:52:20.000000000 +0000
+++ xen-4.6.0/debian/changelog	2016-01-19 14:11:24.000000000 +0000
@@ -1,3 +1,13 @@
+xen (4.6.0-1+nmu1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Drop unused patching in of $(PREFIX), $(SBINDIR) and $(BINDIR)
+    which are no longer used by the upstream build system.
+  * Use correct/consistent LIBEXEC dirs throughout build
+    (Closes: #805508).
+
+ -- Ian Campbell <[email protected]>  Tue, 19 Jan 2016 12:25:52 +0000
+
 xen (4.6.0-1) unstable; urgency=medium
 
   * New upstream release.
diff -Nru xen-4.6.0/debian/patches/config-prefix.diff xen-4.6.0/debian/patches/config-prefix.diff
--- xen-4.6.0/debian/patches/config-prefix.diff	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/patches/config-prefix.diff	2016-01-19 14:11:24.000000000 +0000
@@ -6,8 +6,8 @@
 Patch-Name: config-prefix.diff
 ---
  Config.mk          | 2 +-
- config/Paths.mk.in | 9 +++++++--
- 2 files changed, 8 insertions(+), 3 deletions(-)
+ config/Paths.mk.in | 1 +
+ 2 files changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/Config.mk b/Config.mk
 index 54fbb9d..675bc18 100644
@@ -34,18 +34,3 @@
  prefix                   := @prefix@
  bindir                   := @bindir@
  sbindir                  := @sbindir@
-@@ -29,8 +30,12 @@ includedir               := @includedir@
- localstatedir            := @localstatedir@
- sysconfdir               := @sysconfdir@
- 
--LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
--LIBEXEC_BIN              := @LIBEXEC_BIN@
-+PREFIX                   := $(prefix)
-+
-+SBINDIR                  := $(sbindir)
-+BINDIR                   := $(bindir)
-+LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)-$(PACKAGE_VERSION)
-+LIBEXEC_BIN              := $(LIBEXEC)/bin
- LIBEXEC_LIB              := $(LIBEXEC)/lib
- LIBEXEC_INC              := $(LIBEXEC)/include
- 
diff -Nru xen-4.6.0/debian/patches/series xen-4.6.0/debian/patches/series
--- xen-4.6.0/debian/patches/series	2015-11-01 20:38:23.000000000 +0000
+++ xen-4.6.0/debian/patches/series	2016-01-19 14:11:24.000000000 +0000
@@ -1,4 +1,5 @@
 version.diff
+tools-allow-configure-time-choice-of-libexec-subdire.patch
 config-prefix.diff
 tools-libfsimage-abiname.diff
 tools-libxc-abiname.diff
diff -Nru xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch
--- xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch	1970-01-01 01:00:00.000000000 +0100
+++ xen-4.6.0/debian/patches/tools-allow-configure-time-choice-of-libexec-subdire.patch	2016-01-19 14:11:24.000000000 +0000
@@ -0,0 +1,233 @@
+From 493bf6ef4a8669b2dc53d7603de544135ad81b33 Mon Sep 17 00:00:00 2001
+From: Ian Campbell <[email protected]>
+Date: Wed, 16 Dec 2015 15:06:35 +0000
+Subject: tools: allow configure time choice of libexec subdirectory.
+
+Currently we hardcode various paths such as $libexec/xen/{bin,boot},
+however some downstreams (notably Debian) would like instead to
+install things into $libexec/xen-X.Y/{bin,boot} as part of allowing
+multiple versions of the tools packages to be installed.
+
+Since this currently involves patching configure its a bit fiddly,
+provide a configure option for the leaf dir instead, name it
+--with-libexec-leaf-dir similar to the existing
+--with-sysconfig-leaf-dir.
+
+Rather than have the determination of the full path in both configure
+and config/Paths.mk.in move it into configure only. Also for
+consistency move the other LIBEXEC_* to configure, even though they
+are only substituted into Paths.mk.
+
+Signed-off-by: Ian Campbell <[email protected]>
+Reviewed-by: Doug Goldstein <[email protected]>
+Acked-by: Ian Jackson <[email protected]>
+Cc: [email protected]
+[ ijc -- removed stray ` ]
+
+(cherry picked from commit de858271c16851d662b2613699401df6ecec8ef8)
+
+Patch-Name: tools-allow-configure-time-choice-of-libexec-subdire.patch
+---
+ config/Paths.mk.in |  6 +++---
+ configure          | 26 +++++++++++++++++++++++---
+ m4/paths.m4        | 24 ++++++++++++++++++------
+ tools/configure    | 26 +++++++++++++++++++++++---
+ 4 files changed, 67 insertions(+), 15 deletions(-)
+
+diff --git a/config/Paths.mk.in b/config/Paths.mk.in
+index d36504f..1c7afb4 100644
+--- a/config/Paths.mk.in
++++ b/config/Paths.mk.in
+@@ -29,10 +29,10 @@ includedir               := @includedir@
+ localstatedir            := @localstatedir@
+ sysconfdir               := @sysconfdir@
+ 
+-LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
++LIBEXEC                  := @LIBEXEC@
+ LIBEXEC_BIN              := @LIBEXEC_BIN@
+-LIBEXEC_LIB              := $(LIBEXEC)/lib
+-LIBEXEC_INC              := $(LIBEXEC)/include
++LIBEXEC_LIB              := @LIBEXEC_LIB@
++LIBEXEC_INC              := @LIBEXEC_INC@
+ 
+ SHAREDIR                 := @SHAREDIR@
+ MAN1DIR                  := $(mandir)/man1
+diff --git a/configure b/configure
+index 80b27d6..5af40d6 100755
+--- a/configure
++++ b/configure
+@@ -606,7 +606,10 @@ XEN_LIB_STORED
+ XEN_LOG_DIR
+ XEN_RUN_DIR
+ XENFIRMWAREDIR
++LIBEXEC_INC
++LIBEXEC_LIB
+ LIBEXEC_BIN
++LIBEXEC
+ CONFIG_LEAF_DIR
+ host_os
+ host_vendor
+@@ -659,6 +662,7 @@ ac_user_opts='
+ enable_option_checking
+ with_initddir
+ with_sysconfig_leaf_dir
++with_libexec_leaf_dir
+ with_xen_dumpdir
+ enable_xen
+ enable_tools
+@@ -1299,6 +1303,8 @@ Optional Packages:
+                           options for runlevel scripts and daemons such as
+                           xenstored. This should be either "sysconfig" or
+                           "default". [sysconfig]
++  --with-libexec-leaf-dir=SUBDIR
++                          Name of subdirectory in libexecdir to use.
+   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
+                           [LOCALSTATEDIR/lib/xen/dump]
+ 
+@@ -1924,6 +1930,15 @@ CONFIG_LEAF_DIR=$config_leaf_dir
+ 
+ 
+ 
++# Check whether --with-libexec-leaf-dir was given.
++if test "${with_libexec_leaf_dir+set}" = set; then :
++  withval=$with_libexec_leaf_dir; libexec_subdir=$withval
++else
++  libexec_subdir=$PACKAGE_TARNAME
++fi
++
++
++
+ # Check whether --with-xen-dumpdir was given.
+ if test "${with_xen_dumpdir+set}" = set; then :
+   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
+@@ -1940,11 +1955,16 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+          ;;
+     esac
+ fi
+-libexecdir=`eval echo $libexecdir`
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++
++
++LIBEXEC_BIN=${LIBEXEC}/bin
++
++LIBEXEC_LIB=${LIBEXEC}/lib
+ 
++LIBEXEC_INC=${LIBEXEC}/include
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ 
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
+diff --git a/m4/paths.m4 b/m4/paths.m4
+index 63e0f6b..fa902bb 100644
+--- a/m4/paths.m4
++++ b/m4/paths.m4
+@@ -62,6 +62,14 @@ AC_ARG_WITH([sysconfig-leaf-dir],
+ CONFIG_LEAF_DIR=$config_leaf_dir
+ AC_SUBST(CONFIG_LEAF_DIR)
+ 
++dnl autoconf docs suggest to use a "package name" subdir. We make it
++dnl configurable for the benefit of those who want e.g. xen-X.Y instead.
++AC_ARG_WITH([libexec-leaf-dir],
++    AS_HELP_STRING([--with-libexec-leaf-dir=SUBDIR],
++    [Name of subdirectory in libexecdir to use.]),
++    [libexec_subdir=$withval],
++    [libexec_subdir=$PACKAGE_TARNAME])
++
+ AC_ARG_WITH([xen-dumpdir],
+     AS_HELP_STRING([--with-xen-dumpdir=DIR],
+     [Path to directory for domU crash dumps. [LOCALSTATEDIR/lib/xen/dump]]),
+@@ -77,13 +85,17 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+     esac
+ fi
+ dnl expand exec_prefix or it will endup in substituted variables
+-libexecdir=`eval echo $libexecdir`
+-dnl autoconf doc suggest to use a "package name" subdir
+-dnl This variable will be substituted in various .in files
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
+-AC_SUBST(LIBEXEC_BIN)
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++AC_SUBST(LIBEXEC)
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++dnl These variables will be substituted in various .in files
++LIBEXEC_BIN=${LIBEXEC}/bin
++AC_SUBST(LIBEXEC_BIN)
++LIBEXEC_LIB=${LIBEXEC}/lib
++AC_SUBST(LIBEXEC_LIB)
++LIBEXEC_INC=${LIBEXEC}/include
++AC_SUBST(LIBEXEC_INC)
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ AC_SUBST(XENFIRMWAREDIR)
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
+diff --git a/tools/configure b/tools/configure
+index aa66876..c04b38a 100755
+--- a/tools/configure
++++ b/tools/configure
+@@ -726,7 +726,10 @@ XEN_LIB_STORED
+ XEN_LOG_DIR
+ XEN_RUN_DIR
+ XENFIRMWAREDIR
++LIBEXEC_INC
++LIBEXEC_LIB
+ LIBEXEC_BIN
++LIBEXEC
+ CONFIG_LEAF_DIR
+ FILE_OFFSET_BITS
+ OBJEXT
+@@ -789,6 +792,7 @@ enable_option_checking
+ enable_largefile
+ with_initddir
+ with_sysconfig_leaf_dir
++with_libexec_leaf_dir
+ with_xen_dumpdir
+ enable_rpath
+ enable_githttp
+@@ -1490,6 +1494,8 @@ Optional Packages:
+                           options for runlevel scripts and daemons such as
+                           xenstored. This should be either "sysconfig" or
+                           "default". [sysconfig]
++  --with-libexec-leaf-dir=SUBDIR
++                          Name of subdirectory in libexecdir to use.
+   --with-xen-dumpdir=DIR  Path to directory for domU crash dumps.
+                           [LOCALSTATEDIR/lib/xen/dump]
+   --with-linux-backend-modules="mod1 mod2"
+@@ -3887,6 +3893,15 @@ CONFIG_LEAF_DIR=$config_leaf_dir
+ 
+ 
+ 
++# Check whether --with-libexec-leaf-dir was given.
++if test "${with_libexec_leaf_dir+set}" = set; then :
++  withval=$with_libexec_leaf_dir; libexec_subdir=$withval
++else
++  libexec_subdir=$PACKAGE_TARNAME
++fi
++
++
++
+ # Check whether --with-xen-dumpdir was given.
+ if test "${with_xen_dumpdir+set}" = set; then :
+   withval=$with_xen_dumpdir; xen_dumpdir_path=$withval
+@@ -3903,11 +3918,16 @@ if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+          ;;
+     esac
+ fi
+-libexecdir=`eval echo $libexecdir`
+-LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
++LIBEXEC=`eval echo $libexecdir/$libexec_subdir`
++
++
++LIBEXEC_BIN=${LIBEXEC}/bin
++
++LIBEXEC_LIB=${LIBEXEC}/lib
+ 
++LIBEXEC_INC=${LIBEXEC}/include
+ 
+-XENFIRMWAREDIR=`eval echo $libexecdir/$PACKAGE_TARNAME/boot`
++XENFIRMWAREDIR=${LIBEXEC}/boot
+ 
+ 
+ XEN_RUN_DIR=$localstatedir/run/xen
diff -Nru xen-4.6.0/debian/rules.real xen-4.6.0/debian/rules.real
--- xen-4.6.0/debian/rules.real	2015-11-01 20:38:20.000000000 +0000
+++ xen-4.6.0/debian/rules.real	2016-01-19 14:11:24.000000000 +0000
@@ -67,6 +67,7 @@
 			--infodir=/usr/share/info \
 			--sysconfdir=/etc \
 			--localstatedir=/var \
+			--with-libexec-leaf-dir=xen-$(VERSION) \
 			--disable-blktap1 \
 			--disable-blktap2 \
 			--disable-ocamltools \

Reply via email to