source: trunk/dports/lang/gcc45/Portfile @ 127045

Last change on this file since 127045 was 127045, checked in by mfeiri@…, 5 years ago

gcc43, gcc44, gcc45, gcc46, gcc47, gcc48, gcc49, gcc5: build conflict with libunwind-headers resolved in r127042

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.3 KB
Line 
1# $Id: Portfile 127045 2014-10-19 22:54:11Z mfeiri@macports.org $
2
3PortSystem 1.0
4PortGroup select 1.0
5PortGroup compiler_blacklist_versions 1.0
6
7# Whenever this port is bumped for version/revision, please revbump dragonegg-3.[34]-gcc-4.5
8name                gcc45
9subport             libgcc45 {}
10
11epoch               1
12version             4.5.4
13revision            10
14platforms           darwin
15categories          lang
16maintainers         mww openmaintainer
17# an exception in the license allows dependents to not be GPL
18license             {GPL-3+ Permissive}
19description         The GNU compiler collection
20long_description    The GNU compiler collection, including front ends for \
21                    C, C++, Objective-C, Objective-C++, Fortran, and Java.
22
23homepage            http://gcc.gnu.org/
24master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/:gcc \
25                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/:gcc \
26                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/:gcc \
27                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/:gcc \
28                    gnu:gcc/gcc-${version}:gcc \
29                    ftp://sourceware.org/pub/java/:ecj \
30                    http://mirrors.kernel.org/sources.redhat.com/java/:ecj \
31                    http://www.mirrorservice.org/sites/sources.redhat.com/pub/java/:ecj \
32                    http://ftp-stud.fht-esslingen.de/pub/Mirrors/sourceware.org/java/:ecj
33
34use_bzip2           yes
35
36set dcore           gcc-core-${version}.tar.bz2
37set dfort           gcc-fortran-${version}.tar.bz2
38set dcxx            gcc-g++-${version}.tar.bz2
39set djava           gcc-java-${version}.tar.bz2
40set dobjc           gcc-objc-${version}.tar.bz2
41
42set ecj             ecj-4.5.jar
43
44distfiles           ${dcore}:gcc ${dfort}:gcc ${dcxx}:gcc ${djava}:gcc ${dobjc}:gcc ${ecj}:ecj
45extract.only        ${dcore} ${dfort} ${dcxx} ${djava} ${dobjc}
46
47checksums           gcc-core-${version}.tar.bz2 \
48                    rmd160  558a68fad29011b8ba04e1c103eb204bd1e54d5a \
49                    sha256  894d90f72cbfc8707e330fa2b1847c443fa97cf9b7f26e86be554709510e624a \
50                    gcc-fortran-${version}.tar.bz2 \
51                    rmd160  98a4a816e8f0ec8f3081d99af5460fe1afea6ade \
52                    sha256  cf0803b4f5334a526dd8da1b2171d6724f50c17346b2d5c509b6abc973d2ef34 \
53                    gcc-g++-${version}.tar.bz2 \
54                    rmd160  9003882b806822ea7c5c114d060904464c07ca7a \
55                    sha256  f7e3bab5e22713fbce46c2acb35fb727748473a34a942ce00393d75e1b09b6b9 \
56                    gcc-java-${version}.tar.bz2 \
57                    rmd160  719bfe5fd93542e7e3907cce23362c52eef9009c \
58                    sha256  c98398da6f8c4c7d1758e291089d99853fdd27112cd3f146b7a8c26e6d762a23 \
59                    gcc-objc-${version}.tar.bz2 \
60                    rmd160  6c5bf2b75cb61105bfa3fd4c0d2462871c687495 \
61                    sha256  92e7f8894a2f372a77d30732831c366289cea74f2a56c53cfec9de2ace413c92 \
62                    ecj-4.5.jar \
63                    rmd160  d3f4da657f086b6423f74e93f001132f4855368a \
64                    sha256  98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
65
66depends_build       bin:makeinfo:texinfo
67depends_lib         port:gmp port:mpfr port:libiconv port:libmpc path:lib/libgcc/libgcc_s.1.dylib:libgcc port:ld64 port:cctools
68depends_run         port:gcc_select port:libgcc45
69
70depends_skip_archcheck-append texinfo gcc_select ld64 cctools
71license_noconflict  gmp mpfr ppl libmpc
72
73patchfiles          ppc_fde_encoding.diff \
74                    texinfo5.patch
75
76set major           4.5
77
78worksrcdir          gcc-${version}
79
80post-extract {
81    copy ${distpath}/${ecj} ${worksrcpath}/ecj.jar
82}
83
84platform darwin {
85    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
86}
87
88configure.dir       ${workpath}/build
89configure.cmd       ${worksrcpath}/configure
90configure.args      --enable-languages=c,c++,objc,obj-c++,fortran,java \
91                    --libdir=${prefix}/lib/${name} \
92                    --includedir=${prefix}/include/${name} \
93                    --infodir=${prefix}/share/info \
94                    --mandir=${prefix}/share/man \
95                    --datarootdir=${prefix}/share/gcc-${major} \
96                    --with-local-prefix=${prefix} \
97                    --with-libiconv-prefix=${prefix} \
98                    --with-system-zlib \
99                    --disable-nls \
100                    --program-suffix=-mp-${major} \
101                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
102                    --with-gmp=${prefix} \
103                    --with-mpfr=${prefix} \
104                    --with-mpc=${prefix} \
105                    --enable-stage1-checking \
106                    --disable-multilib \
107                    --enable-plugin \
108                    --with-as=${prefix}/bin/as \
109                    --with-ld=${prefix}/bin/ld \
110                    --with-ar=${prefix}/bin/ar \
111                    --with-bugurl=https://trac.macports.org/newticket
112
113configure.env-append \
114                    AR_FOR_TARGET=${prefix}/bin/ar \
115                    AS_FOR_TARGET=${prefix}/bin/as \
116                    LD_FOR_TARGET=${prefix}/bin/ld \
117                    NM_FOR_TARGET=${prefix}/bin/nm \
118                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
119                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
120                    STRIP_FOR_TARGET=${prefix}/bin/strip \
121                    OTOOL=${prefix}/bin/otool \
122                    OTOOL64=${prefix}/bin/otool
123
124pre-configure {
125    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
126
127    # TODO: Remove when base automatically creates configure.dir (2.2.1?).
128    file mkdir ${configure.dir}
129}
130
131# http://trac.macports.org/ticket/29067
132compiler.blacklist-append gcc-4.0
133
134# http://trac.macports.org/ticket/29104
135compiler.blacklist-append {llvm-gcc-4.2 < 2336.1}
136
137# LTO doesn't work for other targets, see ticket #32863
138if {![variant_isset universal] && ${build_arch} eq "x86_64"} {
139    configure.args-append --enable-lto
140}
141
142# "-stdlib" would be passed on to the bootstrap compiler if present
143configure.cxx_stdlib
144
145build.dir           ${configure.dir}
146build.target        bootstrap
147use_parallel_build  yes
148
149destroot.target     install install-info-host
150
151if {${subport} == "libgcc45"} {
152    # http://trac.macports.org/ticket/35770
153    # http://trac.macports.org/ticket/38814
154    # While there can be multiple versions of these runtimes in a single
155    # process, it is not possible to pass objects between different versions,
156    # so we simplify this by having the libgcc port provide the newest version
157    # of these runtimes for all versions of gcc to use.
158    #
159    # If there is a binary incompatible change to the runtime in a future
160    # version of gcc, then the latest version of gcc to provide a given ABI
161    # version should continue to provide a subport for that and older gcc
162    # versions.
163
164    depends_run-delete port:libgcc45
165
166    configure.args-delete --libdir=${prefix}/lib/${name}
167    configure.args-append --libdir=${prefix}/lib/libgcc
168
169    configure.args-delete --enable-languages=c,c++,objc,obj-c++,fortran,java
170    configure.args-append --enable-languages=c,c++,objc,obj-c++
171
172    # TODO: Possibly disable bootstrap with appropriate configure flags.
173    #       the problem is that libstdc++'s configure script tests for tls support
174    #       using the running compiler (not gcc for which libstdc++ is being built).
175    #       Thus when we build with clang, we get a mismatch
176    # http://trac.macports.org/ticket/36116
177    #compiler.blacklist-append {clang < 425}
178    #configure.args-append --disable-bootstrap
179    #build.target        all
180
181    post-destroot {
182        file mkdir ${destroot}${prefix}/lib/libgcc.merged
183
184        set dylibs {libobjc-gnu.2.dylib}
185
186        foreach dylib ${dylibs} {
187            move ${destroot}${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/libgcc.merged
188            if {[variant_isset universal]} {
189                foreach archdir [glob ${destroot}${prefix}/lib/libgcc/*/] {
190                    set archdir_nodestroot [string map "${destroot}/ /" ${archdir}]
191                    if {[file exists ${archdir}/${dylib}]} {
192                        system "install_name_tool -id ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}"
193                        foreach link ${dylibs} {
194                            system "install_name_tool -change ${archdir_nodestroot}${link} ${prefix}/lib/libgcc/${link} ${archdir}/${dylib}"
195                        }
196                        system "lipo -create -output ${destroot}${prefix}/lib/libgcc.merged/${dylib}~ ${destroot}${prefix}/lib/libgcc.merged/${dylib} ${archdir}/${dylib} && mv ${destroot}${prefix}/lib/libgcc.merged/${dylib}~ ${destroot}${prefix}/lib/libgcc.merged/${dylib}"
197                    }
198                }
199            }
200
201            # strip debug symbols to supress debugger warnings:
202            # http://trac.macports.org/attachment/ticket/34831
203            system "strip -x ${destroot}${prefix}/lib/libgcc.merged/${dylib}"
204        }
205
206        file delete -force ${destroot}${prefix}/bin             
207        file delete -force ${destroot}${prefix}/share
208        file delete -force ${destroot}${prefix}/include
209        file delete -force ${destroot}${prefix}/lib/libgcc
210        file delete -force ${destroot}${prefix}/libexec
211
212        move ${destroot}${prefix}/lib/libgcc.merged ${destroot}${prefix}/lib/libgcc
213    }
214} else {
215post-destroot {
216    # install/copy ffitarget.h only if we have it
217    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
218        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
219    }
220    file rename ${destroot}${prefix}/share/python/aotcompile.py \
221                ${destroot}${prefix}/share/python/aotcompile-45.py
222    file rename ${destroot}${prefix}/share/python/classfile.py \
223                ${destroot}${prefix}/share/python/classfile-45.py
224
225    # darwin-sections.def gets missed on install for some reason
226    if {${os.arch} ne "powerpc"} {
227        eval file copy ${worksrcpath}/../gcc-${version}/gcc/config/darwin-sections.def [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/plugin/include/config]
228    }
229
230    file delete ${destroot}${prefix}/share/info/dir
231
232    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
233        set extension [file extension ${file}]
234        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
235       
236        file rename ${file} ${newfile}
237    }
238
239    foreach dylib {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib libgcc_s.1.dylib libgfortran.3.dylib libstdc++.6.dylib libobjc-gnu.2.dylib libgomp.1.dylib libssp.0.dylib} {
240        # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
241        # https://trac.macports.org/ticket/40098
242        # https://trac.macports.org/ticket/40100
243        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
244            delete ${destroot}${prefix}/lib/${name}/${dylib}
245            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
246        }
247
248        if {[variant_isset universal]} {
249            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
250                if {[file exists ${archdir}/${dylib}]} {
251                    delete ${archdir}/${dylib}
252                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
253                }
254            }
255        }
256    }
257}
258
259select.group        gcc
260select.file         ${filespath}/mp-${name}
261
262}
263
264platform darwin {
265    if {${os.major} == 8} {
266        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45248
267        configure.args-append --with-dwarf2
268    }
269}
270
271platform powerpc {
272    configure.universal_archs ppc ppc64
273
274    # https://trac.macports.org/ticket/39655
275    configure.args-delete --enable-plugin
276}
277platform i386 {
278    configure.universal_archs i386 x86_64
279}
280variant universal {
281    configure.args-delete --disable-multilib
282}
283# the generated compiler doesn't accept -arch
284configure.env-append CPP="${configure.cc} -E"
285build.env-append CPP="${configure.cc} -E"
286configure.cc-append [get_canonical_archflags]
287configure.cc_archflags
288configure.cxx_archflags
289configure.objc_archflags
290configure.ld_archflags
291configure.universal_cflags
292configure.universal_cxxflags
293configure.universal_ldflags
294configure.universal_args
295
296livecheck.type      regex
297livecheck.url       http://gcc.gnu.org/gcc-4.5/
298livecheck.regex     GCC (4\\.5\\.\[0-9\])
Note: See TracBrowser for help on using the repository browser.