aboutsummaryrefslogtreecommitdiffstats
path: root/chapter5
diff options
context:
space:
mode:
Diffstat (limited to 'chapter5')
-rw-r--r--chapter5/binutils.sh12
-rw-r--r--chapter5/gcc.sh44
-rw-r--r--chapter5/glibc.sh33
-rw-r--r--chapter5/libstdc++.sh16
-rw-r--r--chapter5/linux-api-headers.sh7
5 files changed, 112 insertions, 0 deletions
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