Skip to contentSkip to conversation

tool changes to honor configure --prefix=DIR

PATCH Superseded Olaf Hering 6 participants 78 messages Sep 25, 2014 – Oct 1, 2014 Kbuild

v4 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v4 cover tool changes to honor configure --prefix=DIR

In my attempt to get a xen.rpm from 'make rpmball' which operates entirely below the configured --prefix= I came up with these changes.

This is a resend of the remaining parts of this series with the comments incorporated:
http://lists.xenproject.org/archives/html/xen-devel/2014-09/msg03003.html

In v4 of this series configure is updated to provide all paths:
prefix, bindir, sbindir, libdir, libexecdir, datarootdir, mandir, docdir, dvidir, htmldir, pdfdir, psdir, includedir, localstatedir, sysconfdir
These variables are used to feed the private variables used in the xen source tree. At some later point another patch may convert them all to the common automake variants.

Additional options: with-initddir, with-linux-backend-modules, with-sysconfig-leaf-dir and enable-rpath.

Removed options: --disable-debug, in favour of 'make debug=yn debug_symbols=yn'.

Every path is now stored in config/Paths.mk.

With this series its now possible to run everything except pygrub below the configured --prefix=.

NOTE: the renaming of tools/hotplug/Linux/init.d/xencommons.in may cause trouble in configured working copies. Use 'git clean -dfx' to wipe all and everything before git pull.

One outstanding bug is pygrub, which does not know about $prefix/$lib/python/site-packages. This is still on my todo list.

Olaf Hering (28):
Neutralize make uninstall
tools/hotplug: fix race during xen.conf creation tools/python: use also LDFLAGS for build
Add configure --with-initddir=DIR
tools/hotplug: use XEN_SCRIPT_DIR instead of hardcoded path tools/configure.ac: sort AC_CONFIG_FILES
tools: use INITD_DIR instead of CONFIG_DIR/init.d|rc.d tools/hotplug: substitute XEN_SCRIPT_DIR on FreeBSD
remove duplicate variables from config
Substitue configure variables in Paths.mk.in
tools: substitute bindir instead of BINDIR
Use configure --mandir=DIR to set MANDIR
Use configure --docdir=DIR to set DOCDIR
Use configure --includedir=DIR to set INCLUDEDIR
Use configure --libexecdir=BASEDIR to set LIBEXEC
Use configure --prefix=DIR to set PREFIX
Use configure --localstatedir=BASEDIR to set path to /var Add configure --enable-rpath
Add configure --with-linux-backend-modules="mod1 mod2"
Put bash_completion.d below --sysconfdir=DIR
Add configure --with-sysconfig-leaf-dir=SUBDIR to set CONFIG_LEAF_DIR Make XENFIRMWAREDIR a subdir of libexecdir
tools: remove private copies of includedir and libdir from libxenstat Use Paths.mk for docs, stubdom and tools build
tools: use XEN_LIB_STORED instead of /var/lib/xenstored Use XEN_RUN_DIR instead of /var/run/xen
move vtpmmgr helpers from tools to stubdom
Separate runtime debug output from debug symbols

 .gitignore                                         |   7 ++
 Config.mk                                          |  19 ++--
 Makefile                                           |  15 +--
 README                                             |  12 ---
 config/Docs.mk.in                                  |   7 +-
 config/Linux.mk                                    |   2 +
 config/Linux.modules                               |  20 ----
 config/NetBSD.mk                                   |   5 -
 config/NetBSDRump.mk                               |   2 -
 config/Paths.mk.in                                 |  44 +++++++--
 config/StdGNU.mk                                   |  23 -----
 config/Stubdom.mk.in                               |  10 --
 config/SunOS.mk                                    |  15 ---
 config/Tools.mk.in                                 |  17 ++--
 docs/misc/distro_mapping.txt                       |   5 +-
 m4/paths.m4                                        | 103 +++++++++++++++------
 m4/xenstored.m4                                    |   8 +-
 stubdom/Makefile                                   |   7 +-
 stubdom/configure.ac                               |   1 -
 stubdom/vtpmmgr/Makefile                           |   5 +
 {tools => stubdom}/vtpmmgr/calc.pl                 |   0
 {tools => stubdom}/vtpmmgr/manage-vtpmmgr.pl       |   0
 tools/Makefile                                     |  36 +++++--
 tools/Rules.mk                                     |   1 -
 tools/configure.ac                                 |  54 +++++++++--
 tools/console/Makefile                             |   4 +-
 tools/hotplug/FreeBSD/Makefile                     |   5 +-
 .../FreeBSD/rc.d/{xencommons => xencommons.in}     |   6 +-
 tools/hotplug/FreeBSD/vif-bridge                   |   2 +-
 tools/hotplug/Linux/Makefile                       |  18 ++--
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in |  10 +-
 .../Linux/init.d/{xen-watchdog => xen-watchdog.in} |   2 +-
 .../init.d/{xencommons.in.in => xencommons.in}     |  13 ++-
 .../Linux/init.d/{xendomains => xendomains.in}     |  14 +--
 tools/hotplug/Linux/systemd/Makefile               |  37 ++------
 .../systemd/xen-qemu-dom0-disk-backend.service.in  |   4 +-
 .../hotplug/Linux/systemd/xen-watchdog.service.in  |   2 +-
 tools/hotplug/Linux/systemd/xenconsoled.service.in |   2 +-
 tools/hotplug/Linux/systemd/xendomains.service.in  |   6 +-
 tools/hotplug/Linux/systemd/xenstored.service.in   |   4 +-
 tools/hotplug/Linux/update-modules.sh              |  36 -------
 tools/hotplug/Linux/{vif-setup => vif-setup.in}    |   2 +-
 .../{xen-backend.rules => xen-backend.rules.in}    |  16 ++--
 ...-hotplug-common.sh => xen-hotplug-common.sh.in} |   4 +-
 tools/hotplug/Linux/{xendomains => xendomains.in}  |   2 +-
 tools/hotplug/NetBSD/Makefile                      |   6 +-
 tools/hotplug/NetBSD/block                         |   2 +-
 .../NetBSD/rc.d/{xencommons => xencommons.in}      |   4 +-
 tools/hotplug/NetBSD/vif-bridge                    |   2 +-
 tools/hotplug/NetBSD/vif-ip                        |   2 +-
 tools/libxl/Makefile                               |   6 +-
 tools/libxl/libxl_dm.c                             |   4 +-
 tools/libxl/libxl_internal.h                       |   1 -
 tools/libxl/libxl_paths.c                          |   7 +-
 tools/libxl/libxl_save_callout.c                   |   2 +-
 tools/misc/Makefile                                |   4 +-
 tools/ocaml/common.make                            |   5 +-
 tools/pygrub/Makefile                              |   8 +-
 tools/python/Makefile                              |   4 +-
 tools/tests/vhpet/Makefile                         |   2 +-
 tools/tests/x86_emulator/Makefile                  |   4 +-
 tools/vtpmmgr/Makefile                             |  15 ---
 tools/xcutils/Makefile                             |   4 +-
 tools/xenpaging/Makefile                           |   4 +-
 tools/xenstat/libxenstat/Makefile                  |   4 -
 tools/xenstore/Makefile                            |   3 +-
 tools/xenstore/xs_lib.c                            |   2 +-
 tools/xentrace/Makefile                            |   4 +-
 xen/Rules.mk                                       |   5 +-
 xen/arch/x86/Makefile                              |   2 +-
 70 files changed, 330 insertions(+), 383 deletions(-)
 delete mode 100644 config/Linux.modules
 rename {tools => stubdom}/vtpmmgr/calc.pl (100%)
 rename {tools => stubdom}/vtpmmgr/manage-vtpmmgr.pl (100%)
 rename tools/hotplug/FreeBSD/rc.d/{xencommons => xencommons.in} (96%)
 rename tools/hotplug/Linux/init.d/{xen-watchdog => xen-watchdog.in} (97%)
 rename tools/hotplug/Linux/init.d/{xencommons.in.in => xencommons.in} (91%)
 rename tools/hotplug/Linux/init.d/{xendomains => xendomains.in} (79%)
 delete mode 100755 tools/hotplug/Linux/update-modules.sh
 rename tools/hotplug/Linux/{vif-setup => vif-setup.in} (61%)
 rename tools/hotplug/Linux/{xen-backend.rules => xen-backend.rules.in} (62%)
 rename tools/hotplug/Linux/{xen-hotplug-common.sh => xen-hotplug-common.sh.in} (94%)
 rename tools/hotplug/Linux/{xendomains => xendomains.in} (99%)
 rename tools/hotplug/NetBSD/rc.d/{xencommons => xencommons.in} (97%)
 delete mode 100644 tools/vtpmmgr/Makefile
#1 lore raw

PATCH v4 1/28 Neutralize make uninstall

The uninstall target does not know about the paths it removes because the toplevel Makefile does not include the required files.

Remove all dangerous commands. There is no replacement.

The proper fix is to remove the files and directories in the Makefiles which install them.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 Makefile | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
Makefile +1 -14
index 3b9bf7a..abef019 100644
@@ -232,21 +232,8 @@ help:
 .PHONY: uninstall
 uninstall: D=$(DESTDIR)
 uninstall:
-	[ -d $(D)$(XEN_CONFIG_DIR) ] && mv -f $(D)$(XEN_CONFIG_DIR) $(D)$(XEN_CONFIG_DIR).old-`date +%s` || true
 	$(MAKE) -C xen uninstall
-	rm -rf $(D)$(CONFIG_DIR)/init.d/xendomains $(D)$(CONFIG_DIR)/init.d/xend
-	rm -rf $(D)$(CONFIG_DIR)/init.d/xencommons $(D)$(CONFIG_DIR)/init.d/xen-watchdog
-	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
-	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
-	rm -f  $(D)$(SYSCONFIG_DIR)/xendomains
-	rm -f  $(D)$(SBINDIR)/xendomains
-	rm -f  $(D)$(SYSCONFIG_DIR)/xencommons
-	rm -f  $(D)$(XEN_SYSTEMD_DIR)/*.service
-	rm -f  $(D)$(XEN_SYSTEMD_DIR)/*.mount
-	rm -f  $(D)$(XEN_SYSTEMD_MODULES_LOAD)/*.conf
-	rm -rf $(D)$(XEN_RUN_DIR)* $(D)/var/lib/xen*
-	make -C tools uninstall
-	rm -rf $(D)/boot/tboot*
+	$(MAKE) -C tools uninstall
 
 .PHONY: xenversion
 xenversion:
#2 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

On Thu, 2014-09-25 at 17:19 +0200, Olaf Hering wrote:

(I seem to have misplaced the 00/28 mail so replying here. In fact I missing a bunch of pieces which did go to the list according to the archives, almost certainly an issue on my end.).

Are you still targeting all this at 4.5? If so then since the code freeze you need mail Konrad and provide an argument for a release exception.

I've not been through it myself yet so I don't know what I think, although I think it will turn out I acked a fair chunk of it on the previous rounds.

#3 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

Quoted 3 lines · Ian Campbell

Are you still targeting all this at 4.5? If so then since the code freeze you need mail Konrad and provide an argument for a release exception.

Yes, the --prefix series should go into 4.5.

Quoted 3 lines

I've not been through it myself yet so I don't know what I think, although I think it will turn out I acked a fair chunk of it on the previous rounds.

You already acked most of it, they are included in the v4 of the series.

Olaf

#4 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

Quoted 7 lines · Olaf Hering
Quoted 3 lines · Ian Campbell

Are you still targeting all this at 4.5? If so then since the code freeze you need mail Konrad and provide an argument for a release exception.

Yes, the --prefix series should go into 4.5.

I expect Konrad is going to ask you why, and what are the risks vs benefits.

Quoted 5 lines
Quoted 3 lines

I've not been through it myself yet so I don't know what I think, although I think it will turn out I acked a fair chunk of it on the previous rounds.

You already acked most of it, they are included in the v4 of the series.

Ian.

#5 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

In reply to Olaf Hering
Quoted 4 lines · Olaf Hering

The uninstall target does not know about the paths it removes because the toplevel Makefile does not include the required files.

Remove all dangerous commands.

Of these only "rm -f $(D)$(XEN_RUN_DIR)*" seems especially dangerous.

The rest will remove things like /*.conf and /xendomains which is bad/wrong but not usually catastrophic

Quoted 1 line

There is no replacement.

Yet? Will this be replaced by additions to the appropriate submake files in the course of this series?

Quoted 45 lines

The proper fix is to remove the files and directories in the Makefiles which install them.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Tim Deegan <[email protected]>
---
 Makefile | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)
Makefile +1 -14
index 3b9bf7a..abef019 100644
@@ -232,21 +232,8 @@ help:
 .PHONY: uninstall
 uninstall: D=$(DESTDIR)
 uninstall:
-	[ -d $(D)$(XEN_CONFIG_DIR) ] && mv -f $(D)$(XEN_CONFIG_DIR) $(D)$(XEN_CONFIG_DIR).old-`date +%s` || true
 	$(MAKE) -C xen uninstall
-	rm -rf $(D)$(CONFIG_DIR)/init.d/xendomains $(D)$(CONFIG_DIR)/init.d/xend
-	rm -rf $(D)$(CONFIG_DIR)/init.d/xencommons $(D)$(CONFIG_DIR)/init.d/xen-watchdog
-	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xen-backend.rules
-	rm -f  $(D)$(CONFIG_DIR)/udev/rules.d/xend.rules
-	rm -f  $(D)$(SYSCONFIG_DIR)/xendomains
-	rm -f  $(D)$(SBINDIR)/xendomains
-	rm -f  $(D)$(SYSCONFIG_DIR)/xencommons
-	rm -f  $(D)$(XEN_SYSTEMD_DIR)/*.service
-	rm -f  $(D)$(XEN_SYSTEMD_DIR)/*.mount
-	rm -f  $(D)$(XEN_SYSTEMD_MODULES_LOAD)/*.conf
-	rm -rf  $(D)$(XEN_RUN_DIR)* $(D)/var/lib/xen*
-	make -C tools uninstall
-	rm -rf $(D)/boot/tboot*
+	$(MAKE) -C tools uninstall
 
 .PHONY: xenversion
 xenversion:

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#6 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

Quoted 8 lines · Ian Campbell
Quoted 4 lines · Olaf Hering

The uninstall target does not know about the paths it removes because the toplevel Makefile does not include the required files.

Remove all dangerous commands.

Of these only "rm -f $(D)$(XEN_RUN_DIR)*" seems especially dangerous.

Quoted 7 lines

The rest will remove things like /*.conf and /xendomains which is bad/wrong but not usually catastrophic

Quoted 1 line

There is no replacement.

Yet? Will this be replaced by additions to the appropriate submake files in the course of this series?

No. Unless I miss something, make uninstall can not work today. At least for the toplevel Makefile. If you want I can add more uninstall parts to the tools Makefiles in a separate series. Either for 4.5 or later.

Olaf

#7 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

Quoted 13 lines · Olaf Hering
Quoted 11 lines · Ian Campbell
Quoted 4 lines · Olaf Hering

The uninstall target does not know about the paths it removes because the toplevel Makefile does not include the required files.

Remove all dangerous commands.

Of these only "rm -f $(D)$(XEN_RUN_DIR)*" seems especially dangerous.

The rest will remove things like /*.conf and /xendomains which is bad/wrong but not usually catastrophic

Quoted 8 lines
Quoted 4 lines
Quoted 1 line

There is no replacement.

Yet? Will this be replaced by additions to the appropriate submake files in the course of this series?

No. Unless I miss something, make uninstall can not work today. At least for the toplevel Makefile. If you want I can add more uninstall parts to the tools Makefiles in a separate series. Either for 4.5 or later.

Later for sure.

Ian.

#8 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

In reply to Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Ian Campbell

Yet? Will this be replaced by additions to the appropriate submake files in the course of this series?

No. Unless I miss something, make uninstall can not work today. At least for the toplevel Makefile. If you want I can add more uninstall parts to the tools Makefiles in a separate series. Either for 4.5 or later.

Ian,

now that I look at staging-4.4 I see that the toplevel Makefile includes config/StdGNU.mk which sets path variables used by the uninstall target. So my series broke uninstall because the variables are not available anymore during 'make uninstall'. I think the right fix is to move the uninstall target to the invividual Makefiles in tools/hotplug/. XEN_RUN_DIR is created at runtime now, it should be left alone by uninstall. /var/lib/xen is created in tools/Makefile, so it should be removed there.

I will adjust this patch and include it in v5 of this series.

Olaf

#9 lore raw

Re: [PATCH 01/28] Neutralize make uninstall

Quoted 9 lines · Olaf Hering
Quoted 6 lines · Olaf Hering
Quoted 2 lines · Ian Campbell

Yet? Will this be replaced by additions to the appropriate submake files in the course of this series?

No. Unless I miss something, make uninstall can not work today. At least for the toplevel Makefile. If you want I can add more uninstall parts to the tools Makefiles in a separate series. Either for 4.5 or later.

Quoted 6 lines

Ian,

now that I look at staging-4.4 I see that the toplevel Makefile includes config/StdGNU.mk which sets path variables used by the uninstall target. So my series broke uninstall because the variables are not available anymore during 'make uninstall'.

Ah, I assumed it had already been broken by e.g. refactoring done for systemd.

Quoted 5 lines

I think the right fix is to move the
uninstall target to the invividual Makefiles in tools/hotplug/. XEN_RUN_DIR is created at runtime now, it should be left alone by uninstall. /var/lib/xen is created in tools/Makefile, so it should be removed there.

I agree. Having the uninstall rule near to the install will be helpful.

Quoted 1 line

I will adjust this patch and include it in v5 of this series.

Thanks.

Ian.

#10 lore raw

PATCH v4 2/28 tools/hotplug: fix race during xen.conf creation

In reply to Olaf Hering

A make -j8 will call the xen.conf rule twice. The move-if-changed macro may fail of the tmp file was already removed by the other make process. Fix this by let the all target depend on install. Also remove the generated file with make clean.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/hotplug/Linux/systemd/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/hotplug/Linux/systemd/Makefile +2 -1
index dc98b67..90ba16e 100644
@@ -21,10 +21,11 @@ ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
 			$(XEN_SYSTEMD_SERVICE)
 
 .PHONY: all
-all:	$(ALL_XEN_SYSTEMD)
+all:	install
 
 .PHONY: clean
 clean:
+	rm -f $(ALL_XEN_SYSTEMD)
 
 .PHONY: install
 install: $(ALL_XEN_SYSTEMD)
Acked-by on v4 2/28
#11 lore raw

Re: [PATCH 02/28] tools/hotplug: fix race during xen.conf creation

Quoted 8 lines · Olaf Hering

A make -j8 will call the xen.conf rule twice. The move-if-changed macro may fail of the tmp file was already removed by the other make process. Fix this by let the all target depend on install. Also remove the generated file with make clean.

Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Quoted 27 lines
Cc Wei Liu <[email protected]>
---
 tools/hotplug/Linux/systemd/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
tools/hotplug/Linux/systemd/Makefile +2 -1
index dc98b67..90ba16e 100644
@@ -21,10 +21,11 @@ ALL_XEN_SYSTEMD =	$(XEN_SYSTEMD_MODULES)  \
 			$(XEN_SYSTEMD_SERVICE)
 
 .PHONY: all
-all:	$(ALL_XEN_SYSTEMD)
+all:	install
 
 .PHONY: clean
 clean:
+	rm -f $(ALL_XEN_SYSTEMD)
 
 .PHONY: install
 install: $(ALL_XEN_SYSTEMD)

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#12 lore raw

PATCH v4 3/28 tools/python: use also LDFLAGS for build

In reply to Olaf Hering

An upcoming change will pass -Wl,-rpath to xc.so. Make sure such LDFLAGS will be used for python libs.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/python/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tools/python/Makefile +2 -2
index 4918229..533d3de 100644
@@ -11,11 +11,11 @@ build: genwrap.py $(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		$(XEN_ROOT)/tools/libxl/libxl_types.idl \
 		xen/lowlevel/xl/_pyxl_types.h \
 		xen/lowlevel/xl/_pyxl_types.c
-	CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build
+	CC="$(CC)" CFLAGS="$(CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build
 
 .PHONY: install
 install:
-	CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \
+	CC="$(CC)" CFLAGS="$(CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \
 		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
 
 .PHONY: test
#14 lore raw

PATCH v4 4/28 Add configure --with-initddir=DIR

In reply to Olaf Hering

Preserve existing behaviour: Fedora gets rc.d/init.d, BSD gets rc.d, everyone else gets init.d.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                    |  1 -
 config/Paths.mk.in           |  1 +
 docs/misc/distro_mapping.txt |  5 +++--
 m4/paths.m4                  | 20 ++++++++++++++++++++
 4 files changed, 24 insertions(+), 3 deletions(-)
Config.mk +0 -1
index 2bb8dcc..e4ff64d 100644
@@ -76,7 +76,6 @@ endef
 
 # See distro_mapping.txt for other options
 $(eval $(call setvar_dir,CONFIG_LEAF_DIR,,/etc/sysconfig,sysconfig,default))
-$(eval $(call setvar_dir,INITD_DIR,/etc,/rc.d/init.d,/rc.d/init.d,/init.d))
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
config/Paths.mk.in +1 -0
index 507b6d1..c01d0ef 100644
@@ -24,6 +24,7 @@ XEN_LOG_DIR              := @XEN_LOG_DIR@
 XEN_LIB_STORED           := @XEN_LIB_STORED@
 
 CONFIG_DIR               := @CONFIG_DIR@
+INITD_DIR                := @INITD_DIR@
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
docs/misc/distro_mapping.txt +3 -2
index f849d07..d2b1399 100644
@@ -13,8 +13,9 @@ build host, via the "setvar_dir" macro in Config.mk) and for some
 scripts at run-time.  If the Red Hat directory exists, it is used;
 otherwise the Debian one is used.
 
-You can override this by setting the variables in the environment or
-your ".config" (which is included by .config).
+The INITD_DIR path can be changed with configure --with-initddir=DIR.
+The CONFIG_LEAF_DIR path can be changed by setting the variables in
+the environment or your ".config" (which is included by Config.mk). 
 
 To add support for new distributions that don't use the above locations,
 one must grep for the above elements and add appropriate checks.
m4/paths.m4 +20 -0
index b183845..19b6481 100644
@@ -22,6 +22,23 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+AC_ARG_WITH([initddir],
+    AS_HELP_STRING([--with-initddir=DIR],
+    [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
+    [initddir_path=$withval],
+    [case "$host_os" in
+         *linux*)
+         if test -d $sysconfdir/rc.d/init.d ; then
+             initddir_path=$sysconfdir/rc.d/init.d
+         else
+             initddir_path=$sysconfdir/init.d
+         fi
+         ;;
+         *)
+         initddir_path=$sysconfdir/rc.d
+         ;;
+     esac])
+
 BINDIR=$prefix/bin
 AC_SUBST(BINDIR)
 
@@ -63,6 +80,9 @@ AC_SUBST(XENFIRMWAREDIR)
 CONFIG_DIR=$sysconfdir
 AC_SUBST(CONFIG_DIR)
 
+INITD_DIR=$initddir_path
+AC_SUBST(INITD_DIR)
+
 XEN_CONFIG_DIR=$CONFIG_DIR/xen
 AC_SUBST(XEN_CONFIG_DIR)
Acked-by on v4 4/28
#15 lore raw

Re: [PATCH 04/28] Add configure --with-initddir=DIR

Quoted 6 lines · Olaf Hering

Preserve existing behaviour: Fedora gets rc.d/init.d, BSD gets rc.d, everyone else gets init.d.

Please rerun autogen.sh after applying this patch.

Quoted 93 lines
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                    |  1 -
 config/Paths.mk.in           |  1 +
 docs/misc/distro_mapping.txt |  5 +++--
 m4/paths.m4                  | 20 ++++++++++++++++++++
 4 files changed, 24 insertions(+), 3 deletions(-)
Config.mk +0 -1
index 2bb8dcc..e4ff64d 100644
@@ -76,7 +76,6 @@ endef
 
 # See distro_mapping.txt for other options
 $(eval $(call setvar_dir,CONFIG_LEAF_DIR,,/etc/sysconfig,sysconfig,default))
-$(eval $(call setvar_dir,INITD_DIR,/etc,/rc.d/init.d,/rc.d/init.d,/init.d))
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
config/Paths.mk.in +1 -0
index 507b6d1..c01d0ef 100644
@@ -24,6 +24,7 @@ XEN_LOG_DIR              := @XEN_LOG_DIR@
 XEN_LIB_STORED           := @XEN_LIB_STORED@
 
 CONFIG_DIR               := @CONFIG_DIR@
+INITD_DIR                := @INITD_DIR@
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
docs/misc/distro_mapping.txt +3 -2
index f849d07..d2b1399 100644
@@ -13,8 +13,9 @@ build host, via the "setvar_dir" macro in Config.mk) and for some
 scripts at run-time.  If the Red Hat directory exists, it is used;
 otherwise the Debian one is used.
 
-You can override this by setting the variables in the environment or
-your ".config" (which is included by .config).
+The INITD_DIR path can be changed with configure --with-initddir=DIR.
+The CONFIG_LEAF_DIR path can be changed by setting the variables in
+the environment or your ".config" (which is included by Config.mk). 
 
 To add support for new distributions that don't use the above locations,
 one must grep for the above elements and add appropriate checks.
m4/paths.m4 +20 -0
index b183845..19b6481 100644
@@ -22,6 +22,23 @@ if test "x$sysconfdir" = 'x${prefix}/etc' ; then
     esac
 fi
 
+AC_ARG_WITH([initddir],
+    AS_HELP_STRING([--with-initddir=DIR],
+    [Path to directory with sysv runlevel scripts. [SYSCONFDIR/init.d]]),
+    [initddir_path=$withval],
+    [case "$host_os" in
+         *linux*)
+         if test -d $sysconfdir/rc.d/init.d ; then
+             initddir_path=$sysconfdir/rc.d/init.d
+         else
+             initddir_path=$sysconfdir/init.d
+         fi
+         ;;
+         *)
+         initddir_path=$sysconfdir/rc.d
+         ;;
+     esac])
+
 BINDIR=$prefix/bin
 AC_SUBST(BINDIR)
 
@@ -63,6 +80,9 @@ AC_SUBST(XENFIRMWAREDIR)
 CONFIG_DIR=$sysconfdir
 AC_SUBST(CONFIG_DIR)
 
+INITD_DIR=$initddir_path
+AC_SUBST(INITD_DIR)
+
 XEN_CONFIG_DIR=$CONFIG_DIR/xen
 AC_SUBST(XEN_CONFIG_DIR)
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#16 lore raw

PATCH v4 5/28 tools/hotplug: use XEN_SCRIPT_DIR instead of hardcoded path

In reply to Olaf Hering

Helper scripts get installed into XEN_SCRIPT_DIR, but initscripts, helper scripts and udev rules still refer to the hardcoded location /etc/xen/scripts/. Update scripts, rules and Makefile to refer to @XEN_SCRIPT_DIR@ instead.

Update configure.ac to substitute the path in files using XEN_SCRIPT_DIR. Remove XEN_SCRIPT_DIR from StdGNU.mk and SunOS.mk, its already in Paths.mk.

Note: In SunOS.mk it refered to PRIVATE_PREFIX, which was introduced by 9f6d07bac9f14aaa8bafe38b4a217e61a3a57842 ("tools: get rid of hardcoded config dirs").

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 .gitignore                                               |  6 ++++++
 config/StdGNU.mk                                         |  1 -
 config/SunOS.mk                                          |  1 -
 tools/configure.ac                                       |  6 ++++++
 .../Linux/init.d/{xen-watchdog => xen-watchdog.in}       |  2 +-
 tools/hotplug/Linux/init.d/xencommons.in.in              |  2 +-
 tools/hotplug/Linux/init.d/{xendomains => xendomains.in} |  2 +-
 tools/hotplug/Linux/{vif-setup => vif-setup.in}          |  2 +-
 .../Linux/{xen-backend.rules => xen-backend.rules.in}    | 16 ++++++++--------
 .../{xen-hotplug-common.sh => xen-hotplug-common.sh.in}  |  2 +-
 tools/hotplug/Linux/{xendomains => xendomains.in}        |  2 +-
 11 files changed, 26 insertions(+), 16 deletions(-)
.gitignore +6 -0
index 67ed7cb..4344c52 100644
@@ -160,6 +160,12 @@ tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fs-back/fs-backend
 tools/hotplug/common/hotplugpath.sh
+tools/hotplug/Linux/init.d/xen-watchdog
+tools/hotplug/Linux/init.d/xendomains
+tools/hotplug/Linux/vif-setup
+tools/hotplug/Linux/xen-backend.rules
+tools/hotplug/Linux/xen-hotplug-common.sh
+tools/hotplug/Linux/xendomains
 tools/include/xen/*
 tools/include/xen-foreign/*.(c|h|size)
 tools/include/xen-foreign/checker
config/StdGNU.mk +0 -1
index ddf83d7..4cc3a01 100644
@@ -48,7 +48,6 @@ XEN_PAGING_DIR = /var/lib/xen/xenpaging
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(XEN_CONFIG_DIR)/scripts
 
 BOOT_DIR ?= /boot
 
config/SunOS.mk +0 -1
index d493eca..1470514 100644
@@ -32,7 +32,6 @@ PRIVATE_PREFIX = $(LIBDIR)/xen
 PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
 
 XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-XEN_SCRIPT_DIR = $(PRIVATE_PREFIX)/scripts
 
 BOOT_DIR ?= /boot
 
tools/configure.ac +6 -0
index 4f45418..cc351c7 100644
@@ -9,6 +9,8 @@ AC_CONFIG_FILES([
 ../config/Tools.mk
 hotplug/Linux/init.d/xencommons.in
 hotplug/Linux/init.d/sysconfig.xencommons
+hotplug/Linux/init.d/xen-watchdog
+hotplug/Linux/init.d/xendomains
 hotplug/Linux/systemd/proc-xen.mount
 hotplug/Linux/systemd/var-lib-xenstored.mount
 hotplug/Linux/systemd/xenstored.socket
@@ -18,6 +20,10 @@ hotplug/Linux/systemd/xenconsoled.service
 hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service
 hotplug/Linux/systemd/xendomains.service
 hotplug/Linux/systemd/xen-watchdog.service
+hotplug/Linux/vif-setup
+hotplug/Linux/xen-backend.rules
+hotplug/Linux/xen-hotplug-common.sh
+hotplug/Linux/xendomains
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
tools/hotplug/Linux/init.d/xen-watchdog.in renamed from tools/hotplug/Linux/init.d/xen-watchdog +1 -1
similarity index 97%
rename from tools/hotplug/Linux/init.d/xen-watchdog
rename to tools/hotplug/Linux/init.d/xen-watchdog.in
index 3592fda..32c7268 100644
@@ -17,7 +17,7 @@
 ### END INIT INFO
 #
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 DAEMON=${SBINDIR}/xenwatchdogd
 base=$(basename $DAEMON)
tools/hotplug/Linux/init.d/xencommons.in.in +1 -1
index a723eb4..bd1d9ba 100644
@@ -20,7 +20,7 @@
 
 XENSTORED=@XENSTORED@
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 if [ -d /etc/sysconfig ]; then
 	xencommons_config=/etc/sysconfig
tools/hotplug/Linux/init.d/xendomains.in renamed from tools/hotplug/Linux/init.d/xendomains +1 -1
similarity index 97%
rename from tools/hotplug/Linux/init.d/xendomains
rename to tools/hotplug/Linux/init.d/xendomains.in
index 3857602..5b88e2d 100644
@@ -24,7 +24,7 @@
 #                    systemd systems.
 ### END INIT INFO
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 case "$1" in
     start)
tools/hotplug/Linux/vif-setup.in renamed from tools/hotplug/Linux/vif-setup +1 -1
similarity index 61%
rename from tools/hotplug/Linux/vif-setup
rename to tools/hotplug/Linux/vif-setup.in
index bcc462e..c3bc662 100644
@@ -4,6 +4,6 @@ if test "$script"
 then
     exec $script $*
 else
-    exec /etc/xen/scripts/vif-bridge $*
+    exec @XEN_SCRIPT_DIR@/vif-bridge $*
 fi
 
tools/hotplug/Linux/xen-backend.rules.in renamed from tools/hotplug/Linux/xen-backend.rules +8 -8
similarity index 62%
rename from tools/hotplug/Linux/xen-backend.rules
rename to tools/hotplug/Linux/xen-backend.rules.in
index a0d409e..7d2f914 100644
@@ -1,10 +1,10 @@
-SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/blktap $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/block $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="/etc/xen/scripts/vif2 $env{ACTION}"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="/etc/xen/scripts/vif-setup online type_if=vif"
-SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="/etc/xen/scripts/vif-setup offline type_if=vif"
-SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="/etc/xen/scripts/vscsi $env{ACTION}"
-SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/xen-hotplug-cleanup"
+SUBSYSTEM=="xen-backend", KERNEL=="tap*", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/blktap $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vbd*", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/block $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vif2-*", RUN+="@XEN_SCRIPT_DIR@/vif2 $env{ACTION}"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="online", RUN+="@XEN_SCRIPT_DIR@/vif-setup online type_if=vif"
+SUBSYSTEM=="xen-backend", KERNEL=="vif-*", ENV{UDEV_CALL}="1", ACTION=="offline", RUN+="@XEN_SCRIPT_DIR@/vif-setup offline type_if=vif"
+SUBSYSTEM=="xen-backend", KERNEL=="vscsi*", RUN+="@XEN_SCRIPT_DIR@/vscsi $env{ACTION}"
+SUBSYSTEM=="xen-backend", ACTION=="remove", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/xen-hotplug-cleanup"
 KERNEL=="evtchn", NAME="xen/%k"
 SUBSYSTEM=="xen", KERNEL=="blktap[0-9]*", NAME="xen/%k", MODE="0600"
 SUBSYSTEM=="blktap2", KERNEL=="blktap[0-9]*", NAME="xen/blktap-2/%k", MODE="0600"
@@ -12,4 +12,4 @@ KERNEL=="blktap-control", NAME="xen/blktap-2/control", MODE="0600"
 KERNEL=="gntdev", NAME="xen/%k", MODE="0600"
 KERNEL=="pci_iomul", NAME="xen/%k", MODE="0600"
 KERNEL=="tapdev[a-z]*", NAME="xen/blktap-2/tapdev%m", MODE="0600"
-SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="/etc/xen/scripts/vif-setup $env{ACTION} type_if=tap"
+SUBSYSTEM=="net", KERNEL=="vif*-emu", ACTION=="add", ENV{UDEV_CALL}="1", RUN+="@XEN_SCRIPT_DIR@/vif-setup $env{ACTION} type_if=tap"
tools/hotplug/Linux/xen-hotplug-common.sh.in renamed from tools/hotplug/Linux/xen-hotplug-common.sh +1 -1
similarity index 98%
rename from tools/hotplug/Linux/xen-hotplug-common.sh
rename to tools/hotplug/Linux/xen-hotplug-common.sh.in
index 7af4688..996e974 100644
@@ -112,7 +112,7 @@ xenstore_write() {
 # Execute each hook in the <hook> directory.
 #
 call_hooks() {
-  for f in /etc/xen/scripts/${1}-${2}.d/*.hook; do
+  for f in @XEN_SCRIPT_DIR@/${1}-${2}.d/*.hook; do
     if [ -x "$f" ]; then . "$f"; fi
   done
 }
tools/hotplug/Linux/xendomains.in renamed from tools/hotplug/Linux/xendomains +1 -1
similarity index 99%
rename from tools/hotplug/Linux/xendomains
rename to tools/hotplug/Linux/xendomains.in
index c45f132..de711b7 100644
@@ -27,7 +27,7 @@
 #                    boots / shuts down.
 ### END INIT INFO
 
-. /etc/xen/scripts/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 CMD=${SBINDIR}/xl
 HEADCOMP="Xen saved domain"
#17 lore raw

PATCH v4 6/28 tools/configure.ac: sort AC_CONFIG_FILES

In reply to Olaf Hering

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/configure.ac | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
tools/configure.ac +6 -6
index cc351c7..29d13ff 100644
@@ -7,19 +7,19 @@ AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
 AC_CONFIG_SRCDIR([libxl/libxl.c])
 AC_CONFIG_FILES([
 ../config/Tools.mk
-hotplug/Linux/init.d/xencommons.in
 hotplug/Linux/init.d/sysconfig.xencommons
 hotplug/Linux/init.d/xen-watchdog
+hotplug/Linux/init.d/xencommons.in
 hotplug/Linux/init.d/xendomains
 hotplug/Linux/systemd/proc-xen.mount
 hotplug/Linux/systemd/var-lib-xenstored.mount
-hotplug/Linux/systemd/xenstored.socket
-hotplug/Linux/systemd/xenstored_ro.socket
-hotplug/Linux/systemd/xenstored.service
-hotplug/Linux/systemd/xenconsoled.service
 hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service
-hotplug/Linux/systemd/xendomains.service
 hotplug/Linux/systemd/xen-watchdog.service
+hotplug/Linux/systemd/xenconsoled.service
+hotplug/Linux/systemd/xendomains.service
+hotplug/Linux/systemd/xenstored.service
+hotplug/Linux/systemd/xenstored.socket
+hotplug/Linux/systemd/xenstored_ro.socket
 hotplug/Linux/vif-setup
 hotplug/Linux/xen-backend.rules
 hotplug/Linux/xen-hotplug-common.sh
#18 lore raw

PATCH v4 7/28 tools: use INITD_DIR instead of CONFIG_DIR/init.d|rc.d

In reply to Olaf Hering
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/hotplug/FreeBSD/Makefile | 4 ++--
 tools/hotplug/NetBSD/Makefile  | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
tools/hotplug/FreeBSD/Makefile +2 -2
index 6480aa5..e21f046 100644
@@ -31,10 +31,10 @@ install-scripts:
 
 .PHONY: install-rcd
 install-rcd:
-	$(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d
+	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	set -e; for i in $(XEN_RCD_PROG); \
 	   do \
-	   $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
 	   sed -i '' 's,@xen_script_dir@,$(DESTDIR)$(XEN_SCRIPT_DIR),g' $(DESTDIR)$(CONFIG_DIR)/$$i; \
 	done
 	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
tools/hotplug/NetBSD/Makefile +3 -3
index fc61162..9084859 100644
@@ -33,12 +33,12 @@ install-scripts:
 
 .PHONY: install-rcd
 install-rcd:
-	$(INSTALL_DIR) $(DESTDIR)$(CONFIG_DIR)/rc.d
+	$(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	set -e; for i in $(XEN_RCD_PROG); \
 	   do \
-	   $(INSTALL_PROG) $$i $(DESTDIR)$(CONFIG_DIR)/rc.d; \
+	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
 	done
-	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(CONFIG_DIR)/rc.d/xen-hotplugpath.sh
+	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(INITD_DIR)/xen-hotplugpath.sh
 
 .PHONY: clean
 clean:
#20 lore raw

PATCH v4 8/28 tools/hotplug: substitute XEN_SCRIPT_DIR on FreeBSD

In reply to Olaf Hering

Also remove DESTDIR from the path, this was most likely not intended.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 .gitignore                                               | 1 +
 tools/configure.ac                                       | 1 +
 tools/hotplug/FreeBSD/Makefile                           | 1 -
 tools/hotplug/FreeBSD/rc.d/{xencommons => xencommons.in} | 2 +-
 4 files changed, 3 insertions(+), 2 deletions(-)
.gitignore +1 -0
index 4344c52..2201cb0 100644
@@ -160,6 +160,7 @@ tools/flask/utils/flask-set-bool
 tools/flask/utils/flask-label-pci
 tools/fs-back/fs-backend
 tools/hotplug/common/hotplugpath.sh
+tools/hotplug/FreeBSD/rc.d/xencommons
 tools/hotplug/Linux/init.d/xen-watchdog
 tools/hotplug/Linux/init.d/xendomains
 tools/hotplug/Linux/vif-setup
tools/configure.ac +1 -0
index 29d13ff..80754ea 100644
@@ -7,6 +7,7 @@ AC_INIT([Xen Hypervisor Tools], m4_esyscmd([../version.sh ../xen/Makefile]),
 AC_CONFIG_SRCDIR([libxl/libxl.c])
 AC_CONFIG_FILES([
 ../config/Tools.mk
+hotplug/FreeBSD/rc.d/xencommons
 hotplug/Linux/init.d/sysconfig.xencommons
 hotplug/Linux/init.d/xen-watchdog
 hotplug/Linux/init.d/xencommons.in
tools/hotplug/FreeBSD/Makefile +0 -1
index e21f046..169a124 100644
@@ -35,7 +35,6 @@ install-rcd:
 	set -e; for i in $(XEN_RCD_PROG); \
 	   do \
 	   $(INSTALL_PROG) $$i $(DESTDIR)$(INITD_DIR); \
-	   sed -i '' 's,@xen_script_dir@,$(DESTDIR)$(XEN_SCRIPT_DIR),g' $(DESTDIR)$(CONFIG_DIR)/$$i; \
 	done
 	$(INSTALL_DATA) ../common/hotplugpath.sh $(DESTDIR)$(XEN_SCRIPT_DIR)
 
tools/hotplug/FreeBSD/rc.d/xencommons.in renamed from tools/hotplug/FreeBSD/rc.d/xencommons +1 -1
similarity index 98%
rename from tools/hotplug/FreeBSD/rc.d/xencommons
rename to tools/hotplug/FreeBSD/rc.d/xencommons.in
index 2d9034c..8b051ec 100644
@@ -5,7 +5,7 @@
 
 . /etc/rc.subr
 
-. @xen_script_dir@/hotplugpath.sh
+. @XEN_SCRIPT_DIR@/hotplugpath.sh
 
 LD_LIBRARY_PATH="${LIBDIR}"
 export LD_LIBRARY_PATH
#22 lore raw

PATCH v4 9/28 remove duplicate variables from config

In reply to Olaf Hering

... because they are already in Paths.mk:
BINDIR, LIBEXEC, PRIVATE_BINDIR, PRIVATE_PREFIX, SBINDIR, SHAREDIR, XEN_CONFIG_DIR, XENFIRMWAREDIR, XEN_LOCK_DIR, XEN_PAGING_DIR, XEN_RUN_DIR. Remove unused PKG_XEN_PREFIX, which was also incorrectly assigned to PRIVATE_PREFIX.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk            |  1 -
 config/NetBSD.mk     |  5 -----
 config/NetBSDRump.mk |  2 --
 config/Paths.mk.in   |  1 -
 config/StdGNU.mk     | 14 --------------
 config/SunOS.mk      |  8 --------
 m4/paths.m4          | 20 ++++++++++++++------
 7 files changed, 14 insertions(+), 37 deletions(-)
Config.mk +0 -1
index e4ff64d..9bda626 100644
@@ -58,7 +58,6 @@ endif
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
-SHAREDIR    ?= $(PREFIX)/share
 DOCDIR      ?= $(SHAREDIR)/doc/xen
 MANDIR      ?= $(SHAREDIR)/man
 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
config/NetBSD.mk +0 -5
index 141de7c..21318d6 100644
@@ -1,11 +1,6 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
 # Override settings for this OS
-LIBEXEC = $(PREFIX)/libexec
-PRIVATE_BINDIR = $(BINDIR)
-
 DLOPEN_LIBS =
 
-XEN_LOCK_DIR = /var/lib
-
 WGET = ftp
config/NetBSDRump.mk +0 -2
index 8daade8..2a87218 100644
@@ -3,8 +3,6 @@ include $(XEN_ROOT)/config/StdGNU.mk
 DLOPEN_LIBS =
 PTHREAD_LIBS =
 
-XEN_LOCK_DIR = /var/lib
-
 WGET = ftp
 
 XENSTORE_XENSTORED=n
config/Paths.mk.in +0 -1
index c01d0ef..4bded93 100644
@@ -29,7 +29,6 @@ XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
 PRIVATE_PREFIX           := @PRIVATE_PREFIX@
-PRIVATE_PREFIX           := @PKG_XEN_PREFIX@
 PRIVATE_BINDIR           := @PRIVATE_BINDIR@
 
 XENFIRMWAREDIR           := @XENFIRMWAREDIR@
config/StdGNU.mk +0 -14
index 4cc3a01..dd6170c 100644
@@ -28,27 +28,13 @@ INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
-BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBEXEC = $(PREFIX)/lib/xen/bin
-SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
-SBINDIR = $(PREFIX)/sbin
-XENFIRMWAREDIR = $(PREFIX)/lib/xen/boot
-
-PRIVATE_PREFIX = $(LIBDIR)/xen
-PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
-
-XEN_LOCK_DIR = /var/lock
-XEN_RUN_DIR = /var/run/xen
-XEN_PAGING_DIR = /var/lib/xen/xenpaging
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
-
 BOOT_DIR ?= /boot
 
 SOCKET_LIBS =
config/SunOS.mk +0 -8
index 1470514..92bde78 100644
@@ -20,18 +20,10 @@ INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
-BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
-SBINDIR = $(PREFIX)/sbin
-XENFIRMWAREDIR = $(LIBDIR)/xen/boot
-
-PRIVATE_PREFIX = $(LIBDIR)/xen
-PRIVATE_BINDIR = $(PRIVATE_PREFIX)/bin
-
-XEN_CONFIG_DIR = $(CONFIG_DIR)/xen
 
 BOOT_DIR ?= /boot
 
m4/paths.m4 +14 -6
index 19b6481..178b9a9 100644
@@ -47,7 +47,10 @@ AC_SUBST(SBINDIR)
 
 dnl XXX: this should be changed to use the passed $libexec
 dnl but can be done as a second step
-LIBEXEC=$prefix/lib/xen/bin
+case "$host_os" in
+*netbsd*)  LIBEXEC=$prefix/libexec ;;
+*) LIBEXEC=$prefix/lib/xen/bin ;;
+esac
 AC_SUBST(LIBEXEC)
 
 LIBDIR=`eval echo $libdir`
@@ -68,10 +71,11 @@ AC_SUBST(SHAREDIR)
 PRIVATE_PREFIX=$LIBDIR/xen
 AC_SUBST(PRIVATE_PREFIX)
 
-PKG_XEN_PREFIX=$LIBDIR/xen
-AC_SUBST(PKG_XEN_PREFIX)
-
-PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+case "$host_os" in
+*freebsd*) PRIVATE_BINDIR=$PRIVATE_PREFIX/bin ;;
+*netbsd*) PRIVATE_BINDIR=$BINDIR ;;
+*) PRIVATE_BINDIR=$PRIVATE_PREFIX/bin ;;
+esac
 AC_SUBST(PRIVATE_BINDIR)
 
 XENFIRMWAREDIR=$prefix/lib/xen/boot
@@ -89,7 +93,11 @@ AC_SUBST(XEN_CONFIG_DIR)
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 AC_SUBST(XEN_SCRIPT_DIR)
 
-XEN_LOCK_DIR=/var/lock
+case "$host_os" in
+*freebsd*) XEN_LOCK_DIR=/var/lib ;;
+*netbsd*) XEN_LOCK_DIR=/var/lib ;;
+*) XEN_LOCK_DIR=/var/lock ;;
+esac
 AC_SUBST(XEN_LOCK_DIR)
 
 XEN_RUN_DIR=/var/run/xen
#23 lore raw

Re: [PATCH 09/28] remove duplicate variables from config

El 25/09/14 a les 17.20, Olaf Hering ha escrit:
[...]

Quoted 17 lines
m4/paths.m4 +4 -1
index 19b6481..178b9a9 100644
@@ -47,7 +47,10 @@ AC_SUBST(SBINDIR)
 
 dnl XXX: this should be changed to use the passed $libexec
 dnl but can be done as a second step
-LIBEXEC=$prefix/lib/xen/bin
+case "$host_os" in
+*netbsd*)  LIBEXEC=$prefix/libexec ;;
+*) LIBEXEC=$prefix/lib/xen/bin ;;
+esac
 AC_SUBST(LIBEXEC)
 
 LIBDIR=`eval echo $libdir`

m4/paths.m4 AC_SUBST(SHAREDIR) · line 75

Quoted 9 lines
m4/paths.m4 +2 -4
@@ -68,10 +71,11 @@ AC_SUBST(SHAREDIR)
 PRIVATE_PREFIX=$LIBDIR/xen
 AC_SUBST(PRIVATE_PREFIX)
 
-PKG_XEN_PREFIX=$LIBDIR/xen
-AC_SUBST(PKG_XEN_PREFIX)
-
-PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+case "$host_os" in
+*freebsd*) PRIVATE_BINDIR=$PRIVATE_PREFIX/bin ;;

Is it really necessary to introduce a FreeBSD case? It could just use the wildcard one since it's the same.

Quoted 25 lines
m4/paths.m4 +8 -1
+*netbsd*) PRIVATE_BINDIR=$BINDIR ;;
+*) PRIVATE_BINDIR=$PRIVATE_PREFIX/bin ;;
+esac
 AC_SUBST(PRIVATE_BINDIR)
 
 XENFIRMWAREDIR=$prefix/lib/xen/boot
@@ -89,7 +93,11 @@ AC_SUBST(XEN_CONFIG_DIR)
 XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 AC_SUBST(XEN_SCRIPT_DIR)
 
-XEN_LOCK_DIR=/var/lock
+case "$host_os" in
+*freebsd*) XEN_LOCK_DIR=/var/lib ;;
+*netbsd*) XEN_LOCK_DIR=/var/lib ;;
+*) XEN_LOCK_DIR=/var/lock ;;
+esac
 AC_SUBST(XEN_LOCK_DIR)
 
 XEN_RUN_DIR=/var/run/xen

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#24 lore raw

Re: [PATCH 09/28] remove duplicate variables from config

Quoted 6 lines · Roger Pau Monné

El 25/09/14 a les 17.20, Olaf Hering ha escrit:

Quoted 5 lines

+++ b/m4/paths.m4

m4/paths.m4 +0 -0
@@ -68,10 +71,11 @@ AC_SUBST(SHAREDIR)
 PRIVATE_PREFIX=$LIBDIR/xen
 AC_SUBST(PRIVATE_PREFIX)
 
Quoted 8 lines

m4/paths.m4 AC_SUBST(SHAREDIR) · line 75

Quoted 6 lines
m4/paths.m4 +2 -4
-PKG_XEN_PREFIX=$LIBDIR/xen
-AC_SUBST(PKG_XEN_PREFIX)
-
-PRIVATE_BINDIR=$PRIVATE_PREFIX/bin
+case "$host_os" in
+*freebsd*) PRIVATE_BINDIR=$PRIVATE_PREFIX/bin ;;

Is it really necessary to introduce a FreeBSD case? It could just use the wildcard one since it's the same.

PRIVATE_BINDIR and PRIVATE_PREFIX will be removed in a later patch (--libexec). But I just realized those two variables are not removed by that later patch. I will fix that with v5.

Olaf

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#25 lore raw

PATCH v4 10/28 Substitue configure variables in Paths.mk.in

In reply to Olaf Hering

This patch lays the groundwork to convert variables used in Makefiles to the common automake style, i.e. PREFIX becomes prefix, MANDIR becomes mandir and so on.

The reason is that configure variables such as mandir expand to ${datarootdir}/man, and datarootdir expands to ${prefix}/share. This requires extra expansion in configure.ac before assigning to MANDIR.

Special care must be taken when variable substition is done in other files, such as xencommons.in. All @VARIABLES@ used in these files have to be the expanded version, or all other variables must be available at runtime.

This patch by itself changes nothing, but upcoming changes will make use of the lowercase variables.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Paths.mk.in | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
config/Paths.mk.in +17 -0
index 4bded93..65ca37b 100644
@@ -12,6 +12,23 @@
 #
 # http://wiki.xen.org/wiki/Category:Host_Configuration#System_wide_xen_configuration
 
+PACKAGE_TARNAME          := @PACKAGE_TARNAME@
+prefix                   := @prefix@
+bindir                   := @bindir@
+sbindir                  := @sbindir@
+libdir                   := @libdir@
+libexecdir               := @libexecdir@
+datarootdir              := @datarootdir@
+mandir                   := @mandir@
+docdir                   := @docdir@
+dvidir                   := @dvidir@
+htmldir                  := @htmldir@
+pdfdir                   := @pdfdir@
+psdir                    := @psdir@
+includedir               := @includedir@
+localstatedir            := @localstatedir@
+sysconfdir               := @sysconfdir@
+
 SBINDIR                  := @SBINDIR@
 BINDIR                   := @BINDIR@
 LIBEXEC                  := @LIBEXEC@
Acked-by on v4 10/28
#26 lore raw

Re: [PATCH 10/28] Substitue configure variables in Paths.mk.in

Quoted 13 lines · Olaf Hering

This patch lays the groundwork to convert variables used in Makefiles to the common automake style, i.e. PREFIX becomes prefix, MANDIR becomes mandir and so on.

The reason is that configure variables such as mandir expand to ${datarootdir}/man, and datarootdir expands to ${prefix}/share. This requires extra expansion in configure.ac before assigning to MANDIR.

Special care must be taken when variable substition is done in other files, such as xencommons.in. All @VARIABLES@ used in these files have to be the expanded version, or all other variables must be available at runtime.

Quoted 4 lines

This patch by itself changes nothing, but upcoming changes will make use of the lowercase variables.

#27 lore raw

PATCH v4 11/28 tools: substitute bindir instead of BINDIR

In reply to Olaf Hering

... and same for sbindir and libdir.
Expand usage of exec_prefix so that it does not appear in substituted variables in systemd files.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Paths.mk.in                                  |  6 +++---
 m4/paths.m4                                         | 15 +++++----------
 m4/xenstored.m4                                     |  8 ++++----
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in  |  4 ++--
 tools/hotplug/Linux/systemd/xen-watchdog.service.in |  2 +-
 tools/hotplug/Linux/systemd/xenconsoled.service.in  |  2 +-
 tools/hotplug/Linux/systemd/xenstored.service.in    |  4 ++--
 7 files changed, 18 insertions(+), 23 deletions(-)
config/Paths.mk.in +3 -3
index 65ca37b..c3c9897 100644
@@ -29,12 +29,12 @@ includedir               := @includedir@
 localstatedir            := @localstatedir@
 sysconfdir               := @sysconfdir@
 
-SBINDIR                  := @SBINDIR@
-BINDIR                   := @BINDIR@
+SBINDIR                  := $(sbindir)
+BINDIR                   := $(bindir)
 LIBEXEC                  := @LIBEXEC@
 
 SHAREDIR                 := @SHAREDIR@
-LIBDIR                   := @LIBDIR@
+LIBDIR                   := $(libdir)
 
 XEN_RUN_DIR              := @XEN_RUN_DIR@
 XEN_LOG_DIR              := @XEN_LOG_DIR@
m4/paths.m4 +5 -10
index 178b9a9..a9c6ebd 100644
@@ -2,6 +2,10 @@ AC_DEFUN([AX_XEN_EXPAND_CONFIG], [
 dnl expand these early so we can use this for substitutions
 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
 test "x$exec_prefix" = "xNONE" && exec_prefix=${prefix}
+dnl expand exec_prefix or it will endup in substituted variables
+bindir=`eval echo $bindir`
+sbindir=`eval echo $sbindir`
+libdir=`eval echo $libdir`
 
 dnl
 if test "x$sysconfdir" = 'x${prefix}/etc' ; then
@@ -39,12 +43,6 @@ AC_ARG_WITH([initddir],
          ;;
      esac])
 
-BINDIR=$prefix/bin
-AC_SUBST(BINDIR)
-
-SBINDIR=$prefix/sbin
-AC_SUBST(SBINDIR)
-
 dnl XXX: this should be changed to use the passed $libexec
 dnl but can be done as a second step
 case "$host_os" in
@@ -53,9 +51,6 @@ case "$host_os" in
 esac
 AC_SUBST(LIBEXEC)
 
-LIBDIR=`eval echo $libdir`
-AC_SUBST(LIBDIR)
-
 XEN_RUN_DIR=/var/run/xen
 AC_SUBST(XEN_RUN_DIR)
 
@@ -68,7 +63,7 @@ AC_SUBST(XEN_LIB_STORED)
 SHAREDIR=$prefix/share
 AC_SUBST(SHAREDIR)
 
-PRIVATE_PREFIX=$LIBDIR/xen
+PRIVATE_PREFIX=`eval echo $libdir`
 AC_SUBST(PRIVATE_PREFIX)
 
 case "$host_os" in
m4/xenstored.m4 +4 -4
index 30b44c9..b268fc2 100644
@@ -6,10 +6,10 @@ AC_DEFUN([AX_XEN_OCAML_XENSTORE_CHECK], [
 
 AC_DEFUN([AX_XEN_OCAML_XENSTORE_DEFAULTS], [
 	xenstore="oxenstored"
-	xenstored=$SBINDIR/oxenstored
+	xenstored=$sbindir/oxenstored
 	AS_IF([test "x$OCAMLC" = "xno" || test "x$OCAMLFIND" = "xno"], [
 		xenstore="xenstored"
-		xenstored=$SBINDIR/xenstored
+		xenstored=$sbindir/xenstored
 	])
 ])
 
@@ -29,11 +29,11 @@ AC_ARG_WITH([xenstored],
 	[
 		AS_IF([test "x$withval" = "xxenstored"], [
 			xenstore=$withval
-			xenstored=$SBINDIR/xenstored
+			xenstored=$sbindir/xenstored
 		])
 		AS_IF([test "x$withval" = "xoxenstored"], [
 			xenstore=$withval
-			xenstored=$SBINDIR/oxenstored
+			xenstored=$sbindir/oxenstored
 			AX_XEN_OCAML_XENSTORE_CHECK()
 		])
 		AS_IF([test "x$withval" != "xoxenstored" && test "x$withval" != "xxenstored"], [
tools/hotplug/Linux/init.d/sysconfig.xencommons.in +2 -2
index d423ff8..4d76d6b 100644
@@ -14,8 +14,8 @@
 # the XENSTORED variable there.
 #
 # This can be either of:
-#  * @SBINDIR@/oxenstored
-#  * @SBINDIR@/xenstored
+#  * @sbindir@/oxenstored
+#  * @sbindir@/xenstored
 #
 # Changing this requires a reboot to take effect.
 #XENSTORED=@XENSTORED@
tools/hotplug/Linux/systemd/xen-watchdog.service.in +1 -1
index acb2b77..ee77bf9 100644
@@ -6,7 +6,7 @@ ConditionVirtualization=xen
 
 [Service]
 Type=forking
-ExecStart=@SBINDIR@/xenwatchdogd 30 15
+ExecStart=@sbindir@/xenwatchdogd 30 15
 KillSignal=USR1
 
 [Install]
tools/hotplug/Linux/systemd/xenconsoled.service.in +1 -1
index 15fad35..7ca0264 100644
@@ -14,7 +14,7 @@ EnvironmentFile=-/etc/sysconfig/xenconsoled
 PIDFile=@XEN_RUN_DIR@/xenconsoled.pid
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStartPre=/bin/mkdir -p ${XENCONSOLED_LOG_DIR}
-ExecStart=@SBINDIR@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
+ExecStart=@sbindir@/xenconsoled --pid-file @XEN_RUN_DIR@/xenconsoled.pid --log=${XENCONSOLED_LOG} --log-dir=${XENCONSOLED_LOG_DIR} $XENCONSOLED_ARGS
 
 [Install]
 WantedBy=multi-user.target
tools/hotplug/Linux/systemd/xenstored.service.in +2 -2
index 4a9fcee..013e69e 100644
@@ -17,8 +17,8 @@ ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStartPre=-/bin/rm -f @XEN_LIB_STORED@/tdb*
 ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
 ExecStart=/bin/sh -c "exec $XENSTORED --no-fork $XENSTORED_ARGS"
-ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/name" "Domain-0"
-ExecStartPost=-@BINDIR@/xenstore-write "/local/domain/0/domid" 0
+ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/name" "Domain-0"
+ExecStartPost=-@bindir@/xenstore-write "/local/domain/0/domid" 0
 
 [Install]
 WantedBy=multi-user.target
#28 lore raw

Re: [PATCH 11/28] tools: substitute bindir instead of BINDIR

Quoted 26 lines · Olaf Hering

... and same for sbindir and libdir.
Expand usage of exec_prefix so that it does not appear in substituted variables in systemd files.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Paths.mk.in                                  |  6 +++---
 m4/paths.m4                                         | 15 +++++----------
 m4/xenstored.m4                                     |  8 ++++----
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in  |  4 ++--
 tools/hotplug/Linux/systemd/xen-watchdog.service.in |  2 +-
 tools/hotplug/Linux/systemd/xenconsoled.service.in  |  2 +-
 tools/hotplug/Linux/systemd/xenstored.service.in    |  4 ++--
 7 files changed, 18 insertions(+), 23 deletions(-)
config/Paths.mk.in +0 -0
index 65ca37b..c3c9897 100644

config/Paths.mk.in includedir := @includedir@ · line 33

Quoted 7 lines
config/Paths.mk.in +2 -2
@@ -29,12 +29,12 @@ includedir               := @includedir@
 localstatedir            := @localstatedir@
 sysconfdir               := @sysconfdir@
 
-SBINDIR                  := @SBINDIR@
-BINDIR                   := @BINDIR@
+SBINDIR                  := $(sbindir)
+BINDIR                   := $(bindir)

You switch all the users of these to the lower case version, don't you? Or only partially perhaps?

#29 lore raw

Re: [PATCH 11/28] tools: substitute bindir instead of BINDIR

Quoted 5 lines · Ian Campbell

config/Paths.mk.in includedir := @includedir@ · line 33

Quoted 2 lines · Olaf Hering
config/Paths.mk.in +2 -0
+SBINDIR                  := $(sbindir)
+BINDIR                   := $(bindir)

You switch all the users of these to the lower case version, don't you? Or only partially perhaps?

Just the users in this file. Doing the conversion tree-wide, removing BINDIR/SBINDIR, can be done after 4.5.

Olaf

#30 lore raw

Re: [PATCH 11/28] tools: substitute bindir instead of BINDIR

Quoted 10 lines · Olaf Hering
Quoted 5 lines · Ian Campbell

config/Paths.mk.in includedir := @includedir@ · line 33

Quoted 2 lines · Olaf Hering
config/Paths.mk.in +2 -0
+SBINDIR                  := $(sbindir)
+BINDIR                   := $(bindir)

You switch all the users of these to the lower case version, don't you? Or only partially perhaps?

Just the users in this file. Doing the conversion tree-wide, removing BINDIR/SBINDIR, can be done after 4.5.

OK.

#31 lore raw

PATCH v4 12/28 Use configure --mandir=DIR to set MANDIR

In reply to Olaf Hering

Also move common MAN8DIR and MAN1DIR to Paths.mk.in

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk          | 1 -
 config/Paths.mk.in | 3 +++
 config/StdGNU.mk   | 3 ---
 config/SunOS.mk    | 3 ---
 4 files changed, 3 insertions(+), 7 deletions(-)
Config.mk +0 -1
index 9bda626..b8afa43 100644
@@ -59,7 +59,6 @@ include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
 DOCDIR      ?= $(SHAREDIR)/doc/xen
-MANDIR      ?= $(SHAREDIR)/man
 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
 
 # arguments: variable, common path part, path to test, if yes, if no
config/Paths.mk.in +3 -0
index c3c9897..3ba4f77 100644
@@ -34,6 +34,9 @@ BINDIR                   := $(bindir)
 LIBEXEC                  := @LIBEXEC@
 
 SHAREDIR                 := @SHAREDIR@
+MANDIR                   := $(mandir)
+MAN1DIR                  := $(MANDIR)/man1
+MAN8DIR                  := $(MANDIR)/man8
 LIBDIR                   := $(libdir)
 
 XEN_RUN_DIR              := @XEN_RUN_DIR@
config/StdGNU.mk +0 -3
index dd6170c..bcf02ea 100644
@@ -29,9 +29,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
 INCLUDEDIR = $(PREFIX)/include
-MANDIR = $(SHAREDIR)/man
-MAN1DIR = $(MANDIR)/man1
-MAN8DIR = $(MANDIR)/man8
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
config/SunOS.mk +0 -3
index 92bde78..c88fc2a 100644
@@ -21,9 +21,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
 INCLUDEDIR = $(PREFIX)/include
-MANDIR = $(PREFIX)/share/man
-MAN1DIR = $(MANDIR)/man1
-MAN8DIR = $(MANDIR)/man8
 
 BOOT_DIR ?= /boot
#33 lore raw

PATCH v4 13/28 Use configure --docdir=DIR to set DOCDIR

In reply to Olaf Hering
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk          | 1 -
 config/Paths.mk.in | 1 +
 2 files changed, 1 insertion(+), 1 deletion(-)
Config.mk +0 -1
index b8afa43..569f4ab 100644
@@ -58,7 +58,6 @@ endif
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
-DOCDIR      ?= $(SHAREDIR)/doc/xen
 BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
 
 # arguments: variable, common path part, path to test, if yes, if no
config/Paths.mk.in +1 -0
index 3ba4f77..a2221c8 100644
@@ -38,6 +38,7 @@ MANDIR                   := $(mandir)
 MAN1DIR                  := $(MANDIR)/man1
 MAN8DIR                  := $(MANDIR)/man8
 LIBDIR                   := $(libdir)
+DOCDIR                   := $(docdir)
 
 XEN_RUN_DIR              := @XEN_RUN_DIR@
 XEN_LOG_DIR              := @XEN_LOG_DIR@
#35 lore raw

PATCH v4 14/28 Use configure --includedir=DIR to set INCLUDEDIR

In reply to Olaf Hering
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Paths.mk.in | 1 +
 config/StdGNU.mk   | 1 -
 config/SunOS.mk    | 1 -
 3 files changed, 1 insertion(+), 2 deletions(-)
config/Paths.mk.in +1 -0
index a2221c8..2151c14 100644
@@ -33,6 +33,7 @@ SBINDIR                  := $(sbindir)
 BINDIR                   := $(bindir)
 LIBEXEC                  := @LIBEXEC@
 
+INCLUDEDIR               := $(includedir)
 SHAREDIR                 := @SHAREDIR@
 MANDIR                   := $(mandir)
 MAN1DIR                  := $(MANDIR)/man1
config/StdGNU.mk +0 -1
index bcf02ea..b28a077 100644
@@ -28,7 +28,6 @@ INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
-INCLUDEDIR = $(PREFIX)/include
 
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
config/SunOS.mk +0 -1
index c88fc2a..1eaf0f8 100644
@@ -20,7 +20,6 @@ INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
 PREFIX ?= /usr
-INCLUDEDIR = $(PREFIX)/include
 
 BOOT_DIR ?= /boot
#37 lore raw

PATCH v4 15/28 Use configure --libexecdir=BASEDIR to set LIBEXEC

In reply to Olaf Hering

The current usage of LIBEXEC is bogus. It describes the directory for private xen executables. Other places create their own, similar libexecdir path as $prefix/lib/xen/*.

Additional two other variables are used to describe similar paths:
PRIVATE_BINDIR and PRIVATE_PREFIX

The autoconf documentation refers to libexec as a directory for executables and stuff which is called by other programs, not by the user.

Adjust all places that want libexecdir as a target path. LIBEXEC refers now to the base directory. Three convenience variables are used to refer to paths to private binaries, libs and include files.

In the systemd files LIBEXEC_BIN is substituted, so this variable has to be present in autoconf. All other variables are expanded in Paths.mk because they are only used in Makefiles.

Most users of LIBEXEC are updated to use LIBEXEC_BIN because that is what they want.

Users of PRIVATE_BINDIR are updated to use LIBEXEC_BIN because that is what they want. PRIVATE_BINDIR and PRIVATE_PREFIX usage is removed by this patch, in favour of LIBXEC_BIN and LIBEXEC

An internal libxl function was removed. A single helper to retrieve LIBEXEC_BIN remains.

As suggested by the autoconf documentation, configure appends the package name to LIBEXEC to make sure the provided directory really refers to xen. This makes sure "make uninstall" preserves the real libexecdir.

Please rerun autogen.sh after applying this patch.

Cc George Dunlap <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                                           |  2 +-
 config/Paths.mk.in                                  |  8 ++++----
 m4/paths.m4                                         | 21 ++++++++++++++-------
 stubdom/Makefile                                    |  6 +++---
 tools/Makefile                                      | 10 +++++-----
 tools/console/Makefile                              |  4 ++--
 tools/hotplug/FreeBSD/rc.d/xencommons.in            |  2 +-
 tools/hotplug/FreeBSD/vif-bridge                    |  2 +-
 tools/hotplug/Linux/Makefile                        |  4 ++--
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in  |  2 +-
 tools/hotplug/Linux/init.d/xencommons.in.in         |  4 ++--
 tools/hotplug/Linux/init.d/xendomains.in            | 12 ++++++------
 .../systemd/xen-qemu-dom0-disk-backend.service.in   |  2 +-
 tools/hotplug/Linux/systemd/xendomains.service.in   |  6 +++---
 tools/hotplug/Linux/xen-hotplug-common.sh.in        |  2 +-
 tools/hotplug/NetBSD/block                          |  2 +-
 tools/hotplug/NetBSD/rc.d/xencommons                |  2 +-
 tools/hotplug/NetBSD/vif-bridge                     |  2 +-
 tools/hotplug/NetBSD/vif-ip                         |  2 +-
 tools/libxl/Makefile                                |  6 +++---
 tools/libxl/libxl_dm.c                              |  4 ++--
 tools/libxl/libxl_internal.h                        |  1 -
 tools/libxl/libxl_paths.c                           |  7 +------
 tools/libxl/libxl_save_callout.c                    |  2 +-
 tools/misc/Makefile                                 |  4 ++--
 tools/pygrub/Makefile                               |  8 ++++----
 tools/vtpmmgr/Makefile                              |  6 +++---
 tools/xcutils/Makefile                              |  4 ++--
 tools/xenpaging/Makefile                            |  4 ++--
 tools/xentrace/Makefile                             |  4 ++--
 30 files changed, 73 insertions(+), 72 deletions(-)
Config.mk +1 -1
index 569f4ab..ca400a7 100644
@@ -162,7 +162,7 @@ define move-if-changed
 	if ! cmp -s $(1) $(2); then mv -f $(1) $(2); else rm -f $(1); fi
 endef
 
-BUILD_MAKE_VARS := SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \
+BUILD_MAKE_VARS := SBINDIR BINDIR LIBEXEC LIBEXEC_BIN LIBDIR SHAREDIR \
                    XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \
                    XEN_RUN_DIR XEN_PAGING_DIR
 
config/Paths.mk.in +4 -4
index 2151c14..8755785 100644
@@ -31,7 +31,10 @@ sysconfdir               := @sysconfdir@
 
 SBINDIR                  := $(sbindir)
 BINDIR                   := $(bindir)
-LIBEXEC                  := @LIBEXEC@
+LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
+LIBEXEC_BIN              := @LIBEXEC_BIN@
+LIBEXEC_LIB              := $(LIBEXEC)/lib
+LIBEXEC_INC              := $(LIBEXEC)/include
 
 INCLUDEDIR               := $(includedir)
 SHAREDIR                 := @SHAREDIR@
@@ -50,9 +53,6 @@ INITD_DIR                := @INITD_DIR@
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
-PRIVATE_PREFIX           := @PRIVATE_PREFIX@
-PRIVATE_BINDIR           := @PRIVATE_BINDIR@
-
 XENFIRMWAREDIR           := @XENFIRMWAREDIR@
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
m4/paths.m4 +14 -7
index a9c6ebd..b924ffc 100644
@@ -43,13 +43,20 @@ AC_ARG_WITH([initddir],
          ;;
      esac])
 
-dnl XXX: this should be changed to use the passed $libexec
-dnl but can be done as a second step
-case "$host_os" in
-*netbsd*)  LIBEXEC=$prefix/libexec ;;
-*) LIBEXEC=$prefix/lib/xen/bin ;;
-esac
-AC_SUBST(LIBEXEC)
+if test "$libexecdir" = '${exec_prefix}/libexec' ; then
+    case "$host_os" in
+         *netbsd*) ;;
+         *)
+         libexecdir='${exec_prefix}/lib'
+         ;;
+    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)
 
 XEN_RUN_DIR=/var/run/xen
 AC_SUBST(XEN_RUN_DIR)
stubdom/Makefile +3 -3
index 81f6d5a..9dac103 100644
@@ -462,9 +462,9 @@ install-readme:
 	$(INSTALL_DATA) README $(DESTDIR)$(DOCDIR)/README.stubdom
 
 install-ioemu: ioemu-stubdom
-	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC)"
-	$(INSTALL_PROG) stubdom-dm "$(DESTDIR)$(LIBEXEC)"
-	$(INSTALL_DATA) stubdompath.sh "$(DESTDIR)$(LIBEXEC)"
+	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_PROG) stubdom-dm "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_DATA) stubdompath.sh "$(DESTDIR)$(LIBEXEC_BIN)"
 	$(INSTALL_DIR) "$(DESTDIR)$(XENFIRMWAREDIR)"
 	$(INSTALL_DATA) mini-os-$(XEN_TARGET_ARCH)-ioemu/mini-os.gz "$(DESTDIR)$(XENFIRMWAREDIR)/ioemu-stubdom.gz"
 
tools/Makefile +5 -5
index 00f539a..284b73e 100644
@@ -86,7 +86,7 @@ uninstall:
 	rm -rf $(D)$(LIBDIR)/libxenstore* $(D)$(LIBDIR)/libxlutil*
 	rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
 	rm -rf $(D)$(LIBDIR)/xen/
-	rm -rf $(D)$(LIBEXEC)/xen*
+	rm -rf $(D)$(LIBEXEC)
 	rm -rf $(D)$(SBINDIR)/setmask
 	rm -rf $(D)$(SBINDIR)/xen* $(D)$(SBINDIR)/netfix $(D)$(SBINDIR)/xm
 	rm -rf $(D)$(SHAREDIR)/doc/xen
@@ -187,9 +187,9 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		$(QEMU_XEN_ENABLE_DEBUG) \
-		--prefix=$(PREFIX)/lib/xen \
-		--libdir=$(PREFIX)/lib/xen/lib \
-		--includedir=$(PREFIX)/lib/xen/include \
+		--prefix=$(LIBEXEC) \
+		--libdir=$(LIBEXEC_LIB) \
+		--includedir=$(LIBEXEC_INC) \
 		--source-path=$$source \
 		--extra-cflags="-I$(XEN_ROOT)/tools/include \
 		-I$(XEN_ROOT)/tools/libxc/include \
@@ -199,7 +199,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		--extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
 		-L$(XEN_ROOT)/tools/xenstore \
 		-Wl,-rpath=$(PREFIX)/lib/xen/lib" \
-		--bindir=$(LIBEXEC) \
+		--bindir=$(LIBEXEC_BIN) \
 		--datadir=$(SHAREDIR)/qemu-xen \
 		--localstatedir=/var \
 		--disable-kvm \
tools/console/Makefile +2 -2
index 3e38252..6e55618 100644
@@ -32,7 +32,7 @@ xenconsole: $(patsubst %.c,%.o,$(wildcard client/*.c))
 install: $(BIN)
 	$(INSTALL_DIR) $(DESTDIR)/$(SBINDIR)
 	$(INSTALL_PROG) xenconsoled $(DESTDIR)/$(SBINDIR)
-	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
-	$(INSTALL_PROG) xenconsole $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) xenconsole $(DESTDIR)$(LIBEXEC_BIN)
 
 -include $(DEPS)
tools/hotplug/FreeBSD/rc.d/xencommons.in +1 -1
index 8b051ec..c73616e 100644
@@ -65,7 +65,7 @@ xen_startcmd()
 	printf "\n"
 
 	printf "Setting domain 0 name, domid and JSON config...\n"
-	${PRIVATE_BINDIR}/xen-init-dom0
+	${LIBEXEC_BIN}/xen-init-dom0
 }
 
 xen_stop()
tools/hotplug/FreeBSD/vif-bridge +1 -1
index fa7570d..d350df4 100644
@@ -13,7 +13,7 @@
 DIR=$(dirname "$0")
 . "${DIR}/hotplugpath.sh"
 
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
 export PATH
 
 path=$1
tools/hotplug/Linux/Makefile +2 -2
index d5a9ed2..4361f68 100644
@@ -54,8 +54,8 @@ install: all install-initd install-scripts install-udev subdirs-install
 install-initd: all
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
-	[ -d $(DESTDIR)$(LIBEXEC) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
-	$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC)
+	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(XENDOMAINS_LIBEXEC) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) $(XENDOMAINS_INITD) $(DESTDIR)$(INITD_DIR)
 	$(INSTALL_DATA) $(XENDOMAINS_SYSCONFIG) $(DESTDIR)$(SYSCONFIG_DIR)/xendomains
 	$(INSTALL_PROG) $(XENCOMMONS_INITD) $(DESTDIR)$(INITD_DIR)
tools/hotplug/Linux/init.d/sysconfig.xencommons.in +1 -1
index 4d76d6b..4322081 100644
@@ -39,4 +39,4 @@
 #XENBACKENDD_DEBUG=[yes|on|1]
 
 # qemu path
-#QEMU_XEN=/usr/lib/xen/bin/qemu-system-i386
+#QEMU_XEN=@LIBEXEC_BIN@/qemu-system-i386
tools/hotplug/Linux/init.d/xencommons.in.in +2 -2
index bd1d9ba..590f745 100644
@@ -92,14 +92,14 @@ do_start () {
 		fi
 
 		echo Setting domain 0 name, domid and JSON config...
-		${PRIVATE_BINDIR}/xen-init-dom0
+		${LIBEXEC_BIN}/xen-init-dom0
 	fi
 
 	echo Starting xenconsoled...
 	test -z "$XENCONSOLED_TRACE" || XENCONSOLED_ARGS=" --log=$XENCONSOLED_TRACE"
 	${SBINDIR}/xenconsoled --pid-file=$XENCONSOLED_PIDFILE $XENCONSOLED_ARGS
 	echo Starting QEMU as disk backend for dom0
-	test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC}/qemu-system-i386"
+	test -z "$QEMU_XEN" && QEMU_XEN="${LIBEXEC_BIN}/qemu-system-i386"
 	$QEMU_XEN -xen-domid 0 -xen-attach -name dom0 -nographic -M xenpv -daemonize \
 		-monitor /dev/null -serial /dev/null -parallel /dev/null \
 		-pidfile $QEMU_PIDFILE
tools/hotplug/Linux/init.d/xendomains.in +6 -6
index 5b88e2d..dcd330c 100644
@@ -20,7 +20,7 @@
 # Short-Description: Wrapper to start/stop secondary xen domains
 # Description:       Wrapper for starting / stopping domains automatically
 #                    when domain 0 boots / shuts down on systems using init.
-#                    The $LIBEXEC/xendomains helper is shared between init and
+#                    The $LIBEXEC_BIN/xendomains helper is shared between init and
 #                    systemd systems.
 ### END INIT INFO
 
@@ -28,19 +28,19 @@
 
 case "$1" in
     start)
-	$LIBEXEC/xendomains start
+	$LIBEXEC_BIN/xendomains start
 	;;
     stop)
-	$LIBEXEC/xendomains stop
+	$LIBEXEC_BIN/xendomains stop
 	;;
     restart)
-	$LIBEXEC/xendomains restart
+	$LIBEXEC_BIN/xendomains restart
 	;;
     reload)
-	$LIBEXEC/xendomains reload
+	$LIBEXEC_BIN/xendomains reload
 	;;
     status)
-	$LIBEXEC/xendomains status
+	$LIBEXEC_BIN/xendomains status
 	;;
     *)
 	echo "Usage: $0 {start|stop|restart|reload|status}"
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in +1 -1
index 8dbd110..806bcaa 100644
@@ -13,7 +13,7 @@ EnvironmentFile=-/etc/sysconfig/xenstored
 PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
 ExecStartPre=/bin/mkdir -p /var/run/xen
-ExecStart=@LIBEXEC@/qemu-system-i386 -xen-domid 0 \
+ExecStart=@LIBEXEC_BIN@/qemu-system-i386 -xen-domid 0 \
 	-xen-attach -name dom0 -nographic -M xenpv -daemonize \
 	-monitor /dev/null -serial /dev/null -parallel /dev/null \
 	-pidfile @XEN_RUN_DIR@/qemu-dom0.pid
tools/hotplug/Linux/systemd/xendomains.service.in +3 -3
index 70ce7c0..f88c336 100644
@@ -8,9 +8,9 @@ ConditionVirtualization=xen
 Type=oneshot
 RemainAfterExit=true
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
-ExecStart=-@LIBEXEC@/xendomains start
-ExecStop=@LIBEXEC@/xendomains stop
-ExecReload=@LIBEXEC@/xendomains restart
+ExecStart=-@LIBEXEC_BIN@/xendomains start
+ExecStop=@LIBEXEC_BIN@/xendomains stop
+ExecReload=@LIBEXEC_BIN@/xendomains restart
 
 [Install]
 WantedBy=multi-user.target
tools/hotplug/Linux/xen-hotplug-common.sh.in +1 -1
index 996e974..1deafe1 100644
@@ -30,7 +30,7 @@ dir=$(dirname "$0")
 
 exec 2>>/var/log/xen/xen-hotplug.log
 
-export PATH="${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
+export PATH="${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/sbin:/bin:/usr/bin:/usr/sbin:$PATH"
 export LD_LIBRARY_PATH="${LIBDIR}${LD_LIBRARY_PATH+:}$LD_LIBRARY_PATH"
 export LANG="POSIX"
 unset $(set | grep ^LC_ | cut -d= -f1)
tools/hotplug/NetBSD/block +1 -1
index f1146b5..b2e9af5 100644
@@ -7,7 +7,7 @@
 DIR=$(dirname "$0")
 . "${DIR}/hotplugpath.sh"
 
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
 export PATH
 
 error() {
tools/hotplug/NetBSD/rc.d/xencommons +1 -1
index 7ac87e2..793bede 100644
@@ -69,7 +69,7 @@ xen_startcmd()
 	printf "\n"
 
 	printf "Setting domain 0 name, domid and JSON config...\n"
-	${PRIVATE_BINDIR}/xen-init-dom0
+	${LIBEXEC_BIN}/xen-init-dom0
 }
 
 xen_stop()
tools/hotplug/NetBSD/vif-bridge +1 -1
index 64162a8..960303e 100644
@@ -7,7 +7,7 @@
 DIR=$(dirname "$0")
 . "${DIR}/hotplugpath.sh"
 
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
 export PATH
 
 xpath=$1
tools/hotplug/NetBSD/vif-ip +1 -1
index 583e277..28c43de 100644
@@ -7,7 +7,7 @@
 DIR=$(dirname "$0")
 . "${DIR}/hotplugpath.sh"
 
-PATH=${BINDIR}:${SBINDIR}:${LIBEXEC}:${PRIVATE_BINDIR}:/bin:/usr/bin:/sbin:/usr/sbin
+PATH=${BINDIR}:${SBINDIR}:${LIBEXEC_BIN}:/bin:/usr/bin:/sbin:/usr/sbin
 export PATH
 
 xpath=$1
tools/libxl/Makefile +3 -3
index 496a269..602dc9b 100644
@@ -239,10 +239,10 @@ install: all
 	$(INSTALL_DIR) $(DESTDIR)$(LIBDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR)
-	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR)
-	$(INSTALL_PROG) xen-init-dom0 $(DESTDIR)$(PRIVATE_BINDIR)
-	$(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_PROG) xen-init-dom0 $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)
 	$(SYMLINK_SHLIB) libxenlight.so.$(MAJOR).$(MINOR) $(DESTDIR)$(LIBDIR)/libxenlight.so.$(MAJOR)
 	$(SYMLINK_SHLIB) libxenlight.so.$(MAJOR) $(DESTDIR)$(LIBDIR)/libxenlight.so
tools/libxl/libxl_dm.c +2 -2
index fbc82fd..a4ea749 100644
@@ -38,7 +38,7 @@ static const char *qemu_xen_path(libxl__gc *gc)
 #ifdef QEMU_XEN_PATH
     return QEMU_XEN_PATH;
 #else
-    return libxl__abs_path(gc, "qemu-system-i386", libxl__libexec_path());
+    return libxl__abs_path(gc, "qemu-system-i386", libxl__private_bindir_path());
 #endif
 }
 
@@ -73,7 +73,7 @@ const char *libxl__domain_device_model(libxl__gc *gc,
     } else {
         switch (info->device_model_version) {
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL:
-            dm = libxl__abs_path(gc, "qemu-dm", libxl__libexec_path());
+            dm = libxl__abs_path(gc, "qemu-dm", libxl__private_bindir_path());
             break;
         case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN:
             dm = qemu_xen_path(gc);
tools/libxl/libxl_internal.h +0 -1
index f61673c..e13a37e 100644
@@ -2070,7 +2070,6 @@ _hidden int libxl__carefd_close(libxl__carefd*);
 _hidden int libxl__carefd_fd(const libxl__carefd*);
 
 /* common paths */
-_hidden const char *libxl__libexec_path(void);
 _hidden const char *libxl__private_bindir_path(void);
 _hidden const char *libxl__xenfirmwaredir_path(void);
 _hidden const char *libxl__xen_config_dir_path(void);
tools/libxl/libxl_paths.c +1 -6
index 14b28d1..9b7b0d5 100644
@@ -15,14 +15,9 @@
 #include "libxl_osdeps.h" /* must come before any other headers */
 #include "libxl_internal.h"
 
-const char *libxl__libexec_path(void)
-{
-    return LIBEXEC;
-}
-
 const char *libxl__private_bindir_path(void)
 {
-    return PRIVATE_BINDIR;
+    return LIBEXEC_BIN;
 }
 
 const char *libxl__xenfirmwaredir_path(void)
tools/libxl/libxl_save_callout.c +1 -1
index 1c9f806..40b25e4 100644
@@ -174,7 +174,7 @@ static void run_helper(libxl__egc *egc, libxl__save_helper_state *shs,
     shs->stdout_what = GCSPRINTF("domain %"PRIu32" save/restore helper"
                                  " stdout pipe", domid);
 
-    *arg++ = getenv("LIBXL_SAVE_HELPER") ?: PRIVATE_BINDIR "/" "libxl-save-helper";
+    *arg++ = getenv("LIBXL_SAVE_HELPER") ?: LIBEXEC_BIN "/" "libxl-save-helper";
     *arg++ = mode_arg;
     const char **stream_fd_arg = arg++;
     for (i=0; i<num_argnums; i++)
tools/misc/Makefile +2 -2
index 266fd16..3237461 100644
@@ -45,10 +45,10 @@ build: $(TARGETS)
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
-	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_BIN) $(DESTDIR)$(BINDIR)
 	$(INSTALL_PYTHON_PROG) $(INSTALL_SBIN) $(DESTDIR)$(SBINDIR)
-	$(INSTALL_PYTHON_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_PYTHON_PROG) $(INSTALL_PRIVBIN) $(DESTDIR)$(LIBEXEC_BIN)
 	set -e; for d in $(SUBDIRS); do $(MAKE) -C $$d install-recurse; done
 
 .PHONY: clean
tools/pygrub/Makefile +4 -4
index a37a8b1..3dff608 100644
@@ -12,11 +12,11 @@ build:
 install: all
 	CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \
 		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \
-		--install-scripts=$(PRIVATE_BINDIR) --force
-	set -e; if [ $(BINDIR) != $(PRIVATE_BINDIR) -a \
+		--install-scripts=$(LIBEXEC_BIN) --force
+	set -e; if [ $(BINDIR) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(BINDIR)`" != \
-	             "`readlink -f $(PRIVATE_BINDIR)`" ]; then \
-	    ln -sf $(PRIVATE_BINDIR)/pygrub $(DESTDIR)/$(BINDIR); \
+	             "`readlink -f $(LIBEXEC_BIN)`" ]; then \
+	    ln -sf $(LIBEXEC_BIN)/pygrub $(DESTDIR)/$(BINDIR); \
 	fi
 
 .PHONY: clean
tools/vtpmmgr/Makefile +3 -3
index 8890b06..b14c170 100644
@@ -5,9 +5,9 @@ all:
 	@true
 
 install:
-	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC)"
-	$(INSTALL_DATA) calc.pl "$(DESTDIR)$(LIBEXEC)"
-	$(INSTALL_DATA) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC)"
+	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_DATA) calc.pl "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_DATA) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC_BIN)"
 
 clean:
 	@true
tools/xcutils/Makefile +2 -2
index f71703d..1c5237c 100644
@@ -33,8 +33,8 @@ lsevtchn: lsevtchn.o
 
 .PHONY: install
 install: build
-	$(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
-	$(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(PRIVATE_BINDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(PROGRAMS) $(DESTDIR)$(LIBEXEC_BIN)
 
 
 .PHONY: clean
tools/xenpaging/Makefile +2 -2
index 3734ca6..c742e62 100644
@@ -25,8 +25,8 @@ xenpaging: $(OBJS)
 
 install: all
 	$(INSTALL_DIR) -m 0700 $(DESTDIR)$(XEN_PAGING_DIR)
-	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC)
-	$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC)
+	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
+	$(INSTALL_PROG) $(IBINS) $(DESTDIR)$(LIBEXEC_BIN)
 
 clean:
 	rm -f *.o *~ $(DEPS) xen TAGS $(IBINS) $(LIB)
tools/xentrace/Makefile +2 -2
index 63b09c0..b821952 100644
@@ -21,12 +21,12 @@ build: $(BIN) $(LIBBIN)
 .PHONY: install
 install: build
 	$(INSTALL_DIR) $(DESTDIR)$(BINDIR)
-	[ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR)
+	[ -z "$(LIBBIN)" ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DIR) $(DESTDIR)$(MAN1DIR)
 	$(INSTALL_DIR) $(DESTDIR)$(MAN8DIR)
 	$(INSTALL_PROG) $(BIN) $(DESTDIR)$(BINDIR)
 	$(INSTALL_PYTHON_PROG) $(SCRIPTS) $(DESTDIR)$(BINDIR)
-	[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(PRIVATE_BINDIR)
+	[ -z "$(LIBBIN)" ] || $(INSTALL_PROG) $(LIBBIN) $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_DATA) $(MAN1) $(DESTDIR)$(MAN1DIR)
 	$(INSTALL_DATA) $(MAN8) $(DESTDIR)$(MAN8DIR)
#38 lore raw

Re: [PATCH 15/28] Use configure --libexecdir=BASEDIR to set LIBEXEC

tools/Makefile uninstall: · line 89

Quoted 10 lines · Olaf Hering
tools/Makefile +1 -1
index 00f539a..284b73e 100644
@@ -86,7 +86,7 @@ uninstall:
 	rm -rf $(D)$(LIBDIR)/libxenstore* $(D)$(LIBDIR)/libxlutil*
 	rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
 	rm -rf $(D)$(LIBDIR)/xen/
-	rm -rf $(D)$(LIBEXEC)/xen*
+	rm -rf $(D)$(LIBEXEC)

Won't this erase ${exec_prefix}/lib? (rather than the xen subtree)?

Everything else looked good.

#39 lore raw

Re: [PATCH 15/28] Use configure --libexecdir=BASEDIR to set LIBEXEC

Quoted 13 lines · Ian Campbell

tools/Makefile uninstall: · line 89

Quoted 10 lines · Olaf Hering
tools/Makefile +1 -1
index 00f539a..284b73e 100644
@@ -86,7 +86,7 @@ uninstall:
 	rm -rf $(D)$(LIBDIR)/libxenstore* $(D)$(LIBDIR)/libxlutil*
 	rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
 	rm -rf $(D)$(LIBDIR)/xen/
-	rm -rf $(D)$(LIBEXEC)/xen*
+	rm -rf $(D)$(LIBEXEC)

Won't this erase ${exec_prefix}/lib? (rather than the xen subtree)?

No, the internal variable LIBEXEC has to include the subdir name "xen", otherwise everything would end up in "/usr/lib". An earlier patch in series adds this change:

config/Paths.mk.in:LIBEXEC := $(libexecdir)/$(PACKAGE_TARNAME)

Olaf

Acked-by
#40 lore raw

Re: [PATCH 15/28] Use configure --libexecdir=BASEDIR to set LIBEXEC

Quoted 16 lines · Olaf Hering
Quoted 13 lines · Ian Campbell

tools/Makefile uninstall: · line 89

Quoted 10 lines · Olaf Hering
tools/Makefile +1 -1
index 00f539a..284b73e 100644
@@ -86,7 +86,7 @@ uninstall:
 	rm -rf $(D)$(LIBDIR)/libxenstore* $(D)$(LIBDIR)/libxlutil*
 	rm -rf $(D)$(LIBDIR)/python/xen $(D)$(LIBDIR)/python/grub
 	rm -rf $(D)$(LIBDIR)/xen/
-	rm -rf $(D)$(LIBEXEC)/xen*
+	rm -rf $(D)$(LIBEXEC)

Won't this erase ${exec_prefix}/lib? (rather than the xen subtree)?

Quoted 5 lines

No, the internal variable LIBEXEC has to include the subdir name "xen", otherwise everything would end up in "/usr/lib". An earlier patch in series adds this change:

config/Paths.mk.in:LIBEXEC := $(libexecdir)/$(PACKAGE_TARNAME)

Ah, ok. thanks

#41 lore raw

PATCH v4 16/28 Use configure --prefix=DIR to set PREFIX

In reply to Olaf Hering

PREFIX is set by configure --prefix=DIR, nothing outside tools,docs,stubdom is using this variable.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/StdGNU.mk | 2 --
 config/SunOS.mk  | 2 --
 2 files changed, 4 deletions(-)
config/StdGNU.mk +0 -2
index b28a077..16c3043 100644
@@ -27,8 +27,6 @@ INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
-PREFIX ?= /usr
-
 SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
 
 BOOT_DIR ?= /boot
config/SunOS.mk +0 -2
index 1eaf0f8..bb8073f 100644
@@ -19,8 +19,6 @@ INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
-PREFIX ?= /usr
-
 BOOT_DIR ?= /boot
 
 SunOS_LIBDIR = /usr/sfw/lib
#42 lore raw

PATCH v4 17/28 Use configure --localstatedir=BASEDIR to set path to /var

In reply to Olaf Hering

This is helpful to test make uninstall with --prefix=/private/dir as unprivileged user. No change in behaviour is expected by this change.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 m4/paths.m4    | 24 ++++++++++++++++--------
 tools/Makefile |  2 +-
 2 files changed, 17 insertions(+), 9 deletions(-)
m4/paths.m4 +16 -8
index b924ffc..7ca4e53 100644
@@ -2,6 +2,14 @@ AC_DEFUN([AX_XEN_EXPAND_CONFIG], [
 dnl expand these early so we can use this for substitutions
 test "x$prefix" = "xNONE" && prefix=$ac_default_prefix
 test "x$exec_prefix" = "xNONE" && exec_prefix=${prefix}
+
+dnl Use /var instead of /usr/local/var because there can be only one
+dnl xenstored active at a time. All tools have to share this dir, even
+dnl if they come from a different --prefix=.
+if test "$localstatedir" = '${prefix}/var' ; then
+    localstatedir=/var
+fi
+
 dnl expand exec_prefix or it will endup in substituted variables
 bindir=`eval echo $bindir`
 sbindir=`eval echo $sbindir`
@@ -58,13 +66,13 @@ dnl This variable will be substituted in various .in files
 LIBEXEC_BIN=`eval echo $libexecdir/$PACKAGE_TARNAME/bin`
 AC_SUBST(LIBEXEC_BIN)
 
-XEN_RUN_DIR=/var/run/xen
+XEN_RUN_DIR=$localstatedir/run/xen
 AC_SUBST(XEN_RUN_DIR)
 
-XEN_LOG_DIR=/var/log/xen
+XEN_LOG_DIR=$localstatedir/log/xen
 AC_SUBST(XEN_LOG_DIR)
 
-XEN_LIB_STORED=/var/lib/xenstored
+XEN_LIB_STORED=$localstatedir/lib/xenstored
 AC_SUBST(XEN_LIB_STORED)
 
 SHAREDIR=$prefix/share
@@ -96,15 +104,15 @@ XEN_SCRIPT_DIR=$XEN_CONFIG_DIR/scripts
 AC_SUBST(XEN_SCRIPT_DIR)
 
 case "$host_os" in
-*freebsd*) XEN_LOCK_DIR=/var/lib ;;
-*netbsd*) XEN_LOCK_DIR=/var/lib ;;
-*) XEN_LOCK_DIR=/var/lock ;;
+*freebsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*netbsd*) XEN_LOCK_DIR=$localstatedir/lib ;;
+*) XEN_LOCK_DIR=$localstatedir/lock ;;
 esac
 AC_SUBST(XEN_LOCK_DIR)
 
-XEN_RUN_DIR=/var/run/xen
+XEN_RUN_DIR=$localstatedir/run/xen
 AC_SUBST(XEN_RUN_DIR)
 
-XEN_PAGING_DIR=/var/lib/xen/xenpaging
+XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
 ])
tools/Makefile +1 -1
index 284b73e..67e1dc5 100644
@@ -201,7 +201,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		-Wl,-rpath=$(PREFIX)/lib/xen/lib" \
 		--bindir=$(LIBEXEC_BIN) \
 		--datadir=$(SHAREDIR)/qemu-xen \
-		--localstatedir=/var \
+		--localstatedir=$(localstatedir) \
 		--disable-kvm \
 		--disable-docs \
 		--disable-guest-agent \
Acked-by on v4 17/28
#43 lore raw

Re: [PATCH 17/28] Use configure --localstatedir=BASEDIR to set path to /var

Quoted 6 lines · Olaf Hering

This is helpful to test make uninstall with --prefix=/private/dir as unprivileged user. No change in behaviour is expected by this change.

Please rerun autogen.sh after applying this patch.

#44 lore raw

PATCH v4 18/28 Add configure --enable-rpath

In reply to Olaf Hering

This fixes the tools when xen is configured with --prefix=/odd/path

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk          |  3 +++
 config/Tools.mk.in |  2 ++
 tools/Makefile     | 16 ++++++++++++++--
 tools/configure.ac |  1 +
 4 files changed, 20 insertions(+), 2 deletions(-)
Config.mk +3 -0
index ca400a7..73281d8 100644
@@ -208,6 +208,9 @@ LDFLAGS += $(foreach i, $(EXTRA_LIB), -L$(i))
 CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i))
 LDFLAGS += $(foreach i, $(PREPEND_LIB), -L$(i))
 CFLAGS += $(foreach i, $(PREPEND_INCLUDES), -I$(i))
+ifeq ($(XEN_TOOLS_RPATH),y)
+LDFLAGS += -Wl,-rpath,$(LIBDIR)
+endif
 APPEND_LDFLAGS += $(foreach i, $(APPEND_LIB), -L$(i))
 APPEND_CFLAGS += $(foreach i, $(APPEND_INCLUDES), -I$(i))
 
config/Tools.mk.in +2 -0
index 974e28e..5126bb1 100644
@@ -43,6 +43,8 @@ PTHREAD_LIBS        := @PTHREAD_LIBS@
 
 PTYFUNCS_LIBS       := @PTYFUNCS_LIBS@
 
+XEN_TOOLS_RPATH     := @rpath@
+
 # Download GIT repositories via HTTP or GIT's own protocol?
 # GIT's protocol is faster and more robust, when it works at all (firewalls
 # may block it). We make it the default, but if your GIT repository downloads
tools/Makefile +14 -2
index 67e1dc5..38b4c48 100644
@@ -110,6 +110,14 @@ IOEMU_CONFIGURE_CROSS ?= --cross-prefix=$(CROSS_COMPILE) \
 			 --interp-prefix=$(CROSS_SYS_ROOT)
 endif
 
+ifeq ($(XEN_TOOLS_RPATH),y)
+QEMU_UPSTREAM_RPATH := -Wl,-rpath,$(LIBEXEC_LIB):$(LIBDIR)
+IOEMU_EXTRA_LDFLAGS := --extra-ldflags="-Wl,-rpath,$(LIBDIR)"
+else
+QEMU_UPSTREAM_RPATH := -Wl,-rpath,$(LIBEXEC_LIB)
+IOEMU_EXTRA_LDFLAGS :=
+endif
+
 QEMU_ROOT := $(shell if [ -d "$(QEMU_TRADITIONAL_LOC)" ]; then echo "$(QEMU_TRADITIONAL_LOC)"; else echo .; fi)
 ifneq ($(QEMU_ROOT),.)
 export QEMU_ROOT
@@ -145,7 +153,10 @@ subdir-all-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
 	set -e; \
 		$(buildmakevars2shellvars); \
 		cd qemu-xen-traditional-dir; \
-		$(QEMU_ROOT)/xen-setup --cpu=$(IOEMU_CPU_ARCH) $(IOEMU_CONFIGURE_CROSS); \
+		$(QEMU_ROOT)/xen-setup \
+		$(IOEMU_EXTRA_LDFLAGS) \
+		--cpu=$(IOEMU_CPU_ARCH) \
+		$(IOEMU_CONFIGURE_CROSS); \
 		$(MAKE) all
 
 subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
@@ -154,6 +165,7 @@ subdir-install-qemu-xen-traditional-dir: qemu-xen-traditional-dir-find
 		cd qemu-xen-traditional-dir; \
 		$(QEMU_ROOT)/xen-setup \
 		--extra-cflags="$(EXTRA_CFLAGS_QEMU_TRADITIONAL)" \
+		$(IOEMU_EXTRA_LDFLAGS) \
 		--cpu=$(IOEMU_CPU_ARCH) \
 		$(IOEMU_CONFIGURE_CROSS); \
 		$(MAKE) install
@@ -198,7 +210,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 		$(EXTRA_CFLAGS_QEMU_XEN)" \
 		--extra-ldflags="-L$(XEN_ROOT)/tools/libxc \
 		-L$(XEN_ROOT)/tools/xenstore \
-		-Wl,-rpath=$(PREFIX)/lib/xen/lib" \
+		$(QEMU_UPSTREAM_RPATH)" \
 		--bindir=$(LIBEXEC_BIN) \
 		--datadir=$(SHAREDIR)/qemu-xen \
 		--localstatedir=$(localstatedir) \
tools/configure.ac +1 -0
index 80754ea..abc5033 100644
@@ -80,6 +80,7 @@ m4_include([../m4/systemd.m4])
 AX_XEN_EXPAND_CONFIG()
 
 # Enable/disable options
+AX_ARG_DEFAULT_DISABLE([rpath], [Build tools with -Wl,-rpath,LIBDIR])
 AX_ARG_DEFAULT_DISABLE([githttp], [Download GIT repositories via HTTP])
 AX_ARG_DEFAULT_ENABLE([monitors], [Disable xenstat and xentop monitoring tools])
 AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
#46 lore raw

PATCH v4 19/28 Add configure --with-linux-backend-modules="mod1 mod2"

In reply to Olaf Hering

This replaces config/Linux.modules with a configure option. As a result of this change only a single xencomons.in is required, instead of a xencomons.in.in and sed hackery.

After this change blktap2 and blktap will be loaded at the same time. This is already done in out-of-tree xencommons scripts, and systemd will load both modules as well. No harm is expected by loading both modules.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 README                                             | 12 --------
 config/Linux.modules                               | 20 ------------
 config/Tools.mk.in                                 |  2 ++
 tools/configure.ac                                 | 34 +++++++++++++++++++-
 tools/hotplug/Linux/Makefile                       | 14 +++------
 .../init.d/{xencommons.in.in => xencommons.in}     |  5 ++-
 tools/hotplug/Linux/systemd/Makefile               | 34 ++++----------------
 tools/hotplug/Linux/update-modules.sh              | 36 ----------------------
 8 files changed, 49 insertions(+), 108 deletions(-)
README +0 -12
index 81bf938..3203d8a 100644
@@ -231,15 +231,3 @@ There are optional targets as part of Xen's top-level makefile that will
 download and build tboot: install-tboot, build-tboot, dist-tboot, clean-tboot.
 These will download the latest tar file from the SourceForge site using wget,
 then build/install/dist according to Xen's settings.
-
-Required Kernel modules
-======================
-
-Xen has a set of Kernel modules which the init scripts ensure to load before
-before starting Xen guests. The list of modules are maintained in one place:
-
-  * config/$(XEN_OS).modules
-
-For more details refer to:
-
-http://wiki.xen.org/wiki/Category:Host_Configuration#Kernel_modules
config/Linux.modules deleted +0 -20
deleted file mode 100644
index 8a764df..0000000
@@ -1,20 +0,0 @@
-# The file supports a simple language, comments are ignored, and if you there
-# are module replacements this can be listed by using a pipe to show preference
-# for the first module, followed by the older module.
-
-xen-evtchn
-xen-gntdev
-xen-gntalloc
-xen-blkback
-xen-netback
-xen-pciback
-evtchn
-gntdev
-netbk
-blkbk
-xen-scsibk
-usbbk
-pciback
-xen-acpi-processor
-# Prefer to load blktap2 if found, otherwise load blktap
-blktap2|blktap
config/Tools.mk.in +2 -0
index 5126bb1..23ae8b1 100644
@@ -71,6 +71,8 @@ SYSTEMD_LIBS        := @SYSTEMD_LIBS@
 XEN_SYSTEMD_DIR     := @SYSTEMD_DIR@
 XEN_SYSTEMD_MODULES_LOAD := @SYSTEMD_MODULES_LOAD@
 
+LINUX_BACKEND_MODULES := @LINUX_BACKEND_MODULES@
+
 #System options
 ZLIB                := @zlib@
 CONFIG_LIBICONV     := @libiconv@
tools/configure.ac +33 -1
index abc5033..87e14cd 100644
@@ -10,7 +10,7 @@ AC_CONFIG_FILES([
 hotplug/FreeBSD/rc.d/xencommons
 hotplug/Linux/init.d/sysconfig.xencommons
 hotplug/Linux/init.d/xen-watchdog
-hotplug/Linux/init.d/xencommons.in
+hotplug/Linux/init.d/xencommons
 hotplug/Linux/init.d/xendomains
 hotplug/Linux/systemd/proc-xen.mount
 hotplug/Linux/systemd/var-lib-xenstored.mount
@@ -90,6 +90,38 @@ AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
 AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
 
+AC_ARG_WITH([linux-backend-modules],
+    AS_HELP_STRING([--with-linux-backend-modules="mod1 mod2"],
+    [List of Linux backend module or modalias names to be autoloaded on startup.]),
+    [LINUX_BACKEND_MODULES="$withval"],
+    [case "$host_os" in
+*linux*)
+LINUX_BACKEND_MODULES="
+xen-evtchn
+xen-gntdev
+xen-gntalloc
+xen-blkback
+xen-netback
+xen-pciback
+evtchn
+gntdev
+netbk
+blkbk
+xen-scsibk
+usbbk
+pciback
+xen-acpi-processor
+blktap2
+blktap
+"
+;;
+*)
+LINUX_BACKEND_MODULES=
+;;
+esac])
+LINUX_BACKEND_MODULES="`eval echo $LINUX_BACKEND_MODULES`"
+AC_SUBST(LINUX_BACKEND_MODULES)
+
 dnl Enable blktap2 on Linux only.
 AC_ARG_ENABLE([blktap2],
     AS_HELP_STRING([--enable-blktap2],
tools/hotplug/Linux/Makefile +4 -10
index 4361f68..e6e7bcb 100644
@@ -35,23 +35,17 @@ UDEV_RULES_DIR = $(CONFIG_DIR)/udev
 UDEV_RULES = xen-backend.rules $(UDEV_RULES-y)
 
 .PHONY: all
-all: $(XENCOMMONS_INITD) subdirs-all
-
-$(XENCOMMONS_INITD): $(XEN_ROOT)/config/$(XEN_OS).modules $(XENCOMMONS_INITD).in
-	$(XEN_ROOT)/tools/hotplug/Linux/update-modules.sh \
-		$(XEN_ROOT) \
-		$(XEN_OS) \
-		$(XENCOMMONS_INITD) > $@
+all: subdirs-all
 
 .PHONY: build
-build: all
+build:
 
 .PHONY: install
 install: all install-initd install-scripts install-udev subdirs-install
 
 # See docs/misc/distro_mapping.txt for INITD_DIR location
 .PHONY: install-initd
-install-initd: all
+install-initd:
 	[ -d $(DESTDIR)$(INITD_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(INITD_DIR)
 	[ -d $(DESTDIR)$(SYSCONFIG_DIR) ] || $(INSTALL_DIR) $(DESTDIR)$(SYSCONFIG_DIR)
 	[ -d $(DESTDIR)$(LIBEXEC_BIN) ] || $(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
@@ -63,7 +57,7 @@ install-initd: all
 	$(INSTALL_PROG) init.d/xen-watchdog $(DESTDIR)$(INITD_DIR)
 
 .PHONY: install-scripts
-install-scripts: all
+install-scripts:
 	[ -d $(DESTDIR)$(XEN_SCRIPT_DIR) ] || \
 		$(INSTALL_DIR) $(DESTDIR)$(XEN_SCRIPT_DIR)
 	set -e; for i in $(XEN_SCRIPTS); \
tools/hotplug/Linux/init.d/xencommons.in renamed from tools/hotplug/Linux/init.d/xencommons.in.in +4 -1
similarity index 96%
rename from tools/hotplug/Linux/init.d/xencommons.in.in
rename to tools/hotplug/Linux/init.d/xencommons.in
index 590f745..10edf29 100644
@@ -19,6 +19,7 @@
 ### END INIT INFO
 
 XENSTORED=@XENSTORED@
+BACKEND_MODULES="@LINUX_BACKEND_MODULES@"
 
 . @XEN_SCRIPT_DIR@/hotplugpath.sh
 
@@ -58,8 +59,10 @@ fi
 do_start () {
         local time=0
 	local timeout=30
+	local mod
+
+	for mod in $BACKEND_MODULES ; do modprobe "$mod" &>/dev/null ; done
 
-	@LOAD_MODULES@
 	mkdir -p ${XEN_RUN_DIR}
 	mkdir -p ${XEN_LOCK_DIR}
 
tools/hotplug/Linux/systemd/Makefile +6 -28
index 90ba16e..6950d24 100644
@@ -38,31 +38,9 @@ install: $(ALL_XEN_SYSTEMD)
 	$(INSTALL_DATA) *.mount $(DESTDIR)$(XEN_SYSTEMD_DIR)
 	$(INSTALL_DATA) *.conf $(DESTDIR)$(XEN_SYSTEMD_MODULES_LOAD)
 
-$(XEN_SYSTEMD_MODULES): $(XEN_ROOT)/config/$(XEN_OS).modules
-	@set -e ;							\
-	IFS=''								;\
-	cat  $(XEN_ROOT)/config/$(XEN_OS).modules	| (		\
-		while read l ; do					\
-			if echo $${l} | egrep -q "^#" ; then		\
-				continue				;\
-			fi						;\
-			if echo "$${l}" | egrep -q "\|" ; then		\
-				m1=$${l%%|*}				;\
-				m2=$${l#*|} 				;\
-				# Systemd modules-load.d lacks support	;\
-				# for module replacement options, we	;\
-				# need to add that support upstream but ;\
-				# its best instead to ensure this file	;\
-				# is no longer needed. Some folks	;\
-				# however have reported issues with	;\
-				# some modules automatically loading	;\
-				# so we just load all necessary xen	;\
-				# modules and for replacements we load	;\
-				# the latest module			;\
-				echo "$$m1" ;\
-				echo "$$m2" ;\
-			else						\
-				echo "$$l"				;\
-			fi						;\
-		done							\
-	) > $@
+$(XEN_SYSTEMD_MODULES):
+	rm -f [email protected]
+	for mod in $(LINUX_BACKEND_MODULES) ; do \
+		echo $$mod ; \
+		done > [email protected]
+	$(call move-if-changed,[email protected],$@)
tools/hotplug/Linux/update-modules.sh deleted +0 -36
deleted file mode 100755
index 692d220..0000000
@@ -1,36 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-IFS=''
-
-XEN_ROOT=$1
-XEN_OS=$2
-XENCOMMONS_INITD=$3
-
-cat  $XEN_ROOT/config/${XEN_OS}.modules	| (
-	while read l ; do
-		if echo $l | egrep -q "^#" ; then
-			continue
-		fi
-		if echo "$l" | egrep -q "\|" ; then
-			m1=${l%%|*}
-			m2=${l#*|}
-			echo "        modprobe $m1 2>/dev/null || modprobe $m2 2>/dev/null"
-		else
-			echo "        modprobe $l 2>/dev/null"
-		fi
-	done
-) > ${XENCOMMONS_INITD}.modules
-
-cat  ${XENCOMMONS_INITD}.in	| (
-	while read l ; do
-		if echo "$l" | egrep -q "@LOAD_MODULES@" ; then
-			cat ${XENCOMMONS_INITD}.modules
-		else
-			echo $l
-		fi
-	done
-)
-
-rm -f ${XENCOMMONS_INITD}.modules
Acked-by on v4 19/28
#47 lore raw

Re: [PATCH 19/28] Add configure --with-linux-backend-modules="mod1 mod2"

Quoted 11 lines · Olaf Hering

This replaces config/Linux.modules with a configure option. As a result of this change only a single xencomons.in is required, instead of a xencomons.in.in and sed hackery.

After this change blktap2 and blktap will be loaded at the same time. This is already done in out-of-tree xencommons scripts, and systemd will load both modules as well. No harm is expected by loading both modules.

Please rerun autogen.sh after applying this patch.

#48 lore raw

PATCH v4 20/28 Put bash_completion.d below --sysconfdir=DIR

In reply to Olaf Hering
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk          | 2 --
 config/Paths.mk.in | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
Config.mk +0 -2
index 73281d8..cf7af12 100644
@@ -58,8 +58,6 @@ endif
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
-BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
-
 # arguments: variable, common path part, path to test, if yes, if no
 define setvar_dir
   ifndef $(1)
config/Paths.mk.in +1 -0
index 8755785..e1fe4a3 100644
@@ -50,6 +50,7 @@ XEN_LIB_STORED           := @XEN_LIB_STORED@
 
 CONFIG_DIR               := @CONFIG_DIR@
 INITD_DIR                := @INITD_DIR@
+BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
Acked-by on v4 20/28
#49 lore raw

Re: [PATCH 20/28] Put bash_completion.d below --sysconfdir=DIR

Quoted 1 line · Olaf Hering

Not sure the subject is 100% accurate, since it seems to just be moving the location of the definition, not changing it in any way?

Quoted 38 lines
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk          | 2 --
 config/Paths.mk.in | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)
Config.mk +0 -2
index 73281d8..cf7af12 100644
@@ -58,8 +58,6 @@ endif
 include $(XEN_ROOT)/config/$(XEN_OS).mk
 include $(XEN_ROOT)/config/$(XEN_TARGET_ARCH).mk
 
-BASH_COMPLETION_DIR ?= $(CONFIG_DIR)/bash_completion.d
-
 # arguments: variable, common path part, path to test, if yes, if no
 define setvar_dir
   ifndef $(1)
config/Paths.mk.in +1 -0
index 8755785..e1fe4a3 100644
@@ -50,6 +50,7 @@ XEN_LIB_STORED           := @XEN_LIB_STORED@
 
 CONFIG_DIR               := @CONFIG_DIR@
 INITD_DIR                := @INITD_DIR@
+BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#50 lore raw

Re: [PATCH 20/28] Put bash_completion.d below --sysconfdir=DIR

Quoted 7 lines · Ian Campbell
Quoted 1 line · Olaf Hering

Not sure the subject is 100% accurate, since it seems to just be moving the location of the definition, not changing it in any way?

You are right. I will reword this part.

Olaf

#51 lore raw

PATCH v4 21/28 Add configure --with-sysconfig-leaf-dir=SUBDIR to set CONFIG_LEAF_DIR

In reply to Olaf Hering

Set CONFIG_LEAF_DIR with configure to give control if needed. The check for the correct value if the option is not specified is tricky. Since other packages (such as grub2) started to populate also /etc/default/ a given system may have both directories. Use "default" only if /etc/sysconfig does not exist. "sysconfig" remains the default.

Move the variable from StdGNU.mk to Linux.mk because thats the only place where it is used.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                    |  3 ---
 config/Linux.mk              |  2 ++
 config/Paths.mk.in           |  1 +
 config/StdGNU.mk             |  2 --
 docs/misc/distro_mapping.txt |  4 ++--
 m4/paths.m4                  | 11 +++++++++++
 6 files changed, 16 insertions(+), 7 deletions(-)
Config.mk +0 -3
index cf7af12..dff71b3 100644
@@ -69,9 +69,6 @@ define setvar_dir
   endif
 endef
 
-# See distro_mapping.txt for other options
-$(eval $(call setvar_dir,CONFIG_LEAF_DIR,,/etc/sysconfig,sysconfig,default))
-
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
 EXTRA_LIB += $(EXTRA_PREFIX)/lib
config/Linux.mk +2 -0
index b421a1c..2a84b6b 100644
@@ -1 +1,3 @@
 include $(XEN_ROOT)/config/StdGNU.mk
+
+SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
config/Paths.mk.in +1 -0
index e1fe4a3..9fd87c5 100644
@@ -50,6 +50,7 @@ XEN_LIB_STORED           := @XEN_LIB_STORED@
 
 CONFIG_DIR               := @CONFIG_DIR@
 INITD_DIR                := @INITD_DIR@
+CONFIG_LEAF_DIR          := @CONFIG_LEAF_DIR@
 BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
config/StdGNU.mk +0 -2
index 16c3043..1566d7f 100644
@@ -27,8 +27,6 @@ INSTALL_DIR  = $(INSTALL) -d -m0755 -p
 INSTALL_DATA = $(INSTALL) -m0644 -p
 INSTALL_PROG = $(INSTALL) -m0755 -p
 
-SYSCONFIG_DIR = $(CONFIG_DIR)/$(CONFIG_LEAF_DIR)
-
 BOOT_DIR ?= /boot
 
 SOCKET_LIBS =
docs/misc/distro_mapping.txt +2 -2
index d2b1399..2e46592 100644
@@ -14,8 +14,8 @@ scripts at run-time.  If the Red Hat directory exists, it is used;
 otherwise the Debian one is used.
 
 The INITD_DIR path can be changed with configure --with-initddir=DIR.
-The CONFIG_LEAF_DIR path can be changed by setting the variables in
-the environment or your ".config" (which is included by Config.mk). 
+The CONFIG_LEAF_DIR name can be changed with configure
+--with-sysconfig-leaf-dir=SUBDIR.
 
 To add support for new distributions that don't use the above locations,
 one must grep for the above elements and add appropriate checks.
m4/paths.m4 +11 -0
index 7ca4e53..9fb4fcd 100644
@@ -51,6 +51,17 @@ AC_ARG_WITH([initddir],
          ;;
      esac])
 
+AC_ARG_WITH([sysconfig-leaf-dir],
+    AS_HELP_STRING([--with-sysconfig-leaf-dir=SUBDIR],
+    [Name of subdirectory in /etc to store runtime options for runlevel
+    scripts and daemons such as xenstoerd.
+    This should be either "sysconfig" or "default". [sysconfig]]),
+    [config_leaf_dir=$withval],
+    [config_leaf_dir=sysconfig
+    if test ! -d /etc/sysconfig ; then config_leaf_dir=default ; fi])
+CONFIG_LEAF_DIR=$config_leaf_dir
+AC_SUBST(CONFIG_LEAF_DIR)
+
 if test "$libexecdir" = '${exec_prefix}/libexec' ; then
     case "$host_os" in
          *netbsd*) ;;
Acked-by on v4 21/28
#52 lore raw

Re: [PATCH 21/28] Add configure --with-sysconfig-leaf-dir=SUBDIR to set CONFIG_LEAF_DIR

Quoted 7 lines · Olaf Hering

Set CONFIG_LEAF_DIR with configure to give control if needed. The check for the correct value if the option is not specified is tricky. Since other packages (such as grub2) started to populate also /etc/default/ a given system may have both directories. Use "default" only if /etc/sysconfig does not exist. "sysconfig" remains the default.

Quoted 6 lines

Move the variable from StdGNU.mk to Linux.mk because thats the only place where it is used.

Please rerun autogen.sh after applying this patch.

#53 lore raw

PATCH v4 22/28 Make XENFIRMWAREDIR a subdir of libexecdir

In reply to Olaf Hering

Put the firmware files below libexecdir. This is essentially just a new name for the existing path. It has the benefit that it can be configured via --libexecdir= if required.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Paths.mk.in | 2 +-
 m4/paths.m4        | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)
config/Paths.mk.in +1 -1
index 9fd87c5..50d40cc 100644
@@ -55,7 +55,7 @@ BASH_COMPLETION_DIR      := $(CONFIG_DIR)/bash_completion.d
 XEN_LOCK_DIR             := @XEN_LOCK_DIR@
 XEN_PAGING_DIR           := @XEN_PAGING_DIR@
 
-XENFIRMWAREDIR           := @XENFIRMWAREDIR@
+XENFIRMWAREDIR           := $(LIBEXEC)/boot
 
 XEN_CONFIG_DIR           := @XEN_CONFIG_DIR@
 XEN_SCRIPT_DIR           := @XEN_SCRIPT_DIR@
m4/paths.m4 +0 -3
index 9fb4fcd..d647f65 100644
@@ -99,9 +99,6 @@ case "$host_os" in
 esac
 AC_SUBST(PRIVATE_BINDIR)
 
-XENFIRMWAREDIR=$prefix/lib/xen/boot
-AC_SUBST(XENFIRMWAREDIR)
-
 CONFIG_DIR=$sysconfdir
 AC_SUBST(CONFIG_DIR)
#54 lore raw

PATCH v4 23/28 tools: remove private copies of includedir and libdir from libxenstat

In reply to Olaf Hering

They are wrong and unused.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/xenstat/libxenstat/Makefile | 4 ----
 1 file changed, 4 deletions(-)
tools/xenstat/libxenstat/Makefile +0 -4
index f64a45c..86068cb 100644
@@ -15,10 +15,6 @@
 XEN_ROOT=$(CURDIR)/../../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-prefix=$(PREFIX)
-includedir=$(prefix)/include
-libdir=$(prefix)/lib
-
 LDCONFIG=ldconfig
 MAKE_LINK=ln -sf
#55 lore raw

PATCH v4 24/28 Use Paths.mk for docs, stubdom and tools build

In reply to Olaf Hering

Paths.mk contains just directories set by configure. Source this file first when building docs,stubdom or tools. Remove unused path variables from $subsystem.mk.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Docs.mk.in    | 7 +------
 config/Paths.mk.in   | 2 ++
 config/Stubdom.mk.in | 6 ------
 config/Tools.mk.in   | 9 ++-------
 tools/Rules.mk       | 1 -
 5 files changed, 5 insertions(+), 20 deletions(-)
config/Docs.mk.in +1 -6
index 497650f..33bd529 100644
@@ -1,9 +1,4 @@
-# Prefix and install folder
-prefix              := @prefix@
-PREFIX              := $(prefix)
-exec_prefix         := @exec_prefix@
-libdir              := @libdir@
-LIBDIR              := $(libdir)
+-include $(XEN_ROOT)/config/Paths.mk
 
 # Tools
 FIG2DEV             := @FIG2DEV@
config/Paths.mk.in +2 -0
index 50d40cc..fe10f76 100644
@@ -29,6 +29,8 @@ includedir               := @includedir@
 localstatedir            := @localstatedir@
 sysconfdir               := @sysconfdir@
 
+PREFIX                   := $(prefix)
+
 SBINDIR                  := $(sbindir)
 BINDIR                   := $(bindir)
 LIBEXEC                  := $(libexecdir)/$(PACKAGE_TARNAME)
config/Stubdom.mk.in +0 -6
index c1c83bc..9098cbf 100644
@@ -1,10 +1,4 @@
-# Prefix and install folder
 -include $(XEN_ROOT)/config/Paths.mk
-prefix              := @prefix@
-PREFIX              := $(prefix)
-exec_prefix         := @exec_prefix@
-libdir              := @libdir@
-LIBDIR              := $(libdir)
 
 # Path Programs
 CMAKE               := @CMAKE@
config/Tools.mk.in +2 -7
index 23ae8b1..73b578a 100644
@@ -1,15 +1,10 @@
+-include $(XEN_ROOT)/config/Paths.mk
+
 CONFIG_RUMP         := @CONFIG_RUMP@
 ifeq ($(CONFIG_RUMP),y)
 XEN_OS              := NetBSDRump
 endif
 
-# Prefix and install folder
-prefix              := @prefix@
-PREFIX              := $(prefix)
-exec_prefix         := @exec_prefix@
-libdir              := @libdir@
-LIBDIR              := $(libdir)
-
 # A debug build of tools?
 debug               := @debug@
 
tools/Rules.mk +0 -1
index e2fdf63..87a56dc 100644
@@ -5,7 +5,6 @@ all:
 
 -include $(XEN_ROOT)/config/Tools.mk
 include $(XEN_ROOT)/Config.mk
--include $(XEN_ROOT)/config/Paths.mk
 
 export _INSTALL := $(INSTALL)
 INSTALL = $(XEN_ROOT)/tools/cross-install
#57 lore raw

PATCH v4 25/28 tools: use XEN_LIB_STORED instead of /var/lib/xenstored

In reply to Olaf Hering

Remove hardcoded /var/lib/xenstored instead of using the existing XEN_LIB_STORED variable.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 tools/configure.ac                                      | 1 +
 tools/hotplug/FreeBSD/rc.d/xencommons.in                | 2 +-
 tools/hotplug/Linux/init.d/sysconfig.xencommons.in      | 4 ++--
 tools/hotplug/Linux/init.d/xencommons.in                | 2 +-
 tools/hotplug/NetBSD/rc.d/{xencommons => xencommons.in} | 2 +-
 tools/xenstore/Makefile                                 | 3 ++-
 tools/xenstore/xs_lib.c                                 | 2 +-
 7 files changed, 9 insertions(+), 7 deletions(-)
tools/configure.ac +1 -0
index 87e14cd..4595976 100644
@@ -25,6 +25,7 @@ hotplug/Linux/vif-setup
 hotplug/Linux/xen-backend.rules
 hotplug/Linux/xen-hotplug-common.sh
 hotplug/Linux/xendomains
+hotplug/NetBSD/rc.d/xencommons
 ])
 AC_CONFIG_HEADERS([config.h])
 AC_CONFIG_AUX_DIR([../])
tools/hotplug/FreeBSD/rc.d/xencommons.in +1 -1
index c73616e..900990b 100644
@@ -37,7 +37,7 @@ xen_startcmd()
 	if test -z "$xenstored_pid"; then
 		printf "Cleaning xenstore database.\n"
 		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="/var/lib/xenstored"
+			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
 		fi
 		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
tools/hotplug/Linux/init.d/sysconfig.xencommons.in +2 -2
index 4322081..c12fc8a 100644
@@ -27,10 +27,10 @@
 #XENSTORED_TRACE=[yes|on|1]
 
 ## Type: string
-## Default: "/var/lib/xenstored"
+## Default: "@XEN_LIB_STORED@"
 #
 # Running xenstored on XENSTORED_ROOTDIR
-#XENSTORED_ROOTDIR=/var/lib/xenstored
+#XENSTORED_ROOTDIR=@XEN_LIB_STORED@
 
 ## Type: string
 ## Default: Not defined, xenbackendd debug mode off
tools/hotplug/Linux/init.d/xencommons.in +1 -1
index 10edf29..d53a1f3 100644
@@ -68,7 +68,7 @@ do_start () {
 
 	if ! `${BINDIR}/xenstore-read -s / >/dev/null 2>&1`
 	then
-		test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="/var/lib/xenstored"
+		test -z "$XENSTORED_ROOTDIR" && XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
 		rm -f "$XENSTORED_ROOTDIR"/tdb* &>/dev/null
 		test -z "$XENSTORED_TRACE" || XENSTORED_ARGS=" -T /var/log/xen/xenstored-trace.log"
 
tools/hotplug/NetBSD/rc.d/xencommons.in renamed from tools/hotplug/NetBSD/rc.d/xencommons +1 -1
similarity index 98%
rename from tools/hotplug/NetBSD/rc.d/xencommons
rename to tools/hotplug/NetBSD/rc.d/xencommons.in
index 793bede..db03f22 100644
@@ -41,7 +41,7 @@ xen_startcmd()
 	if test -z "$xenstored_pid"; then
 		printf "Cleaning xenstore database.\n"
 		if [ -z "${XENSTORED_ROOTDIR}" ]; then
-			XENSTORED_ROOTDIR="/var/lib/xenstored"
+			XENSTORED_ROOTDIR="@XEN_LIB_STORED@"
 		fi
 		rm -f ${XENSTORED_ROOTDIR}/tdb* >/dev/null 2>&1
 		printf "Starting xenservices: xenstored, xenconsoled."
tools/xenstore/Makefile +2 -1
index cff57ed..563abd4 100644
@@ -9,6 +9,7 @@ CFLAGS += -I.
 CFLAGS += -I$(XEN_ROOT)/tools/
 CFLAGS += -I./include
 CFLAGS += $(CFLAGS_libxenctrl)
+CFLAGS += -DXEN_LIB_STORED="\"$(XEN_LIB_STORED)\""
 
 CFLAGS-$(CONFIG_SYSTEMD)  += $(SYSTEMD_CFLAGS)
 LDFLAGS-$(CONFIG_SYSTEMD) += $(SYSTEMD_LIBS)
@@ -129,7 +130,7 @@ install: all
 	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)
 	$(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/xenstore-compat
 ifeq ($(XENSTORE_XENSTORED),y)
-	$(INSTALL_DIR) $(DESTDIR)/var/lib/xenstored
+	$(INSTALL_DIR) $(DESTDIR)$(XEN_LIB_STORED)
 	$(INSTALL_PROG) xenstored $(DESTDIR)$(SBINDIR)
 endif
 	$(INSTALL_PROG) xenstore-control $(DESTDIR)$(BINDIR)
tools/xenstore/xs_lib.c +1 -1
index 9a78755..d166497 100644
@@ -30,7 +30,7 @@
 const char *xs_daemon_rootdir(void)
 {
 	char *s = getenv("XENSTORED_ROOTDIR");
-	return (s ? s : "/var/lib/xenstored");
+	return (s ? s : XEN_LIB_STORED);
 }
 
 const char *xs_daemon_rundir(void)
#58 lore raw

PATCH v4 26/28 Use XEN_RUN_DIR instead of /var/run/xen

In reply to Olaf Hering

Also remove duplicate XEN_RUN_DIR from m4/paths.m4.

Please rerun autogen.sh after applying this patch.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 m4/paths.m4                                                       | 3 ---
 tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in | 2 +-
 2 files changed, 1 insertion(+), 4 deletions(-)
m4/paths.m4 +0 -3
index d647f65..0943886 100644
@@ -118,9 +118,6 @@ case "$host_os" in
 esac
 AC_SUBST(XEN_LOCK_DIR)
 
-XEN_RUN_DIR=$localstatedir/run/xen
-AC_SUBST(XEN_RUN_DIR)
-
 XEN_PAGING_DIR=$localstatedir/lib/xen/xenpaging
 AC_SUBST(XEN_PAGING_DIR)
 ])
tools/hotplug/Linux/systemd/xen-qemu-dom0-disk-backend.service.in +1 -1
index 806bcaa..d3470fc 100644
@@ -12,7 +12,7 @@ EnvironmentFile=-/etc/default/xenstored
 EnvironmentFile=-/etc/sysconfig/xenstored
 PIDFile=@XEN_RUN_DIR@/qemu-dom0.pid
 ExecStartPre=/bin/grep -q control_d /proc/xen/capabilities
-ExecStartPre=/bin/mkdir -p /var/run/xen
+ExecStartPre=/bin/mkdir -p @XEN_RUN_DIR@
 ExecStart=@LIBEXEC_BIN@/qemu-system-i386 -xen-domid 0 \
 	-xen-attach -name dom0 -nographic -M xenpv -daemonize \
 	-monitor /dev/null -serial /dev/null -parallel /dev/null \
#60 lore raw

PATCH v4 27/28 move vtpmmgr helpers from tools to stubdom

In reply to Olaf Hering

Tools.mk contains a dead CONFIG_VTPM, @vtpm@ is never expanded because @vtpm@ is only known by stubdom/configure.ac. Move the two perl scripts to stubdom/vtpmmgr and install them as executeable. This was introduced by the recent commit ffa11862aa431494e809c6e99f7358c12cb67e44 ("vtpmmgr:
add example control tools")
Also remove vtpm= from config/Stubdom.mk because vtpm= is (appearently) not used by make itself.

Cc Daniel De Graaf <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Stubdom.mk.in                         |  1 -
 config/Tools.mk.in                           |  1 -
 stubdom/vtpmmgr/Makefile                     |  5 +++++
 {tools => stubdom}/vtpmmgr/calc.pl           |  0
 {tools => stubdom}/vtpmmgr/manage-vtpmmgr.pl |  0
 tools/Makefile                               |  1 -
 tools/vtpmmgr/Makefile                       | 15 ---------------
 7 files changed, 5 insertions(+), 18 deletions(-)
config/Stubdom.mk.in +0 -1
index 9098cbf..5990fc4 100644
@@ -6,7 +6,6 @@ FETCHER             := @FETCHER@
 
 # A debug build of stubdom? //FIXME: Someone make this do something
 debug               := @debug@
-vtpm = @vtpm@
 
 STUBDOM_TARGETS     := @STUBDOM_TARGETS@
 STUBDOM_BUILD       := @STUBDOM_BUILD@
config/Tools.mk.in +0 -1
index 73b578a..5239f4e 100644
@@ -57,7 +57,6 @@ CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP1      := @blktap1@
 CONFIG_BLKTAP2      := @blktap2@
-CONFIG_VTPM         := @vtpm@
 CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@
 
 CONFIG_SYSTEMD      := @systemd@
stubdom/vtpmmgr/Makefile +5 -0
index a39a22c..c5e17c5 100644
@@ -23,6 +23,11 @@ build: $(TARGET)
 $(TARGET): $(OBJS)
 	ar -rcs $@ $^
 
+install:
+	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_PROG) calc.pl "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_PROG) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC_BIN)"
+
 clean:
 	rm -f $(TARGET) $(OBJS)
 
stubdom/vtpmmgr/calc.pl renamed from tools/vtpmmgr/calc.pl +0 -0
similarity index 100%
rename from tools/vtpmmgr/calc.pl
rename to stubdom/vtpmmgr/calc.pl
stubdom/vtpmmgr/manage-vtpmmgr.pl renamed from tools/vtpmmgr/manage-vtpmmgr.pl +0 -0
similarity index 100%
rename from tools/vtpmmgr/manage-vtpmmgr.pl
rename to stubdom/vtpmmgr/manage-vtpmmgr.pl
tools/Makefile +0 -1
index 38b4c48..4afadfd 100644
@@ -34,7 +34,6 @@ SUBDIRS-$(CONFIG_X86) += xenpaging
 SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
 SUBDIRS-$(CONFIG_TESTS) += tests
-SUBDIRS-$(CONFIG_VTPM) += vtpmmgr
 
 # These don't cross-compile
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
tools/vtpmmgr/Makefile deleted +0 -15
deleted file mode 100644
index b14c170..0000000
@@ -1,15 +0,0 @@
-XEN_ROOT=$(CURDIR)/../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-all:
-	@true
-
-install:
-	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
-	$(INSTALL_DATA) calc.pl "$(DESTDIR)$(LIBEXEC_BIN)"
-	$(INSTALL_DATA) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC_BIN)"
-
-clean:
-	@true
-
-.PHONY: all install clean
Acked-by on v4 27/28
#61 lore raw

Re: [PATCH 27/28] move vtpmmgr helpers from tools to stubdom

Quoted 5 lines · Olaf Hering

Tools.mk contains a dead CONFIG_VTPM, @vtpm@ is never expanded because @vtpm@ is only known by stubdom/configure.ac. Move the two perl scripts to stubdom/vtpmmgr and install them as executeable. This was introduced by the recent commit ffa11862aa431494e809c6e99f7358c12cb67e44 ("vtpmmgr:
add example control tools")

Not exactly recent any more ;-)

Quoted 5 lines

Also remove vtpm= from config/Stubdom.mk because vtpm= is (appearently) not used by make itself.

Cc Daniel De Graaf <[email protected]>

I'd like to see Daniels opinion though.

Quoted 95 lines
Cc Ian Jackson <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Wei Liu <[email protected]>
---
 config/Stubdom.mk.in                         |  1 -
 config/Tools.mk.in                           |  1 -
 stubdom/vtpmmgr/Makefile                     |  5 +++++
 {tools => stubdom}/vtpmmgr/calc.pl           |  0
 {tools => stubdom}/vtpmmgr/manage-vtpmmgr.pl |  0
 tools/Makefile                               |  1 -
 tools/vtpmmgr/Makefile                       | 15 ---------------
 7 files changed, 5 insertions(+), 18 deletions(-)
config/Stubdom.mk.in +0 -1
index 9098cbf..5990fc4 100644
@@ -6,7 +6,6 @@ FETCHER             := @FETCHER@
 
 # A debug build of stubdom? //FIXME: Someone make this do something
 debug               := @debug@
-vtpm = @vtpm@
 
 STUBDOM_TARGETS     := @STUBDOM_TARGETS@
 STUBDOM_BUILD       := @STUBDOM_BUILD@
config/Tools.mk.in +0 -1
index 73b578a..5239f4e 100644
@@ -57,7 +57,6 @@ CONFIG_QEMU_TRAD    := @qemu_traditional@
 CONFIG_QEMU_XEN     := @qemu_xen@
 CONFIG_BLKTAP1      := @blktap1@
 CONFIG_BLKTAP2      := @blktap2@
-CONFIG_VTPM         := @vtpm@
 CONFIG_QEMUU_EXTRA_ARGS:= @EXTRA_QEMUU_CONFIGURE_ARGS@
 
 CONFIG_SYSTEMD      := @systemd@
stubdom/vtpmmgr/Makefile +5 -0
index a39a22c..c5e17c5 100644
@@ -23,6 +23,11 @@ build: $(TARGET)
 $(TARGET): $(OBJS)
 	ar -rcs $@ $^
 
+install:
+	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_PROG) calc.pl "$(DESTDIR)$(LIBEXEC_BIN)"
+	$(INSTALL_PROG) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC_BIN)"
+
 clean:
 	rm -f $(TARGET) $(OBJS)
 
stubdom/vtpmmgr/calc.pl renamed from tools/vtpmmgr/calc.pl +0 -0
similarity index 100%
rename from tools/vtpmmgr/calc.pl
rename to stubdom/vtpmmgr/calc.pl
stubdom/vtpmmgr/manage-vtpmmgr.pl renamed from tools/vtpmmgr/manage-vtpmmgr.pl +0 -0
similarity index 100%
rename from tools/vtpmmgr/manage-vtpmmgr.pl
rename to stubdom/vtpmmgr/manage-vtpmmgr.pl
tools/Makefile +0 -1
index 38b4c48..4afadfd 100644
@@ -34,7 +34,6 @@ SUBDIRS-$(CONFIG_X86) += xenpaging
 SUBDIRS-$(CONFIG_X86) += debugger/gdbsx
 SUBDIRS-$(CONFIG_X86) += debugger/kdd
 SUBDIRS-$(CONFIG_TESTS) += tests
-SUBDIRS-$(CONFIG_VTPM) += vtpmmgr
 
 # These don't cross-compile
 ifeq ($(XEN_COMPILE_ARCH),$(XEN_TARGET_ARCH))
tools/vtpmmgr/Makefile deleted +0 -15
deleted file mode 100644
index b14c170..0000000
@@ -1,15 +0,0 @@
-XEN_ROOT=$(CURDIR)/../..
-include $(XEN_ROOT)/tools/Rules.mk
-
-all:
-	@true
-
-install:
-	$(INSTALL_DIR) "$(DESTDIR)$(LIBEXEC_BIN)"
-	$(INSTALL_DATA) calc.pl "$(DESTDIR)$(LIBEXEC_BIN)"
-	$(INSTALL_DATA) manage-vtpmmgr.pl "$(DESTDIR)$(LIBEXEC_BIN)"
-
-clean:
-	@true
-
-.PHONY: all install clean
#62 lore raw

PATCH v4 28/28 Separate runtime debug output from debug symbols

In reply to Olaf Hering

With this change debug and debug_symbols is used consistently. With 'make debug=yn debug_symbols=yn' my rebuild time and diskspace usage goes down:
105275K clean xen.git checkout.
y 1247041K build time: 5:57
n 812112K build time: 5:34

Two variables exist to control runtime and compiletime debug info:
debug= for tools,stubdom,docs selects either -O1 or -O2 builds, and passes the flag down to qemu-upstream to enable additional runtime debugging.
debug= for xen enables some asserts and extra checks in the code. debug_symbols= is used in few places to pass -g to gcc. Other places still pass -g unconditionally to gcc.

Wrap all -g assigments to CFLAGS into debug_symbols==y. Pass --enable-debug-info --disable-strip to qemu-upstream build.

Remove the --enable-debug configure option. Its now controlled by calling make with debug=yn and/or debug_symbols=yn for xen, tools and stubdom builds.

No change in behaviour is expected by that patch for tools and xen. For stubdom CFLAGS change from -O1 to O2 with debug=n.

Please rerun autogen.sh after applying this patch.

Cc David Scott <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                         | 5 ++++-
 config/Stubdom.mk.in              | 3 ---
 config/Tools.mk.in                | 3 ---
 stubdom/Makefile                  | 1 -
 stubdom/configure.ac              | 1 -
 tools/Makefile                    | 7 +++++++
 tools/configure.ac                | 1 -
 tools/ocaml/common.make           | 5 ++++-
 tools/tests/vhpet/Makefile        | 2 +-
 tools/tests/x86_emulator/Makefile | 4 ++--
 xen/Rules.mk                      | 5 ++++-
 xen/arch/x86/Makefile             | 2 +-
 12 files changed, 23 insertions(+), 16 deletions(-)
Config.mk +4 -1
index dff71b3..7781dd5 100644
@@ -16,7 +16,7 @@ or       = $(if $(strip $(1)),$(1),$(if $(strip $(2)),$(2),$(if $(strip $(3)),$(
 
 -include $(XEN_ROOT)/.config
 
-# A debug build of Xen and tools?
+# A debug build of Xen?
 debug ?= y
 debug_symbols ?= $(debug)
 
@@ -39,6 +39,9 @@ SHELL     ?= /bin/sh
 HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
+ifeq ($(debug_symbols),y)
+HOSTCFLAGS += -g
+endif
 
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
config/Stubdom.mk.in +0 -3
index 5990fc4..65c7b23 100644
@@ -4,9 +4,6 @@
 CMAKE               := @CMAKE@
 FETCHER             := @FETCHER@
 
-# A debug build of stubdom? //FIXME: Someone make this do something
-debug               := @debug@
-
 STUBDOM_TARGETS     := @STUBDOM_TARGETS@
 STUBDOM_BUILD       := @STUBDOM_BUILD@
 STUBDOM_INSTALL     := @STUBDOM_INSTALL@
config/Tools.mk.in +0 -3
index 5239f4e..762d047 100644
@@ -5,9 +5,6 @@ ifeq ($(CONFIG_RUMP),y)
 XEN_OS              := NetBSDRump
 endif
 
-# A debug build of tools?
-debug               := @debug@
-
 # Tools path
 BISON               := @BISON@
 FLEX                := @FLEX@
stubdom/Makefile +0 -1
index 9dac103..e3eb502 100644
@@ -4,7 +4,6 @@ MINI_OS = $(XEN_ROOT)/extras/mini-os
 export XEN_OS=MiniOS
 
 export stubdom=y
-export debug=y
 include $(XEN_ROOT)/Config.mk
 -include $(XEN_ROOT)/config/Stubdom.mk
 
stubdom/configure.ac +0 -1
index 6468203..0caa3bf 100644
@@ -45,7 +45,6 @@ AS_IF([test "x$ioemu$qemu_traditional" = "xyn"], [
     AC_MSG_ERROR(IOEMU stubdomain requires qemu-traditional)
 ])
 
-AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of stubdom])
 AX_ARG_DEFAULT_ENABLE([extfiles], [Use xen extfiles repository for libraries])
 
 AC_ARG_VAR([CMAKE], [Path to the cmake program])
tools/Makefile +7 -0
index 4afadfd..9ae1ab1 100644
@@ -189,6 +189,12 @@ else
 QEMU_XEN_ENABLE_DEBUG :=
 endif
 
+ifeq ($(debug_symbols),y)
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --enable-debug-info --disable-strip
+else
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --disable-debug-info
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_LOC) ; then \
 		source=$(QEMU_UPSTREAM_LOC); \
@@ -198,6 +204,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		$(QEMU_XEN_ENABLE_DEBUG) \
+		$(QEMU_XEN_ENABLE_DEBUG_SYMBOLS) \
 		--prefix=$(LIBEXEC) \
 		--libdir=$(LIBEXEC_LIB) \
 		--includedir=$(LIBEXEC_INC) \
tools/configure.ac +0 -1
index 4595976..1cdd7d0 100644
@@ -88,7 +88,6 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
-AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
 AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
 
 AC_ARG_WITH([linux-backend-modules],
tools/ocaml/common.make +4 -1
index d5478f6..33b3142 100644
@@ -13,7 +13,10 @@ CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
-OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
+ifeq ($(debug_symbols),y)
+OCAMLCFLAGS += -g
+endif
+OCAMLCFLAGS += $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
 
tools/tests/vhpet/Makefile +1 -1
index 763409d..e4f5c14 100644
@@ -20,7 +20,7 @@ run: $(TARGET)
 	./$(TARGET) 200 1 0 20 0x0103 > $(TARGET).200.1.0.20.0x0103.out
 
 $(TARGET): hpet.c main.c hpet.h emul.h Makefile
-	$(HOSTCC) -g -o $@ hpet.c main.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ hpet.c main.c
 
 .PHONY: clean
 clean:
tools/tests/x86_emulator/Makefile +2 -2
index 73517b7..edfd832 100644
@@ -43,7 +43,7 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
 HOSTCFLAGS += $(CFLAGS_xeninclude)
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
 
 test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate/x86_emulate.h
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
xen/Rules.mk +4 -1
index e2f9e36..a8bbd8e 100644
@@ -43,7 +43,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE
xen/arch/x86/Makefile +1 -1
index c1e244d..b994bfa 100644
@@ -163,7 +163,7 @@ boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
 efi/mkreloc: efi/mkreloc.c
-	$(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
 .PHONY: clean
 clean::
#63 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 49

Quoted 11 lines · Olaf Hering
xen/Rules.mk +4 -1
@@ -43,7 +43,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h

I am not sure this is correct. Xen needs to embed its full symbol table for backtraces, so does need to be built unconditionally with -g

~Andrew

#64 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 6 lines
Quoted 1 line
Quoted 1 line · On 25.09.14 at 17:41, <[email protected]> wrote:
Quoted 4 lines · Olaf Hering
xen/Rules.mk +0 -0
@@ -43,7 +43,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
Quoted 10 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 49

Quoted 7 lines
xen/Rules.mk +4 -1
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h

I am not sure this is correct. Xen needs to embed its full symbol table for backtraces, so does need to be built unconditionally with -g

What does -g have to do with backtrace generation? If you're after .debug_frame, that can be had as .eh_frame without -g (and with -fasynchronous-unwind-tables passed instead). Yet whether everyone wants this is not at all clear, so providing a knob to turn it on/off seems quite desirable to me.

Jan

#65 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

In reply to Andrew Cooper
Quoted 5 lines · Andrew Cooper
Quoted 4 lines · Olaf Hering
xen/Rules.mk +0 -0
@@ -43,7 +43,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
Quoted 10 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 49

Quoted 7 lines
xen/Rules.mk +4 -1
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h

I am not sure this is correct. Xen needs to embed its full symbol table for backtraces, so does need to be built unconditionally with -g

Ok, please discard this patch.

After thinking about the approach some more I'm not sure if configure for tools/stubdom and env vars for xen will work at the same time. I will find out.

Olaf

#66 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

In reply to Olaf Hering
Quoted 16 lines
Quoted 1 line
Quoted 1 line · On 25.09.14 at 17:20, <[email protected]> wrote:

With this change debug and debug_symbols is used consistently. With 'make debug=yn debug_symbols=yn' my rebuild time and diskspace usage goes down:

   105275K clean xen.git checkout.

y 1247041K build time: 5:57
n 812112K build time: 5:34

Two variables exist to control runtime and compiletime debug info:
debug= for tools,stubdom,docs selects either -O1 or -O2 builds, and passes the flag down to qemu-upstream to enable additional runtime debugging.
debug= for xen enables some asserts and extra checks in the code. debug_symbols= is used in few places to pass -g to gcc. Other places still pass -g unconditionally to gcc.

Quoted 6 lines

Wrap all -g assigments to CFLAGS into debug_symbols==y. Pass --enable-debug-info --disable-strip to qemu-upstream build.

Remove the --enable-debug configure option. Its now controlled by calling make with debug=yn and/or debug_symbols=yn for xen, tools and stubdom builds.

I'm having mixed feelings with this: On one hand it's nice to control this on the command line. Otoh, since you don't force a full rebuild when the setting changes between (incremental) builds, I'm not certain a proper binary will result (or the build even succeed). Yes, that's already a problem for the hypervisor build without this patch (and I think such settings should only be passed through .config, which should never be changed after an initial build), but extending this doesn't necessarily seem like the right route.

Jan

#67 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 8 lines · Jan Beulich

I'm having mixed feelings with this: On one hand it's nice to control this on the command line. Otoh, since you don't force a full rebuild when the setting changes between (incremental) builds, I'm not certain a proper binary will result (or the build even succeed). Yes, that's already a problem for the hypervisor build without this patch (and I think such settings should only be passed through .config, which should never be changed after an initial build), but extending this doesn't necessarily seem like the right route.

After spending some more time on this it looks my change regarding tools and stubdom can be done in a different way. Initially I was thinking that "var ?= val" will override "var := val", but its exactly the opposite.

So for xen builds the patch will not change much except that it separates runtime debug from debug symbols. For the tools+stubdom side I suggest to have to knobs: --enable-debug for runtime debug like it is done today, and a new --enable-debug-info or --enable-debug_symbols which controls just the "-g" flag.

Any objections to that approach?

Regarding the rebuild if the compile environment changes: I'm in favour of that. Just recently I upgraded from SLE11 to SLE12 and I had to cleanup first before running make again. Maybe there is a way that everything depends on some header (or knob) which contains CFLAGS, LDFLAGS, the toolchain path and other build related things. If some of that changes, force a rebuild.

Olaf

#68 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 5 lines · Olaf Hering

So for xen builds the patch will not change much except that it separates runtime debug from debug symbols. For the tools+stubdom side I suggest to have to knobs: --enable-debug for runtime debug like it is done today, and a new --enable-debug-info or --enable-debug_symbols which controls just the "-g" flag.

But I wonder how all that is supposed to work anyway for tools and xen? If I do "configure --disable-debug --disable-debug-info && make rpmball" xen still is built with debug=y. And to change that I have to use 'make rpmball debug=n' which affects also tools build.

Olaf

#69 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 10:54, <[email protected]> wrote:
Quoted 5 lines · Olaf Hering

So for xen builds the patch will not change much except that it separates runtime debug from debug symbols. For the tools+stubdom side I suggest to have to knobs: --enable-debug for runtime debug like it is done today, and a new --enable-debug-info or --enable-debug_symbols which controls just the "-g" flag.

Quoted 4 lines

But I wonder how all that is supposed to work anyway for tools and xen? If I do "configure --disable-debug --disable-debug-info && make rpmball" xen still is built with debug=y. And to change that I have to use 'make rpmball debug=n' which affects also tools build.

With the hypervisor part of the build intentionally not being controlled by the configure mechanism, I don't see how this can be properly separated using the same command line override mechanism to control both kinds of build sub-components.

Jan

#70 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 9 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 10:54, <[email protected]> wrote:

But I wonder how all that is supposed to work anyway for tools and xen? If I do "configure --disable-debug --disable-debug-info && make rpmball" xen still is built with debug=y. And to change that I have to use 'make rpmball debug=n' which affects also tools build.

With the hypervisor part of the build intentionally not being controlled by the configure mechanism, I don't see how this can be properly separated using the same command line override mechanism to control both kinds of build sub-components.

I think the bug is that everything uses debug=N.
Perhaps that variable should be controlled by the subsystems? Like 'make debug_$subsys=N rpmbuild' which sets debug=N before the 'include $(XEN_ROOT)/Config.mk'. Then configure --enable-debug will set debug_$subsys in config/$subsys.mk which in turn sets debug=.

Olaf

#71 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

Quoted 8 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 11:22, <[email protected]> wrote:
Quoted 5 lines · Jan Beulich
Quoted 5 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 10:54, <[email protected]> wrote:

But I wonder how all that is supposed to work anyway for tools and xen? If I do "configure --disable-debug --disable-debug-info && make rpmball" xen still is built with debug=y. And to change that I have to use 'make rpmball debug=n' which affects also tools build.

Quoted 7 lines
Quoted 4 lines

With the hypervisor part of the build intentionally not being controlled by the configure mechanism, I don't see how this can be properly separated using the same command line override mechanism to control both kinds of build sub-components.

I think the bug is that everything uses debug=N. Perhaps that variable should be controlled by the subsystems?

Yes, I think so (except that I don't like underscores in variables like this and would prefer dashes, but that's surely a personal taste thing).

Jan

#72 lore raw

Re: [PATCH 28/28] Separate runtime debug output from debug symbols

In reply to Olaf Hering
Quoted 17 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 10:17, <[email protected]> wrote:
Quoted 8 lines · Jan Beulich

I'm having mixed feelings with this: On one hand it's nice to control this on the command line. Otoh, since you don't force a full rebuild when the setting changes between (incremental) builds, I'm not certain a proper binary will result (or the build even succeed). Yes, that's already a problem for the hypervisor build without this patch (and I think such settings should only be passed through .config, which should never be changed after an initial build), but extending this doesn't necessarily seem like the right route.

After spending some more time on this it looks my change regarding tools and stubdom can be done in a different way. Initially I was thinking that "var ?= val" will override "var := val", but its exactly the opposite.

Quoted 7 lines

So for xen builds the patch will not change much except that it separates runtime debug from debug symbols. For the tools+stubdom side I suggest to have to knobs: --enable-debug for runtime debug like it is done today, and a new --enable-debug-info or --enable-debug_symbols which controls just the "-g" flag.

Any objections to that approach?

Sounds reasonable.

Quoted 6 lines

Regarding the rebuild if the compile environment changes: I'm in favour of that. Just recently I upgraded from SLE11 to SLE12 and I had to cleanup first before running make again. Maybe there is a way that everything depends on some header (or knob) which contains CFLAGS, LDFLAGS, the toolchain path and other build related things. If some of that changes, force a rebuild.

We could certain borrow some of Linux'es build machinery for this, but iirc even they don't go as far as rebuilding when tool chain component versions change (and unless there are bugs in the tool chain I also don't think that's necessary).

Jan

#73 lore raw

PATCH v2 28/28 Separate runtime debug output from debug symbols

In reply to Olaf Hering

With this change debug and debug_symbols is used consistently. With 'make debug=yn debug_symbols=yn' my rebuild time and diskspace usage goes down:
105275K clean xen.git checkout.
y 1247041K build time: 5:57
n 812112K build time: 5:34

Add make variable debug_(stubdom|tools|xen)= to control debug= for runtime debug. Add make variable debuginfo_(stubdom|tools|xen)= to control debug_symbols= for gcc -g. Add configure --enable-debuginfo to set debuginf_(stubdom|tools) once at configure time. The existing --enable-debug will set debug_(stubdom|tools) once at configure time.

Currently two variables control runtime and compiletime debug info:
debug= for tools,stubdom selects either -O1 or -O2 builds, and passes the flag down to qemu-upstream to enable additional runtime debugging. debug= for xen enables some asserts and extra checks in the code. debug_symbols= is used in few places to pass -g to gcc. Other places still pass -g unconditionally to gcc.

Wrap all -g assigments to CFLAGS into debug_symbols==y. Pass --enable-debug-info --disable-strip to qemu-upstream build.

No change in behaviour is expected by that patch for tools and xen. For stubdom CFLAGS change from -O1 to O2 with debug=n.
It is still possible to use 'make debug=N debug_symbols=N'. But with this patch it is now possible to do 'configure --disable-debug --enable-debuginfo && make rpmbuild debug_xen=n'.

Please rerun autogen.sh after applying this patch.

Cc David Scott <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>
---
 Config.mk                         | 3 +++
 config/Stubdom.mk.in              | 8 +++++---
 config/Tools.mk.in                | 8 +++++---
 stubdom/Makefile                  | 3 +--
 stubdom/configure.ac              | 3 ++-
 tools/Makefile                    | 7 +++++++
 tools/configure.ac                | 3 ++-
 tools/ocaml/common.make           | 5 ++++-
 tools/tests/vhpet/Makefile        | 2 +-
 tools/tests/x86_emulator/Makefile | 4 ++--
 xen/Rules.mk                      | 9 ++++++++-
 xen/arch/x86/Makefile             | 2 +-
 12 files changed, 41 insertions(+), 16 deletions(-)
Config.mk +3 -0
index dff71b3..8a65adf 100644
@@ -39,6 +39,9 @@ SHELL     ?= /bin/sh
 HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
+ifeq ($(debug_symbols),y)
+HOSTCFLAGS += -g
+endif
 
 DISTDIR     ?= $(XEN_ROOT)/dist
 DESTDIR     ?= /
config/Stubdom.mk.in +5 -3
index 5990fc4..0576a2c 100644
@@ -1,12 +1,14 @@
 -include $(XEN_ROOT)/config/Paths.mk
 
+debug_stubdom       := @debug@
+debuginfo_stubdom   := @debuginfo@
+debug               := $(debug_stubdom)
+debug_symbols       := $(debuginfo_stubdom)
+
 # Path Programs
 CMAKE               := @CMAKE@
 FETCHER             := @FETCHER@
 
-# A debug build of stubdom? //FIXME: Someone make this do something
-debug               := @debug@
-
 STUBDOM_TARGETS     := @STUBDOM_TARGETS@
 STUBDOM_BUILD       := @STUBDOM_BUILD@
 STUBDOM_INSTALL     := @STUBDOM_INSTALL@
config/Tools.mk.in +5 -3
index 5239f4e..ab7598c 100644
@@ -1,13 +1,15 @@
 -include $(XEN_ROOT)/config/Paths.mk
 
+debug_tools         := @debug@
+debuginfo_tools     := @debuginfo@
+debug               := $(debug_tools)
+debug_symbols       := $(debuginfo_tools)
+
 CONFIG_RUMP         := @CONFIG_RUMP@
 ifeq ($(CONFIG_RUMP),y)
 XEN_OS              := NetBSDRump
 endif
 
-# A debug build of tools?
-debug               := @debug@
-
 # Tools path
 BISON               := @BISON@
 FLEX                := @FLEX@
stubdom/Makefile +1 -2
index 9dac103..60dc0b8 100644
@@ -4,9 +4,8 @@ MINI_OS = $(XEN_ROOT)/extras/mini-os
 export XEN_OS=MiniOS
 
 export stubdom=y
-export debug=y
-include $(XEN_ROOT)/Config.mk
 -include $(XEN_ROOT)/config/Stubdom.mk
+include $(XEN_ROOT)/Config.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
 ifeq ($(XEN_TARGET_ARCH),x86_32)
stubdom/configure.ac +2 -1
index 6468203..f2c9dfd 100644
@@ -45,7 +45,8 @@ AS_IF([test "x$ioemu$qemu_traditional" = "xyn"], [
     AC_MSG_ERROR(IOEMU stubdomain requires qemu-traditional)
 ])
 
-AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of stubdom])
+AX_ARG_DEFAULT_ENABLE([debug], [Disable runtime debug of stubdom])
+AX_ARG_DEFAULT_ENABLE([debuginfo], [Disable creation of debuginfo symbols during build of stubdom])
 AX_ARG_DEFAULT_ENABLE([extfiles], [Use xen extfiles repository for libraries])
 
 AC_ARG_VAR([CMAKE], [Path to the cmake program])
tools/Makefile +7 -0
index 4afadfd..9ae1ab1 100644
@@ -189,6 +189,12 @@ else
 QEMU_XEN_ENABLE_DEBUG :=
 endif
 
+ifeq ($(debug_symbols),y)
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --enable-debug-info --disable-strip
+else
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --disable-debug-info
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_LOC) ; then \
 		source=$(QEMU_UPSTREAM_LOC); \
@@ -198,6 +204,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		$(QEMU_XEN_ENABLE_DEBUG) \
+		$(QEMU_XEN_ENABLE_DEBUG_SYMBOLS) \
 		--prefix=$(LIBEXEC) \
 		--libdir=$(LIBEXEC_LIB) \
 		--includedir=$(LIBEXEC_INC) \
tools/configure.ac +2 -1
index 4595976..f896bbb 100644
@@ -88,7 +88,8 @@ AX_ARG_DEFAULT_ENABLE([ocamltools], [Disable Ocaml tools])
 AX_ARG_DEFAULT_ENABLE([xsmpolicy], [Disable XSM policy compilation])
 AX_ARG_DEFAULT_DISABLE([ovmf], [Enable OVMF])
 AX_ARG_DEFAULT_ENABLE([seabios], [Disable SeaBIOS])
-AX_ARG_DEFAULT_ENABLE([debug], [Disable debug build of tools])
+AX_ARG_DEFAULT_ENABLE([debug], [Disable runtime debug of tools])
+AX_ARG_DEFAULT_ENABLE([debuginfo], [Disable creation of debuginfo symbols during build of tools])
 AX_ARG_DEFAULT_DISABLE([blktap1], [Enable blktap1 tools])
 
 AC_ARG_WITH([linux-backend-modules],
tools/ocaml/common.make +4 -1
index d5478f6..33b3142 100644
@@ -13,7 +13,10 @@ CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
-OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
+ifeq ($(debug_symbols),y)
+OCAMLCFLAGS += -g
+endif
+OCAMLCFLAGS += $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
 
tools/tests/vhpet/Makefile +1 -1
index 763409d..e4f5c14 100644
@@ -20,7 +20,7 @@ run: $(TARGET)
 	./$(TARGET) 200 1 0 20 0x0103 > $(TARGET).200.1.0.20.0x0103.out
 
 $(TARGET): hpet.c main.c hpet.h emul.h Makefile
-	$(HOSTCC) -g -o $@ hpet.c main.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ hpet.c main.c
 
 .PHONY: clean
 clean:
tools/tests/x86_emulator/Makefile +2 -2
index 73517b7..edfd832 100644
@@ -43,7 +43,7 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
 HOSTCFLAGS += $(CFLAGS_xeninclude)
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
 
 test_x86_emulator.o: test_x86_emulator.c blowfish.h x86_emulate/x86_emulate.h
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
xen/Rules.mk +8 -1
index e2f9e36..442ffaa 100644
@@ -10,6 +10,10 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+debug_xen     ?= y
+debuginfo_xen ?= y
+debug         := $(debug_xen)
+debug_symbols := $(debuginfo_xen)
 
 include $(XEN_ROOT)/Config.mk
 
@@ -43,7 +47,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE
xen/arch/x86/Makefile +1 -1
index c1e244d..b994bfa 100644
@@ -163,7 +163,7 @@ boot/mkelf32: boot/mkelf32.c
 	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
 efi/mkreloc: efi/mkreloc.c
-	$(HOSTCC) $(HOSTCFLAGS) -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ $<
 
 .PHONY: clean
 clean::
#74 lore raw

Re: [PATCH 28/28 v2] Separate runtime debug output from debug symbols

Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 13:40, <[email protected]> wrote:
tools/tests/vhpet/Makefile +1 -1
@@ -20,7 +20,7 @@ run: $(TARGET)
 	./$(TARGET) 200 1 0 20 0x0103 > $(TARGET).200.1.0.20.0x0103.out
 
 $(TARGET): hpet.c main.c hpet.h emul.h Makefile
-	$(HOSTCC) -g -o $@ hpet.c main.c
+	$(HOSTCC) $(HOSTCFLAGS) -o $@ hpet.c main.c
 
 .PHONY: clean
 clean:
tools/tests/x86_emulator/Makefile +0 -0
@@ -43,7 +43,7 @@ x86_emulate/x86_emulate.c x86_emulate/x86_emulate.h:
 HOSTCFLAGS += $(CFLAGS_xeninclude)
 
 x86_emulate.o: x86_emulate.c x86_emulate/x86_emulate.c 

x86_emulate/x86_emulate.h

tools/tests/x86_emulator/Makefile +1 -1
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<
 
 test_x86_emulator.o: test_x86_emulator.c blowfish.h 

x86_emulate/x86_emulate.h

tools/tests/x86_emulator/Makefile

Quoted 2 lines
tools/tests/x86_emulator/Makefile +1 -1
-	$(HOSTCC) $(HOSTCFLAGS) -c -g -o $@ $<
+	$(HOSTCC) $(HOSTCFLAGS) -c -o $@ $<

I question this for all three instances above: These are purely testing tools which don't even get built by default. There's nothing wrong with them always being built with debug info, allowing to immediately run them usefully in a debugger without consideration of build mode.

xen/Rules.mk lock_profile ?= n · line 16

Quoted 10 lines
xen/Rules.mk +4 -0
@@ -10,6 +10,10 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+debug_xen     ?= y
+debuginfo_xen ?= y
+debug         := $(debug_xen)
+debug_symbols := $(debuginfo_xen)

I'm not sure I want to see this do away with the old mechanism altogether - various of my testing build flavors depend on overriding the "debug" variable, and I wouldn't want to change all their .config files. At least for a certain period of time the latter two should probably continue to use ?=.

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 56

Quoted 12 lines
xen/Rules.mk +4 -1
@@ -43,7 +47,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE

The context here shows that CFLAGS-y gets used elsewhere, so please do so too above. And if possible this should be considered elsewhere too.

In any event I don't see this change as important enough to warrant overriding the feature freeze.

Jan

#75 lore raw

Re: [PATCH 28/28 v2] Separate runtime debug output from debug symbols

Quoted 17 lines · Jan Beulich

xen/Rules.mk lock_profile ?= n · line 16

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 13:40, <[email protected]> wrote:
xen/Rules.mk +4 -0
@@ -10,6 +10,10 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+debug_xen     ?= y
+debuginfo_xen ?= y
+debug         := $(debug_xen)
+debug_symbols := $(debuginfo_xen)

I'm not sure I want to see this do away with the old mechanism altogether - various of my testing build flavors depend on overriding the "debug" variable, and I wouldn't want to change all their .config files. At least for a certain period of time the latter two should probably continue to use ?=.

I think .config will continue to work with a "debug := y" and also 'make debug=y'.

Quoted 11 lines
Quoted 11 lines
xen/Rules.mk +4 -1
@@ -43,7 +47,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
Quoted 5 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 56

Quoted 1 line
xen/Rules.mk +0 -0
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE

The context here shows that CFLAGS-y gets used elsewhere, so please do so too above. And if possible this should be considered elsewhere too.

I'm not sure what you mean? The hunk just makes "-g" conditional.

Quoted 2 lines

In any event I don't see this change as important enough to warrant overriding the feature freeze.

Regarding feature freeze, that small version below for 'make debug=yn debug_symbols=yn' will work for me as well.

Olaf

Separate runtime debug output from debug symbols

With this change debug and debug_symbols is used consistently. With 'make debug=yn debug_symbols=yn' my rebuild time and diskspace usage goes down:
105275K clean xen.git checkout.
y 1247041K build time: 5:57
n 812112K build time: 5:34

No change in behaviour is expected by that patch for tools and xen. For stubdom CFLAGS change from -O1 to O2 with debug=n.

Cc David Scott <[email protected]>
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Jan Beulich <[email protected]>
Cc Keir Fraser <[email protected]>
Cc Samuel Thibault <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Tim Deegan <[email protected]>
Cc Wei Liu <[email protected]>
stubdom/Makefile +1 -2
index 9dac103..60dc0b8 100644
@@ -4,9 +4,8 @@ MINI_OS = $(XEN_ROOT)/extras/mini-os
 export XEN_OS=MiniOS
 
 export stubdom=y
-export debug=y
-include $(XEN_ROOT)/Config.mk
 -include $(XEN_ROOT)/config/Stubdom.mk
+include $(XEN_ROOT)/Config.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
 ifeq ($(XEN_TARGET_ARCH),x86_32)
tools/Makefile +7 -0
index 4afadfd..9ae1ab1 100644
@@ -189,6 +189,12 @@ else
 QEMU_XEN_ENABLE_DEBUG :=
 endif
 
+ifeq ($(debug_symbols),y)
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --enable-debug-info --disable-strip
+else
+QEMU_XEN_ENABLE_DEBUG_SYMBOLS := --disable-debug-info
+endif
+
 subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	if test -d $(QEMU_UPSTREAM_LOC) ; then \
 		source=$(QEMU_UPSTREAM_LOC); \
@@ -198,6 +204,7 @@ subdir-all-qemu-xen-dir: qemu-xen-dir-find
 	cd qemu-xen-dir; \
 	$$source/configure --enable-xen --target-list=i386-softmmu \
 		$(QEMU_XEN_ENABLE_DEBUG) \
+		$(QEMU_XEN_ENABLE_DEBUG_SYMBOLS) \
 		--prefix=$(LIBEXEC) \
 		--libdir=$(LIBEXEC_LIB) \
 		--includedir=$(LIBEXEC_INC) \
tools/ocaml/common.make +4 -1
index d5478f6..33b3142 100644
@@ -13,7 +13,10 @@ CFLAGS += -fPIC -Werror -I$(shell ocamlc -where)
 
 OCAMLOPTFLAG_G := $(shell $(OCAMLOPT) -h 2>&1 | sed -n 's/^  *\(-g\) .*/\1/p')
 OCAMLOPTFLAGS = $(OCAMLOPTFLAG_G) -ccopt "$(LDFLAGS)" -dtypes $(OCAMLINCLUDE) -cc $(CC) -w F -warn-error F
-OCAMLCFLAGS += -g $(OCAMLINCLUDE) -w F -warn-error F
+ifeq ($(debug_symbols),y)
+OCAMLCFLAGS += -g
+endif
+OCAMLCFLAGS += $(OCAMLINCLUDE) -w F -warn-error F
 
 VERSION := 4.1
 
xen/Rules.mk +2 -1
index e2f9e36..a8bbd8e 100644
@@ -43,7 +43,8 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+CFLAGS-$(debug_symbols) += -g
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE
#76 lore raw

Re: [PATCH 28/28 v2] Separate runtime debug output from debug symbols

Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 16:02, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich

xen/Rules.mk lock_profile ?= n · line 16

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 13:40, <[email protected]> wrote:
xen/Rules.mk +4 -0
@@ -10,6 +10,10 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+debug_xen     ?= y
+debuginfo_xen ?= y
+debug         := $(debug_xen)
+debug_symbols := $(debuginfo_xen)

I'm not sure I want to see this do away with the old mechanism altogether - various of my testing build flavors depend on overriding the "debug" variable, and I wouldn't want to change all their .config files. At least for a certain period of time the latter two should probably continue to use ?=.

Quoted 2 lines

I think .config will continue to work with a "debug := y" and also 'make debug=y'.

Ah, right, you do this before the inclusion point of Config.mk.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
xen/Rules.mk +4 -1
@@ -43,7 +47,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
Quoted 7 lines
Quoted 5 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 50

Quoted 1 line
xen/Rules.mk +0 -0
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE

The context here shows that CFLAGS-y gets used elsewhere, so please do so too above. And if possible this should be considered elsewhere too.

I'm not sure what you mean? The hunk just makes "-g" conditional.

Looks like you nevertheless understood, as your shrunk down patch does what I was asking for here (quoted below).

Quoted 5 lines
Quoted 2 lines

In any event I don't see this change as important enough to warrant overriding the feature freeze.

Regarding feature freeze, that small version below for 'make debug=yn debug_symbols=yn' will work for me as well.

This indeed seems more acceptable at this point. But the final say would be with Konrad anyway.

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 46

Quoted 8 lines
xen/Rules.mk +1 -1
@@ -43,7 +43,8 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+CFLAGS-$(debug_symbols) += -g

(This one.)

Jan

#77 lore raw

Re: [PATCH 28/28 v2] Separate runtime debug output from debug symbols

Quoted 48 lines · Jan Beulich
Quoted 21 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 16:02, <[email protected]> wrote:
Quoted 17 lines · Jan Beulich

xen/Rules.mk lock_profile ?= n · line 16

Quoted 11 lines
Quoted 1 line
Quoted 1 line · On 26.09.14 at 13:40, <[email protected]> wrote:
xen/Rules.mk +4 -0
@@ -10,6 +10,10 @@ lock_profile  ?= n
 crash_debug   ?= n
 frame_pointer ?= n
 lto           ?= n
+debug_xen     ?= y
+debuginfo_xen ?= y
+debug         := $(debug_xen)
+debug_symbols := $(debuginfo_xen)

I'm not sure I want to see this do away with the old mechanism altogether - various of my testing build flavors depend on overriding the "debug" variable, and I wouldn't want to change all their .config files. At least for a certain period of time the latter two should probably continue to use ?=.

Quoted 2 lines

I think .config will continue to work with a "debug := y" and also 'make debug=y'.

Ah, right, you do this before the inclusion point of Config.mk.

Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
xen/Rules.mk +4 -1
@@ -43,7 +47,10 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+ifeq ($(debug_symbols),y)
+CFLAGS += -g
+endif
+CFLAGS += -pipe -D__XEN__ -include $(BASEDIR)/include/xen/config.h
 CFLAGS += -nostdinc
 
Quoted 7 lines
Quoted 5 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 50

Quoted 1 line
xen/Rules.mk +0 -0
 CFLAGS-$(XSM_ENABLE)    += -DXSM_ENABLE

The context here shows that CFLAGS-y gets used elsewhere, so please do so too above. And if possible this should be considered elsewhere too.

I'm not sure what you mean? The hunk just makes "-g" conditional.

Looks like you nevertheless understood, as your shrunk down patch does what I was asking for here (quoted below).

Quoted 8 lines
Quoted 5 lines
Quoted 2 lines

In any event I don't see this change as important enough to warrant overriding the feature freeze.

Regarding feature freeze, that small version below for 'make debug=yn debug_symbols=yn' will work for me as well.

This indeed seems more acceptable at this point. But the final say would be with Konrad anyway.

I don't see this introducing an regressions. If there is an regression it will be during build time so pretty easy to spot.

Quoted 14 lines

xen/Rules.mk ALL_OBJS-$(x86) += $(BASEDIR)/crypto/built_in.o · line 46

Quoted 9 lines
xen/Rules.mk +1 -1
@@ -43,7 +43,8 @@ ALL_OBJS-$(x86)          += $(BASEDIR)/crypto/built_in.o
 
 CFLAGS += -fno-builtin -fno-common
 CFLAGS += -Werror -Wredundant-decls -Wno-pointer-arith
-CFLAGS += -pipe -g -D__XEN__ -include $(BASEDIR)/include/xen/config.h
+CFLAGS-$(debug_symbols) += -g

(This one.)

Jan