/* * gcc — the GNU C and C++ compiler. * * The seed compiler for the whole distro. Out-of-tree build (gcc refuses * in-tree configure) with the default 3-stage bootstrap: the compiler * builds itself twice, so what lands in the store is self-hosted. * * LANGUAGES: c,c++ — gcc's bootstrap FORCES the C++ frontend even for a * C-only request (configure.ac: "If bootstrapping, C++ must be enabled"), * so the explicit c,c++ is the honest configuration. It also ships * libstdc++, which everything downstream (including kappa itself) needs. * LTO is always enabled. * * BUILD REQUIREMENTS * ================== * - the three math libs via --with-gmp/--with-mpfr/--with-mpc (resolved * from the dependency paths below; they build static-only, so gcc links * them statically and needs no runtime lib resolution) * - binutils: its bin dir is prepended to PATH so gcc finds as/ld * - a C++ compiler on the bootstrap system: cc1 is C++, even for the C * frontend (the seed toolchain that built kappa provides one) * - make * * PORTABILITY * =========== * - --disable-multilib: barebones systems have no 32-bit libs to link * - --disable-nls: no gettext dependency * - prebuilt .info pages ship in the tarball, so texinfo is NOT required * - the testsuite needs dejagnu and takes hours — check is omitted * - bootstrap needs ~10 GB of temp space; keep KAPPA_ROOT off tmpfs */ package "gcc" { const version = "16.2.0" const source = "https://ftp.gnu.org/gnu/gcc/gcc-${version}/gcc-${version}.tar.gz" sha256 = "071d00a097579e5ef7ce97fc4a9e58e73fd3503c0a013c765c970370a5a53b9b" license = "GPL-3.0-or-later WITH GCC-exception-3.1" provides = ["cc", "gcc", "cpp"] depends = [ { name = "gmp" }, { name = "mpfr" }, { name = "mpc" }, { name = "binutils" }, { name = "make" }, ] prepare { curl -L -O ${source} echo "071d00a097579e5ef7ce97fc4a9e58e73fd3503c0a013c765c970370a5a53b9b gcc-${version}.tar.gz" | sha256sum -c - // Rebuilds reuse the temp work dir — wipe any stale out-of-tree // build state before extracting a fresh source tree. rm -rf gcc-${version} tar xf gcc-${version}.tar.gz ROOT=$KAPPA_ROOT; [ -z $ROOT ] && ROOT=/usr/local/kappa; if [ -d $ROOT/temp/gmp/destdir/usr ]; then echo $ROOT/temp/gmp/destdir/usr; else echo $ROOT/bin/$(grep '^gmp ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > gmp.path; if [ -d $ROOT/temp/mpfr/destdir/usr ]; then echo $ROOT/temp/mpfr/destdir/usr; else echo $ROOT/bin/$(grep '^mpfr ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > mpfr.path; if [ -d $ROOT/temp/mpc/destdir/usr ]; then echo $ROOT/temp/mpc/destdir/usr; else echo $ROOT/bin/$(grep '^mpc ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr; fi > mpc.path; if [ -d $ROOT/temp/binutils/destdir/usr/bin ]; then echo $ROOT/temp/binutils/destdir/usr/bin; else echo $ROOT/bin/$(grep '^binutils ' $ROOT/db/installed | tail -1 | cut -d' ' -f3)/usr/bin; fi > bin.path mkdir -p gcc-${version}/build } // "c,c++" is double-quoted because a bare comma is a DSL token that gets // re-joined with a space (--enable-languages=c, c++ would split argv). build { GMP=$(cat gmp.path); MPFR=$(cat mpfr.path); MPC=$(cat mpc.path); BIN=$(cat bin.path); cd gcc-${version}/build; PATH=$BIN:$PATH ../configure --prefix=${prefix} --with-gmp=$GMP --with-mpfr=$MPFR --with-mpc=$MPC --enable-languages="c,c++" --disable-multilib --disable-nls BIN=$(cat bin.path); cd gcc-${version}/build; PATH=$BIN:$PATH make -j${jobs} } install { BIN=$(cat bin.path); cd gcc-${version}/build; PATH=$BIN:$PATH make DESTDIR=${destdir} install } }