source: trunk/dports/lang/gcc45/Portfile

Last change on this file was 148394, checked in by ryandesign@…, 19 months ago

gcc43, gcc44, gcc45, gcc46, gcc47, gcc48, gcc49, gcc5, gcc6, gcc7: change build.target from bootstrap to bootstrap-lean to use less disk space during the build

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 12.9 KB
Line 
1# $Id: Portfile 148394 2016-05-07 00:56:38Z ryandesign@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            12
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:cctools \
68                    port:gmp \
69                    port:ld64 \
70                    path:lib/libgcc/libgcc_s.1.dylib:libgcc \
71                    port:libiconv \
72                    port:libmpc \
73                    port:mpfr
74depends_run         port:gcc_select \
75                    port:libgcc45
76
77depends_skip_archcheck-append texinfo gcc_select ld64 cctools
78license_noconflict  gmp mpfr ppl libmpc
79
80patchfiles          ppc_fde_encoding.diff \
81                    texinfo5.patch
82
83# Handle OS X deployment targets correctly (GCC PR target/63810
84# <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810>).
85patchfiles-append   macosx-version-min.patch
86
87# Don't link with "-flat_namespace -undefined suppress" on Yosemite and
88# later (#45483).
89patchfiles-append   yosemite-libtool.patch
90
91set major           [join [lrange [split ${version} .-] 0 1] .]
92
93worksrcdir          gcc-${version}
94
95post-extract {
96    copy ${distpath}/${ecj} ${worksrcpath}/ecj.jar
97}
98
99platform darwin {
100    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
101}
102
103configure.dir       ${workpath}/build
104configure.cmd       ${worksrcpath}/configure
105configure.args      --enable-languages=c,c++,objc,obj-c++,fortran,java \
106                    --libdir=${prefix}/lib/${name} \
107                    --includedir=${prefix}/include/${name} \
108                    --infodir=${prefix}/share/info \
109                    --mandir=${prefix}/share/man \
110                    --datarootdir=${prefix}/share/gcc-${major} \
111                    --with-local-prefix=${prefix} \
112                    --with-libiconv-prefix=${prefix} \
113                    --with-system-zlib \
114                    --disable-nls \
115                    --program-suffix=-mp-${major} \
116                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
117                    --with-gmp=${prefix} \
118                    --with-mpfr=${prefix} \
119                    --with-mpc=${prefix} \
120                    --enable-stage1-checking \
121                    --disable-multilib \
122                    --enable-plugin \
123                    --with-build-config=bootstrap-debug \
124                    --with-as=${prefix}/bin/as \
125                    --with-ld=${prefix}/bin/ld \
126                    --with-ar=${prefix}/bin/ar \
127                    --with-bugurl=https://trac.macports.org/newticket
128
129configure.env-append \
130                    AR_FOR_TARGET=${prefix}/bin/ar \
131                    AS_FOR_TARGET=${prefix}/bin/as \
132                    LD_FOR_TARGET=${prefix}/bin/ld \
133                    NM_FOR_TARGET=${prefix}/bin/nm \
134                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
135                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
136                    STRIP_FOR_TARGET=${prefix}/bin/strip \
137                    OTOOL=${prefix}/bin/otool \
138                    OTOOL64=${prefix}/bin/otool
139
140pre-configure {
141    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
142
143    # TODO: Remove when base automatically creates configure.dir (2.2.1?).
144    file mkdir ${configure.dir}
145}
146
147# http://trac.macports.org/ticket/29067
148compiler.blacklist-append gcc-4.0
149
150# http://trac.macports.org/ticket/29104
151compiler.blacklist-append {llvm-gcc-4.2 < 2336.1}
152
153# LTO doesn't work for other targets, see ticket #32863
154if {![variant_isset universal] && ${build_arch} eq "x86_64"} {
155    configure.args-append --enable-lto
156}
157
158# "-stdlib" would be passed on to the bootstrap compiler if present
159configure.cxx_stdlib
160
161build.dir           ${configure.dir}
162build.target        bootstrap-lean
163use_parallel_build  yes
164
165destroot.target     install install-info-host
166
167if {${subport} == "libgcc45"} {
168    # http://trac.macports.org/ticket/35770
169    # http://trac.macports.org/ticket/38814
170    # While there can be multiple versions of these runtimes in a single
171    # process, it is not possible to pass objects between different versions,
172    # so we simplify this by having the libgcc port provide the newest version
173    # of these runtimes for all versions of gcc to use.
174    #
175    # If there is a binary incompatible change to the runtime in a future
176    # version of gcc, then the latest version of gcc to provide a given ABI
177    # version should continue to provide a subport for that and older gcc
178    # versions.
179
180    depends_run-delete port:libgcc45
181
182    configure.args-delete --libdir=${prefix}/lib/${name}
183    configure.args-append --libdir=${prefix}/lib/libgcc
184
185    configure.args-delete --enable-languages=c,c++,objc,obj-c++,fortran,java
186    configure.args-append --enable-languages=c,c++,objc,obj-c++
187
188    # TODO: Possibly disable bootstrap with appropriate configure flags.
189    #       the problem is that libstdc++'s configure script tests for tls support
190    #       using the running compiler (not gcc for which libstdc++ is being built).
191    #       Thus when we build with clang, we get a mismatch
192    # http://trac.macports.org/ticket/36116
193    #compiler.blacklist-append {clang < 425}
194    #configure.args-append --disable-bootstrap
195    #build.target        all
196
197    post-destroot {
198        file mkdir ${destroot}${prefix}/lib/libgcc.merged
199
200        set dylibs {libobjc-gnu.2.dylib}
201
202        foreach dylib ${dylibs} {
203            move ${destroot}${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/libgcc.merged
204            if {[variant_isset universal]} {
205                foreach archdir [glob ${destroot}${prefix}/lib/libgcc/*/] {
206                    set archdir_nodestroot [string map "${destroot}/ /" ${archdir}]
207                    if {[file exists ${archdir}/${dylib}]} {
208                        system "install_name_tool -id ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}"
209                        foreach link ${dylibs} {
210                            system "install_name_tool -change ${archdir_nodestroot}${link} ${prefix}/lib/libgcc/${link} ${archdir}/${dylib}"
211                        }
212                        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}"
213                    }
214                }
215            }
216
217            # strip debug symbols to supress debugger warnings:
218            # http://trac.macports.org/attachment/ticket/34831
219            system "strip -x ${destroot}${prefix}/lib/libgcc.merged/${dylib}"
220        }
221
222        file delete -force ${destroot}${prefix}/bin             
223        file delete -force ${destroot}${prefix}/share
224        file delete -force ${destroot}${prefix}/include
225        file delete -force ${destroot}${prefix}/lib/libgcc
226        file delete -force ${destroot}${prefix}/libexec
227
228        move ${destroot}${prefix}/lib/libgcc.merged ${destroot}${prefix}/lib/libgcc
229    }
230} else {
231post-destroot {
232    # install/copy ffitarget.h only if we have it
233    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
234        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
235    }
236    file rename ${destroot}${prefix}/share/python/aotcompile.py \
237                ${destroot}${prefix}/share/python/aotcompile-45.py
238    file rename ${destroot}${prefix}/share/python/classfile.py \
239                ${destroot}${prefix}/share/python/classfile-45.py
240
241    # darwin-sections.def gets missed on install for some reason
242    if {${os.arch} ne "powerpc"} {
243        eval file copy ${worksrcpath}/../gcc-${version}/gcc/config/darwin-sections.def [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/plugin/include/config]
244    }
245
246    file delete ${destroot}${prefix}/share/info/dir
247
248    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
249        set extension [file extension ${file}]
250        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
251       
252        file rename ${file} ${newfile}
253    }
254
255    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} {
256        # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
257        # https://trac.macports.org/ticket/40098
258        # https://trac.macports.org/ticket/40100
259        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
260            delete ${destroot}${prefix}/lib/${name}/${dylib}
261            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
262        }
263
264        if {[variant_isset universal]} {
265            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
266                if {[file exists ${archdir}/${dylib}]} {
267                    delete ${archdir}/${dylib}
268                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
269                }
270            }
271        }
272    }
273}
274
275select.group        gcc
276select.file         ${filespath}/mp-${name}
277
278}
279
280platform darwin {
281    if {${os.major} == 8} {
282        # http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45248
283        configure.args-append --with-dwarf2
284    }
285}
286
287platform powerpc {
288    configure.universal_archs ppc ppc64
289
290    # https://trac.macports.org/ticket/39655
291    configure.args-delete --enable-plugin
292}
293platform i386 {
294    configure.universal_archs i386 x86_64
295}
296variant universal {
297    configure.args-delete --disable-multilib
298}
299# the generated compiler doesn't accept -arch
300configure.env-append CPP="${configure.cc} -E"
301build.env-append CPP="${configure.cc} -E"
302configure.cc-append [get_canonical_archflags]
303configure.cc_archflags
304configure.cxx_archflags
305configure.objc_archflags
306configure.ld_archflags
307configure.universal_cflags
308configure.universal_cxxflags
309configure.universal_ldflags
310configure.universal_args
311
312livecheck.type      regex
313livecheck.url       http://ftp.gnu.org/gnu/gcc/
314livecheck.regex     gcc-(${major}\\.\[0-9.\]+)/
Note: See TracBrowser for help on using the repository browser.