Define $(CROSS_TOOLS) to ensure reproducible builds (issue #173)

Each of the submodule configuration files defined a subset of the
cross compiler tools that it used and many were picking up the
system `ar`, `nm`, `strip, `ld`, etc.  They all now use a `Makefile`
macro that defines the path to the proper cross compiler tools.

For ones that need the tools, but not the musl-libc gcc,
there is $(CROSS_TOOLS_NOCC) that is all of them without gcc.
This is for musl-libc itself, as well as xen and the Linux kernel.
This commit is contained in:
Trammell Hudson 2017-04-08 13:23:34 -04:00
parent ae6bed14a2
commit 07eb5e9717
Failed to extract signature
19 changed files with 61 additions and 41 deletions

View File

@ -73,6 +73,18 @@ heads_cc := $(INSTALL)/bin/musl-gcc \
-gno-record-gcc-switches \
CROSS := $(build)/../crossgcc/x86_64-linux-musl/bin/x86_64-musl-linux-
CROSS_TOOLS_NOCC := \
AR="$(CROSS)ar" \
LD="$(CROSS)ld" \
STRIP="$(CROSS)strip" \
NM="$(CROSS)nm" \
OBJCOPY="$(CROSS)objcopy" \
OBJDUMP="$(CROSS)objdump" \
CROSS_TOOLS := \
CC="$(heads_cc)" \
$(CROSS_TOOLS_NOCC) \
all: $(BOARD).rom

View File

@ -10,8 +10,7 @@ busybox_configure := $(MAKE) CC="$(heads_cc)" oldconfig
busybox_config := busybox.config
busybox_output := busybox
busybox_target := \
CC="$(heads_cc)" \
STRIP="$(CROSS)strip" \
$(CROSS_TOOLS) \
CONFIG_PREFIX="$(initrd_dir)" \
$(MAKE_JOBS) \
install

View File

@ -11,7 +11,7 @@ cryptsetup_hash := af2b04e8475cf40b8d9ffd97a1acfa73aa787c890430afd89804fb544d6ad
# Use an empty prefix so that the executables will not include the
# build path.
cryptsetup_configure := ./configure \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-gcrypt-pbkdf2 \

View File

@ -8,8 +8,7 @@ dropbear_url := http://matt.ucc.asn.au/dropbear/releases/$(dropbear_tar)
dropbear_hash := 2720ea54ed009af812701bcc290a2a601d5c107d12993e5d92c0f5f81f718891
dropbear_configure := ./configure \
CC="$(heads_cc)" \
AR="$(CROSS)ar" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
@ -17,6 +16,7 @@ dropbear_config :=
dropbear_output := ssh scp
dropbear_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
dbclient scp \
&& \

View File

@ -13,7 +13,7 @@ flashrom_hash := cb3156b0f63eb192024b76c0814135930297aac41f80761a5d293de769783c4
flashrom_target := \
$(MAKE_JOBS) \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
WARNERROR=no \
CONFIG_ENABLE_LIBUSB0_PROGRAMMERS=no \
CONFIG_ENABLE_LIBUSB1_PROGRAMMERS=no \

View File

@ -14,8 +14,7 @@ gpg_hash := 6b47a3100c857dcab3c60e6152e56a997f2c7862c1b8b2b25adf3884a1ae2276
# we use the install target so that they will be copied to the correct
# location.
gpg_configure := ./configure \
CC="$(heads_cc)" \
AR="$(CROSS)ar" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--with-libusb="$(INSTALL)" \
--prefix "/" \

View File

@ -7,9 +7,7 @@ kexec_url := https://kernel.org/pub/linux/utils/kernel/kexec/$(kexec_tar)
kexec_hash := cc7b60dad0da202004048a6179d8a53606943062dd627a2edba45a8ea3a85135
kexec_configure := ./configure \
CC="$(heads_cc)" \
STRIP="$(CROSS)strip" \
AR="$(CROSS)ar" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--target x86_64 \
--prefix="/" \
@ -18,6 +16,7 @@ kexec_configure := ./configure \
kexec_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
install \

View File

@ -8,7 +8,7 @@ libusb_url := https://downloads.sourceforge.net/project/libusb/libusb-1.0/libusb
libusb_hash := 7dce9cce9a81194b7065ee912bcd55eeffebab694ea403ffb91b67db66b1824b
libusb_configure := ./configure \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
--disable-udev \
@ -18,6 +18,7 @@ libusb_configure := ./configure \
# into our actual target location
libusb_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \
libusb_libraries := libusb/.libs/libusb-1.0.so.0

View File

@ -10,7 +10,7 @@ libusb-compat_url := https://downloads.sourceforge.net/project/libusb/libusb-com
libusb-compat_hash := 404ef4b6b324be79ac1bfb3d839eac860fbc929e6acb1ef88793a6ea328bc55a
libusb-compat_configure := ./configure \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "/" \
PKG_CONFIG=/bin/false \
@ -22,6 +22,7 @@ libusb-compat_configure := ./configure \
# into our actual target location
libusb-compat_target := $(MAKE_JOBS) \
DESTDIR="$(INSTALL)" \
$(CROSS_TOOLS) \
install \
libusb-compat_libraries := libusb/.libs/libusb-0.1.so.4

View File

@ -9,7 +9,7 @@ lvm2_hash := 23a3d1cddd41b3ef51812ebf83e9fa491f502fe74130d4263be327a91914660d
# cross compiling test assumes malloc/realloc aren't glibc compat
# so we force it via the configure cache.
lvm2_configure := \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
PKG_CONFIG=/bin/false \
MODPROBE_CMD=/bin/false \
ac_cv_func_malloc_0_nonnull=yes \
@ -17,6 +17,7 @@ lvm2_configure := \
./configure \
--host i386-elf-linux \
--prefix "/" \
--enable-devmapper \
--disable-selinux \
--disable-udev-systemd-background-jobs \
--disable-realtime \
@ -29,12 +30,9 @@ lvm2_configure := \
# not sure why LIB_SUFFIX is not defined in the cross build
lvm2_target := \
$(MAKE_JOBS) \
AR="$(CROSS)ar" \
all \
&& \
$(MAKE) \
-C $(build)/$(lvm2_dir) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
all \
install_device-mapper \
lvm2_libraries := libdm/libdevmapper.so.1.02

View File

@ -13,7 +13,7 @@ mbedtls_configure :=
mbedtls_target := \
SHARED=1 \
DESTDIR=$(INSTALL) \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
$(MAKE_JOBS) \
install

View File

@ -16,6 +16,7 @@ musl_output := ../../install/bin/musl-gcc
# That works, with some hacks...
#
musl_configure := ./configure \
$(CROSS_TOOLS_NOCC) \
CC="$(CROSS)gcc" \
--prefix="$(INSTALL)" \
--syslibdir="/lib" \
@ -24,7 +25,8 @@ musl_configure := ./configure \
musl_target := \
$(MAKE_JOBS) \
AR="$(CROSS)ar" \
$(CROSS_TOOLS_NOCC) \
CC="$(CROSS)gcc" \
install \
musl_libraries := \

View File

@ -18,7 +18,7 @@ pciutils_hash := 64293c6ab9318c40ef262b76d87bd9097531759752bac556e50979b1e63cfe6
pciutils_target := \
$(MAKE_JOBS) \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
ZLIB=no \
HWDB=no \
SHARED=yes \
@ -27,7 +27,7 @@ pciutils_target := \
&& \
$(MAKE) \
-C $(build)/$(pciutils_dir) \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
ZLIB=no \
HWDB=no \
SHARED=yes \

View File

@ -7,14 +7,17 @@ popt_url := http://rpm5.org/files/popt/$(popt_tar)
popt_hash := e728ed296fe9f069a0e005003c3d6b2dde3d9cad453422a10d6558616d304cc8
popt_configure := ./configure \
CC="$(heads_cc)" \
--prefix "" \
$(CROSS_TOOLS) \
--prefix "/" \
--host i386-elf-linux \
popt_target := $(MAKE_JOBS) \
popt_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
&& $(MAKE) \
-C "$(build)/$(popt_dir)" \
prefix="$(INSTALL)" \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
install
popt_libraries := .libs/libpopt.so.0

View File

@ -9,15 +9,17 @@ qrencode_hash := e794e26a96019013c0e3665cb06b18992668f352c5553d0a553f5d144f7f2a7
qrencode_libraries := .libs/libqrencode.so.3
qrencode_configure := ./configure \
CC="$(heads_cc)" \
--prefix "" \
$(CROSS_TOOLS) \
--prefix "/" \
--without-tools \
--host i386-elf-linux \
qrencode_target := $(MAKE_JOBS) \
qrencode_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
&& $(MAKE) \
-C "$(build)/$(qrencode_dir)" \
prefix="$(INSTALL)" \
DESTDIR="$(INSTALL)" \
install
qrencode_depends := $(musl_dep)

View File

@ -12,7 +12,7 @@ tpmtotp_url := https://github.com/osresearch/tpmtotp/archive/v$(tpmtotp_version)
tpmtotp_hash := e8205aa3d19e536080f5974ed06ab9a88c4c3f37870c2f6a3a08a2f39302c22c
tpmtotp_target := \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
CFLAGS="-I$(INSTALL)/include" \
LDFLAGS="-L$(INSTALL)/lib" \

View File

@ -7,10 +7,9 @@ util-linux_url := https://www.kernel.org/pub/linux/utils/util-linux/v2.29/$(util
util-linux_hash := accea4d678209f97f634f40a93b7e9fcad5915d1f4749f6c47bee6bf110fe8e3
util-linux_configure := ./configure \
CC="$(heads_cc)" \
$(CROSS_TOOLS) \
--host i386-elf-linux \
--prefix "$(INSTALL)" \
--datadir "$(INSTALL)/share" \
--prefix "/" \
--oldincludedir "$(INSTALL)/include" \
--without-ncurses \
--without-ncursesw \
@ -24,7 +23,10 @@ util-linux_configure := ./configure \
util-linux_target := \
$(MAKE_JOBS) install
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
install
util-linux_libraries += .libs/libuuid.so.1

View File

@ -10,7 +10,9 @@ xen_hash := b795d5631a85fb68295361067195ecd00003656dacede4ec57533fce33ab5109
xen_output := xen
xen_configure :=
xen_target := $(MAKE_JOBS) \
CC="$(CROSS)gcc -Wno-builtin-macro-redefined -D__FILE__=\\\"__FILE__\\\"" \
LD="$(CROSS)ld" \
xen_target := \
$(MAKE_JOBS) \
$(CROSS_TOOL_NOCC) \
CC="$(CROSS)gcc -Wno-builtin-macro-redefined -D__FILE__=\\\"__FILE__\\\"" \

View File

@ -7,13 +7,13 @@ zlib_url := http://www.zlib.net/$(zlib_tar)
zlib_hash := c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
zlib_configure := \
CC="$(heads_cc)" \
AR="$(CROSS)ar" \
$(CROSS_TOOLS) \
./configure \
--prefix="/" \
zlib_target := \
$(MAKE_JOBS) \
$(CROSS_TOOLS) \
DESTDIR="$(INSTALL)" \
install \