source: trunk/dports/lang/gcc6/Portfile @ 147830

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

gcc6: update to 6-20160410

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