Bash script to build LFS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.7 KiB

#!/usr/bin/env bash
echo "---- LFS=${LFS}"
echo "---- LFS_TGT=${LFS_TGT}"
case $(uname --machine) in
i?86)
ln --symbolic --force --verbose ld-linux.so.2 "${LFS}"/lib/ld-lsb.so.3
;;
x86_64)
ln --symbolic --force --verbose ../lib/ld-linux-x86-64.so.2 "${LFS}"/lib64
ln --symbolic --force --verbose ../lib/ld-linux-x86-64.so.2 "${LFS}"/lib64/ld-lsb-x86-64.so.3
;;
esac
patch --forward --strip=1 --input=../glibc-fhs-1.patch
patch --forward --strip=1 --input=../glibc-2.43-upstream_fixes-1.patch
mkdir --verbose build
cd build || return 1
echo "rootsbindir=/usr/sbin" > configparms
../configure \
--prefix=/usr \
--host="${LFS_TGT}" \
--build="$(../scripts/config.guess)" \
--disable-nscd \
libc_cv_slibdir=/usr/lib \
--enable-kernel=5.10
make
make DESTDIR="${LFS}" install
sed '/RTLDLIST=/s@/usr@@g' -i "${LFS}"/usr/bin/ldd
echo 'int main(){}' | "${LFS_TGT}"-gcc -x c - -v -Wl,--verbose &> dummy.log
grep -E -o "${LFS}/lib.*/S?crt[1in].*succeeded" dummy.log || return 1
grep -B3 "^ ${LFS}/usr/include" dummy.log || return 1
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g' || return 1
grep "/lib.*/libc.so.6 " dummy.log |grep 'succeeded' || return 1
case $(uname -m) in
i?86)
readelf -l a.out | grep ': /lib' | grep '/lib/ld-linux.so.2' || return 1
grep found dummy.log |grep "${LFS}/usr/lib/ld-linux.so.2" || return 1
;;
x86_64)
readelf -l a.out | grep ': /lib' | grep '/lib64/ld-linux-x86-64.so.2' || return 1
grep found dummy.log |grep "${LFS}/usr/lib/ld-linux-x86-64.so.2" || return 1
;;
esac