aboutsummaryrefslogtreecommitdiff
path: root/reproduce/software/make/basic.mk
diff options
context:
space:
mode:
authorMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-30 11:22:23 +0100
committerMohammad Akhlaghi <mohammad@akhlaghi.org>2019-04-30 11:39:05 +0100
commitcd73f88157764334e96fa6f286687e3fa9b061fd (patch)
tree58f99201c6b69ed9a2069b544a240e32f9d3e158 /reproduce/software/make/basic.mk
parentb733fa6fcc2368fd63d14230181efcd84483f523 (diff)
Running PatchELF on all programs after Coreutils
Even though the Coreutils configure script says that it adds `rpath' to its executables, its executables don't have it. As a result, it goes to use the host operating system libraries, causing failures when they don't match with the template. Unfortunately after some tests with the configure script, I couldn't find any way to include `rpath'! Even though `-rpath-link' is present in all linking commands during Coreutils' build, the installed files still don't have it! So I was forced to use PatchELF. However, one problem is that Coreutils installs many programs, not just one like Bash or AWK. As a brute-force solution, with this commit, we are running PatchELF on all the installed programs. It won't hurt those that already have it, but it will fix all those that don't. With this commit, I am also making the following non-related small changes: - In `build-rules.mk', the `&&' characters were placed at the start of the line for better readability. - Bash, Readline and NCURSES are now built in parallel on systems that support it (during `basic.mk').
Diffstat (limited to 'reproduce/software/make/basic.mk')
-rw-r--r--reproduce/software/make/basic.mk35
1 files changed, 27 insertions, 8 deletions
diff --git a/reproduce/software/make/basic.mk b/reproduce/software/make/basic.mk
index c800411..f210d79 100644
--- a/reproduce/software/make/basic.mk
+++ b/reproduce/software/make/basic.mk
@@ -438,7 +438,7 @@ $(ibidir)/ncurses: $(tdir)/ncurses-$(ncurses-version).tar.gz \
--with-shared --enable-rpath --without-normal \
--without-debug --with-cxx-binding \
--with-cxx-shared --enable-widec --enable-pc-files \
- --with-pkg-config=$(ildir)/pkgconfig )
+ --with-pkg-config=$(ildir)/pkgconfig, -j$(numthreads))
# Unfortunately there are many problems with `ncurses' using
# "normal" (or 8-bit) characters. The standard way that will work
@@ -509,7 +509,7 @@ $(ibidir)/readline: $(tdir)/readline-$(readline-version).tar.gz \
$(ibidir)/ncurses
$(call gbuild, $<, readline-$(readline-version), static, \
--with-curses --disable-install-examples, \
- SHLIB_LIBS="-lncursesw" ) \
+ SHLIB_LIBS="-lncursesw" -j$(numthreads)) \
&& echo "GNU Readline $(readline-version)" > $@
$(ibidir)/patchelf: $(tdir)/patchelf-$(patchelf-version).tar.gz \
@@ -580,7 +580,8 @@ $(ibidir)/bash: $(tdir)/bash-$(bash-version).tar.lz \
else stopt=""; \
fi; \
$(call gbuild, $<, bash-$(bash-version),, \
- --with-installed-readline=$(ildir) $$stopt )
+ --with-installed-readline=$(ildir) $$stopt, \
+ -j$(numthreads))
# Atleast on GNU/Linux systems, Bash doesn't include RPATH by
# default. So, we have to manually include it, currently we are
@@ -738,11 +739,29 @@ $(ibidir)/wget: $(tdir)/wget-$(wget-version).tar.lz \
$(ibidir)/coreutils: $(tdir)/coreutils-$(coreutils-version).tar.xz \
$(ibidir)/openssl
# Coreutils will use the hashing features of OpenSSL's `libcrypto'.
- # See Tar's comments for the `-j' option.
- $(call gbuild, $<, coreutils-$(coreutils-version), static, \
- LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
- --enable-rpath --disable-silent-rules --with-openssl, \
- -j$(numthreads)) \
+ #
+ # For some reason, with this configuration (by default it says that
+ # it supports `rpath'), Coreutils doesn't include `rpath' in its
+ # installed executables. So we have to manually add them after the
+ # standard build is complete. One problem is that Coreutils
+ # installs many executables. So to simplify things, we'll just
+ # manually add `rpath' to everything in `.local/bin' using
+ # `patchelf' on non-Mac systems. It won't affect those that already
+ # have it.
+ #
+ # The echo after the PatchELF loop is to avoid a crash if the last
+ # file that PatchELF encounters is not usable (and it returns with
+ # an error).
+ $(call gbuild, $<, coreutils-$(coreutils-version), static, \
+ LDFLAGS="$(LDFLAGS)" CPPFLAGS="$(CPPFLAGS)" \
+ --disable-silent-rules --with-openssl=yes, \
+ -j$(numthreads)) \
+ && if [ x$(on_mac_os) != xyes ]; then \
+ for f in $(ibdir)/*; do \
+ $(ibdir)/patchelf --set-rpath $(ildir) $$f; \
+ done; \
+ echo "PatchELF applied to all programs."; \
+ fi \
&& echo "GNU Coreutils $(coreutils-version)" > $@
$(ibidir)/diffutils: $(tdir)/diffutils-$(diffutils-version).tar.xz \