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