From 1fc2e0af3e427ec8693cbc9394eabeb18e72c78a Mon Sep 17 00:00:00 2001 From: Denis Benato Date: Sat, 7 Dec 2024 17:57:57 +0100 Subject: [PATCH] attr built --- build.sh | 115 ++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 88 insertions(+), 27 deletions(-) diff --git a/build.sh b/build.sh index c18b3c4..9a462d4 100755 --- a/build.sh +++ b/build.sh @@ -202,6 +202,8 @@ export AS="$LFS_TGT-as" export LD="$LFS_TGT-ld" export AR="$LFS_TGT-ar" export RANLIB="$LFS_TGT-ranlib" +export STRIP="$LFS_TGT-strip" +export OBJDUMP="$LFS_TGT-objdump" # remove hardening options for building libraries export CFLAGS="-U_FORTIFY_SOURCE -O2" export CPPFLAGS="-U_FORTIFY_SOURCE -O2" @@ -295,6 +297,7 @@ unset LD unset AS unset AR unset RANLIB +unset STRIP unset OBJDUMP export LD_LIBRARY_PATH="$LD_LIBRARY_PATH_old" @@ -396,9 +399,29 @@ if [ ! -f "$STEPS_DIR/gcc-step3" ]; then fi cd "$LFS_BUILD/gcc/build" - make -j 32 all + "../configure" \ + --target=$LFS_TGT \ + --host=$(../config.guess) \ + --build=$(../config.guess) \ + --prefix=$LFS_TOOLS \ + --with-glibc-version=2.40 \ + --with-sysroot=$LFS \ + --enable-c99 \ + --enable-long-long \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-multilib \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libquadmath-support \ + --disable-decimal-float \ + --enable-languages=c,c++ + + # Reebuild everything now that we have bootstrapped an initial gcc and glibc + make -j 32 # if build fails add --disable-libsanitizer make -j 32 install - + cd "$BASE_DIR" #rm -rf "$LFS_BUILD/gcc" touch "$STEPS_DIR/gcc-step3" @@ -406,34 +429,72 @@ fi # test the cross toolchain which -- $LFS_TGT-as || echo $LFS_TGT-as is not in the PATH + echo 'int main(){}' | "$LFS_TGT-gcc" -xc - "$LFS_TGT-readelf" -l a.out > test_compiler cat test_compiler | grep ld-linux rm -v a.out test_compiler +#cat test_compiler.cpp | "$LFS_TGT-g++" -xc - +#"$LFS_TGT-readelf" -l a.out > test_compiler +#cat test_compiler | grep ld-linux +#rm -v a.out test_compiler + # build m4 -#if [ ! -f "$STEPS_DIR/m4" ]; then -# if [ ! -d "$LFS_BUILD/m4" ]; then -# tar -xzf "$BASE_DIR/sources/m4-1.4.19.tar.gz" -# mv "m4-1.4.19" "$LFS_BUILD/m4" -# fi -# cd "$LFS_BUILD/m4" -# -# #mkdir -vp build -# #cd build -# -# echo "rootsbindir=/usr/sbin" > configparms -# -# "./configure" \ -# --prefix=/usr \ -# --target=$LFS_TGT \ -# --host=$(build-aux/config.guess) \ -# --build=$(build-aux/config.guess) \ -# -# make -j 32 -# make DESTDIR=$LFS install -# -# cd "$BASE_DIR" -# rm -rf "$LFS_BUILD/m4" -# touch "$STEPS_DIR/m4" -#fi \ No newline at end of file +if [ ! -f "$STEPS_DIR/m4" ]; then + if [ ! -d "$LFS_BUILD/m4" ]; then + tar -xzf "$BASE_DIR/sources/m4-1.4.19.tar.gz" + mv "m4-1.4.19" "$LFS_BUILD/m4" + fi + cd "$LFS_BUILD/m4" + + mkdir -vp build + cd build + + echo "rootsbindir=/usr/sbin" > configparms + + "../configure" \ + --prefix=/usr \ + --target=$LFS_TGT \ + --host=$(build-aux/config.guess) \ + --build=$(build-aux/config.guess) \ + + make -j 32 + make DESTDIR=$LFS install + + "$LFS_TGT-strip" --strip-unneeded $LFS/bin/m4 + + cd "$BASE_DIR" + rm -rf "$LFS_BUILD/m4" + touch "$STEPS_DIR/m4" +fi + +# build attr +if [ ! -f "$STEPS_DIR/attr" ]; then + if [ ! -d "$LFS_BUILD/attr" ]; then + tar -xzf "$BASE_DIR/sources/attr-2.5.2.tar.gz" + mv "attr-2.5.2" "$LFS_BUILD/attr" + fi + cd "$LFS_BUILD/attr" + + mkdir -vp build + cd build + + echo "rootsbindir=/usr/sbin" > configparms + + "../configure" \ + --prefix=/usr \ + --disable-static \ + --target=$LFS_TGT \ + --host=$(build-aux/config.guess) \ + --build=$(build-aux/config.guess) \ + + make -j 32 + make DESTDIR=$LFS install + + cd "$BASE_DIR" + + touch "$STEPS_DIR/attr" +fi + +# Right now I have no idea if g++ will build crap. \ No newline at end of file