tools changes to honor --prefix=
cover tools changes to honor --prefix=
In my attempt to get a xen.rpm from 'make rpmball' which operates entirely below the configured --prefix= I came up with these changes. Up to now there was very little runtime testing. ldd reports no missing libs anymore when APPEND_LDFLAGS=" -Wl,-rpath,${_libdir}" is used.
More changes are required to reach the goal..
Olaf Hering (9):
tools/python: add APPEND_LDFLAGS to CFLAGS tools/libfsimage: append APPEND_LDFLAGS to link command tools/debugger: append APPEND_LDFLAGS to link command tools/blktap2: append APPEND_LDFLAGS to link command
tools: add APPEND_LDFLAGS to xentop link command tools/pygrub: add APPEND_LDFLAGS to CFLAGS tools/libxl: remove XEN_RUN_DIR from install target tools/libxc: provide variable paths to libxc tools/libxc: use XEN_RUN_DIR for SUSPEND_LOCK_FILE
tools/blktap2/control/Makefile | 4 ++-- tools/blktap2/drivers/Makefile | 12 ++++++------ tools/blktap2/vhd/Makefile | 4 ++-- tools/debugger/kdd/Makefile | 2 +- tools/libfsimage/common/Makefile | 2 +- tools/libxc/Makefile | 13 ++++++++++++- tools/libxc/xc_private.h | 1 + tools/libxc/xc_suspend.c | 2 +- tools/libxl/Makefile | 1 - tools/pygrub/Makefile | 4 ++-- tools/python/Makefile | 4 ++-- tools/xenstat/xentop/Makefile | 1 + 12 files changed, 31 insertions(+), 19 deletions(-)
PATCH 1/9 tools/python: add APPEND_LDFLAGS to CFLAGS
Required to pass -Wl,-rpath,$libdir to link command.
--- tools/python/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/python/Makefile +2 -2
@@ -16,11 +16,11 @@ build: genpath 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)" $(PYTHON) setup.py build + CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build .PHONY: install install: - CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \ + CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py install \ $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force $(INSTALL_DIR) $(DESTDIR)$(SBINDIR)
PATCH 2/9 tools/libfsimage: append APPEND_LDFLAGS to link command
In reply to Olaf HeringRequired to pass -Wl,-rpath,$libdir to link command.
--- tools/libfsimage/common/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libfsimage/common/Makefile +1 -1
@@ -40,7 +40,7 @@ libfsimage.so.$(MAJOR): libfsimage.so.$(MAJOR).$(MINOR) ln -sf $< $@ libfsimage.so.$(MAJOR).$(MINOR): $(PIC_OBJS) - $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) + $(CC) $(LDFLAGS) -Wl,$(SONAME_LDFLAG) -Wl,libfsimage.so.$(MAJOR) $(SHLIB_LDFLAGS) -o $@ $^ $(PTHREAD_LIBS) $(APPEND_LDFLAGS) -include $(DEPS)
PATCH 3/9 tools/debugger: append APPEND_LDFLAGS to link command
In reply to Olaf HeringRequired to pass -Wl,-rpath,$libdir to link command.
--- tools/debugger/kdd/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/debugger/kdd/Makefile +1 -1
@@ -10,7 +10,7 @@ OBJS := $(CFILES:.c=.o) all: kdd kdd: $(OBJS) - $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) + $(CC) $(LDFLAGS) -o $@ $^ $(LDLIBS) $(APPEND_LDFLAGS) .PHONY: clean clean:
PATCH 4/9 tools/blktap2: append APPEND_LDFLAGS to link command
In reply to Olaf HeringRequired to pass -Wl,-rpath,$libdir to link command.
--- tools/blktap2/control/Makefile | 4 ++-- tools/blktap2/drivers/Makefile | 12 ++++++------ tools/blktap2/vhd/Makefile | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-)
tools/blktap2/control/Makefile +2 -2
@@ -52,13 +52,13 @@ $(LIBSONAME): $(LIB_SHARED) ln -sf $< $@ tap-ctl: tap-ctl.o $(LIBNAME).so - $(CC) $(LDFLAGS) -o $@ $^ + $(CC) $(LDFLAGS) -o $@ $^ $(APPEND_LDFLAGS) $(LIB_STATIC): $(CTL_OBJS) $(AR) r $@ $^ $(LIB_SHARED): $(CTL_PICS) - $(CC) $(LDFLAGS) -fPIC -Wl,$(SONAME_LDFLAG) -Wl,$(LIBSONAME) $(SHLIB_LDFLAGS) -rdynamic $^ -o $@ + $(CC) $(LDFLAGS) -fPIC -Wl,$(SONAME_LDFLAG) -Wl,$(LIBSONAME) $(SHLIB_LDFLAGS) -rdynamic $^ -o $@ $(APPEND_LDFLAGS) install: $(IBIN) $(LIB_STATIC) $(LIB_SHARED) $(INSTALL_DIR) -p $(DESTDIR)$(SBINDIR)
tools/blktap2/drivers/Makefile +6 -6
@@ -79,25 +79,25 @@ all: $(IBIN) lock-util qcow-util tapdisk2: $(TAP-OBJS-y) $(BLK-OBJS-y) $(MISC-OBJS-y) tapdisk2.o - $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm $(APPEND_LDFLAGS) tapdisk-client: tapdisk-client.o - $(CC) -o $@ $^ $(LDFLAGS) -lrt + $(CC) -o $@ $^ $(LDFLAGS) -lrt $(APPEND_LDFLAGS) tapdisk-stream tapdisk-diff: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y) - $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm $(APPEND_LDFLAGS) td-util: td.o tapdisk-utils.o tapdisk-log.o $(PORTABLE-OBJS-y) - $(CC) -o $@ $^ $(LDFLAGS) $(VHDLIBS) + $(CC) -o $@ $^ $(LDFLAGS) $(VHDLIBS) $(APPEND_LDFLAGS) lock-util: lock.c - $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) + $(CC) $(CFLAGS) -DUTIL -o lock-util lock.c $(LDFLAGS) $(APPEND_LDFLAGS) .PHONY: qcow-util qcow-util: img2qcow qcow2raw qcow-create img2qcow qcow2raw qcow-create: %: %.o $(TAP-OBJS-y) $(BLK-OBJS-y) - $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm + $(CC) -o $@ $^ $(LDFLAGS) -lrt -lz $(VHDLIBS) $(AIOLIBS) $(MEMSHRLIBS) -lm $(APPEND_LDFLAGS) install: all $(INSTALL_DIR) -p $(DESTDIR)$(INST_DIR)
tools/blktap2/vhd/Makefile +2 -2
@@ -31,10 +31,10 @@ LIBS_DEPENDS := lib/libvhd.so lib/vhd.a $(LIBS_DEPENDS):subdirs-all vhd-util: vhd-util.o $(LIBS_DEPENDS) - $(CC) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS) + $(CC) $(LDFLAGS) -o vhd-util vhd-util.o $(LIBS) $(APPEND_LDFLAGS) vhd-update: vhd-update.o $(LIBS_DEPENDS) - $(CC) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS) + $(CC) $(LDFLAGS) -o vhd-update vhd-update.o $(LIBS) $(APPEND_LDFLAGS) install: all $(MAKE) subdirs-install
PATCH 5/9 tools: add APPEND_LDFLAGS to xentop link command
In reply to Olaf HeringRequired to pass -Wl,-rpath,$libdir to link command.
--- tools/xenstat/xentop/Makefile | 1 + 1 file changed, 1 insertion(+)
tools/xenstat/xentop/Makefile +1 -0
@@ -24,6 +24,7 @@ CFLAGS += -DHOST_$(XEN_OS) # Include configure output (config.h) to headers search path CFLAGS += -I$(XEN_ROOT)/tools +LDFLAGS += $(APPEND_LDFLAGS) .PHONY: all all: xentop
PATCH 6/9 tools/pygrub: add APPEND_LDFLAGS to CFLAGS
In reply to Olaf HeringRequired to pass -Wl,-rpath,$libdir to link command.
--- tools/pygrub/Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/pygrub/Makefile +2 -2
@@ -6,11 +6,11 @@ include $(XEN_ROOT)/tools/Rules.mk all: build .PHONY: build build: - CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py build + CC="$(CC)" CFLAGS="$(CFLAGS) $(APPEND_LDFLAGS)" $(PYTHON) setup.py build .PHONY: install install: all - CC="$(CC)" CFLAGS="$(CFLAGS)" $(PYTHON) setup.py install \ + 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 \
Re: [PATCH 6/9] tools/pygrub: add APPEND_LDFLAGS to CFLAGS
Quoted 3 lines · Olaf Hering
Required to pass -Wl,-rpath,$libdir to link command.
Signed-off-by Olaf Hering <[email protected]>
Patches #1..#6: Acked-by: Ian Campbell <[email protected]>
PATCH 7/9 tools/libxl: remove XEN_RUN_DIR from install target
In reply to Olaf Heringxencommons creates the _hardcoded_ /var/run/xen already, there is no need to create and package this directory during make install|rpmball.
Without this change installing the resulting xen.rpm will fail on systems where /var/run is a symlink. rpm complains that '/var/run' (the symlink) is already owned by some other system rpm package.
Using XEN_RUN_DIR instead of /var/run/xen tree-wide may be done in a followup patch.
--- tools/libxl/Makefile | 1 - 1 file changed, 1 deletion(-)
tools/libxl/Makefile +0 -1
@@ -230,7 +230,6 @@ install: all $(INSTALL_DIR) $(DESTDIR)$(LIBDIR) $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR) $(INSTALL_DIR) $(DESTDIR)$(BASH_COMPLETION_DIR) - $(INSTALL_DIR) $(DESTDIR)$(XEN_RUN_DIR) $(INSTALL_DIR) $(DESTDIR)$(PRIVATE_BINDIR) $(INSTALL_PROG) xl $(DESTDIR)$(SBINDIR) $(INSTALL_PROG) libxl-save-helper $(DESTDIR)$(PRIVATE_BINDIR)
Re: [PATCH 7/9] tools/libxl: remove XEN_RUN_DIR from install target
Quoted 11 lines · Olaf Hering
xencommons creates the _hardcoded_
/var/run/xenalready, there is no need to create and package this directory during make install|rpmball.Without this change installing the resulting xen.rpm will fail on systems where
/var/runis a symlink. rpm complains that '/var/run' (the symlink) is already owned by some other system rpm package.Using
XEN_RUN_DIRinstead of/var/run/xentree-wide may be done in a followup patch.Signed-off-by Olaf Hering <[email protected]>
PATCH 8/9 tools/libxc: provide variable paths to libxc
In reply to Olaf HeringIn preparation to removal of hardcoded /var/run/xen paths, provide XEN_RUN_DIR and related directories to xc_private.h. Similar code exists already for libxl, stubdom and other parts.
--- tools/libxc/Makefile | 13 ++++++++++++- tools/libxc/xc_private.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-)
tools/libxc/Makefile +12 -1
@@ -118,11 +118,21 @@ ifneq ($(stubdom),y) LIB += xenctrl_osdep_ENOSYS.so endif +genpath-target = $(call buildmakevars2file,_paths.h.tmp) +$(eval $(genpath-target)) + +_paths.h: genpath + sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected] + rm -f [email protected] + $(call move-if-changed,[email protected],$@) + +xc_private.h: _paths.h + .PHONY: all all: build .PHONY: build -build: +build: xc_private.h $(MAKE) libs .PHONY: libs
@@ -150,6 +160,7 @@ TAGS: .PHONY: clean clean: rm -rf *.rpm $(LIB) *~ $(DEPS) \ + _paths.h \ $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \ $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) \ $(OSDEP_LIB_OBJS) $(OSDEP_PIC_OBJS)
tools/libxc/xc_private.h +1 -0
@@ -29,6 +29,7 @@#include <stdlib.h> #include <sys/ioctl.h> +#include "_paths.h" #include "xenctrl.h" #include "xenctrlosdep.h"
Re: [PATCH 8/9] tools/libxc: provide variable paths to libxc
Quoted 15 lines · Olaf Hering
In preparation to removal of hardcoded
/var/run/xenpaths, provideXEN_RUN_DIRand related directories toxc_private.h. Similar code exists already for libxl, stubdom and other parts.Signed-off-by Olaf Hering <[email protected]>--- tools/libxc/Makefile | 13 ++++++++++++- tools/libxc/xc_private.h | 1 + 2 files changed, 13 insertions(+), 1 deletion(-)tools/libxc/Makefile +0
-0
tools/libxc/Makefile ifneq ($(stubdom),y) · line 127
Quoted 10 lines
tools/libxc/Makefile +7
-0@@ -118,11 +118,21 @@ ifneq ($(stubdom),y) LIB += xenctrl_osdep_ENOSYS.so endif +genpath-target = $(call buildmakevars2file,_paths.h.tmp) +$(eval $(genpath-target)) + +_paths.h: genpath + sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected] + rm -f [email protected] + $(call move-if-changed,[email protected],$@)
libxl has the exact same thing. Can we make it a common genpath-include-target or something please.
I'm not sure why this isn't handled vi autoconf and tools/config.h.in.
tools/libxc/Makefile ifneq ($(stubdom),y) · line 135
Quoted 9 lines
tools/libxc/Makefile +4
-1+ +xc_private.h: _paths.h + .PHONY: all all: build .PHONY: build -build: +build: xc_private.h
This might be better as:
$(CTRL_LIB_OBJS) $(XXX_OTHER_OBJS): xc_private.h
tools/libxc/Makefile TAGS: · line 163
Quoted 8 lines
tools/libxc/Makefile +1
-0$(MAKE) libs .PHONY: libs@@ -150,6 +160,7 @@ TAGS: .PHONY: clean clean: rm -rf *.rpm $(LIB) *~ $(DEPS) \ + _paths.h \
Whitespace oddity.
Ian.
Re: [PATCH 8/9] tools/libxc: provide variable paths to libxc
Quoted 2 lines · Ian Campbell
libxl has the exact same thing. Can we make it a common genpath-include-target or something please.
I came up with the untested change below.
Quoted 1 line
I'm not sure why this isn't handled vi autoconf and
tools/config.h.in.
Should these variables (in BUILD_MAKE_VARS) be set via configure?
Olaf
Config.mk | 19 +++++++++++++++---- tools/libxc/Makefile | 8 ++++++++ tools/libxc/xc_private.h | 1 + tools/libxl/Makefile | 7 +------ 4 files changed, 25 insertions(+), 10 deletions(-)
Config.mk +15 -4
@@ -166,19 +166,30 @@ 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 \ + XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ + XEN_RUN_DIR XEN_PAGING_DIR + buildmakevars2file = $(eval $(call buildmakevars2file-closure,$(1))) define buildmakevars2file-closure .PHONY: genpath genpath: rm -f $(1).tmp; \ - $(foreach var, \ - SBINDIR BINDIR LIBEXEC LIBDIR SHAREDIR PRIVATE_BINDIR \ - XENFIRMWAREDIR XEN_CONFIG_DIR XEN_SCRIPT_DIR XEN_LOCK_DIR \ - XEN_RUN_DIR XEN_PAGING_DIR, \ + $(foreach var, $(BUILD_MAKE_VARS) \ echo "$(var)=\"$($(var))\"" >>$(1).tmp;) \ $(call move-if-changed,$(1).tmp,$(1)) endef +buildmakevars2header = $(eval $(call buildmakevars2header-closure,$(1))) +define buildmakevars2header-closure + .PHONY: genpath + genpath: + rm -f $(1).tmp; \ + $(foreach var, $(BUILD_MAKE_VARS) \ + echo "#define $(var) \"$($(var))\"" >>$(1).tmp;)\ + $(call move-if-changed,$(1).tmp,$(1)) +endef + ifeq ($(debug_symbols),y) CFLAGS += -g endif
tools/libxc/Makefile +8 -0
@@ -118,6 +118,13 @@ ifneq ($(stubdom),y) LIB += xenctrl_osdep_ENOSYS.so endif +genpath-target = $(call buildmakevars2header,_paths.h) +$(eval $(genpath-target)) + +xc_private.h: _paths.h + +$(CTRL_LIB_OBJS) $(GUEST_LIB_OBJS) $(OSDEP_LIB_OBJS): xc_private.h + .PHONY: all all: build
@@ -150,6 +157,7 @@ TAGS: .PHONY: clean clean: rm -rf *.rpm $(LIB) *~ $(DEPS) \ + _paths.h \ $(CTRL_LIB_OBJS) $(CTRL_PIC_OBJS) \ $(GUEST_LIB_OBJS) $(GUEST_PIC_OBJS) \ $(OSDEP_LIB_OBJS) $(OSDEP_PIC_OBJS)
tools/libxc/xc_private.h +1 -0
@@ -29,6 +29,7 @@#include <stdlib.h> #include <sys/ioctl.h> +#include "_paths.h" #include "xenctrl.h" #include "xenctrlosdep.h"
tools/libxl/Makefile +1 -6
@@ -141,7 +141,7 @@ $(LIBXL_OBJS) $(LIBXLU_OBJS) $(XL_OBJS) $(SAVE_HELPER_OBJS) \ @rm -f $*.[ch] $(FLEX) --header-file=$*.h --outfile=$*.c $< -genpath-target = $(call buildmakevars2file,_paths.h.tmp) +genpath-target = $(call buildmakevars2header,_paths.h) $(eval $(genpath-target)) libxl.api-ok: check-libxl-api-rules _libxl.api-for-check
@@ -154,11 +154,6 @@ _%.api-for-check: %.h $(AUTOINCS) >[email protected] mv -f [email protected] $@ -_paths.h: genpath - sed -e "s/\([^=]*\)=\(.*\)/#define \1 \2/g" [email protected] >[email protected] - rm -f [email protected] - $(call move-if-changed,[email protected],$@) - _libxl_list.h: $(XEN_INCLUDE)/xen-external/bsd-sys-queue-h-seddery $(XEN_INCLUDE)/xen-external/bsd-sys-queue.h $(PERL) $^ --prefix=libxl >[email protected] $(call move-if-changed,[email protected],$@)
Re: [PATCH 8/9] tools/libxc: provide variable paths to libxc
Quoted 10 lines · Olaf Hering
Quoted 2 lines · Ian Campbell
libxl has the exact same thing. Can we make it a common genpath-include-target or something please.
I came up with the untested change below.
Quoted 1 line
I'm not sure why this isn't handled vi autoconf and
tools/config.h.in.Should these variables (in
BUILD_MAKE_VARS) be set via configure?
Probably? It does seem odd not to obey ./configure --sbindir.
The one to watch out for is --localstatedir (==var) which we explicitly don't want to move to $PREFIX/var by default.
Ian.
Re: [PATCH 8/9] tools/libxc: provide variable paths to libxc
Quoted 6 lines · Ian Campbell
Quoted 5 lines · Olaf Hering
Quoted 2 lines · Ian Campbell
libxl has the exact same thing. Can we make it a common genpath-include-target or something please.
Quoted 7 lines
Quoted 5 lines
I came up with the untested change below.
Quoted 1 line
I'm not sure why this isn't handled vi autoconf and
tools/config.h.in.Should these variables (in
BUILD_MAKE_VARS) be set via configure?Probably? It does seem odd not to obey ./configure --sbindir.
Ok. I have to check the actual code, but this is yet another change as --sbindir may not have an effect today.
Olaf
PATCH 9/9 tools/libxc: use XEN_RUN_DIR for SUSPEND_LOCK_FILE
In reply to Olaf HeringRemove hardcoded /var/run/xen directory path, use XEN_RUN_DIR instead.
--- tools/libxc/xc_suspend.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tools/libxc/xc_suspend.c +1 -1
@@ -20,7 +20,7 @@#include "xc_private.h" #include "xenguest.h" -#define SUSPEND_LOCK_FILE "/var/run/xen/suspend-evtchn-%d.lock" +#define SUSPEND_LOCK_FILE XEN_RUN_DIR "/suspend-evtchn-%d.lock"/* * locking
Re: [PATCH 9/9] tools/libxc: use XEN_RUN_DIR for SUSPEND_LOCK_FILE
Quoted 3 lines · Olaf Hering
Remove hardcoded
/var/run/xendirectory path, useXEN_RUN_DIRinstead.Signed-off-by Olaf Hering <[email protected]>