Skip to content

Commit 38dda46

Browse files
authored
Merge pull request #235879 from Homebrew/gcc@12-backports
gcc@12: apply backports, avoid BOOT_CFLAGS
2 parents 9e62fa4 + ff51b7e commit 38dda46

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

Formula/g/[email protected]

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
class GccAT12 < Formula
22
desc "GNU compiler collection"
33
homepage "https://gcc.gnu.org/"
4-
# TODO: Remove maximum_macos if Xcode 16 support is added to https://github.com/iains/gcc-12-branch
54
url "https://ftpmirror.gnu.org/gnu/gcc/gcc-12.4.0/gcc-12.4.0.tar.xz"
65
mirror "https://ftp.gnu.org/gnu/gcc/gcc-12.4.0/gcc-12.4.0.tar.xz"
76
sha256 "704f652604ccbccb14bdabf3478c9511c89788b12cb3bbffded37341916a9175"
87
license "GPL-3.0-or-later" => { with: "GCC-exception-3.1" }
98

9+
# https://gcc.gnu.org/gcc-12/
10+
# TODO: skip livecheck after 12.5.0
1011
livecheck do
1112
url :stable
1213
regex(%r{href=["']?gcc[._-]v?(12(?:\.\d+)+)(?:/?["' >]|\.t)}i)
@@ -15,23 +16,19 @@ class GccAT12 < Formula
1516
no_autobump! because: :requires_manual_review
1617

1718
bottle do
18-
sha256 arm64_sonoma: "55614581a8985550c5cc84cd29f7122d4aca5d11f60c5ff119e7432419c2b9d8"
19-
sha256 arm64_ventura: "1466d203d2b62e3771a0d1935314747e6a098793622f6a007c23acaf8185731b"
20-
sha256 arm64_monterey: "94bc560bcbfc98966d891656b3a0705958bdac330dfab3a9913c4c412e2f5885"
21-
sha256 sonoma: "de57cdd8fc489a7fb88f7af19a730af87a14418c7181e5ba03e20c40e4d65738"
22-
sha256 ventura: "cbaf8ac753711e7c39e90cc3abf3dee9847dea8908e5e575bd4065ffeef0c9b0"
23-
sha256 monterey: "436e51d082e7cfaa612458fdd2703f530abcd49730e7634ce659700fedb033e1"
24-
sha256 cellar: :any_skip_relocation, arm64_linux: "b7650f4cbd3cbb0bd79ca6d895fe25e2314b498f096592f65288f525568cc0ee"
25-
sha256 cellar: :any_skip_relocation, x86_64_linux: "50b8eb4f9125e36b9daad5dcd7cf470d6780d1ab2a1bad652793299fc6036770"
19+
rebuild 1
20+
sha256 arm64_sonoma: "e2f7681adadb3fa649c8ec44d21b7bcae6ebe10fe70887d1da349b35f94b3709"
21+
sha256 arm64_ventura: "400deedecf290d7045833cb2f847ef282c293c41206a5d97c23ec1397cfe339e"
22+
sha256 sonoma: "5221d99ee23796033e14dd23f0e225a919e18cc3d9f65d106bf347eb1d02f144"
23+
sha256 ventura: "ac115cdeb5aba08514237c700850ee5cac9d384374c0d06261e9fb0f645e07d3"
24+
sha256 arm64_linux: "9bea822c1ff8f1b2140b7c9e57104b0da6b5476390d456904973735cd0c70d6c"
25+
sha256 x86_64_linux: "ac0a35304f2f9242ad99f0c048525a27990b80663912ef993e5fab00ee6e9050"
2626
end
2727

2828
# The bottles are built on systems with the CLT installed, and do not work
2929
# out of the box on Xcode-only systems due to an incorrect sysroot.
3030
pour_bottle? only_if: :clt_installed
3131

32-
# https://github.com/iains/gcc-12-branch/issues/24
33-
# https://github.com/iains/gcc-12-branch/issues/25
34-
depends_on maximum_macos: [:ventura, :build] # Xcode < 16
3532
depends_on "gmp"
3633
depends_on "isl"
3734
depends_on "libmpc"
@@ -53,6 +50,14 @@ class GccAT12 < Formula
5350
url "https://raw.githubusercontent.com/Homebrew/formula-patches/ca7047dad38f16fb02eb63bd4447e17d0b68b3bb/gcc/gcc-12.4.0.diff"
5451
sha256 "c0e8e94fbf65a6ce13286e7f13beb5a1d84b182a610489026ce3e2420fc3d45c"
5552
end
53+
# Backport commits to build on Sonoma/Sequoia to allow rebottling.
54+
# TODO: merge into above patch when updating to 12.5.0.
55+
patch do
56+
on_macos do
57+
url "https://github.com/iains/gcc-12-branch/compare/e300c1337a48cf772b09e7136601fd7f9f09d6f1..99533d94172ed7a24c0e54c4ea97e6ae2260409e.patch"
58+
sha256 "f01bf173c1980cef680e407a5cc4f34af13a3e54cd644138735ec35adc5c6e40"
59+
end
60+
end
5661

5762
def install
5863
# GCC will suffer build errors if forced to use a particular linker.
@@ -97,12 +102,7 @@ def install
97102
toolchain_path = "/Library/Developer/CommandLineTools"
98103
args << "--with-ld=#{toolchain_path}/usr/bin/ld-classic"
99104
end
100-
101-
make_args = []
102105
else
103-
# Fix cc1: error while loading shared libraries: libisl.so.15
104-
args << "--with-boot-ldflags=-static-libstdc++ -static-libgcc #{ENV.ldflags}"
105-
106106
# Fix Linux error: gnu/stubs-32.h: No such file or directory.
107107
args << "--disable-multilib"
108108

@@ -114,15 +114,13 @@ def install
114114
inreplace "gcc/config/i386/t-linux64", "m64=../lib64", "m64="
115115
inreplace "gcc/config/aarch64/t-aarch64-linux", "lp64=../lib64", "lp64="
116116

117-
make_args = %W[
118-
BOOT_CFLAGS=-I#{Formula["zlib"].opt_include}
119-
BOOT_LDFLAGS=-L#{Formula["zlib"].opt_lib}
120-
]
117+
ENV.append_path "CPATH", Formula["zlib"].opt_include
118+
ENV.append_path "LIBRARY_PATH", Formula["zlib"].opt_lib
121119
end
122120

123121
mkdir "build" do
124122
system "../configure", *args
125-
system "make", *make_args
123+
system "make"
126124

127125
# Do not strip the binaries on macOS, it makes them unsuitable
128126
# for loading plugins

0 commit comments

Comments
 (0)