diff --git a/Makefile b/Makefile index a37180bd..f2aa2aa6 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,10 @@ BOARD ?= qemu # If musl-libc is being used in the initrd, set the heads_cc # variable to point to it. musl_dep := musl -heads_cc := $(INSTALL)/bin/musl-gcc +heads_cc := $(INSTALL)/bin/musl-gcc \ + -fdebug-prefix-map=$(pwd)=heads \ + -gno-record-gcc-switches \ + #heads_cc := $(HOME)/install/x86_64-linux-musl/x86_64-linux-musl/bin/gcc all: $(BOARD).rom diff --git a/modules/cryptsetup b/modules/cryptsetup index dd4015e3..81748c2d 100644 --- a/modules/cryptsetup +++ b/modules/cryptsetup @@ -8,18 +8,23 @@ cryptsetup_tar := cryptsetup-$(cryptsetup_version).tar.xz cryptsetup_url := https://www.kernel.org/pub/linux/utils/cryptsetup/v1.7/cryptsetup-$(cryptsetup_version).tar.xz cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6adc02 +# Use an empty prefix so that the executables will not include the +# build path. cryptsetup_configure := ./configure \ CC="$(heads_cc)" \ - CFLAGS="-I$(INSTALL)/include" \ - LDFLAGS="-L$(INSTALL)/lib" \ --host i386-elf-linux \ - --prefix "$(INSTALL)" \ + --prefix "" \ --disable-gcrypt-pbkdf2 \ --with-crypto_backend=kernel \ +# but after building, replace prefix so that they will be installed +# in the correct directory. cryptsetup_target := \ -j 8 \ - install + && $(MAKE) \ + -C $(build)/$(cryptsetup_dir) \ + prefix="$(INSTALL)" \ + install cryptsetup_output := \ src/.libs/cryptsetup \ diff --git a/modules/gpg b/modules/gpg index 6ca97e61..ac499057 100644 --- a/modules/gpg +++ b/modules/gpg @@ -8,10 +8,15 @@ gpg_tar := gnupg-$(gpg_version).tar.bz2 gpg_url := https://www.gnupg.org/ftp/gcrypt/gnupg/$(gpg_tar) gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276 +# For reproducibility reasons we have to override the exec_prefix +# and datarootdir on the configure line so that the Makefiles will +# be generated with the correct paths, but then re-write them when +# we use the install target so that they will be copied to the correct +# location. gpg_configure := ./configure \ CC="$(heads_cc)" \ --host i386-elf-linux \ - --prefix $(INSTALL) \ + --prefix "" \ --disable-bzip2 \ --disable-gpg \ --disable-gpgsm \ @@ -32,7 +37,14 @@ gpg_configure := ./configure \ --disable-dns-cert \ --disable-regex \ -gpg_target := -j 8 install +# Run one build to generate the executables with the pre-defined +# exec_prefix and datarootdir, then a second make to install the binaries +# into our actual target location +gpg_target := -j 8 \ + && $(MAKE) -C $(build)/$(gpg_dir) \ + exec_prefix=$(pwd)/install \ + datarootdir=$(pwd)/install/share \ + install gpg_output := g10/gpgv diff --git a/modules/libuuid b/modules/libuuid index 5ab2c3a8..855a9908 100644 --- a/modules/libuuid +++ b/modules/libuuid @@ -8,10 +8,14 @@ libuuid_hash := 46af3275291091009ad7f1b899de3d0cea0252737550e7919d17237997db5644 libuuid_configure := ./configure \ CC="$(heads_cc)" \ - --prefix $(INSTALL) \ + --prefix "" \ --host i386-elf-linux \ -libuuid_target := install +libuuid_target := -j 8 && \ + $(MAKE) \ + -C "$(build)/$(libuuid_dir)" \ + prefix="$(INSTALL)" \ + install libuuid_libraries := .libs/libuuid.so libuuid_depends := $(musl_dep) diff --git a/modules/popt b/modules/popt index a8468eb3..9803bec3 100644 --- a/modules/popt +++ b/modules/popt @@ -8,10 +8,14 @@ popt_hash := e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8 popt_configure := ./configure \ CC="$(heads_cc)" \ - --prefix $(INSTALL) \ + --prefix "" \ --host i386-elf-linux \ -popt_target := install +popt_target := -j 8 \ + && $(MAKE) \ + -C "$(build)/$(popt_dir)" \ + prefix="$(INSTALL)" \ + install popt_libraries := ./libs/libpopt.so popt_depends := $(musl_dep) diff --git a/modules/qrencode b/modules/qrencode index 8f0ab135..8f1ae921 100644 --- a/modules/qrencode +++ b/modules/qrencode @@ -10,10 +10,14 @@ qrencode_output := .libs/libqrencode.so.$(qrencode_version) qrencode_configure := ./configure \ CC="$(heads_cc)" \ - --prefix $(INSTALL) \ + --prefix "" \ --without-tools \ --host i386-elf-linux \ -qrencode_target := install +qrencode_target := -j 8 \ + && $(MAKE) \ + -C "$(build)/$(qrencode_dir)" \ + prefix="$(INSTALL)" \ + install qrencode_depends := $(musl_dep)