source: trunk/dports/lang/gcc49/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: 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 125551 2014-09-20 23:11:55Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6PortGroup compiler_blacklist_versions 1.0
7PortGroup conflicts_build 1.0
8
9name                gcc49
10subport             libgcc {}
11
12# TODO: On next update, increase epoch to 2 and remove libgcc's separate epoch.
13epoch               1
14version             4.9.1
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}/ \
26                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \
27                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \
28                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \
29                    gnu:gcc/gcc-${version}
30
31distname            gcc-${version}
32use_bzip2           yes
33
34checksums           rmd160  7a829a260648a190afa1d6c616c78ddc861f4f7d \
35                    sha256  d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e
36
37depends_lib         port:gmp port:mpfr port:libiconv port:libmpc path:lib/pkgconfig/cloog-isl.pc:cloog path:lib/libgcc/libgcc_s.1.dylib:libgcc 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
43patch.pre_args      -p1
44patchfiles          Fix-__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.patch
45
46set major           4.9
47
48platform darwin {
49    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
50}
51
52configure.dir       ${workpath}/build
53configure.cmd       ${worksrcpath}/configure
54configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
55                    --libdir=${prefix}/lib/${name} \
56                    --includedir=${prefix}/include/${name} \
57                    --infodir=${prefix}/share/info \
58                    --mandir=${prefix}/share/man \
59                    --datarootdir=${prefix}/share/gcc-${major} \
60                    --with-local-prefix=${prefix} \
61                    --with-system-zlib \
62                    --disable-nls \
63                    --program-suffix=-mp-${major} \
64                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
65                    --with-gmp=${prefix} \
66                    --with-mpfr=${prefix} \
67                    --with-mpc=${prefix} \
68                    --with-cloog=${prefix} --enable-cloog-backend=isl \
69                    --disable-cloog-version-check \
70                    --enable-stage1-checking \
71                    --disable-multilib \
72                    --enable-lto \
73                    --enable-libstdcxx-time \
74                    --with-as=${prefix}/bin/as \
75                    --with-ld=${prefix}/bin/ld \
76                    --with-ar=${prefix}/bin/ar \
77                    --with-bugurl=https://trac.macports.org/newticket
78
79configure.env-append \
80                    AR_FOR_TARGET=${prefix}/bin/ar \
81                    AS_FOR_TARGET=${prefix}/bin/as \
82                    LD_FOR_TARGET=${prefix}/bin/ld \
83                    NM_FOR_TARGET=${prefix}/bin/nm \
84                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
85                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
86                    STRIP_FOR_TARGET=${prefix}/bin/strip \
87                    OTOOL=${prefix}/bin/otool \
88                    OTOOL64=${prefix}/bin/otool
89
90pre-configure {
91    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
92
93    # TODO: Remove when base automatically creates configure.dir (2.2.1?).
94    file mkdir ${configure.dir}
95}
96
97# http://trac.macports.org/ticket/29067
98compiler.blacklist-append gcc-4.0
99
100# http://trac.macports.org/ticket/29104
101compiler.blacklist-append {llvm-gcc-4.2 < 2336.1}
102
103# "-stdlib" would be passed on to the bootstrap compiler if present
104configure.cxx_stdlib
105
106# https://trac.macports.org/ticket/43869
107conflicts_build-append libunwind-headers
108
109build.dir           ${configure.dir}
110build.target        bootstrap
111use_parallel_build  yes
112
113destroot.target     install install-info-host
114
115if {${subport} eq "libgcc"} {
116    conflicts       libgcc-devel
117
118    epoch 2
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 path:lib/libgcc/libgcc_s.1.dylib:libgcc
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 {
198post-destroot {
199    file delete ${destroot}${prefix}/share/info/dir
200
201    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
202        set extension [file extension ${file}]
203        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
204
205        file rename ${file} ${newfile}
206    }
207
208    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} {
209        # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
210        # https://trac.macports.org/ticket/40098
211        # https://trac.macports.org/ticket/40100
212        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
213            delete ${destroot}${prefix}/lib/${name}/${dylib}
214            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
215        }
216
217        if {[variant_isset universal]} {
218            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
219                if {[file exists ${archdir}/${dylib}]} {
220                    delete ${archdir}/${dylib}
221                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
222                }
223            }
224        }
225    }
226}
227
228select.group        gcc
229select.file         ${filespath}/mp-${name}
230
231}
232
233platform powerpc {
234    configure.universal_archs ppc ppc64
235}
236platform i386 {
237    configure.universal_archs i386 x86_64
238}
239variant universal {
240    configure.args-delete --disable-multilib
241}
242# the generated compiler doesn't accept -arch
243configure.env-append CPP="${configure.cc} -E"
244build.env-append CPP="${configure.cc} -E"
245configure.cc-append [get_canonical_archflags]
246configure.cc_archflags
247configure.cxx-append ${configure.cxx_archflags}
248configure.cxx_archflags
249configure.objc_archflags
250configure.ld_archflags
251configure.universal_cflags
252configure.universal_cxxflags
253configure.universal_ldflags
254configure.universal_args
255
256livecheck.type      regex
257livecheck.url       http://gcc.gnu.org/gcc-4.9/
258livecheck.regex     GCC (4\\.9\\.\[0-9\])
Note: See TracBrowser for help on using the repository browser.