From bbf8c8d4222a70ea1228f0ec974c6e2f0510f5b2 Mon Sep 17 00:00:00 2001 From: William Harrington Date: Thu, 18 Mar 2021 11:16:49 -0500 Subject: Add Chapter 5 build scripts for binutils, gcc, glibc, libstdc++ and linux-api-headers. --- chapter5/binutils.sh | 12 ++++++++++++ chapter5/gcc.sh | 44 +++++++++++++++++++++++++++++++++++++++++++ chapter5/glibc.sh | 33 ++++++++++++++++++++++++++++++++ chapter5/libstdc++.sh | 16 ++++++++++++++++ chapter5/linux-api-headers.sh | 7 +++++++ 5 files changed, 112 insertions(+) create mode 100644 chapter5/binutils.sh create mode 100644 chapter5/gcc.sh create mode 100644 chapter5/glibc.sh create mode 100644 chapter5/libstdc++.sh create mode 100644 chapter5/linux-api-headers.sh (limited to 'chapter5') diff --git a/chapter5/binutils.sh b/chapter5/binutils.sh new file mode 100644 index 0000000..870d34a --- /dev/null +++ b/chapter5/binutils.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +mkdir build +cd build + +../configure --prefix=$LFS/tools \ + --with-sysroot=$LFS \ + --target=$LFS_TGT \ + --disable-nls \ + --disable-werror && +make && +make -j1 install \ No newline at end of file diff --git a/chapter5/gcc.sh b/chapter5/gcc.sh new file mode 100644 index 0000000..c5404d1 --- /dev/null +++ b/chapter5/gcc.sh @@ -0,0 +1,44 @@ +#!/bin/bash + +mkdir -p mpfr gmp mpc +tar -xf ../mpfr-*.tar.xz -C mpfr --strip-components=1 +tar -xf ../gmp-*.tar.xz -C gmp --strip-components=1 +tar -xf ../mpc-*.tar.gz -C mpc --strip-components=1 + +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.11 \ + --with-sysroot=${LFS} \ + --with-newlib \ + --without-headers \ + --enable-initfini-array \ + --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 -j1 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 \ No newline at end of file diff --git a/chapter5/glibc.sh b/chapter5/glibc.sh new file mode 100644 index 0000000..7c8fb3a --- /dev/null +++ b/chapter5/glibc.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +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.33-fhs-1.patch && + +mkdir -v build +cd build + +../configure \ + --prefix=/usr \ + --host=${LFS_TGT} \ + --build=$(../scripts/config.guess) \ + --enable-kernel=3.2 \ + --with-headers=${LFS}/usr/include \ + libc_cv_slibdir=/lib && + +make && +make DESTDIR=${LFS} install && + +echo 'int main(){}' > dummy.c && +${LFS_TGT}-gcc dummy.c && +readelf -l a.out | grep '/ld-linux' && + +rm -v dummy.c a.out && + +${LFS}/tools/libexec/gcc/${LFS_TGT}/10.2.0/install-tools/mkheaders \ No newline at end of file diff --git a/chapter5/libstdc++.sh b/chapter5/libstdc++.sh new file mode 100644 index 0000000..958bfa6 --- /dev/null +++ b/chapter5/libstdc++.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +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++/${VERSION} && + +make && +make -j1 DESTDIR=${LFS} install \ No newline at end of file diff --git a/chapter5/linux-api-headers.sh b/chapter5/linux-api-headers.sh new file mode 100644 index 0000000..30383a8 --- /dev/null +++ b/chapter5/linux-api-headers.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +make mrproper && +make headers && +find usr/include -name '.*' -delete && +rm usr/include/Makefile && +cp -rv usr/include ${LFS}/usr \ No newline at end of file -- cgit v1.2.3-54-g00ecf