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

Last change on this file since 125551 was 125551, checked in by ryandesign@…, 6 years ago

gcc43, gcc44, gcc45, gcc46, gcc47, gcc48, gcc49, gcc410: indicate build conflict with libunwind-headers (#43869)

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