2023-01-18 02:39:25 +03:00
|
|
|
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:
|
2023-10-08 04:56:04 +03:00
|
|
|
gnu.org/binutils: '*' # linker needs `as`
|
2023-01-18 02:39:25 +03:00
|
|
|
gnu.org/gmp: '>=4.2'
|
|
|
|
gnu.org/mpfr: '>=2.4.0'
|
|
|
|
gnu.org/mpc: '>=0.8.0'
|
|
|
|
|
|
|
|
build:
|
|
|
|
dependencies:
|
2023-02-10 01:27:57 +03:00
|
|
|
linux:
|
|
|
|
gnu.org/gcc: '*'
|
2023-01-18 02:39:25 +03:00
|
|
|
gnu.org/make: '*'
|
|
|
|
perl.org: '^5.6.1'
|
|
|
|
gnu.org/patch: '*'
|
|
|
|
curl.se: '*'
|
2023-05-10 04:37:11 +03:00
|
|
|
github.com/westes/flex: '*'
|
2023-02-10 01:27:57 +03:00
|
|
|
working-directory: build
|
2023-05-10 03:49:53 +03:00
|
|
|
script:
|
2024-05-22 20:37:57 +03:00
|
|
|
# Applying ians patches on x86-64 too, since he sometimes gets fixes in faster, like:
|
|
|
|
# https://github.com/orgs/Homebrew/discussions/5216
|
2023-05-10 03:49:53 +03:00
|
|
|
# If we have a patch, apply it
|
2024-05-07 18:55:03 +03:00
|
|
|
- run: |
|
2023-05-31 02:12:47 +03:00
|
|
|
if test -n "$PATCH{{version.major}}{{version.minor}}"; then
|
2024-05-07 18:55:03 +03:00
|
|
|
curl "$PATCH{{version.major}}{{version.minor}}" | patch -p1
|
2023-05-31 02:12:47 +03:00
|
|
|
fi
|
2024-05-22 20:37:57 +03:00
|
|
|
if: darwin
|
2024-05-07 18:55:03 +03:00
|
|
|
working-directory: ..
|
2023-01-18 02:39:25 +03:00
|
|
|
|
2023-05-10 03:49:53 +03:00
|
|
|
# if there's no diff yet, unpack iains' source over ours
|
2024-05-07 18:55:03 +03:00
|
|
|
- run: |
|
2023-05-31 02:12:47 +03:00
|
|
|
if test -n "$BRANCH{{version.major}}{{version.minor}}"; then
|
2024-05-07 18:55:03 +03:00
|
|
|
curl -L "$BRANCH{{version.major}}{{version.minor}}" | tar xz --strip-components=1
|
2023-05-31 02:12:47 +03:00
|
|
|
fi
|
2024-05-22 20:37:57 +03:00
|
|
|
if: darwin
|
2024-05-07 18:55:03 +03:00
|
|
|
working-directory: ..
|
2023-01-18 02:39:25 +03:00
|
|
|
|
2023-05-10 03:49:53 +03:00
|
|
|
# The spaces mess things up in the env key
|
2024-05-07 18:55:03 +03:00
|
|
|
- ARGS=($ARGS --with-pkgversion="pkgx GCC {{version}}")
|
2023-01-18 02:39:25 +03:00
|
|
|
|
2023-05-10 03:49:53 +03:00
|
|
|
# On Linux, we need to statically link libstdc++ and libgcc
|
2024-05-07 18:55:03 +03:00
|
|
|
- run: export ARGS=("${ARGS[@]}" --with-boot-ldflags="-static-libstdc++ -static-libgcc $LDFLAGS")
|
|
|
|
if: linux
|
2023-05-10 03:49:53 +03:00
|
|
|
|
|
|
|
- ../configure "${ARGS[@]}"
|
|
|
|
- make --jobs {{ hw.concurrency }}
|
|
|
|
- make install
|
2023-01-18 02:39:25 +03:00
|
|
|
|
2023-02-10 01:27:57 +03:00
|
|
|
# Since we depend on ourselves, this symlink might already exist
|
2023-05-10 03:49:53 +03:00
|
|
|
- run: test -f gc++ || ln -sf c++ gc++
|
|
|
|
working-directory: ${{prefix}}/bin
|
2023-02-10 01:27:57 +03:00
|
|
|
|
|
|
|
# On Linux, we need to move the libraries to the lib directory.
|
2023-05-10 03:49:53 +03:00
|
|
|
- run: |
|
2023-10-05 17:59:41 +03:00
|
|
|
mv lib64/* lib/
|
|
|
|
rmdir lib64
|
|
|
|
if: linux
|
2023-05-10 03:49:53 +03:00
|
|
|
working-directory: ${{prefix}}
|
2023-10-05 17:59:41 +03:00
|
|
|
|
|
|
|
# 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
|
2023-10-08 04:56:04 +03:00
|
|
|
ln -sf ../../../binutils/v\*/bin/ar ar
|
|
|
|
ln -sf ../../../binutils/v\*/bin/nm nm
|
|
|
|
ln -sf ../../../binutils/v\*/bin/ranlib ranlib
|
2023-10-05 17:59:41 +03:00
|
|
|
working-directory: ${{prefix}}/bin
|
|
|
|
|
2023-01-18 02:39:25 +03:00
|
|
|
env:
|
2023-04-26 22:25:45 +03:00
|
|
|
# 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
|
2023-05-10 03:49:53 +03:00
|
|
|
PATCH122: https://raw.githubusercontent.com/Homebrew/formula-patches/1d184289/gcc/gcc-12.2.0-arm.diff
|
2023-04-26 22:25:45 +03:00
|
|
|
# https://github.com/iains/gcc-darwin-arm64
|
2023-05-10 03:49:53 +03:00
|
|
|
PATCH131: https://raw.githubusercontent.com/Homebrew/formula-patches/master/gcc/gcc-13.1.0.diff
|
2023-08-16 07:45:25 +03:00
|
|
|
BRANCH105: https://github.com/iains/gcc-10-branch/archive/refs/heads/gcc-10-5Dr0-pre-0.tar.gz
|
2023-05-31 01:42:10 +03:00
|
|
|
BRANCH114: https://github.com/iains/gcc-11-branch/archive/refs/tags/gcc-11.4-darwin-r0.tar.gz
|
2023-05-10 03:49:53 +03:00
|
|
|
BRANCH123: https://github.com/iains/gcc-12-branch/archive/refs/tags/gcc-12.3-darwin-r0.tar.gz
|
2024-06-20 19:40:38 +03:00
|
|
|
BRANCH124: https://github.com/iains/gcc-12-branch/archive/refs/tags/gcc-12.4-darwin-pre-0.tar.gz
|
2023-08-16 07:45:25 +03:00
|
|
|
BRANCH132: https://github.com/iains/gcc-13-branch/archive/refs/heads/gcc-13-2-darwin.tar.gz
|
2024-05-21 21:15:30 +03:00
|
|
|
BRANCH133: https://github.com/iains/gcc-13-branch/archive/refs/heads/gcc-13-3-darwin-pre-0.tar.gz
|
2024-05-07 18:55:03 +03:00
|
|
|
BRANCH141: https://github.com/iains/gcc-14-branch/archive/refs/heads/gcc-14-1-darwin-pre-0.tar.gz
|
2023-01-18 02:39:25 +03:00
|
|
|
ARGS:
|
|
|
|
- --prefix={{ prefix }}
|
|
|
|
- --libdir={{ prefix }}/lib
|
2023-04-23 00:08:02 +03:00
|
|
|
- --enable-languages=c,c++,objc,obj-c++,fortran
|
2024-05-07 18:55:03 +03:00
|
|
|
- --with-bugurl="https://github.com/pkgxdev/pantry/issues"
|
2023-01-18 02:39:25 +03:00
|
|
|
- --disable-bootstrap
|
|
|
|
- --disable-nls
|
|
|
|
linux:
|
|
|
|
ARGS:
|
|
|
|
- --disable-multilib
|
|
|
|
- --enable-default-pie
|
2023-02-10 01:27:57 +03:00
|
|
|
- --enable-pie-tools
|
2024-05-07 18:55:03 +03:00
|
|
|
- --enable-host-pie
|
2023-08-16 07:45:25 +03:00
|
|
|
linux/x86-64:
|
|
|
|
LDFLAGS: $LDFLAGS -pie
|
2024-05-07 18:55:03 +03:00
|
|
|
CFLAGS: $CFLAGS -fPIC -fPIE
|
|
|
|
CXXFLAGS: $CXXFLAGS -fPIC -fPIE
|
2023-01-18 02:39:25 +03:00
|
|
|
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
|
2023-10-12 23:22:28 +03:00
|
|
|
# llvm-as generates __compact_unwind sections, even when told not to. this causes build errors
|
|
|
|
# for ^10 on darwin+x86-64
|
|
|
|
# https://stackoverflow.com/questions/52211390/trouble-building-gcc-on-mac-cant-find-system-headers
|
|
|
|
BOOT_CFLAGS: -Wa,-mmacos-version-min=10.5
|
|
|
|
CFLAGS_FOR_TARGET: -Wa,-mmacos-version-min=10.5
|
|
|
|
and CXXFLAGS_FOR_TARGET: -Wa,-mmacos-version-min=10.5
|
2023-01-18 02:39:25 +03:00
|
|
|
|
2023-08-16 07:45:25 +03:00
|
|
|
test:
|
2024-05-07 18:55:03 +03:00
|
|
|
- gcc --version | grep -q "pkgx GCC {{version}}"
|
2023-08-16 07:45:25 +03:00
|
|
|
- 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!"
|
2023-04-23 00:08:02 +03:00
|
|
|
|
2023-01-18 02:39:25 +03:00
|
|
|
provides:
|
2023-10-05 17:59:41 +03:00
|
|
|
- bin/ar
|
|
|
|
- bin/cc
|
2023-09-30 19:15:42 +03:00
|
|
|
- bin/c++
|
|
|
|
- bin/gc++
|
2023-01-18 02:39:25 +03:00
|
|
|
- bin/cpp
|
|
|
|
- bin/g++
|
|
|
|
- bin/gcc
|
|
|
|
- bin/gcc-ar
|
|
|
|
- bin/gcc-nm
|
|
|
|
- bin/gcc-ranlib
|
|
|
|
- bin/gcov
|
|
|
|
- bin/gcov-dump
|
|
|
|
- bin/gcov-tool
|
2023-04-23 00:08:02 +03:00
|
|
|
- bin/gfortran
|
2023-01-18 02:39:25 +03:00
|
|
|
- bin/lto-dump
|
2023-10-05 17:59:41 +03:00
|
|
|
- bin/nm
|
|
|
|
- bin/ranlib
|