diff options
author | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-06-12 14:59:45 +0200 |
---|---|---|
committer | Klaus Aehlig <klaus.aehlig@huawei.com> | 2024-06-28 16:23:54 +0200 |
commit | 1c436ab541c61eee970bb1bb6da93d48a05d7824 (patch) | |
tree | bb5ebf9c0794fa3cf3200216f199229c23c2016a /src | |
parent | 44405fcf083ce8fd16d966263aa708e1b86194ba (diff) | |
download | bootstrappable-toolchain-1c436ab541c61eee970bb1bb6da93d48a05d7824.tar.gz |
stage-0/gcc: use our own sh as interpreter
Unfortunately, this does not entirely removes the requirement of
a /bin/sh being present, as awk(1) is invoked during the build to
use popen(3) in one place, a libc function that has a hard-coded
reference to /bin/sh. Nevertheless, using our interpreter wherever
possible greatly reduces the dependency on the host system.
Diffstat (limited to 'src')
-rw-r--r-- | src/bootstrap/stage-0-gcc.TARGETS | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/bootstrap/stage-0-gcc.TARGETS b/src/bootstrap/stage-0-gcc.TARGETS index 33812ef..5f067a3 100644 --- a/src/bootstrap/stage-0-gcc.TARGETS +++ b/src/bootstrap/stage-0-gcc.TARGETS @@ -103,6 +103,9 @@ , "export MAKE=${LOCALBASE}/bin/make" , "export PATH=$(pwd)/binutils/bin:${LOCALBASE}/bin:$PATH" , "export BUILD_ROOT_DIR=${ACTION_DIR}" + , "export SHELL=${LOCALBASE}/bin/sh" + , "export CONFIG_SHELL=${LOCALBASE}/bin/sh" + , "export CXX=no" , "unset LDFLAGS" , "CONF_ARGS=" , "if [ -n \"$HOST_SYSTEM_HDR_DIR\" ]; then" @@ -131,8 +134,16 @@ , "cp -r binutils/. ${DESTDIR}/." , "chmod -R +w ${DESTDIR}/*" , "cd src" + , "for f in $(find . -type f -exec grep -q '#! */bin/sh' {} \\; -print)" + , "do" + , " cp $f $f.__work" + , " rm $f" + , " chmod 755 $f.__work" + , " sed -i 's|#! */bin/sh|#!'\"${SHELL}\"'|g' $f.__work" + , " mv $f.__work $f" + , "done" , "export check_msgfmt=no # do not use system's msgfmt, if available" - , "./configure --prefix=/ --enable-languages=c,c++ --disable-multilib --disable-shared --disable-lto --disable-gcov --disable-libmudflap --disable-libgomp --disable-libssp --disable-nls --disable-libitm ${CONF_ARGS} >configure.log 2>&1 || (cat configure.log && exit 1)" + , "${SHELL} ./configure --prefix=/ --enable-languages=c,c++ --disable-multilib --disable-shared --disable-lto --disable-gcov --disable-libmudflap --disable-libgomp --disable-libssp --disable-nls --disable-libitm ${CONF_ARGS} >configure.log 2>&1 || (cat configure.log && exit 1)" , "${MAKE} -j${NJOBS} >build.log 2>&1 || (cat configure.log build.log && exit 1)" , "${MAKE} -j${NJOBS} DESTDIR=${DESTDIR} install-strip >>build.log 2>&1 || (cat configure.log build.log && exit 1)" , "cd ${DESTDIR}" |