lfs-buildscripts/CH5Build/CH05.02-gcc-pass1.sh

81 lines
1.4 KiB
Bash
Raw Normal View History

2024-10-02 07:23:18 +08:00
#!/bin/bash
2024-10-06 06:16:22 +08:00
# does not build d,ada compilers
2024-10-02 07:23:18 +08:00
2024-10-06 06:16:22 +08:00
source ../versions.sh
2024-10-02 07:23:18 +08:00
GLSOURCES="${LFS}/sources"
if [ "`whoami`" != "lfs" ]; then
myfail "Must run this script as lfs user"
fi
2024-10-08 15:48:40 +08:00
pushd ${GLSOURCES} > /dev/null 2>&1 || myfail "Failed to move to ${GLSOURCES}"
2024-10-02 07:23:18 +08:00
2024-10-04 01:04:58 +08:00
[ -d gcc-${gcc_version} ] && rm -rf gcc-${gcc_version}
2024-10-02 07:23:18 +08:00
tar -Jxf ${gcc_tarball}
cd gcc-${gcc_version}
tar -xf ../${mpfr_tarball}
mv mpfr-${mpfr_version} mpfr
tar -xf ../${gmp_tarball}
mv gmp-${gmp_version} gmp
tar -xf ../${mpc_tarball}
mv mpc-${mpc_version} mpc
2024-10-07 13:40:15 +08:00
sed -e '/m64=/s/lib64/lib/' \
-i.orig gcc/config/i386/t-linux64
2024-10-02 08:06:18 +08:00
2024-10-02 07:23:18 +08:00
mkdir build
cd build
../configure \
--target=${LFS_TGT} \
--prefix=${LFS}/tools \
--with-glibc-version=2.40 \
--with-sysroot=${LFS} \
--with-newlib \
--without-headers \
--enable-default-pie \
--enable-default-ssp \
--disable-nls \
--disable-shared \
--disable-multilib \
--disable-threads \
--disable-libatomic \
--disable-libgomp \
--disable-libquadmath \
--disable-libssp \
--disable-libvtv \
--disable-libstdcxx \
--enable-languages=c,c++
make
if [ $? -ne 0 ]; then
myfail "Failed building gcc pass 1"
fi
make install
if [ $? -ne 0 ]; then
myfail "Failed installing gcc pass 1"
fi
2024-10-03 13:10:40 +08:00
cd ..
cat gcc/limitx.h gcc/glimits.h gcc/limity.h > \
`dirname $(${LFS_TGT}-gcc -print-libgcc-file-name)`/include/limits.h
2024-10-08 15:48:40 +08:00
popd
# cleanup
pushd ${GLSOURCES}
rm -rf gcc-${gcc_version}
popd