Created
September 29, 2022 09:09
-
-
Save escalonn/7fd689b674ad7280db84adaecd646be6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e -o pipefail -x | |
cd $LFS/sources | |
tar --extract --file binutils-2.39.tar.xz | |
cd binutils-2.39 | |
mkdir -v build | |
cd build | |
time { ../configure --prefix=$LFS/tools \ | |
--with-sysroot=$LFS \ | |
--target=$LFS_TGT \ | |
--disable-nls \ | |
--enable-gprofng=no \ | |
--disable-werror && make && make install; } | |
cd $LFS/sources | |
rm --force --recursive binutils-2.39 | |
tar --extract --file gcc-12.2.0.tar.xz | |
cd gcc-12.2.0 | |
tar -xf ../mpfr-4.1.0.tar.xz | |
mv -v mpfr-4.1.0 mpfr | |
tar -xf ../gmp-6.2.1.tar.xz | |
mv -v gmp-6.2.1 gmp | |
tar -xf ../mpc-1.2.1.tar.gz | |
mv -v mpc-1.2.1 mpc | |
case $(uname -m) in | |
x86_64) | |
sed -e '/m64=/s/lib64/lib/' \ | |
-i.orig gcc/config/i386/t-linux64 | |
;; | |
esac | |
mkdir -v build | |
cd build | |
../configure \ | |
--target=$LFS_TGT \ | |
--prefix=$LFS/tools \ | |
--with-glibc-version=2.36 \ | |
--with-sysroot=$LFS \ | |
--with-newlib \ | |
--without-headers \ | |
--disable-nls \ | |
--disable-shared \ | |
--disable-multilib \ | |
--disable-decimal-float \ | |
--disable-threads \ | |
--disable-libatomic \ | |
--disable-libgomp \ | |
--disable-libquadmath \ | |
--disable-libssp \ | |
--disable-libvtv \ | |
--disable-libstdcxx \ | |
--enable-languages=c,c++ | |
make | |
make install | |
cd .. | |
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \ | |
`dirname $($LFS_TGT-gcc -print-libgcc-file-name)`/install-tools/include/limits.h | |
cd $LFS/sources | |
rm --force --recursive gcc-12.2.0 | |
tar --extract --file linux-5.19.11.tar.xz | |
cd linux-5.19.11 | |
make mrproper | |
make headers | |
find usr/include -type f ! -name '*.h' -delete | |
cp -rv usr/include $LFS/usr | |
cd $LFS/sources | |
rm --force --recursive linux-5.19.11 | |
tar --extract --file glibc-2.36.tar.xz | |
cd glibc-2.36 | |
case $(uname -m) in | |
i?86) ln -sfv ld-linux.so.2 $LFS/lib/ld-lsb.so.3 | |
;; | |
x86_64) ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64 | |
ln -sfv ../lib/ld-linux-x86-64.so.2 $LFS/lib64/ld-lsb-x86-64.so.3 | |
;; | |
esac | |
patch -Np1 -i ../glibc-2.36-fhs-1.patch | |
mkdir -v build | |
cd build | |
echo "rootsbindir=/usr/sbin" > configparms | |
../configure \ | |
--prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(../scripts/config.guess) \ | |
--enable-kernel=3.2 \ | |
--with-headers=$LFS/usr/include \ | |
libc_cv_slibdir=/usr/lib | |
make | |
make DESTDIR=$LFS install | |
sed '/RTLDLIST=/s@/usr@@g' -i $LFS/usr/bin/ldd | |
echo 'int main(){}' | gcc -xc - | |
readelf -l a.out | grep ld-linux | |
rm -v a.out | |
$LFS/tools/libexec/gcc/$LFS_TGT/12.2.0/install-tools/mkheaders | |
cd $LFS/sources | |
rm --force --recursive glibc-2.36 | |
tar --extract --file gcc-12.2.0.tar.xz | |
cd gcc-12.2.0 | |
mkdir -v build | |
cd build | |
../libstdc++-v3/configure \ | |
--host=$LFS_TGT \ | |
--build=$(../config.guess) \ | |
--prefix=/usr \ | |
--disable-multilib \ | |
--disable-nls \ | |
--disable-libstdcxx-pch \ | |
--with-gxx-include-dir=/tools/$LFS_TGT/include/c++/12.2.0 | |
make | |
make DESTDIR=$LFS install | |
rm -v $LFS/usr/lib/lib{stdc++,stdc++fs,supc++}.la | |
cd $LFS/sources | |
rm --force --recursive gcc-12.2.0 | |
tar --extract --file m4-1.4.19.tar.xz | |
cd m4-1.4.19 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive m4-1.4.19 | |
tar --extract --file ncurses-6.3.tar.gz | |
cd ncurses-6.3 | |
sed -i s/mawk// configure | |
mkdir build | |
pushd build | |
../configure | |
make -C include | |
make -C progs tic | |
popd | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(./config.guess) \ | |
--mandir=/usr/share/man \ | |
--with-manpage-format=normal \ | |
--with-shared \ | |
--without-normal \ | |
--with-cxx-shared \ | |
--without-debug \ | |
--without-ada \ | |
--disable-stripping \ | |
--enable-widec | |
make | |
make DESTDIR=$LFS TIC_PATH=$(pwd)/build/progs/tic install | |
echo "INPUT(-lncursesw)" > $LFS/usr/lib/libncurses.so | |
cd $LFS/sources | |
rm --force --recursive ncurses-6.3 | |
tar --extract --file bash-5.1.16.tar.gz | |
cd bash-5.1.16 | |
make | |
make DESTDIR=$LFS install | |
ln -sv bash $LFS/bin/sh | |
cd $LFS/sources | |
rm --force --recursive bash-5.1.16 | |
tar --extract --file coreutils-9.1.tar.xz | |
cd coreutils-9.1 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) \ | |
--enable-install-program=hostname \ | |
--enable-no-install-program=kill,uptime | |
make | |
make DESTDIR=$LFS install | |
mv -v $LFS/usr/bin/chroot $LFS/usr/sbin | |
mkdir -pv $LFS/usr/share/man/man8 | |
mv -v $LFS/usr/share/man/man1/chroot.1 $LFS/usr/share/man/man8/chroot.8 | |
sed -i 's/"1"/"8"/' $LFS/usr/share/man/man8/chroot.8 | |
cd $LFS/sources | |
rm --force --recursive coreutils-9.1 | |
tar --extract --file diffutils-3.8.tar.xz | |
cd diffutils-3.8 | |
./configure --prefix=/usr --host=$LFS_TGT | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive diffutils-3.8 | |
tar --extract --file file-5.42.tar.gz | |
cd file-5.42 | |
mkdir build | |
pushd build | |
../configure --disable-bzlib \ | |
--disable-libseccomp \ | |
--disable-xzlib \ | |
--disable-zlib | |
make | |
popd | |
./configure --prefix=/usr --host=$LFS_TGT --build=$(./config.guess) | |
make FILE_COMPILE=$(pwd)/build/src/file | |
make DESTDIR=$LFS install | |
rm -v $LFS/usr/lib/libmagic.la | |
cd $LFS/sources | |
rm --force --recursive file-5.42 | |
tar --extract --file findutils-4.9.0.tar.xz | |
cd findutils-4.9.0 | |
./configure --prefix=/usr \ | |
--localstatedir=/var/lib/locate \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive findutils-4.9.0 | |
tar --extract --file gawk-5.1.1.tar.xz | |
cd gawk-5.1.1 | |
sed -i 's/extras//' Makefile.in | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive gawk-5.1.1 | |
tar --extract --file grep-3.7.tar.xz | |
cd grep-3.7 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive grep-3.7 | |
tar --extract --file gzip-1.12.tar.xz | |
cd gzip-1.12 | |
./configure --prefix=/usr --host=$LFS_TGT | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive gzip-1.12 | |
tar --extract --file make-4.3.tar.gz | |
cd make-4.3 | |
./configure --prefix=/usr \ | |
--without-guile \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive make-4.3 | |
tar --extract --file patch-2.7.6.tar.xz | |
cd patch-2.7.6 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive patch-2.7.6 | |
tar --extract --file sed-4.8.tar.xz | |
cd sed-4.8 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive sed-4.8 | |
tar --extract --file tar-1.34.tar.xz | |
cd tar-1.34 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) | |
make | |
make DESTDIR=$LFS install | |
cd $LFS/sources | |
rm --force --recursive tar-1.34 | |
tar --extract --file xz-5.2.6.tar.xz | |
cd xz-5.2.6 | |
./configure --prefix=/usr \ | |
--host=$LFS_TGT \ | |
--build=$(build-aux/config.guess) \ | |
--disable-static \ | |
--docdir=/usr/share/doc/xz-5.2.6 | |
make | |
make DESTDIR=$LFS install | |
rm -v $LFS/usr/lib/liblzma.la | |
cd $LFS/sources | |
rm --force --recursive xz-5.2.6 | |
tar --extract --file binutils-2.39.tar.xz | |
cd binutils-2.39 | |
sed '6009s/$add_dir//' -i ltmain.sh | |
mkdir -v build | |
cd build | |
../configure \ | |
--prefix=/usr \ | |
--build=$(../config.guess) \ | |
--host=$LFS_TGT \ | |
--disable-nls \ | |
--enable-shared \ | |
--enable-gprofng=no \ | |
--disable-werror \ | |
--enable-64-bit-bfd | |
make | |
make DESTDIR=$LFS install | |
rm -v $LFS/usr/lib/lib{bfd,ctf,ctf-nobfd,opcodes}.{a,la} | |
cd $LFS/sources | |
rm --force --recursive binutils-2.39 | |
tar --extract --file gcc-12.2.0.tar.xz | |
cd gcc-12.2.0 | |
tar -xf ../mpfr-4.1.0.tar.xz | |
mv -v mpfr-4.1.0 mpfr | |
tar -xf ../gmp-6.2.1.tar.xz | |
mv -v gmp-6.2.1 gmp | |
tar -xf ../mpc-1.2.1.tar.gz | |
mv -v mpc-1.2.1 mpc | |
case $(uname -m) in | |
x86_64) | |
sed -e '/m64=/s/lib64/lib/' -i.orig gcc/config/i386/t-linux64 | |
;; | |
esac | |
sed '/thread_header =/s/@.*@/gthr-posix.h/' \ | |
-i libgcc/Makefile.in libstdc++-v3/include/Makefile.in | |
mkdir -v build | |
cd build | |
../configure \ | |
--build=$(../config.guess) \ | |
--host=$LFS_TGT \ | |
--target=$LFS_TGT \ | |
LDFLAGS_FOR_TARGET=-L$PWD/$LFS_TGT/libgcc \ | |
--prefix=/usr \ | |
--with-build-sysroot=$LFS \ | |
--enable-initfini-array \ | |
--disable-nls \ | |
--disable-multilib \ | |
--disable-decimal-float \ | |
--disable-libatomic \ | |
--disable-libgomp \ | |
--disable-libquadmath \ | |
--disable-libssp \ | |
--disable-libvtv \ | |
--enable-languages=c,c++ | |
make | |
make DESTDIR=$LFS install | |
ln -sv gcc $LFS/usr/bin/cc | |
cd $LFS/sources | |
rm --force --recursive gcc-12.2.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment