source: trunk/dports/lang/gcc5/Portfile @ 125598

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

gcc5: update to 5-20140824

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.7 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 125598 2014-09-22 16:30:37Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6PortGroup compiler_blacklist_versions 1.0
7PortGroup conflicts_build 1.0
8
9name                gcc5
10subport             libgcc-devel {}
11
12version             5-20140824
13platforms           darwin
14categories          lang
15maintainers         mww openmaintainer
16# an exception in the license allows dependents to not be GPL
17license             {GPL-3+ Permissive}
18description         The GNU compiler collection, prerelease BETA
19long_description    The GNU compiler collection, including front ends for \
20                    C, C++, Objective-C, Objective-C++, Fortran and Java. \
21                    This is a prerelease BETA version!
22
23homepage            http://gcc.gnu.org/
24master_sites        http://gcc.petsads.us/snapshots/${version} \
25                    ftp://ftp.gwdg.de/pub/linux/gcc/snapshots/${version}/ \
26                    ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/snapshots/${version}/ \
27                    ftp://gcc.gnu.org/pub/gcc/snapshots/${version}/ \
28                    http://mirrors-us.seosue.com/gcc/snapshots/${version}/ \
29                    http://gcc.skazkaforyou.com/snapshots/${version}/
30
31distname            gcc-${version}
32use_bzip2           yes
33
34checksums           rmd160  afc26c594493bd5cd7fe3518c372021a28b318da \
35                    sha256  955390588b0f1bff631c9e3d3a33fad5b0d5244afdc3bbc9692d172ec4b9d957
36
37depends_lib         port:gmp port:mpfr port:libiconv port:libmpc path:lib/pkgconfig/cloog-isl.pc:cloog port:libgcc-devel port:ld64 port:cctools
38depends_run         port:gcc_select
39
40depends_skip_archcheck-append gcc_select ld64 cctools
41license_noconflict  gmp mpfr ppl libmpc
42
43patchfiles          patch-10.10.diff
44
45set major           [lindex [split ${version} .-] 0]
46
47platform darwin {
48    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
49}
50
51configure.dir       ${workpath}/build
52configure.cmd       ${worksrcpath}/configure
53configure.args      --enable-languages=c,c++,objc,obj-c++,fortran,java \
54                    --libdir=${prefix}/lib/${name} \
55                    --includedir=${prefix}/include/${name} \
56                    --infodir=${prefix}/share/info \
57                    --mandir=${prefix}/share/man \
58                    --datarootdir=${prefix}/share/gcc-${major} \
59                    --with-local-prefix=${prefix} \
60                    --with-system-zlib \
61                    --disable-nls \
62                    --program-suffix=-mp-${major} \
63                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
64                    --with-gmp=${prefix} \
65                    --with-mpfr=${prefix} \
66                    --with-mpc=${prefix} \
67                    --with-cloog=${prefix} --enable-cloog-backend=isl \
68                    --disable-cloog-version-check \
69                    --enable-stage1-checking \
70                    --disable-multilib \
71                    --enable-lto \
72                    --enable-libstdcxx-time \
73                    --with-as=${prefix}/bin/as \
74                    --with-ld=${prefix}/bin/ld \
75                    --with-ar=${prefix}/bin/ar \
76                    --with-bugurl=https://trac.macports.org/newticket
77
78configure.env-append \
79                    AR_FOR_TARGET=${prefix}/bin/ar \
80                    AS_FOR_TARGET=${prefix}/bin/as \
81                    LD_FOR_TARGET=${prefix}/bin/ld \
82                    NM_FOR_TARGET=${prefix}/bin/nm \
83                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
84                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
85                    STRIP_FOR_TARGET=${prefix}/bin/strip \
86                    OTOOL=${prefix}/bin/otool \
87                    OTOOL64=${prefix}/bin/otool
88
89pre-configure {
90    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
91
92    # TODO: Remove when base automatically creates configure.dir (2.2.1?).
93    file mkdir ${configure.dir}
94}
95
96# http://trac.macports.org/ticket/29067
97compiler.blacklist-append gcc-4.0
98
99# http://trac.macports.org/ticket/29104
100compiler.blacklist-append {llvm-gcc-4.2 < 2336.1}
101
102# "-stdlib" would be passed on to the bootstrap compiler if present
103configure.cxx_stdlib
104
105# https://trac.macports.org/ticket/43869
106conflicts_build-append libunwind-headers
107
108build.dir           ${configure.dir}
109build.target        bootstrap
110use_parallel_build  yes
111
112destroot.target     install install-info-host
113
114if {${subport} eq "libgcc-devel"} {
115    conflicts       libgcc
116
117    # http://trac.macports.org/ticket/35770
118    # http://trac.macports.org/ticket/38814
119    # While there can be multiple versions of these runtimes in a single
120    # process, it is not possible to pass objects between different versions,
121    # so we simplify this by having the libgcc port provide the newest version
122    # of these runtimes for all versions of gcc to use.
123    #
124    # If there is a binary incompatible change to the runtime in a future
125    # version of gcc, then the latest version of gcc to provide a given ABI
126    # version should continue to provide a subport for that and older gcc
127    # versions.
128
129    depends_lib-delete port:libgcc-devel
130
131    configure.args-delete --libdir=${prefix}/lib/${name}
132    configure.args-append --libdir=${prefix}/lib/libgcc
133
134    configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
135    configure.args-append --enable-languages=c,c++,objc,obj-c++,lto,fortran
136
137    # TODO: Possibly disable bootstrap with appropriate configure flags.
138    #       the problem is that libstdc++'s configure script tests for tls support
139    #       using the running compiler (not gcc for which libstdc++ is being built).
140    #       Thus when we build with clang, we get a mismatch
141    # http://trac.macports.org/ticket/36116
142    #compiler.blacklist-append {clang < 425}
143    #configure.args-append --disable-bootstrap
144    #build.target        all
145
146    post-destroot {
147        file mkdir ${destroot}${prefix}/lib/libgcc.merged
148
149        # Note that we really don't want to include libgcc_ext.10.[45].dylib here, but install_name_tool
150        # doesn't know how to change the id of stubs, and it's easier than recreating them for each
151        # gcc port.
152        set dylibs {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib libgcc_s.1.dylib libgfortran.3.dylib libquadmath.0.dylib libstdc++.6.dylib libobjc-gnu.4.dylib libgomp.1.dylib libitm.1.dylib libssp.0.dylib libasan.0.dylib libatomic.1.dylib}
153
154        foreach dylib ${dylibs} {
155            # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
156            # https://trac.macports.org/ticket/40098
157            # https://trac.macports.org/ticket/40100
158            if {! [file exists ${destroot}${prefix}/lib/libgcc/${dylib}]} {
159                continue
160            }
161
162            move ${destroot}${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/libgcc.merged
163            if {[variant_isset universal]} {
164                foreach archdir [glob ${destroot}${prefix}/lib/libgcc/*/] {
165                    set archdir_nodestroot [string map "${destroot}/ /" ${archdir}]
166                    if {[file exists ${archdir}/${dylib}]} {
167                        system "install_name_tool -id ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}"
168                        foreach link ${dylibs} {
169                            system "install_name_tool -change ${archdir_nodestroot}${link} ${prefix}/lib/libgcc/${link} ${archdir}/${dylib}"
170                        }
171                        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}"
172                    }
173                }
174            }
175
176            # strip debug symbols to supress debugger warnings:
177            # http://trac.macports.org/attachment/ticket/34831
178            if {! [string match *libgcc_ext* ${dylib}]} {
179                system "strip -x ${destroot}${prefix}/lib/libgcc.merged/${dylib}"
180            }
181        }
182
183        file delete -force ${destroot}${prefix}/bin             
184        file delete -force ${destroot}${prefix}/share
185        file delete -force ${destroot}${prefix}/include
186        file delete -force ${destroot}${prefix}/lib/libgcc
187        file delete -force ${destroot}${prefix}/libexec
188
189        move ${destroot}${prefix}/lib/libgcc.merged ${destroot}${prefix}/lib/libgcc
190
191        # For binary compatibility with binaries that linked against the old libstdcxx port
192        ln -s libgcc/libstdc++.6.dylib ${destroot}${prefix}/lib/libstdc++.6.dylib
193    }
194} else {
195post-destroot {
196    file delete ${destroot}${prefix}/share/info/dir
197
198    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
199        set extension [file extension ${file}]
200        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
201
202        file rename ${file} ${newfile}
203    }
204
205    foreach dylib {libgcc_ext.10.4.dylib libgcc_ext.10.5.dylib libgcc_s.1.dylib libgfortran.3.dylib libquadmath.0.dylib libstdc++.6.dylib libobjc-gnu.4.dylib libgomp.1.dylib libitm.1.dylib libssp.0.dylib libasan.0.dylib libatomic.1.dylib} {
206        # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
207        # https://trac.macports.org/ticket/40098
208        # https://trac.macports.org/ticket/40100
209        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
210            delete ${destroot}${prefix}/lib/${name}/${dylib}
211            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
212        }
213
214        if {[variant_isset universal]} {
215            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
216                if {[file exists ${archdir}/${dylib}]} {
217                    delete ${archdir}/${dylib}
218                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
219                }
220            }
221        }
222    }
223}
224
225select.group        gcc
226select.file         ${filespath}/mp-${name}
227
228}
229
230platform powerpc {
231    configure.universal_archs ppc ppc64
232}
233platform i386 {
234    configure.universal_archs i386 x86_64
235}
236variant universal {
237    configure.args-delete --disable-multilib
238}
239# the generated compiler doesn't accept -arch
240configure.env-append CPP="${configure.cc} -E"
241build.env-append CPP="${configure.cc} -E"
242configure.cc-append [get_canonical_archflags]
243configure.cc_archflags
244configure.cxx-append ${configure.cxx_archflags}
245configure.cxx_archflags
246configure.objc_archflags
247configure.ld_archflags
248configure.universal_cflags
249configure.universal_cxxflags
250configure.universal_ldflags
251configure.universal_args
252
253livecheck.type      regex
254livecheck.url       ftp://gcc.gnu.org/pub/gcc/snapshots/
255livecheck.regex     LATEST-${major} -> (${major}-\[0-9\]+)
Note: See TracBrowser for help on using the repository browser.