aboutsummaryrefslogtreecommitdiff
path: root/reproduce/src/make
diff options
context:
space:
mode:
Diffstat (limited to 'reproduce/src/make')
-rw-r--r--reproduce/src/make/dependencies-basic.mk51
-rw-r--r--reproduce/src/make/dependencies-build-rules.mk6
2 files changed, 53 insertions, 4 deletions
diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index 4c57e30..45a4192 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -134,8 +134,16 @@ $(tarballs): $(tdir)/%:
# GNU Lzip: For a static build, the `-static' flag should be given to
# LDFLAGS on the command-line (not from the environment).
$(ibdir)/lzip: $(tdir)/lzip-$(lzip-version).tar.gz
+ echo; echo $(static_build); echo;
+ifeq ($(static_build),yes)
$(call gbuild,$(subst $(tdir)/,,$<), lzip-$(lzip-version), , \
- LDFLAGS="-static")
+ LDFLAGS="-static")
+else
+ $(call gbuild,$(subst $(tdir)/,,$<), lzip-$(lzip-version))
+endif
+
+
+
# GNU Gzip.
@@ -144,24 +152,47 @@ $(ibdir)/gzip: $(tdir)/gzip-$(gzip-version).tar.lz \
$(call gbuild,$(subst $(tdir)/,,$<), gzip-$(gzip-version), static)
+
+
+
# Zlib: its `./configure' doesn't use Autoconf's configure script, it just
# accepts a direct `--static' option.
$(ildir)/libz.a: $(tdir)/zlib-$(zlib-version).tar.gz
+ifeq ($(static_build),yes)
$(call gbuild,$(subst $(tdir)/,,$<), zlib-$(zlib-version), , \
--static)
+else
+ $(call gbuild,$(subst $(tdir)/,,$<), zlib-$(zlib-version))
+endif
+
+
+
+
# XZ Utils
$(ibdir)/xz: $(tdir)/xz-$(xz-version).tar.gz
$(call gbuild,$(subst $(tdir)/,,$<), xz-$(xz-version), static)
+
+
+
+
# Bzip2: Bzip2 doesn't have a configure script.
$(ibdir)/bzip2: $(tdir)/bzip2-$(bzip2-version).tar.gz
tdir=bzip2-$(bzip2-version); \
+ if [ $(static_build) = yes ]; then \
+ makecommand="make LDFLAGS=-static"; \
+ else \
+ makecommand="make"; \
+ fi; \
cd $(ddir) && rm -rf $$tdir && tar xf $< && cd $$tdir && \
- make LDFLAGS=-static && make install PREFIX=$(idir) && \
+ $$makecommand && make install PREFIX=$(idir) && \
cd .. && rm -rf $$tdir
+
+
+
# GNU Binutils:
$(ibdir)/nm: $(tdir)/binutils-$(binutils-version).tar.lz \
$(ibdir)/lzip \
@@ -169,6 +200,10 @@ $(ibdir)/nm: $(tdir)/binutils-$(binutils-version).tar.lz \
$(call gbuild,$(subst $(tdir)/,,$<), binutils-$(binutils-version), \
static)
+
+
+
+
# GNU Tar: When built statically, tar gives a segmentation fault on
# unpacking Bash. So we'll build it dynamically.
$(ibdir)/tar: $(tdir)/tar-$(tar-version).tar.gz \
@@ -179,6 +214,10 @@ $(ibdir)/tar: $(tdir)/tar-$(tar-version).tar.gz \
$(ibdir)/nm
$(call gbuild,$(subst $(tdir)/,,$<), tar-$(tar-version))
+
+
+
+
# GNU Make: Unfortunately it needs dynamic linking in two instances: when
# loading objects (dynamically linked libraries), or when using the
# `getpwnam' function (for tilde expansion). The first can be disabled with
@@ -188,8 +227,16 @@ $(ibdir)/make: $(tdir)/make-$(make-version).tar.lz \
$(ibdir)/tar
$(call gbuild,$(subst $(tdir)/,,$<), make-$(make-version))
+
+
+
+
# GNU Bash
$(ibdir)/bash: $(tdir)/bash-$(bash-version).tar.gz \
$(ibdir)/make
+ifeq ($(static_build),yes)
$(call gbuild,$(subst $(tdir)/,,$<), bash-$(bash-version), , \
--enable-static-link)
+else
+ $(call gbuild,$(subst $(tdir)/,,$<), bash-$(bash-version))
+endif
diff --git a/reproduce/src/make/dependencies-build-rules.mk b/reproduce/src/make/dependencies-build-rules.mk
index 31e7759..49838f3 100644
--- a/reproduce/src/make/dependencies-build-rules.mk
+++ b/reproduce/src/make/dependencies-build-rules.mk
@@ -48,7 +48,9 @@
# 4: Extra configuration options.
# 5: Extra options/arguments to pass to Make.
# 6: Step to run between `make' and `make install': usually `make check'.
-gbuild = if [ $(3)x = staticx ]; then export LDFLAGS="$$LDFLAGS -static"; fi; \
+gbuild = if [ $(static_build) = yes ] && $(3)x = staticx ]; then \
+ export LDFLAGS="$$LDFLAGS -static"; \
+ fi; \
check="$(6)"; \
if [ x"$$check" = x ]; then check="echo Skipping-check"; fi; \
cd $(ddir) && rm -rf $(2) && tar xf $(tdir)/$(1) && cd $(2) && \
@@ -64,7 +66,7 @@ gbuild = if [ $(3)x = staticx ]; then export LDFLAGS="$$LDFLAGS -static"; fi; \
# CMake
# -----
-cbuild = if [ $(3)x = staticx ]; then \
+cbuild = if [ $(static_build) = yes ] && [ $(3)x = staticx ]; then \
export LDFLAGS="$$LDFLAGS -static"; \
opts="-DBUILD_SHARED_LIBS=OFF"; \
fi; \