This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH] detect overridden install prefix [BZ #18512]
- From: Martin Sebor <msebor at redhat dot com>
- To: GNU C Library <libc-alpha at sourceware dot org>
- Date: Thu, 11 Jun 2015 17:46:23 -0600
- Subject: [PATCH] detect overridden install prefix [BZ #18512]
- Authentication-results: sourceware.org; auth=none
Attempting to install glibc configured with --prefix=/usr into
a non-standard directory specified by the prefix make variable
fails with an error. Carlos indicated this is an unsupported
use case that he would prefer to detect and error out on early
in the installation process.
Attached is a simple patch that implements this detection. The
patch also updates the INSTALL file to mention this caveat and
recommend using DESTDIR instead. To keep the patch simple
I didn't implement the idea of detecting whether the overridden
prefix is actually different than the prefix the library was
configured with.
ChangeLog:
2015-06-11 Martin Sebor <msebor@redhat.com>
[BZ #18512]
* Makerules (check-install-supported): New target.
install: Add check-install-supported as a dependency.
* INSTALL (Installing the C Library): Document that overriding
prefix and exec_prefix is not supported. Mention DESTDIR.
Martin
diff --git a/INSTALL b/INSTALL
index 8e13f2c..c1a8ecf 100644
--- a/INSTALL
+++ b/INSTALL
@@ -295,11 +295,13 @@ headers from libraries other than the GNU C Library yourself after
installing the library.
You can install the GNU C Library somewhere other than where you
-configured it to go by setting the 'install_root' variable on the
-command line for 'make install'. The value of this variable is
+configured it to go by setting the 'DESTDIR' GNU standard make variable
+on the command line for 'make install'. The value of this variable is
prepended to all the paths for installation. This is useful when
setting up a chroot environment or preparing a binary distribution. The
-directory should be specified with an absolute file name.
+directory should be specified with an absolute file name. Installing
+with the prefix and exec_prefix GNU standard make variables set is not
+supported.
The GNU C Library includes a daemon called 'nscd', which you may or
may not want to run. 'nscd' caches name service lookups; it can
diff --git a/Makerules b/Makerules
index c79915f..502d22a 100644
--- a/Makerules
+++ b/Makerules
@@ -906,6 +906,26 @@ endef
installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
$(inst_libdir)/$(patsubst %,$(libtype$o),\
$(libprefix)$(libc-name)))
+
+.PHONY: check-install-supported
+check-install-supported:
+
+# Check to see if the prefix or exec_prefix GNU standard variable
+# has been overridden on the command line and, if so, fail with
+# an error message since doing so is not supported (sed DESTDIR
+# instead).
+ifeq ($(origin prefix),command line)
+check-install-supported:
+ $(error Overriding prefix is not supported. Set DESTDIR instead.)
+endif
+
+ifeq ($(origin exec_prefix),command line)
+check-install-supported:
+ $(error Overriding exec_prefix is not supported. Set DESTDIR instead.)
+endif
+
+install: check-install-supported
+
install: $(installed-libcs)
$(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
$(make-target-directory)