diff --git a/build.sh b/build.sh index 0792f05..d1a5e6f 100755 --- a/build.sh +++ b/build.sh @@ -65,6 +65,9 @@ echo "" make --version echo "" +export BUILD_MACHINE_TRIPLET=$(gcc -dumpmachine) +export TARGET_MACHINE_TRIPLET=$LFS_TGT + # Create the target directory mkdir -p "$LFS" export STEPS_DIR="$LFS/../steps/" @@ -159,32 +162,32 @@ if [ ! -f "$STEPS_DIR/gcc-step1" ]; then mkdir -vp build cd build - "../configure" \ - --target=$LFS_TGT \ - --host=$(../config.guess) \ - --build=$(../config.guess) \ - --prefix=$LFS_TOOLS \ - --with-glibc-version=2.40 \ - --with-sysroot=$LFS \ - --with-newlib \ - --disable-gdbtk \ - --disable-shared \ - --without-headers \ - --enable-default-pie \ - --enable-default-ssp \ - --disable-nls \ - --disable-multilib \ - --disable-threads \ - --disable-libatomic \ - --disable-libmudflap \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libquadmath-support \ - --disable-libssp \ - --disable-libvtv \ - --disable-libstdcxx \ - --disable-decimal-float \ - --disable-libsanitizer \ + "../configure" \ + --target=$LFS_TGT \ + --host=${BUILD_MACHINE_TRIPLET} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --prefix=$LFS_TOOLS \ + --with-glibc-version=2.40 \ + --with-sysroot=$LFS \ + --with-newlib \ + --disable-gdbtk \ + --disable-shared \ + --without-headers \ + --enable-default-pie \ + --enable-default-ssp \ + --disable-nls \ + --disable-multilib \ + --disable-threads \ + --disable-libatomic \ + --disable-libmudflap \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libquadmath-support \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --disable-decimal-float \ + --disable-libsanitizer \ --enable-languages=c make -j 32 all-gcc # if build fails add --disable-libsanitizer make -j 32 install-gcc @@ -231,7 +234,7 @@ if [ ! -f "$STEPS_DIR/glibc" ]; then --prefix=/usr \ --target=$LFS_TGT \ --host=$LFS_TGT \ - --build=$(../scripts/config.guess) \ + --build=${BUILD_MACHINE_TRIPLET} \ --with-headers=$LFS/usr/include \ --with-binutils=$LFS_TOOLS/bin \ --without-cvs \ @@ -313,29 +316,29 @@ if [ ! -f "$STEPS_DIR/gcc-step2" ]; then cd build # ../configure is already done - "../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-libatomic \ - --disable-libmudflap \ - --disable-libgomp \ - --disable-libquadmath \ - --disable-libquadmath-support \ - --disable-libssp \ - --disable-libvtv \ - --disable-libstdcxx \ - --disable-decimal-float \ - --disable-libsanitizer \ + "../configure" \ + --target=$LFS_TGT \ + --host=${BUILD_MACHINE_TRIPLET} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --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-libatomic \ + --disable-libmudflap \ + --disable-libgomp \ + --disable-libquadmath \ + --disable-libquadmath-support \ + --disable-libssp \ + --disable-libvtv \ + --disable-libstdcxx \ + --disable-decimal-float \ + --disable-libsanitizer \ --enable-languages=c # Repeat this @@ -399,23 +402,23 @@ if [ ! -f "$STEPS_DIR/gcc-step3" ]; then fi cd "$LFS_BUILD/gcc/build" - "../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 \ + "../configure" \ + --target=$LFS_TGT \ + --host=${BUILD_MACHINE_TRIPLET} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --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 @@ -469,8 +472,9 @@ if [ ! -f "$STEPS_DIR/m4" ]; then echo "rootsbindir=/usr/sbin" > configparms - "../configure" \ - --prefix=/usr \ + "../configure" \ + --prefix=/usr \ + --build=${BUILD_MACHINE_TRIPLET} \ --host=$LFS_TGT make -j 32 @@ -544,15 +548,16 @@ if [ ! -f "$STEPS_DIR/ncurses" ]; then cd build # --build=${CLFS_HOST} \ - "../configure" \ - --prefix=$LFS/usr \ - --with-shared \ - --host=${LFS_TGT} \ - --without-debug \ - --disable-stripping \ - --without-ada \ - --enable-overwrite \ - --with-build-cc=gcc \ + "../configure" \ + --prefix=$LFS/usr \ + --with-shared \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --without-debug \ + --disable-stripping \ + --without-ada \ + --enable-overwrite \ + --with-build-cc=gcc \ --libdir=$LFS/usr/lib make -j 32 @@ -575,14 +580,14 @@ if [ ! -f "$STEPS_DIR/bash" ]; then cd build # --build=${CLFS_HOST} \ - "../configure" \ - --prefix=$LFS \ - --host=${LFS_TGT} \ - --without-bash-malloc \ - --enable-threads \ + "../configure" \ + --prefix=$LFS \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --without-bash-malloc \ + --enable-threads \ --with-curses - - + make -j 32 make install @@ -625,9 +630,10 @@ if [ ! -f "$STEPS_DIR/check" ]; then mkdir -vp build cd build - "../configure" \ - --prefix=$LFS \ - --host=${LFS_TGT} \ + "../configure" \ + --prefix=$LFS \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ --libdir=$LFS/lib make -j 32 @@ -652,6 +658,7 @@ if [ ! -f "$STEPS_DIR/coreutils" ]; then "../configure" \ --prefix=$LFS \ --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ --enable-install-program=hostname \ --cache-file=config.cache @@ -677,6 +684,7 @@ if [ ! -f "$STEPS_DIR/diffutils" ]; then "../configure" \ --prefix=$LFS \ --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ --enable-install-program=hostname \ --cache-file=config.cache @@ -688,6 +696,84 @@ if [ ! -f "$STEPS_DIR/diffutils" ]; then touch "$STEPS_DIR/diffutils" fi +# build file +if [ ! -f "$STEPS_DIR/file" ]; then + if [ ! -d "$LFS_BUILD/file" ]; then + tar -xf "$BASE_DIR/sources/file-5.46.tar.gz" + mv "file-5.46" "$LFS_BUILD/file" + fi + cd "$LFS_BUILD/file" + + mkdir -vp build + cd build + + "../configure" \ + --prefix=$LFS \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --libdir=$LFS/lib + + make -j 32 + make -j 32 install + + cd "$BASE_DIR" + + touch "$STEPS_DIR/file" +fi + +# build findutils +if [ ! -f "$STEPS_DIR/findutils" ]; then + if [ ! -d "$LFS_BUILD/findutils" ]; then + tar -xf "$BASE_DIR/sources/findutils-4.10.0.tar.xz" + mv "findutils-4.10.0" "$LFS_BUILD/findutils" + fi + cd "$LFS_BUILD/findutils" + + mkdir -vp build + cd build + + echo "gl_cv_func_wcwidth_works=yes" > config.cache + echo "ac_cv_func_fnmatch_gnu=yes" >> config.cache + + "../configure" \ + --prefix=$LFS \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --cache-file=config.cache + + make -j 32 + make -j 32 install + + cd "$BASE_DIR" + + touch "$STEPS_DIR/findutils" +fi + +# build gawk +if [ ! -f "$STEPS_DIR/gawk" ]; then + if [ ! -d "$LFS_BUILD/gawk" ]; then + tar -xf "$BASE_DIR/sources/gawk-5.3.1.tar.xz" + mv "gawk-5.3.1" "$LFS_BUILD/gawk" + fi + cd "$LFS_BUILD/gawk" + + mkdir -vp build + cd build + + "../configure" \ + --prefix=$LFS \ + --host=${LFS_TGT} \ + --build=${BUILD_MACHINE_TRIPLET} \ + --cache-file=config.cache + + make -j 32 + make -j 32 install + + cd "$BASE_DIR" + + touch "$STEPS_DIR/gawk" +fi + #"$LFS_TGT-strip" --strip-unneeded $LFS/bin/* # build libcap2