forked from lotia/homebrew-versions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcc43.rb
279 lines (255 loc) · 9.84 KB
/
gcc43.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
require 'formula'
class Gcc43 < Formula
def arch
if Hardware::CPU.type == :intel
if MacOS.prefer_64_bit?
'x86_64'
else
'i686'
end
elsif Hardware::CPU.type == :ppc
if MacOS.prefer_64_bit?
'ppc64'
else
'ppc'
end
end
end
def osmajor
`uname -r`.chomp
end
homepage 'http://gcc.gnu.org'
url 'http://ftpmirror.gnu.org/gcc/gcc-4.3.6/gcc-4.3.6.tar.bz2'
mirror 'http://ftp.gnu.org/gnu/gcc/gcc-4.3.6/gcc-4.3.6.tar.bz2'
sha1 'df276018e3c664c7e6aa7ca88a180515eea61663'
option 'enable-cxx', 'Build the g++ compiler'
option 'enable-fortran', 'Build the gfortran compiler'
option 'enable-java', 'Buld the gcj compiler'
option 'enable-objc', 'Enable Objective-C language support'
option 'enable-objcxx', 'Enable Objective-C++ language support'
option 'enable-all-languages', 'Enable all compilers and languages, except Ada'
option 'enable-nls', 'Build with native language support (localization)'
option 'enable-profiled-build', 'Make use of profile guided optimization when bootstrapping GCC'
option 'enable-multilib', 'Build with multilib support'
depends_on 'gmp4'
depends_on 'mpfr2'
depends_on 'ecj' if build.include? 'enable-java' or build.include? 'enable-all-languages'
# Patches adapted from macports:
# http://trac.macports.org/browser/trunk/dports/lang/gcc43/files
def patches; DATA; end
def install
# GCC will suffer build errors if forced to use a particular linker.
ENV.delete 'LD'
if build.include? 'enable-all-languages'
# Everything but Ada, which requires a pre-existing GCC Ada compiler
# (gnat) to bootstrap.
languages = %w[c c++ fortran java objc obj-c++]
else
# The C compiler is always built, but additional defaults can be added
# here.
languages = %w[c]
languages << 'c++' if build.include? 'enable-cxx'
languages << 'fortran' if build.include? 'enable-fortran'
languages << 'java' if build.include? 'enable-java'
languages << 'objc' if build.include? 'enable-objc'
languages << 'obj-c++' if build.include? 'enable-objcxx'
end
# Sandbox the GCC lib, libexec and include directories so they don't wander
# around telling small children there is no Santa Claus. This results in a
# partially keg-only brew following suggestions outlined in the "How to
# install multiple versions of GCC" section of the GCC FAQ:
# http://gcc.gnu.org/faq.html#multiple
gcc_prefix = prefix + 'gcc'
args = [
"--build=#{arch}-apple-darwin#{osmajor}",
# Sandbox everything...
"--prefix=#{gcc_prefix}",
# ...except the stuff in share...
"--datadir=#{share}",
"--mandir=#{man}",
# ...and the binaries...
"--bindir=#{bin}",
# ...which are tagged with a suffix to distinguish them.
"--enable-languages=#{languages.join(',')}",
"--program-suffix=-#{version.to_s.slice(/\d\.\d/)}",
"--with-gmp=#{Formula.factory('gmp4').opt_prefix}",
"--with-mpfr=#{Formula.factory('mpfr2').opt_prefix}",
"--with-system-zlib",
"--enable-stage1-checking",
"--enable-checking=release",
# a no-op unless --HEAD is built because in head warnings will raise errs.
"--disable-werror"
]
args << '--disable-nls' unless build.include? 'enable-nls'
if build.include? 'enable-java' or build.include? 'enable-all-languages'
args << "--with-ecj-jar=#{Formula.factory('ecj').opt_prefix}/share/java/ecj.jar"
end
if build.include? 'enable-multilib'
args << '--enable-multilib'
else
args << '--disable-multilib'
end
mkdir 'build' do
unless MacOS::CLT.installed?
# For Xcode-only systems, we need to tell the sysroot path.
# 'native-system-header's will be appended
args << "--with-native-system-header-dir=/usr/include"
args << "--with-sysroot=#{MacOS.sdk_path}"
end
system '../configure', *args
# Flags for Clang compatibility
make_flags = 'BOOT_CFLAGS="$BOOT_CFLAGS -D_FORTIFY_SOURCE=0" STAGE1_CFLAGS="$STAGE1_CFLAGS -std=gnu89 -D_FORTIFY_SOURCE=0 -fkeep-inline-functions"'
if build.include? 'enable-profiled-build'
# Takes longer to build, may bug out. Provided for those who want to
# optimise all the way to 11.
system "make #{make_flags} profiledbootstrap"
else
system "make #{make_flags} bootstrap"
end
# At this point `make check` could be invoked to run the testsuite. The
# deja-gnu formula must be installed in order to do this.
system 'make install'
# Remove conflicting manpages in man7
man7.rmtree
end
end
end
__END__
--- gcc-4.3.6/gcc/config.gcc.orig 2009-10-18 12:07:26.000000000 -0400
+++ gcc-4.3.6/gcc/config.gcc 2009-10-18 12:07:46.000000000 -0400
@@ -417,7 +417,7 @@
*-*-darwin*)
tm_file="${tm_file} darwin.h"
case ${target} in
- *-*-darwin9*)
+ *-*-darwin9* | *-*-darwin1[0-9]*)
tm_file="${tm_file} darwin9.h"
;;
esac
--- gcc-4.3.6/configure.orig 2009-10-18 12:09:09.000000000 -0400
+++ gcc-4.3.6/configure 2009-10-18 12:10:07.000000000 -0400
@@ -2133,7 +2133,7 @@
*-*-chorusos)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
- powerpc-*-darwin* | i[3456789]86-*-darwin* | x86_64-*-darwin9*)
+ powerpc-*-darwin* | i[3456789]86-*-darwin* | x86_64-*-darwin9* | x86_64-*-darwin1[0-9]*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
--- gcc-4.3.6/configure.ac.orig 2009-10-18 12:12:07.000000000 -0400
+++ gcc-4.3.6/configure.ac 2009-10-18 12:15:37.000000000 -0400
@@ -410,7 +410,7 @@
*-*-chorusos)
noconfigdirs="$noconfigdirs target-newlib target-libgloss ${libgcj}"
;;
- powerpc-*-darwin* | i[[3456789]]86-*-darwin* | x86_64-*-darwin9*)
+ powerpc-*-darwin* | i[[3456789]]86-*-darwin* | x86_64-*-darwin9* | x86_64-*-darwin1[[0-9]]*)
noconfigdirs="$noconfigdirs bfd binutils ld gas opcodes gdb gprof"
noconfigdirs="$noconfigdirs sim target-rda"
;;
--- gcc-4.3.6/libjava/configure.orig 2009-10-18 12:17:53.000000000 -0400
+++ gcc-4.3.6/libjava/configure 2009-10-18 12:19:04.000000000 -0400
@@ -27297,7 +27297,7 @@
m68*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
- powerpc*-*-darwin* | i?86-*-darwin9* | x86_64-*-darwin9*)
+ powerpc*-*-darwin* | i?86-*-darwin9* | i?86-*-darwin1[0-9]* | x86_64-*-darwin9* | x86_64-*-darwin1[0-9]*)
SIGNAL_HANDLER=include/darwin-signal.h
;;
*)
--- gcc-4.3.6/libjava/configure.ac.orig 2009-10-18 12:19:42.000000000 -0400
+++ gcc-4.3.6/libjava/configure.ac 2009-10-18 12:20:18.000000000 -0400
@@ -1563,7 +1563,7 @@
m68*-*-linux*)
SIGNAL_HANDLER=include/dwarf2-signal.h
;;
- powerpc*-*-darwin* | i?86-*-darwin9* | x86_64-*-darwin9*)
+ powerpc*-*-darwin* | i?86-*-darwin9* | i?86-*-darwin1[[0-9]]* | x86_64-*-darwin9* | x86_64-*-darwin1[[0-9]]*)
SIGNAL_HANDLER=include/darwin-signal.h
;;
*)
--- gcc-4.3.6/libjava/configure.host.orig 2009-10-18 12:38:02.000000000 -0400
+++ gcc-4.3.6/libjava/configure.host 2009-10-18 12:38:28.000000000 -0400
@@ -295,11 +295,11 @@
slow_pthread_self=
can_unwind_signal=no
;;
- i?86-*-darwin9*)
+ i?86-*-darwin9* | i?86-*-darwin1[0-9]*)
can_unwind_signal=yes
DIVIDESPEC=-f%{m32:no-}%{!m32:%{!m64:no-}}%{m64:}use-divide-subroutine
;;
- x86_64-*-darwin9*)
+ x86_64-*-darwin9* | x86_64-*-darwin1[0-9]*)
enable_hash_synchronization_default=yes
slow_pthread_self=
can_unwind_signal=yes
--- gcc-4.3.6/gcc/config/i386/t-darwin64.orig 2009-10-18 12:21:43.000000000 -0400
+++ gcc-4.3.6/gcc/config/i386/t-darwin64 2009-10-18 12:22:21.000000000 -0400
@@ -1,5 +1,11 @@
LIB2_SIDITI_CONV_FUNCS=yes
LIB2FUNCS_EXTRA = $(srcdir)/config/darwin-64.c
+MULTILIB_OPTIONS = m32
+MULTILIB_DIRNAMES = i386
+
+LIBGCC = stmp-multilib
+INSTALL_LIBGCC = install-multilib
+
softfp_wrap_start := '\#ifdef __x86_64__'
softfp_wrap_end := '\#endif'
--- gcc-4.3.6/gcc/cp/Make-lang.in 2009/09/09 08:14:36 151554
+++ gcc-4.3.6/gcc/cp/Make-lang.in 2009/09/09 08:46:32 151555
@@ -72,7 +72,7 @@
CXX_C_OBJS = attribs.o c-common.o c-format.o c-pragma.o c-semantics.o c-lex.o \
c-dump.o $(CXX_TARGET_OBJS) c-pretty-print.o c-opts.o c-pch.o \
c-incpath.o cppdefault.o c-ppoutput.o c-cppbuiltin.o prefix.o \
- c-gimplify.o c-omp.o tree-inline.o
+ c-gimplify.o c-omp.o
# Language-specific object files for C++ and Objective C++.
CXX_AND_OBJCXX_OBJS = cp/call.o cp/decl.o cp/expr.o cp/pt.o cp/typeck2.o \
diff --git src/powerpc/darwin.S src/powerpc/darwin.S
--- gcc-4.3.6/libffi/src/powerpc/darwin.S
+++ gcc-4.3.6/libffi/src/powerpc/darwin.S
@@ -191,17 +191,17 @@ EH_frame1:
LSCIE1:
.long 0x0 ; CIE Identifier Tag
.byte 0x1 ; CIE Version
.ascii "zR\0" ; CIE Augmentation
.byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
.byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
.byte 0x41 ; CIE RA Column
.byte 0x1 ; uleb128 0x1; Augmentation size
- .byte 0x90 ; FDE Encoding (indirect pcrel)
+ .byte 0x10 ; FDE Encoding (pcrel)
.byte 0xc ; DW_CFA_def_cfa
.byte 0x1 ; uleb128 0x1
.byte 0x0 ; uleb128 0x0
.align LOG2_GPR_BYTES
LECIE1:
.globl _ffi_call_DARWIN.eh
_ffi_call_DARWIN.eh:
LSFDE1:
diff --git src/powerpc/darwin_closure.S src/powerpc/darwin_closure.S
--- gcc-4.3.6/libffi/src/powerpc/darwin_closure.S
+++ gcc-4.3.6/libffi/src/powerpc/darwin_closure.S
@@ -253,17 +253,17 @@ EH_frame1:
LSCIE1:
.long 0x0 ; CIE Identifier Tag
.byte 0x1 ; CIE Version
.ascii "zR\0" ; CIE Augmentation
.byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor
.byte 0x7c ; sleb128 -4; CIE Data Alignment Factor
.byte 0x41 ; CIE RA Column
.byte 0x1 ; uleb128 0x1; Augmentation size
- .byte 0x90 ; FDE Encoding (indirect pcrel)
+ .byte 0x10 ; FDE Encoding (pcrel)
.byte 0xc ; DW_CFA_def_cfa
.byte 0x1 ; uleb128 0x1
.byte 0x0 ; uleb128 0x0
.align LOG2_GPR_BYTES
LECIE1:
.globl _ffi_closure_ASM.eh
_ffi_closure_ASM.eh:
LSFDE1: