distributable: url: https://ftp.gnu.org/gnu/gcc/gcc-{{version.raw}}/gcc-{{ version.raw }}.tar.xz strip-components: 1 versions: github: gcc-mirror/gcc/tags strip: /^releases\/gcc-/ dependencies: darwin: apple.com/xcode/clt: '*' # needed for MacOS.sdk gnu.org/gmp: '>=4.2' gnu.org/mpfr: '>=2.4.0' gnu.org/mpc: '>=0.8.0' # Post bootstrap # gnu.org/binutils: '*' build: dependencies: darwin: tea.xyz/gx/cc: c99 # need cc to strip `-nodefaultrpaths` # linux: # gnu.org/gcc: '*' gnu.org/make: '*' perl.org: '^5.6.1' gnu.org/patch: '*' curl.se: '*' script: | # Branch from the Darwin maintainer of GCC, with a few generic fixes and # Apple Silicon support, located at https://github.com/iains/gcc-12-branch curl https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff | patch -p1 # skip multilib prefixes for best interop sed -i.bak -e 's_m64=../lib64_m64=_' gcc/config/i386/t-linux64 rm gcc/config/i386/t-linux64.bak ### /*** BOOTSTRAP BLOCK - REMOVE AFTER BOOTSTRAP ***/ if test "{{hw.platform}}" = "linux"; then command -v sudo && SUDO=sudo $SUDO apt-get --yes install gcc g++ fi ### /*** END BOOTSTRAP BLOCK ***/ mkdir build cd build # Note that env vars with spaces don't behave well, due to shells and life # in general. So we handle those in script. Unless and until we decide to # change to bash arrays, as in https://github.com/teaxyz/cli/pull/283, # but that will have untold and unforseen consequences. # convert ARGS to an array since we need space-including values export ARGS=($ARGS --with-pkgversion="tea GCC {{version}}") if test {{hw.platform}} = "linux"; then export ARGS=("${ARGS[@]}" --with-boot-ldflags="-static-libstdc++ -static-libgcc $LDFLAGS") fi ../configure "${ARGS[@]}" make --jobs {{ hw.concurrency }} make install cd {{prefix}}/bin ln -s c++ gc++ env: ARGS: - --prefix={{ prefix }} - --libdir={{ prefix }}/lib - --enable-languages=c,c++,objc,obj-c++ - --with-bugurl="https://github.com/teaxyz/pantry.extra/issues" - --disable-bootstrap - --disable-nls linux: ARGS: - --disable-multilib - --enable-default-pie darwin: ARGS: # Reliance on CLT hard path is yuck. - --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk darwin/aarch64: ARGS: # https://en.wikipedia.org/wiki/Darwin_(operating_system)#Darwin_16%E2%80%9319;_OS_X_rebranded_into_macOS - --build=aarch64-apple-darwin20.0.0 darwin/x86-64: ARGS: - --build=x86_64-apple-darwin20.0.0 test: # FIXME: remove after bootstrap of gcc/binutils dependencies: gnu.org/binutils: '*' # for `as` script: | gcc --version | grep -q "tea GCC {{version}}" gcc -o test1 test.c -lgmp ./test1 g++ -o test2 test.cc test "$(./test2)" = "Hello, world!" provides: # we keep `c++` in tea.xyz/gx/cc, but we expose it # as `gc++` here in case someone wants it explicitly - bin/gc++ - bin/cpp - bin/g++ - bin/gcc - bin/gcc-ar - bin/gcc-nm - bin/gcc-ranlib - bin/gcov - bin/gcov-dump - bin/gcov-tool - bin/lto-dump