mirror of
https://git.adityakumar.xyz/lfs-scripts.git
synced 2024-12-22 15:22:56 +00:00
Add 8.26 - Build gcc
This commit is contained in:
parent
9dc826f8e1
commit
24befb2ffd
2 changed files with 86 additions and 0 deletions
74
scripts/chapter8/8.26-gcc.sh
Normal file
74
scripts/chapter8/8.26-gcc.sh
Normal file
|
@ -0,0 +1,74 @@
|
|||
#!/bin/bash
|
||||
|
||||
cd /sources
|
||||
tar xf gcc-12.2.0.tar.xz
|
||||
cd gcc-12.2.0
|
||||
|
||||
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 --prefix=/usr \
|
||||
LD=ld \
|
||||
--enable-languages=c,c++ \
|
||||
--disable-multilib \
|
||||
--disable-bootstrap \
|
||||
--with-system-zlib
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
make -j5
|
||||
|
||||
if [ $? -ne 0 ]
|
||||
then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ulimit -s 32768
|
||||
|
||||
chown -Rv tester .
|
||||
su tester -c "PATH=$PATH make -k check"
|
||||
|
||||
../contrib/test_summary
|
||||
|
||||
make install
|
||||
|
||||
chown -v -R root:root \
|
||||
/usr/lib/gcc/$(gcc -dumpmachine)/12.2.0/include{,-fixed}
|
||||
|
||||
ln -svr /usr/bin/cpp /usr/lib
|
||||
|
||||
ln -sfv ../../libexec/gcc/$(gcc -dumpmachine)/12.2.0/liblto_plugin.so \
|
||||
/usr/lib/bfd-plugins/
|
||||
|
||||
echo 'int main(){}' > dummy.c
|
||||
cc dummy.c -v -Wl,--verbose &> dummy.log
|
||||
readelf -l a.out | grep ': /lib'
|
||||
|
||||
grep -o '/usr/lib.*/crt[1in].*succeeded' dummy.log
|
||||
|
||||
grep -B4 '^ /usr/include' dummy.log
|
||||
|
||||
grep 'SEARCH.*/usr/lib' dummy.log |sed 's|; |\n|g'
|
||||
|
||||
grep "/lib.*/libc.so.6 " dummy.log
|
||||
|
||||
grep found dummy.log
|
||||
|
||||
rm -v dummy.c a.out dummy.log
|
||||
|
||||
mkdir -pv /usr/share/gdb/auto-load/usr/lib
|
||||
mv -v /usr/lib/*gdb.py /usr/share/gdb/auto-load/usr/lib
|
||||
|
||||
cd /sources
|
||||
rm -rf gcc-12.2.0
|
||||
|
|
@ -846,3 +846,15 @@ then
|
|||
stop_script "chapter8/8.25-shadow.sh"
|
||||
fi
|
||||
|
||||
# Chapter 8.26
|
||||
# ============
|
||||
echo "Building gcc"
|
||||
su -c "bash $SCRIPT/chapter8/8.26-gcc.sh"
|
||||
|
||||
# Exit on error
|
||||
check_exit_code
|
||||
if [ $exit_status -ne 0 ]
|
||||
then
|
||||
stop_script "chapter8/8.26-gcc.sh"
|
||||
fi
|
||||
|
||||
|
|
Loading…
Reference in a new issue