pantry/projects/gnu.org/gcc/package.yml
Jacob Heider d131f1863f fix(gcc).symlinks
I believe these should be the binutils versions
2023-10-08 08:32:30 -04:00

143 lines
4.5 KiB
YAML

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:
gnu.org/binutils: '*' # linker needs `as`
gnu.org/gmp: '>=4.2'
gnu.org/mpfr: '>=2.4.0'
gnu.org/mpc: '>=0.8.0'
build:
dependencies:
linux:
gnu.org/gcc: '*'
gnu.org/make: '*'
perl.org: '^5.6.1'
gnu.org/patch: '*'
curl.se: '*'
github.com/westes/flex: '*'
working-directory: build
script:
# If we have a patch, apply it
- |
if test "{{hw.platform}}+{{hw.arch}}" = "darwin+aarch64"; then
if test -n "$PATCH{{version.major}}{{version.minor}}"; then
curl "$PATCH{{version.major}}{{version.minor}}" | patch -p1 -d..
fi
fi
# if there's no diff yet, unpack iains' source over ours
- |
if test "{{hw.platform}}+{{hw.arch}}" = "darwin+aarch64"; then
if test -n "$BRANCH{{version.major}}{{version.minor}}"; then
curl -L "$BRANCH{{version.major}}{{version.minor}}" | tar xz --strip-components=1 -C ..
fi
fi
# The spaces mess things up in the env key
- ARGS=($ARGS --with-pkgversion="tea GCC {{version}}")
# On Linux, we need to statically link libstdc++ and libgcc
- |
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
# Since we depend on ourselves, this symlink might already exist
- run: test -f gc++ || ln -sf c++ gc++
working-directory: ${{prefix}}/bin
# On Linux, we need to move the libraries to the lib directory.
- run: |
mv lib64/* lib/
rmdir lib64
if: linux
working-directory: ${{prefix}}
# other tools simply expect these symlinks and often fail without them
# NOTE forcing symlinks because we build with ourselves and sometimes that
# means we're building with the exact same version FIXME
- run: |
ln -sf gcc cc
ln -sf ../../../binutils/v\*/bin/ar ar
ln -sf ../../../binutils/v\*/bin/nm nm
ln -sf ../../../binutils/v\*/bin/ranlib ranlib
working-directory: ${{prefix}}/bin
env:
# 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
PATCH122: https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff
# https://github.com/iains/gcc-darwin-arm64
PATCH131: https://raw.githubusercontent.com/Homebrew/formula-patches/master/gcc/gcc-13.1.0.diff
BRANCH105: https://github.com/iains/gcc-10-branch/archive/refs/heads/gcc-10-5Dr0-pre-0.tar.gz
BRANCH114: https://github.com/iains/gcc-11-branch/archive/refs/tags/gcc-11.4-darwin-r0.tar.gz
BRANCH123: https://github.com/iains/gcc-12-branch/archive/refs/tags/gcc-12.3-darwin-r0.tar.gz
BRANCH132: https://github.com/iains/gcc-13-branch/archive/refs/heads/gcc-13-2-darwin.tar.gz
ARGS:
- --prefix={{ prefix }}
- --libdir={{ prefix }}/lib
- --enable-languages=c,c++,objc,obj-c++,fortran
- --with-bugurl="https://github.com/teaxyz/pantry/issues"
- --disable-bootstrap
- --disable-nls
linux:
ARGS:
- --disable-multilib
- --enable-default-pie
- --enable-pie-tools
linux/x86-64:
LDFLAGS: $LDFLAGS -pie
CFLAGS: $CFLAGS -fPIC
CXXFLAGS: $CXXFLAGS -fPIC
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:
- gcc --version | grep -q "tea GCC {{version}}"
- gcc -print-libgcc-file-name
- gcc -print-multiarch
- gcc -dumpspecs
- gcc -o test1 test.c -lgmp
- ./test1
- g++ -o test2 test.cc
- test "$(./test2)" = "Hello, world!"
- gfortran -o test3 test.f90
- test "$(./test3)" = "Hello, world!"
provides:
- bin/ar
- bin/cc
- bin/c++
- 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/gfortran
- bin/lto-dump
- bin/nm
- bin/ranlib