@@ -21,54 +21,70 @@ def osmajor
21
21
22
22
desc "GNU compiler collection"
23
23
homepage "https://gcc.gnu.org"
24
- url "https://ftp.gnu.org/gnu/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz"
25
- mirror "https://ftpmirror.gnu.org/gcc/gcc-8.5.0/gcc-8.5.0.tar.xz"
26
- sha256 "d308841a511bb830a6100397b0042db24ce11f642dab6ea6ee44842e5325ed50"
27
- revision 1
24
+ url "https://ftp.gnu.org/gnu/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz"
25
+ mirror "https://ftpmirror.gnu.org/gcc/gcc-14.2.0/gcc-14.2.0.tar.xz"
26
+ sha256 "a7b39bc69cbf9e25826c5a60ab26477001f7c08d85cec04bc0e29cabed6f3cc9"
28
27
29
28
bottle do
30
- sha256 "092a1e615cdea11f55784252145d1da94f968d1a0ec59266d4f3a9e846be242d" => :tiger_altivec
31
29
end
32
30
33
- conflicts_with "gcc8" , :because => "both install the same version of GCC"
34
-
35
31
option "with-nls" , "Build with native language support (localization)"
36
- option "with-jit" , "Build just-in-time compiler"
37
32
# enabling multilib on a host that can't run 64-bit results in build failures
38
33
option "without-multilib" , "Build without multilib support" if MacOS . prefer_64_bit?
34
+ # JIT fails to build on i386, or any platform for Tiger
35
+ if !( Hardware ::CPU . type == :intel && !MacOS . prefer_64_bit? ) || MacOS . version > :leopard
36
+ option "with-jit" , "Build just-in-time compiler"
37
+ end
39
38
39
+ # System texinfo is too old
40
+ depends_on "texinfo" => :build
40
41
depends_on "gmp"
41
42
depends_on "libmpc"
42
43
depends_on "mpfr"
43
- depends_on "isl018"
44
+ depends_on "isl"
45
+ # System zlib is missing crc32_combine on Tiger
46
+ depends_on "zlib"
44
47
45
48
if MacOS . version < :leopard
46
49
# The as that comes with Tiger isn't capable of dealing with the
47
50
# PPC asm that comes in libitm
48
- depends_on "cctools" => :build
51
+ depends_on "cctools"
52
+ # GCC invokes ld with flags the system ld doesn't have
53
+ depends_on "ld64"
49
54
end
50
55
51
- # Bug 21514 - [DR 488] templates and anonymous enum - fixed in 4.0.2
52
- # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=21514
56
+ # Needs a newer tigerbrew-provided GCC to build
53
57
fails_with :gcc_4_0
58
+ fails_with :gcc
54
59
fails_with :llvm
55
60
56
61
# GCC bootstraps itself, so it is OK to have an incompatible C++ stdlib
57
62
cxxstdlib_check :skip
58
63
64
+ # Applied upstream: https://github.com/gcc-mirror/gcc/commit/1cfe4a4d0d4447b364815d5e5c889deb2e533669
65
+ # Can remove in a later version.
66
+ patch :p0 do
67
+ url "https://github.com/macports/macports-ports/raw/b5a5b6679f59dcad1b21f66bb01e3f8a3a377b4b/lang/gcc14/files/darwin-ppc-fpu.patch"
68
+ sha256 "7f14356f2e9efdf46503ca1156302c9b294db52569f4d56073267142b6d2ee71"
69
+ end
70
+
71
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117834
72
+ patch :p0 do
73
+ url "https://github.com/macports/macports-ports/raw/b5a5b6679f59dcad1b21f66bb01e3f8a3a377b4b/lang/gcc14/files/darwin8-define-PTHREAD_RWLOCK_INITIALIZER.patch"
74
+ sha256 "57ffac38f4d5eb4d92634d9e7c339f961e3eb908d13a944d622bfc6915a4f435"
75
+ end
76
+
59
77
# The bottles are built on systems with the CLT installed, and do not work
60
78
# out of the box on Xcode-only systems due to an incorrect sysroot.
61
79
def pour_bottle?
62
80
MacOS ::CLT . installed?
63
81
end
64
82
65
83
def version_suffix
66
- version . to_s . slice ( /\d / )
84
+ version . to_s . slice ( /\d \d / )
67
85
end
68
86
69
87
def install
70
- # GCC will suffer build errors if forced to use a particular linker.
71
- ENV . delete "LD"
72
88
# GCC Bug 25127 for PowerPC
73
89
# https://gcc.gnu.org/bugzilla//show_bug.cgi?id=25127
74
90
# ../../../libgcc/unwind.inc: In function '_Unwind_RaiseException':
@@ -83,10 +99,6 @@ def install
83
99
ENV . append_to_cflags "-force_cpusubtype_ALL"
84
100
end
85
101
86
- if MacOS . version < :leopard
87
- ENV [ "AS" ] = ENV [ "AS_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /as"
88
- end
89
-
90
102
# We avoiding building:
91
103
# - Ada, which requires a pre-existing GCC Ada compiler to bootstrap
92
104
# - Go, currently not supported on macOS
@@ -106,7 +118,7 @@ def install
106
118
"--with-gmp=#{ Formula [ "gmp" ] . opt_prefix } " ,
107
119
"--with-mpfr=#{ Formula [ "mpfr" ] . opt_prefix } " ,
108
120
"--with-mpc=#{ Formula [ "libmpc" ] . opt_prefix } " ,
109
- "--with-isl=#{ Formula [ "isl018 " ] . opt_prefix } " ,
121
+ "--with-isl=#{ Formula [ "isl " ] . opt_prefix } " ,
110
122
"--with-system-zlib" ,
111
123
"--enable-checking=release" ,
112
124
"--with-pkgversion=Tigerbrew #{ name } #{ pkg_version } #{ build . used_options *" " } " . strip ,
@@ -131,9 +143,38 @@ def install
131
143
132
144
args << "--enable-host-shared" if build . with? ( "jit" )
133
145
134
- # Ensure correct install names when linking against libgcc_s;
135
- # see discussion in https://github.com/Homebrew/homebrew/pull/34303
136
- inreplace "libgcc/config/t-slibgcc-darwin" , "@shlib_slibdir@" , "#{ HOMEBREW_PREFIX } /lib/gcc/#{ version_suffix } "
146
+ # These two flags are required for zlib to be found in the last stage
147
+ inreplace "gcc/Makefile.in" do |s |
148
+ s . change_make_var! "ZLIB" , "-L#{ Formula [ "zlib" ] . opt_lib } -lz"
149
+ s . change_make_var! "ZLIBINC" , "-I#{ Formula [ "zlib" ] . opt_include } "
150
+ end
151
+
152
+ if MacOS . version < :leopard
153
+ # We need to use a newer as to build, but we also want the compiler
154
+ # to use it at runtime
155
+ ENV [ "AS" ] = ENV [ "AS_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /as"
156
+ # Following Macports on which tools to specify both in the environment
157
+ # and as configure args
158
+ args << "--with-as=#{ Formula [ "cctools" ] . bin } /as"
159
+ # We'll also configure the compiler to use the rest of the newer cctools
160
+ ENV [ "AR_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /ar"
161
+ args << "--with-ar=#{ Formula [ "cctools" ] . bin } /ar"
162
+ ENV [ "NM_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /nm"
163
+ ENV [ "RANLIB_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /ranlib"
164
+ ENV [ "STRIP_FOR_TARGET" ] = "#{ Formula [ "cctools" ] . bin } /strip"
165
+
166
+ # We need ld both for the build and for the end result compiler to use
167
+ # Note that unlike the above, which are more nice-to-haves, gcc-14
168
+ # will actually fail to use the system ld on Tiger.
169
+ ENV . ld64
170
+ ENV [ "LD_FOR_TARGET" ] = ENV [ "LD" ]
171
+ args << "--with-ld=#{ ENV [ "LD" ] } "
172
+
173
+ # Avoids the need for the ttyname_r patch
174
+ # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=117857
175
+ # https://github.com/mistydemeo/tigerbrew/pull/1286#issuecomment-2664224824
176
+ ENV . append_to_cflags "-D__DARWIN_UNIX03"
177
+ end
137
178
138
179
mkdir "build" do
139
180
unless MacOS ::CLT . installed?
0 commit comments