diff options
-rw-r--r-- | doc/BOOTSTRAP.md | 2 | ||||
-rw-r--r-- | etc/repos.json | 2 | ||||
-rw-r--r-- | etc/scripts/TARGETS | 1 | ||||
-rwxr-xr-x | etc/scripts/bootstrap-ar.sh | 50 | ||||
-rw-r--r-- | src/bootstrap/stage-0-binutils.TARGETS | 23 |
5 files changed, 14 insertions, 64 deletions
diff --git a/doc/BOOTSTRAP.md b/doc/BOOTSTRAP.md index 2d70641..b7b21f7 100644 --- a/doc/BOOTSTRAP.md +++ b/doc/BOOTSTRAP.md @@ -37,7 +37,7 @@ to missing `ar`, final linking is done via custom compile commands. Bootstrapping the archiver `ar`, requires the Busybox "essentials" and `make` from the previous steps. This archiver has proper indexing support and is compiled via its `Makefile`. However, due to missing `ar` from earlier stages, -final linking is done via custom script. +final linking is done via custom compile commands. ### 4. Binutils diff --git a/etc/repos.json b/etc/repos.json index cc85614..267aa49 100644 --- a/etc/repos.json +++ b/etc/repos.json @@ -1,7 +1,6 @@ { "main": "gcc-latest-musl+tools" , "repositories": { "patches": {"repository": {"type": "file", "path": "etc/patches"}} - , "scripts": {"repository": {"type": "file", "path": "etc/scripts"}} , "imports": {"repository": {"type": "file", "path": "etc/imports"}} , "defaults": {"repository": {"type": "file", "path": "etc/defaults"}} , "bootstrap": {"repository": {"type": "file", "path": "src/bootstrap"}} @@ -273,7 +272,6 @@ { "rules": "rules/stage-0" , "busybox": "stage-0/busybox" , "make": "stage-0/make" - , "scripts": "scripts" } } , "stage-0/gcc": diff --git a/etc/scripts/TARGETS b/etc/scripts/TARGETS deleted file mode 100644 index a3f7fa0..0000000 --- a/etc/scripts/TARGETS +++ /dev/null @@ -1 +0,0 @@ -{"bootstrap-ar": {"type": "install", "deps": ["bootstrap-ar.sh"]}} diff --git a/etc/scripts/bootstrap-ar.sh b/etc/scripts/bootstrap-ar.sh deleted file mode 100755 index 609b0d1..0000000 --- a/etc/scripts/bootstrap-ar.sh +++ /dev/null @@ -1,50 +0,0 @@ -#!/bin/sh - -set -eu - -SRCDIR=$1 - -( cd ${SRCDIR} - - export CC=${CC:-cc} - export LD=${LD:-${CC}} - export AR=true - export RANLIB=true - export MAKE=${MAKE:-make} - export CFLAGS="${CFLAGS:-} -I." - - AR_SRCS=" - binutils/ar.c - binutils/arparse.c - binutils/arlex.c - binutils/arsup.c - binutils/not-ranlib.c - binutils/rename.c - binutils/binemul.c - binutils/emul_vanilla.c - binutils/bucomm.c - binutils/version.c - binutils/filemode.c - " - - # fake dlfcn.h in order to disable dynamic loads during configure - echo '#error fail here' > dlfcn.h - - # configure and build object files for bfd, libiberty, zlib, and libsframe - ./configure --prefix=/ --disable-nls --enable-gprofng=no --disable-werror --enable-deterministic-archives --without-zstd - ${MAKE} MAKEINFO=true all-binutils || true - - export CFLAGS="${CFLAGS} -DDEFAULT_AR_DETERMINISTIC=1 -Dbin_dummy_emulation="bin_vanilla_emulation" -Iinclude -Ibfd " - - # build archiver object files - NUM=0 - for SRC in ${AR_SRCS}; do - # use short object file name to keep final command line short - ${CC} ${CFLAGS} -c ${SRC} -o ${NUM}.o - NUM=$((${NUM}+1)) - done - - ${CC} ${CFLAGS} -o ar $(ls *.o bfd/*.o libiberty/*.o zlib/*.o libsframe/*.o | LC_ALL=C sort) -ldl -) - -mv ${SRCDIR}/ar . diff --git a/src/bootstrap/stage-0-binutils.TARGETS b/src/bootstrap/stage-0-binutils.TARGETS index f1a8fb1..5740ddf 100644 --- a/src/bootstrap/stage-0-binutils.TARGETS +++ b/src/bootstrap/stage-0-binutils.TARGETS @@ -20,13 +20,7 @@ , "outs": ["cflags"] } , "staged_bootstrap_sources_and_flags": - { "type": "install" - , "dirs": - [ ["files", "src"] - , ["flag_files", "flags"] - , [["@", "scripts", "", "bootstrap-ar"], "."] - ] - } + {"type": "install", "dirs": [["files", "src"], ["flag_files", "flags"]]} , "bootstrap-ar": { "type": ["@", "rules", "CC/foreign/shell", "data"] , "project": ["staged_bootstrap_sources_and_flags"] @@ -34,12 +28,21 @@ [["@", "busybox", "", "bootstrap"], ["@", "make", "", "bootstrap"]] , "cmds": [ "export LD=${CC}" + , "export AR=true" + , "export RANLIB=true" , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=${LOCALBASE}/bin:$PATH" - , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags)\"" + , "export CFLAGS=\"${CFLAGS} $(cat flags/cflags) -I${TMPDIR}\"" , "unset LDFLAGS" - , "./bootstrap-ar.sh src >build.log 2>&1 || (cat build.log && exit 1)" - , "mv ar ${DESTDIR}/bin/" + , "printf '#error fail here' > ${TMPDIR}/dlfcn.h # disable via fake header" + , "cd src" + , "./configure --prefix=/ --disable-nls --enable-gprofng=no --disable-werror --enable-deterministic-archives --without-zstd >configure.log 2>&1 || (cat configure.log && exit 1)" + , "${MAKE} MAKEINFO=true all-binutils >build.log 2>&1 || true" + , "cd binutils" + , "AR_SRCS='ar.c arparse.c arlex.c arsup.c not-ranlib.c rename.c binemul.c emul_vanilla.c bucomm.c version.c filemode.c'" + , "AR_DEPS=\"$(ls ../bfd/*.o ../libiberty/*.o ../zlib/*.o ../libsframe/*.o | LC_ALL=C sort)\"" + , "AR_CFLAGS=\"${CFLAGS} -DDEFAULT_AR_DETERMINISTIC=1 -Dbin_dummy_emulation=bin_vanilla_emulation -I../include -I../bfd\"" + , "${CC} ${AR_CFLAGS} -o ${DESTDIR}/bin/ar ${AR_SRCS} ${AR_DEPS} -ldl >../build.log 2>&1 || (cat ../configure.log ../build.log && exit 1)" ] , "outs": ["bin/ar"] } |