repo/core/gcc/build

70 lines
1.7 KiB
Plaintext
Raw Normal View History

2019-06-17 14:27:17 +00:00
#!/bin/sh -e
2019-07-15 03:02:52 +00:00
# Use lib not lib64 by default.
2022-09-30 09:40:30 +00:00
sed '/m64=/s/lib64/lib/' gcc/config/i386/t-linux64 > _
mv -f _ gcc/config/i386/t-linux64
sed 's/lib64/lib/' gcc/config/i386/linux64.h > _
mv -f _ gcc/config/i386/linux64.h
2019-07-14 23:54:58 +00:00
2019-06-17 14:27:17 +00:00
# Build must happen outside of gcc source.
2019-06-17 17:50:37 +00:00
mkdir -p gcc-build
2019-06-21 11:25:22 +00:00
cd gcc-build
2019-06-17 14:27:17 +00:00
2020-05-11 07:15:00 +00:00
# Grab the system's GCC version.
2022-06-13 02:29:39 +00:00
gcc_version=$(gcc -dumpfullversion 2>/dev/null) || gcc_version=null
2020-05-11 07:15:00 +00:00
# Skip the bootstrap process if we are able.
2022-06-13 02:29:39 +00:00
case $2 in "${gcc_version%%.*}"*)
2020-05-11 07:15:00 +00:00
printf '%s\n' "Minor version difference, disabling bootstrap."
bootstrap=--disable-bootstrap
esac
2022-09-30 09:40:30 +00:00
../configure \
libat_cv_have_ifunc=no \
2019-06-17 17:46:58 +00:00
--prefix=/usr \
2020-05-08 08:52:08 +00:00
--libexecdir=/usr/lib \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
2019-07-13 07:23:32 +00:00
--disable-multilib \
2019-06-17 17:46:58 +00:00
--disable-symvers \
--disable-libmpx \
--disable-libmudflap \
--disable-libsanitizer \
--disable-werror \
--disable-fixed-point \
--disable-libstdcxx-pch \
2020-03-03 18:57:12 +00:00
--disable-nls \
2019-06-17 17:46:58 +00:00
--enable-checking=release \
--enable-__cxa_atexit \
--enable-default-pie \
--enable-default-ssp \
--enable-shared \
--enable-threads \
--enable-tls \
2021-07-09 08:03:42 +00:00
--enable-initfini-array \
2019-07-13 15:30:27 +00:00
--enable-languages=c,c++ \
2020-05-08 08:52:08 +00:00
--without-included-gettext \
2021-07-01 16:52:38 +00:00
--with-zstd=no \
2020-05-08 08:52:08 +00:00
--with-system-zlib \
2020-05-11 07:15:00 +00:00
--build=x86_64-pc-linux-musl \
"${bootstrap:---enable-bootstrap}"
2019-06-17 14:27:17 +00:00
2019-07-13 07:14:38 +00:00
make
2023-03-02 14:40:00 +00:00
make DESTDIR="$1" install
2019-06-18 18:00:16 +00:00
2019-07-12 07:22:13 +00:00
# Save 35MB.
2020-03-27 09:51:24 +00:00
find "$1" -name libgtkpeer.a -exec rm -f {} +
find "$1" -name libgjsmalsa.a -exec rm -f {} +
find "$1" -name libgij.a -exec rm -f {} +
2019-07-12 07:22:13 +00:00
2021-07-01 16:55:52 +00:00
ln -sf gcc "$1/usr/bin/cc"
cp -f ../c99 "$1/usr/bin"
2020-02-15 19:53:33 +00:00
# Symlink for LTO.
{
mkdir -p "$1/usr/lib/bfd-plugins"
2020-05-15 18:35:37 +00:00
ln -s "/usr/lib/gcc/x86_64-pc-linux-musl/$2/liblto_plugin.so" \
2020-02-15 19:53:33 +00:00
"$1/usr/lib/bfd-plugins/liblto_plugin.so"
}