Skip to contentSkip to conversation

tools: honour --libdir when it is passed to ./configure

PATCH Superseded Matt Wilson 4 participants 8 messages Jun 23, 2012 – Jul 4, 2012

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 tools: honour --libdir when it is passed to ./configure

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

Changes since v2:
* Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong.
* Don't include config/Tools.mk from the top level Config.mk.
* Just assume that libraries specified via EXTRA_PREFIX live in $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day.

Config.mk +1 -1
diff -r 32034d1914a6 -r 177d5f1e353f Config.mk
@@ -67,7 +67,7 @@ endef
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
 endif
 
 PYTHON      ?= python
config/NetBSD.mk +0 -1
diff -r 32034d1914a6 -r 177d5f1e353f config/NetBSD.mk
@@ -1,7 +1,6 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
 # Override settings for this OS
-LIBLEAFDIR_x86_64 = lib
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 
config/StdGNU.mk +1 -7
diff -r 32034d1914a6 -r 177d5f1e353f config/StdGNU.mk
@@ -32,13 +32,7 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_32 = lib
-LIBLEAFDIR_x86_64 ?= lib64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
-LIBEXEC = $(LIBDIR_x86_32)/xen/bin
+LIBEXEC = $(PREFIX)/lib/xen/bin
 SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1
config/SunOS.mk +0 -4
diff -r 32034d1914a6 -r 177d5f1e353f config/SunOS.mk
@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_64 = lib/amd64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8
config/Tools.mk.in +2 -1
diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in
@@ -1,6 +1,7 @@
 # Prefix and install folder
 PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
 # A debug build of tools?
 debug               := @debug@
config/x86_64.mk +0 -3
diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
 SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
 # Use only if calling $(LD) directly.
tools/libfsimage/Rules.mk +4 -9
diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk
@@ -1,17 +1,12 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
 CFLAGS += -Werror -D_GNU_SOURCE
 LDFLAGS += -L../common/
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
 FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
 .PHONY: fs-install
 fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)
tools/libfsimage/common/Makefile +1 -1
diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 MAJOR = 1.0
 MINOR = 0
tools/libfsimage/common/fsimage_plugin.c +2 -21
diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c
@@ -122,7 +122,6 @@ fail:
 static int load_plugins(void)
 {
 	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
 	struct dirent *dp = NULL;
 	struct dirent *dpp;
 	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
 	int err;
 	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
 	if (fsdir == NULL)
 		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
 	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
 		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
 		if (strcmp(dpp->d_name, "..") == 0)
 			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
 		if (init_plugin(tmp) != 0)
 			goto fail;
Acked-by on v3 1/1
#1 lore raw
Quoted 11 lines · Matt Wilson

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Quoted 4 lines

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

Thanks Matt.

Ian.

Quoted 181 lines

Changes since v2:
* Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong.
* Don't include config/Tools.mk from the top level Config.mk.
* Just assume that libraries specified via EXTRA_PREFIX live in $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day.

diff -r 32034d1914a6 -r 177d5f1e353f Config.mk

Config.mk +1 -1
@@ -67,7 +67,7 @@ endef
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
 endif
 
 PYTHON      ?= python

diff -r 32034d1914a6 -r 177d5f1e353f config/NetBSD.mk

config/NetBSD.mk +0 -1
@@ -1,7 +1,6 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
 # Override settings for this OS
-LIBLEAFDIR_x86_64 = lib
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 

diff -r 32034d1914a6 -r 177d5f1e353f config/StdGNU.mk

config/StdGNU.mk +1 -7
@@ -32,13 +32,7 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_32 = lib
-LIBLEAFDIR_x86_64 ?= lib64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
-LIBEXEC = $(LIBDIR_x86_32)/xen/bin
+LIBEXEC = $(PREFIX)/lib/xen/bin
 SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1

diff -r 32034d1914a6 -r 177d5f1e353f config/SunOS.mk

config/SunOS.mk +0 -4
@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_64 = lib/amd64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in +2 -1
@@ -1,6 +1,7 @@
 # Prefix and install folder
 PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
 # A debug build of tools?
 debug               := @debug@

diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk

config/x86_64.mk +0 -3
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
 SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
 # Use only if calling $(LD) directly.

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk

tools/libfsimage/Rules.mk +4 -9
@@ -1,17 +1,12 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
 CFLAGS += -Werror -D_GNU_SOURCE
 LDFLAGS += -L../common/
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
 FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
 .PHONY: fs-install
 fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile

tools/libfsimage/common/Makefile +1 -1
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 MAJOR = 1.0
 MINOR = 0

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c

tools/libfsimage/common/fsimage_plugin.c +2 -21
@@ -122,7 +122,6 @@ fail:
 static int load_plugins(void)
 {
 	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
 	struct dirent *dp = NULL;
 	struct dirent *dpp;
 	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
 	int err;
 	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
 	if (fsdir == NULL)
 		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
 	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
 		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
 		if (strcmp(dpp->d_name, "..") == 0)
 			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
 		if (init_plugin(tmp) != 0)
 			goto fail;
#2 lore raw
In reply to Matt Wilson

Matt Wilson writes ("[Xen-devel] [PATCH v3] tools: honour --libdir when it is passed to ./configure"):

Quoted 11 lines

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Quoted 4 lines

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

Thanks for this. FYI I intend to commit this before 4.2rc1. However I think it has a good chance of breaking something (eg, the test pushes).

So I want to wait until we don't have a big patch series also waiting in staging.

I've marked the message to return but please do feel free to remind me if I seem to have forgotten it.

Ian.

#3 lore raw
In reply to Matt Wilson
Quoted 82 lines · Matt Wilson

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

Changes since v2:
* Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong.
* Don't include config/Tools.mk from the top level Config.mk.
* Just assume that libraries specified via EXTRA_PREFIX live in

    $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day.

diff -r 32034d1914a6 -r 177d5f1e353f Config.mk

Config.mk +1 -1
@@ -67,7 +67,7 @@ endef
 
  ifneq ($(EXTRA_PREFIX),)
  EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
  endif
 
  PYTHON      ?= python

diff -r 32034d1914a6 -r 177d5f1e353f config/NetBSD.mk

config/NetBSD.mk +0 -1
@@ -1,7 +1,6 @@
  include $(XEN_ROOT)/config/StdGNU.mk
 
  # Override settings for this OS
-LIBLEAFDIR_x86_64 = lib
  LIBEXEC = $(PREFIX)/libexec
  PRIVATE_BINDIR = $(BINDIR)
 

diff -r 32034d1914a6 -r 177d5f1e353f config/StdGNU.mk

config/StdGNU.mk +1 -7
@@ -32,13 +32,7 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
  PREFIX ?= /usr
  BINDIR = $(PREFIX)/bin
  INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_32 = lib
-LIBLEAFDIR_x86_64 ?= lib64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
-LIBEXEC = $(LIBDIR_x86_32)/xen/bin
+LIBEXEC = $(PREFIX)/lib/xen/bin
  SHAREDIR = $(PREFIX)/share
  MANDIR = $(SHAREDIR)/man
  MAN1DIR = $(MANDIR)/man1

diff -r 32034d1914a6 -r 177d5f1e353f config/SunOS.mk

config/SunOS.mk +0 -4
@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
  PREFIX ?= /usr
  BINDIR = $(PREFIX)/bin
  INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_64 = lib/amd64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
  MANDIR = $(PREFIX)/share/man
  MAN1DIR = $(MANDIR)/man1
  MAN8DIR = $(MANDIR)/man8

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in line 3

Quoted 3 lines
config/Tools.mk.in +0 -1
@@ -1,6 +1,7 @@
  # Prefix and install folder
  PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@

Sorry for the late reply, but if you get rid of LIB_PATH, I think you should also remove AX_DEFAULT_LIB and m4_include([m4/default_lib.m4]) from configure.ac, and remove the macro file tools/m4/default_lib.m4.

Quoted 111 lines
config/Tools.mk.in +2 -0
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
  # A debug build of tools?
  debug               := @debug@

diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk

config/x86_64.mk +0 -3
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
  CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
  SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
  # Use only if calling $(LD) directly.

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk

tools/libfsimage/Rules.mk +4 -9
@@ -1,17 +1,12 @@
  include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
  CFLAGS += -Werror -D_GNU_SOURCE
  LDFLAGS += -L../common/
 
  PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
  FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
  .PHONY: fs-install
  fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
  $(FSLIB): $(PIC_OBJS)
  	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile

tools/libfsimage/common/Makefile +1 -1
@@ -1,5 +1,5 @@
  XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
  MAJOR = 1.0
  MINOR = 0

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c

tools/libfsimage/common/fsimage_plugin.c +2 -21
@@ -122,7 +122,6 @@ fail:
  static int load_plugins(void)
  {
  	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
  	struct dirent *dp = NULL;
  	struct dirent *dpp;
  	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
  	int err;
  	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
  	if (fsdir == NULL)
  		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
  	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
  		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
  		if (strcmp(dpp->d_name, "..") == 0)
  			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
  		if (init_plugin(tmp) != 0)
  			goto fail;
#4 lore raw
Quoted 12 lines

config/Tools.mk.in line 3

Quoted 8 lines

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in +0 -1
@@ -1,6 +1,7 @@
  # Prefix and install folder
  PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@

Sorry for the late reply, but if you get rid of LIB_PATH, I think you should also remove AX_DEFAULT_LIB and m4_include([m4/default_lib.m4]) from configure.ac, and remove the macro file tools/m4/default_lib.m4.

This can be a subsequent cleanup I think?

I've just spoken to someone else who has tripped over the lib64 issue -- I think this is a good time to commit this fix.

Quoted 113 lines
Quoted 112 lines
config/Tools.mk.in +2 -0
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
  # A debug build of tools?
  debug               := @debug@

diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk

config/x86_64.mk +0 -3
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
  CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
  SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
  # Use only if calling $(LD) directly.

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk

tools/libfsimage/Rules.mk +4 -9
@@ -1,17 +1,12 @@
  include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
  CFLAGS += -Werror -D_GNU_SOURCE
  LDFLAGS += -L../common/
 
  PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
  FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
  .PHONY: fs-install
  fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
  $(FSLIB): $(PIC_OBJS)
  	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile

tools/libfsimage/common/Makefile +1 -1
@@ -1,5 +1,5 @@
  XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
  MAJOR = 1.0
  MINOR = 0

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c

tools/libfsimage/common/fsimage_plugin.c +2 -21
@@ -122,7 +122,6 @@ fail:
  static int load_plugins(void)
  {
  	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
  	struct dirent *dp = NULL;
  	struct dirent *dpp;
  	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
  	int err;
  	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
  	if (fsdir == NULL)
  		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
  	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
  		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
  		if (strcmp(dpp->d_name, "..") == 0)
  			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
  		if (init_plugin(tmp) != 0)
  			goto fail;
#5 lore raw
Quoted 11 lines · Ian Campbell
Quoted 10 lines

config/Tools.mk.in line 3

Quoted 7 lines

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in +0 -1
@@ -1,6 +1,7 @@
   # Prefix and install folder
   PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@

Sorry for the late reply, but if you get rid of LIB_PATH, I think you should also remove AX_DEFAULT_LIB and m4_include([m4/default_lib.m4]) from configure.ac, and remove the macro file tools/m4/default_lib.m4.

Quoted 1 line

This can be a subsequent cleanup I think?

Yes, sure. Matt will you take care of that also?

Quoted 2 lines

I've just spoken to someone else who has tripped over the lib64 issue -- I think this is a good time to commit this fix.

#6 lore raw
In reply to Matt Wilson
Quoted 11 lines · Matt Wilson

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Quoted 4 lines

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

I was about to commit this. However It seems that files previously installed in /usr/lib/xen/boot (e.g. hvmloader) are now being installed into e.g. /xen/boot/hvmloader -- i.e. we've dropped the /usr/lib somewhere.

So I'm afraid I've backed this out.

My test was roughly:

        configure && make dist
        find dist | sort > ../FILE_LIST.BASE
        apply
        configure && make dist
        find dist | sort > ../FILE_LIST
        
        diff -u ../FILE_LIST.BASE ../FILE_LIST
        diff -u <(sed -e 's/lib64/lib/' ../FILE_LIST.BASE | sort ) ../FILE_LIST
        [...]
        @@ -727,10 +724,6 @@
         dist/install/usr/lib/xen/bin/xenpaging
         dist/install/usr/lib/xen/bin/xenpvnetboot
         dist/install/usr/lib/xen/boot
        -dist/install/usr/lib/xen/boot/hvmloader
        -dist/install/usr/lib/xen/boot/ioemu-stubdom.gz
        -dist/install/usr/lib/xen/boot/pv-grub-x86_32.gz
        -dist/install/usr/lib/xen/boot/pv-grub-x86_64.gz
         dist/install/usr/lib/xen/boot/xenstore-stubdom.gz
         dist/install/usr/local
         dist/install/usr/local/etc
        @@ -1098,4 +1091,10 @@
         dist/install/var/run/xenstored
         dist/install/var/xen
         dist/install/var/xen/dump
        +dist/install/xen
        +dist/install/xen/boot
        +dist/install/xen/boot/hvmloader
        +dist/install/xen/boot/ioemu-stubdom.gz
        +dist/install/xen/boot/pv-grub-x86_32.gz
        +dist/install/xen/boot/pv-grub-x86_64.gz
         dist/README

Strangely /usr/lib/xen/boot/xenstore-stubdom.gz wasn't effected...

Quoted 181 lines

Changes since v2:
* Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong.
* Don't include config/Tools.mk from the top level Config.mk.
* Just assume that libraries specified via EXTRA_PREFIX live in $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day.

diff -r 32034d1914a6 -r 177d5f1e353f Config.mk

Config.mk +1 -1
@@ -67,7 +67,7 @@ endef
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
 endif
 
 PYTHON      ?= python

diff -r 32034d1914a6 -r 177d5f1e353f config/NetBSD.mk

config/NetBSD.mk +0 -1
@@ -1,7 +1,6 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
 # Override settings for this OS
-LIBLEAFDIR_x86_64 = lib
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 

diff -r 32034d1914a6 -r 177d5f1e353f config/StdGNU.mk

config/StdGNU.mk +1 -7
@@ -32,13 +32,7 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_32 = lib
-LIBLEAFDIR_x86_64 ?= lib64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
-LIBEXEC = $(LIBDIR_x86_32)/xen/bin
+LIBEXEC = $(PREFIX)/lib/xen/bin
 SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1

diff -r 32034d1914a6 -r 177d5f1e353f config/SunOS.mk

config/SunOS.mk +0 -4
@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_64 = lib/amd64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in +2 -1
@@ -1,6 +1,7 @@
 # Prefix and install folder
 PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
 # A debug build of tools?
 debug               := @debug@

diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk

config/x86_64.mk +0 -3
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
 SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
 # Use only if calling $(LD) directly.

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk

tools/libfsimage/Rules.mk +4 -9
@@ -1,17 +1,12 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
 CFLAGS += -Werror -D_GNU_SOURCE
 LDFLAGS += -L../common/
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
 FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
 .PHONY: fs-install
 fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile

tools/libfsimage/common/Makefile +1 -1
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 MAJOR = 1.0
 MINOR = 0

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c

tools/libfsimage/common/fsimage_plugin.c +2 -21
@@ -122,7 +122,6 @@ fail:
 static int load_plugins(void)
 {
 	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
 	struct dirent *dp = NULL;
 	struct dirent *dpp;
 	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
 	int err;
 	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
 	if (fsdir == NULL)
 		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
 	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
 		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
 		if (strcmp(dpp->d_name, "..") == 0)
 			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
 		if (init_plugin(tmp) != 0)
 			goto fail;
#7 lore raw
Quoted 15 lines · Ian Campbell
Quoted 14 lines · Matt Wilson

Currently shared libraries are automatically installed into /usr/lib or /usr/lib64, depending on the supplied --prefix value and $(XEN_TARGET_ARCH). Some systems, like recent Debian and Ubuntu releases, do not use /usr/lib64, but instead /usr/lib/x86_64-linux-gnu.

With this change, packagers can supply the desired location for shared libraries on the ./configure command line. Packagers need to note that the default behaviour on 64-bit Linux systems will be to install shared libraries in /usr/lib, not /usr/lib64, unless a --libdir value is provided to ./configure.

Additionally, the libfsimage plugins are now loaded explicitly from $LIBDIR/fs, removing platform-based decision trees in code.

Quoted 8 lines
Quoted 1 line

I was about to commit this. However It seems that files previously installed in /usr/lib/xen/boot (e.g. hvmloader) are now being installed into e.g. /xen/boot/hvmloader -- i.e. we've dropped the /usr/lib somewhere.

So I'm afraid I've backed this out.

Many apologies for not catching that. I missed one usage of
LIBDIR_x86_32: XENFIRMWAREDIR. I'll fix it up now, along with cleaning up the default_lib.m4 remnant.

Matt

Quoted 219 lines

My test was roughly:

        configure && make dist
        find dist | sort > ../FILE_LIST.BASE
        apply
        configure && make dist
        find dist | sort > ../FILE_LIST
        
        diff -u ../FILE_LIST.BASE ../FILE_LIST
        diff -u <(sed -e 's/lib64/lib/' ../FILE_LIST.BASE | sort ) ../FILE_LIST
        [...]
        @@ -727,10 +724,6 @@
         dist/install/usr/lib/xen/bin/xenpaging
         dist/install/usr/lib/xen/bin/xenpvnetboot
         dist/install/usr/lib/xen/boot
        -dist/install/usr/lib/xen/boot/hvmloader
        -dist/install/usr/lib/xen/boot/ioemu-stubdom.gz
        -dist/install/usr/lib/xen/boot/pv-grub-x86_32.gz
        -dist/install/usr/lib/xen/boot/pv-grub-x86_64.gz
         dist/install/usr/lib/xen/boot/xenstore-stubdom.gz
         dist/install/usr/local
         dist/install/usr/local/etc
        @@ -1098,4 +1091,10 @@
         dist/install/var/run/xenstored
         dist/install/var/xen
         dist/install/var/xen/dump
        +dist/install/xen
        +dist/install/xen/boot
        +dist/install/xen/boot/hvmloader
        +dist/install/xen/boot/ioemu-stubdom.gz
        +dist/install/xen/boot/pv-grub-x86_32.gz
        +dist/install/xen/boot/pv-grub-x86_64.gz
         dist/README

Strangely /usr/lib/xen/boot/xenstore-stubdom.gz wasn't effected...

Quoted 181 lines

Changes since v2:
* Drop the #ifndef check for FSIMAGE_FSDIR, let the normal compiler error provide information that something is wrong.
* Don't include config/Tools.mk from the top level Config.mk.
* Just assume that libraries specified via EXTRA_PREFIX live in $(EXTRA_LIB)/lib. EXTRA_PREFIX should probably just go away one day.

diff -r 32034d1914a6 -r 177d5f1e353f Config.mk

Config.mk +1 -1
@@ -67,7 +67,7 @@ endef
 
 ifneq ($(EXTRA_PREFIX),)
 EXTRA_INCLUDES += $(EXTRA_PREFIX)/include
-EXTRA_LIB += $(EXTRA_PREFIX)/$(LIBLEAFDIR)
+EXTRA_LIB += $(EXTRA_PREFIX)/lib
 endif
 
 PYTHON      ?= python

diff -r 32034d1914a6 -r 177d5f1e353f config/NetBSD.mk

config/NetBSD.mk +0 -1
@@ -1,7 +1,6 @@
 include $(XEN_ROOT)/config/StdGNU.mk
 
 # Override settings for this OS
-LIBLEAFDIR_x86_64 = lib
 LIBEXEC = $(PREFIX)/libexec
 PRIVATE_BINDIR = $(BINDIR)
 

diff -r 32034d1914a6 -r 177d5f1e353f config/StdGNU.mk

config/StdGNU.mk +1 -7
@@ -32,13 +32,7 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_32 = lib
-LIBLEAFDIR_x86_64 ?= lib64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_32 = $(PREFIX)/$(LIBLEAFDIR_x86_32)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
-LIBEXEC = $(LIBDIR_x86_32)/xen/bin
+LIBEXEC = $(PREFIX)/lib/xen/bin
 SHAREDIR = $(PREFIX)/share
 MANDIR = $(SHAREDIR)/man
 MAN1DIR = $(MANDIR)/man1

diff -r 32034d1914a6 -r 177d5f1e353f config/SunOS.mk

config/SunOS.mk +0 -4
@@ -22,10 +22,6 @@ INSTALL_PROG = $(INSTALL) -m0755 -p
 PREFIX ?= /usr
 BINDIR = $(PREFIX)/bin
 INCLUDEDIR = $(PREFIX)/include
-LIBLEAFDIR = lib
-LIBLEAFDIR_x86_64 = lib/amd64
-LIBDIR = $(PREFIX)/$(LIBLEAFDIR)
-LIBDIR_x86_64 = $(PREFIX)/$(LIBLEAFDIR_x86_64)
 MANDIR = $(PREFIX)/share/man
 MAN1DIR = $(MANDIR)/man1
 MAN8DIR = $(MANDIR)/man8

diff -r 32034d1914a6 -r 177d5f1e353f config/Tools.mk.in

config/Tools.mk.in +2 -1
@@ -1,6 +1,7 @@
 # Prefix and install folder
 PREFIX              := @prefix@
-LIBLEAFDIR_x86_64   := @LIB_PATH@
+exec_prefix         := @exec_prefix@
+LIBDIR              := @libdir@
 
 # A debug build of tools?
 debug               := @debug@

diff -r 32034d1914a6 -r 177d5f1e353f config/x86_64.mk

config/x86_64.mk +0 -3
@@ -10,9 +10,6 @@ CONFIG_IOEMU := y
 
 CFLAGS += -m64
 
-LIBLEAFDIR = $(LIBLEAFDIR_x86_64)
-LIBDIR = $(LIBDIR_x86_64)
-
 SunOS_LIBDIR = $(SunOS_LIBDIR_x86_64)
 
 # Use only if calling $(LD) directly.

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/Rules.mk

tools/libfsimage/Rules.mk +4 -9
@@ -1,17 +1,12 @@
 include $(XEN_ROOT)/tools/Rules.mk
 
-CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/
+CFLAGS += -Wno-unknown-pragmas -I$(XEN_ROOT)/tools/libfsimage/common/ -DFSIMAGE_FSDIR=\"$(FSDIR)\"
 CFLAGS += -Werror -D_GNU_SOURCE
 LDFLAGS += -L../common/
 
 PIC_OBJS := $(patsubst %.c,%.opic,$(LIB_SRCS-y))
 
-FSDIR-$(CONFIG_Linux) = $(LIBDIR)/fs/$(FS)
-FSDIR-$(CONFIG_SunOS)-x86_64 = $(PREFIX)/lib/fs/$(FS)/64
-FSDIR-$(CONFIG_SunOS)-x86_32 = $(PREFIX)/lib/fs/$(FS)/
-FSDIR-$(CONFIG_SunOS) = $(FSDIR-$(CONFIG_SunOS)-$(XEN_TARGET_ARCH))
-FSDIR-$(CONFIG_NetBSD) = $(LIBDIR)/fs/$(FS)
-FSDIR = $(FSDIR-y)
+FSDIR = $(LIBDIR)/fs
 
 FSLIB = fsimage.so
 
@@ -20,8 +15,8 @@ fs-all: $(FSLIB)
 
 .PHONY: fs-install
 fs-install: fs-all
-	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)
-	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)
+	$(INSTALL_DIR) $(DESTDIR)$(FSDIR)/$(FS)
+	$(INSTALL_PROG) $(FSLIB) $(DESTDIR)$(FSDIR)/$(FS)
 
 $(FSLIB): $(PIC_OBJS)
 	$(CC) $(LDFLAGS) $(SHLIB_LDFLAGS) -o $@ $^ -lfsimage $(FS_LIBDEPS) $(APPEND_LDFLAGS)

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/Makefile

tools/libfsimage/common/Makefile +1 -1
@@ -1,5 +1,5 @@
 XEN_ROOT = $(CURDIR)/../../..
-include $(XEN_ROOT)/tools/Rules.mk
+include $(XEN_ROOT)/tools/libfsimage/Rules.mk
 
 MAJOR = 1.0
 MINOR = 0

diff -r 32034d1914a6 -r 177d5f1e353f tools/libfsimage/common/fsimage_plugin.c

tools/libfsimage/common/fsimage_plugin.c +2 -21
@@ -122,7 +122,6 @@ fail:
 static int load_plugins(void)
 {
 	const char *fsdir = getenv("FSIMAGE_FSDIR");
-	const char *isadir = "";
 	struct dirent *dp = NULL;
 	struct dirent *dpp;
 	DIR *dir = NULL;
@@ -131,26 +130,8 @@ static int load_plugins(void)
 	int err;
 	int ret = -1;
 
-#if defined(FSIMAGE_FSDIR)
 	if (fsdir == NULL)
 		fsdir = FSIMAGE_FSDIR;
-#elif defined(__sun__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-
-	if (sizeof(void *) == 8)
-		isadir = "64/";
-#elif defined(__ia64__)
-	if (fsdir == NULL)
-		fsdir = "/usr/lib/fs";
-#else
-	if (fsdir == NULL) {
-		if (sizeof(void *) == 8)
-			fsdir = "/usr/lib64/fs";
-		else
-			fsdir = "/usr/lib/fs";
-	}
-#endif
 
 	if ((name_max = pathconf(fsdir, _PC_NAME_MAX)) == -1)
 		goto fail;
@@ -172,8 +153,8 @@ static int load_plugins(void)
 		if (strcmp(dpp->d_name, "..") == 0)
 			continue;
 
-		(void) snprintf(tmp, name_max, "%s/%s/%sfsimage.so", fsdir,
-		    dpp->d_name, isadir);
+		(void) snprintf(tmp, name_max, "%s/%s/fsimage.so", fsdir,
+			dpp->d_name);
 
 		if (init_plugin(tmp) != 0)
 			goto fail;