From 6a24c58cf13129766b64eca8bbdec678e68b6d4e Mon Sep 17 00:00:00 2001 From: Mohammad Akhlaghi Date: Thu, 29 Nov 2018 12:28:23 +0000 Subject: Using proper shell when building programs with GNU tools Previously the SHELL environment variable was only set in `./configure', `make', and `make install' after our internal Bash was installed. This caused problems with Lzip's configure script on older shells (tested on a Mac OS by Raul Infante Sainz). So now, before having our own Bash, we set it to a possibly existing Bash on the system and if that isn't present, just the standard `/bin/sh'. --- reproduce/src/make/dependencies-build-rules.mk | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk index 9ff3463..eafa29c 100644 --- a/reproduce/src/make/dependencies-build-rules.mk +++ b/reproduce/src/make/dependencies-build-rules.mk @@ -53,7 +53,10 @@ gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ fi; \ check="$(6)"; \ if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \ - if [ -f $(ibdir)/bash ]; then shellop="SHELL=$(ibdir)/bash"; fi; \ + if [ -f $(ibdir)/bash ]; then shellop="SHELL=$(ibdir)/bash"; \ + elif [ -f /bin/bash ]; then shellop="SHELL=/bin/bash"; \ + else shellop="SHELL=/bin/sh"; \ + fi; \ cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) && \ ./configure $(4) "$$shellop" --prefix=$(idir) && \ make "$$shellop" $(5) && \ @@ -67,11 +70,15 @@ gbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ # CMake # ----- +# +# According to the link below, in CMake `/bin/sh' is hardcoded, so there is +# no way to change it. +# +# https://stackoverflow.com/questions/21167014/how-to-set-shell-variable-in-makefiles-generated-by-cmake cbuild = if [ x$(static_build) = xyes ] && [ $(3)x = staticx ]; then \ export LDFLAGS="$$LDFLAGS -static"; \ opts="-DBUILD_SHARED_LIBS=OFF"; \ fi; \ - export SHELL=$(ibdir)/bash; \ cd $(ddir) && rm -rf $(2) && tar xf $(1) && cd $(2) && \ rm -rf pipeline-build && mkdir pipeline-build && \ cd pipeline-build && \ -- cgit v1.2.1