diff options
-rw-r--r-- | README.md | 10 | ||||
-rw-r--r-- | etc/defaults/CC/stage-0.TARGETS | 10 | ||||
-rwxr-xr-x | etc/scripts/bootstrap-busybox/bootstrap.sh | 2 | ||||
-rw-r--r-- | src/bootstrap/stage-0-binutils.TARGETS | 7 | ||||
-rw-r--r-- | src/bootstrap/stage-0-busybox.TARGETS | 1 | ||||
-rw-r--r-- | src/bootstrap/stage-0-gcc.TARGETS | 2 | ||||
-rw-r--r-- | src/bootstrap/stage-0-make.TARGETS | 1 |
7 files changed, 24 insertions, 9 deletions
@@ -119,10 +119,10 @@ For bootstrapping the toolchains, the build host must be a Linux system with: 3. C compiler (e.g., TinyCC, old GCC) The C compiler for bootstrapping can be specified by setting the fields -`BOOTSTRAP_CC` and `BOOTSTRAP_PATH` in configuration variable `TOOLCHAIN_CONFIG` -(e.g., on command line `-D'{"TOOLCHAIN_CONFIG": {"BOOTSTRAP_CC": "gcc"}}'`). If -not set, the C compiler is assumed to be `cc` available in the search paths -`/bin` or `/usr/bin`. +`BOOTSTRAP_CC`, `BOOTSTRAP_CFLAGS`, and `BOOTSTRAP_PATH` in configuration +variable `TOOLCHAIN_CONFIG` (e.g., on command line `-D'{"TOOLCHAIN_CONFIG": +{"BOOTSTRAP_CC": "gcc"}}'`). If not set, the C compiler is assumed to be `cc` +available in the search paths `/bin` or `/usr/bin`. *Note that currently supported build hosts are required to be an `x86_64` architecture and use either the GNU or musl C library.* @@ -158,6 +158,8 @@ Fields for building the toolchains: - `BOOTSTRAP_CC`: The initial C compiler for bootstrapping (default: `"cc"`) +- `BOOTSTRAP_CFLAGS`: + The initial C compile flags for bootstrapping (default: `["-w"]`) - `BOOTSTRAP_PATH`: Search path for the initial C compiler (default: `["/bin", "/usr/bin"]`) - `HOST_SYSTEM_HDR_DIR`: diff --git a/etc/defaults/CC/stage-0.TARGETS b/etc/defaults/CC/stage-0.TARGETS index f58d2bf..0877ffd 100644 --- a/etc/defaults/CC/stage-0.TARGETS +++ b/etc/defaults/CC/stage-0.TARGETS @@ -12,6 +12,16 @@ , "default": "cc" } ] + , "CFLAGS": + { "type": "lookup" + , "map": + { "type": "var" + , "name": "TOOLCHAIN_CONFIG" + , "default": {"type": "empty_map"} + } + , "key": "BOOTSTRAP_CFLAGS" + , "default": ["-w"] + } , "PATH": { "type": "lookup" , "map": diff --git a/etc/scripts/bootstrap-busybox/bootstrap.sh b/etc/scripts/bootstrap-busybox/bootstrap.sh index cb9b2fb..a49d53c 100755 --- a/etc/scripts/bootstrap-busybox/bootstrap.sh +++ b/etc/scripts/bootstrap-busybox/bootstrap.sh @@ -7,7 +7,7 @@ APPLET_GROUP=$2 APPLET_NAME=$3 export CC=${CC:-cc} -export CFLAGS="-D_GNU_SOURCE -Iinclude -I${SRCDIR} -I${SRCDIR}/include" +export CFLAGS="${CFLAGS:-} -D_GNU_SOURCE -Iinclude -I${SRCDIR} -I${SRCDIR}/include" DEP_SRCS=" libbb/bb_pwd.c diff --git a/src/bootstrap/stage-0-binutils.TARGETS b/src/bootstrap/stage-0-binutils.TARGETS index 3a42b4a..f1a8fb1 100644 --- a/src/bootstrap/stage-0-binutils.TARGETS +++ b/src/bootstrap/stage-0-binutils.TARGETS @@ -13,7 +13,7 @@ { "type": ["@", "rules", "CC/foreign/shell", "data"] , "cmds": [ "echo 'int main() {int i=1; return *((char*)&i) == 1;}' > endian_test.c" - , "${CC} -o endian_test endian_test.c" + , "${CC} ${CFLAGS} -o endian_test endian_test.c" , "CFLAGS=\"-D__$(./endian_test && echo BIG || echo LITTLE)_ENDIAN__=1\"" , "echo \"${CFLAGS}\" > ${DESTDIR}/cflags" ] @@ -36,7 +36,8 @@ [ "export LD=${CC}" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=${LOCALBASE}/bin:$PATH" - , "export CFLAGS=\"$(cat flags/cflags)\"" + , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags)\"" + , "unset LDFLAGS" , "./bootstrap-ar.sh src >build.log 2>&1 || (cat build.log && exit 1)" , "mv ar ${DESTDIR}/bin/" ] @@ -56,7 +57,7 @@ , "export AR=${LOCALBASE}/bin/ar" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=${LOCALBASE}/bin:$PATH" - , "export CFLAGS=\"$(cat flags/cflags)\"" + , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags)\"" , "unset LDFLAGS" , "if [ -f /lib/ld-musl-$(uname -m).so.1 ]; then" , " ln -s /lib/ld-musl-$(uname -m).so.1 ${TMPDIR}/ldd" diff --git a/src/bootstrap/stage-0-busybox.TARGETS b/src/bootstrap/stage-0-busybox.TARGETS index a6964e1..dff331d 100644 --- a/src/bootstrap/stage-0-busybox.TARGETS +++ b/src/bootstrap/stage-0-busybox.TARGETS @@ -54,6 +54,7 @@ , "export MAKE=${LOCALBASE}/bin/make" , "export CC=${LOCALBASE}/gcc/bin/gcc" , "export CXX=${LOCALBASE}/gcc/bin/g++" + , "unset CFLAGS LDFLAGS" , "${MAKE} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" defconfig >configure.log 2>&1 || (cat configure.log && exit 1)" , "${MAKE} -j${NJOBS} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" >build.log 2>&1 || (cat configure.log build.log && exit 1)" , "${MAKE} -j${NJOBS} HOSTCC=${CC} HOSTCXX=${CXX} CONFIG_EXTRA_LDLIBS=\"m resolv\" CONFIG_PREFIX=${DESTDIR} install >>build.log 2>&1 || (cat configure.log build.log && exit 1)" diff --git a/src/bootstrap/stage-0-gcc.TARGETS b/src/bootstrap/stage-0-gcc.TARGETS index 777b947..33812ef 100644 --- a/src/bootstrap/stage-0-gcc.TARGETS +++ b/src/bootstrap/stage-0-gcc.TARGETS @@ -103,7 +103,7 @@ , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=$(pwd)/binutils/bin:${LOCALBASE}/bin:$PATH" , "export BUILD_ROOT_DIR=${ACTION_DIR}" - , "unset CFLAGS LDFLAGS" + , "unset LDFLAGS" , "CONF_ARGS=" , "if [ -n \"$HOST_SYSTEM_HDR_DIR\" ]; then" , " CONF_ARGS=\"$CONF_ARGS --with-sysroot=/ --with-native-system-header-dir=$HOST_SYSTEM_HDR_DIR\"" diff --git a/src/bootstrap/stage-0-make.TARGETS b/src/bootstrap/stage-0-make.TARGETS index 3a38240..3dcefb3 100644 --- a/src/bootstrap/stage-0-make.TARGETS +++ b/src/bootstrap/stage-0-make.TARGETS @@ -18,6 +18,7 @@ , "export LD=${CC}" , "export AR=true" , "export RANLIB=true" + , "unset LDFLAGS" , "cd ${TMPDIR}" , "${WORKDIR}/configure --prefix=/ --disable-nls --disable-rpath --disable-load --disable-dependency-tracking >configure.log 2>&1 || (cat configure.log && exit 1)" , "./build.sh >build.log 2>&1 || true" |