source: trunk/dports/lang/gcc49/Portfile @ 127045

Last change on this file since 127045 was 127045, checked in by mfeiri@…, 5 years ago

gcc43, gcc44, gcc45, gcc46, gcc47, gcc48, gcc49, gcc5: build conflict with libunwind-headers resolved in r127042

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 10.6 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 127045 2014-10-19 22:54:11Z mfeiri@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6PortGroup compiler_blacklist_versions 1.0
7
8name                gcc49
9subport             libgcc {}
10
11# TODO: On next update, increase epoch to 2 and remove libgcc's separate epoch.
12epoch               1
13version             4.9.1
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}/ \
25                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \
26                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \
27                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \
28                    gnu:gcc/gcc-${version}
29
30distname            gcc-${version}
31use_bzip2           yes
32
33checksums           rmd160  7a829a260648a190afa1d6c616c78ddc861f4f7d \
34                    sha256  d334781a124ada6f38e63b545e2a3b8c2183049515a1abab6d513f109f1d717e
35
36depends_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
37depends_run         port:gcc_select
38
39depends_skip_archcheck-append gcc_select ld64 cctools
40license_noconflict  gmp mpfr ppl libmpc
41
42patch.pre_args      -p1
43patchfiles          Fix-__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__.patch
44
45set major           4.9
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++,lto,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
105build.dir           ${configure.dir}
106build.target        bootstrap
107use_parallel_build  yes
108
109destroot.target     install install-info-host
110
111if {${subport} eq "libgcc"} {
112    conflicts       libgcc-devel
113
114    epoch 2
115
116    # http://trac.macports.org/ticket/35770
117    # http://trac.macports.org/ticket/38814
118    # While there can be multiple versions of these runtimes in a single
119    # process, it is not possible to pass objects between different versions,
120    # so we simplify this by having the libgcc port provide the newest version
121    # of these runtimes for all versions of gcc to use.
122    #
123    # If there is a binary incompatible change to the runtime in a future
124    # version of gcc, then the latest version of gcc to provide a given ABI
125    # version should continue to provide a subport for that and older gcc
126    # versions.
127
128    depends_lib-delete path:lib/libgcc/libgcc_s.1.dylib:libgcc
129
130    configure.args-delete --libdir=${prefix}/lib/${name}
131    configure.args-append --libdir=${prefix}/lib/libgcc
132
133    configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
134    configure.args-append --enable-languages=c,c++,objc,obj-c++,lto,fortran
135
136    # TODO: Possibly disable bootstrap with appropriate configure flags.
137    #       the problem is that libstdc++'s configure script tests for tls support
138    #       using the running compiler (not gcc for which libstdc++ is being built).
139    #       Thus when we build with clang, we get a mismatch
140    # http://trac.macports.org/ticket/36116
141    #compiler.blacklist-append {clang < 425}
142    #configure.args-append --disable-bootstrap
143    #build.target        all
144
145    post-destroot {
146        file mkdir ${destroot}${prefix}/lib/libgcc.merged
147
148        # Note that we really don't want to include libgcc_ext.10.[45].dylib here, but install_name_tool
149        # doesn't know how to change the id of stubs, and it's easier than recreating them for each
150        # gcc port.
151        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}
152
153        foreach dylib ${dylibs} {
154            # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
155            # https://trac.macports.org/ticket/40098
156            # https://trac.macports.org/ticket/40100
157            if {! [file exists ${destroot}${prefix}/lib/libgcc/${dylib}]} {
158                continue
159            }
160
161            move ${destroot}${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/libgcc.merged
162            if {[variant_isset universal]} {
163                foreach archdir [glob ${destroot}${prefix}/lib/libgcc/*/] {
164                    set archdir_nodestroot [string map "${destroot}/ /" ${archdir}]
165                    if {[file exists ${archdir}/${dylib}]} {
166                        system "install_name_tool -id ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}"
167                        foreach link ${dylibs} {
168                            system "install_name_tool -change ${archdir_nodestroot}${link} ${prefix}/lib/libgcc/${link} ${archdir}/${dylib}"
169                        }
170                        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}"
171                    }
172                }
173            }
174
175            # strip debug symbols to supress debugger warnings:
176            # http://trac.macports.org/attachment/ticket/34831
177            if {! [string match *libgcc_ext* ${dylib}]} {
178                system "strip -x ${destroot}${prefix}/lib/libgcc.merged/${dylib}"
179            }
180        }
181
182        file delete -force ${destroot}${prefix}/bin             
183        file delete -force ${destroot}${prefix}/share
184        file delete -force ${destroot}${prefix}/include
185        file delete -force ${destroot}${prefix}/lib/libgcc
186        file delete -force ${destroot}${prefix}/libexec
187
188        move ${destroot}${prefix}/lib/libgcc.merged ${destroot}${prefix}/lib/libgcc
189
190        # For binary compatibility with binaries that linked against the old libstdcxx port
191        ln -s libgcc/libstdc++.6.dylib ${destroot}${prefix}/lib/libstdc++.6.dylib
192    }
193} else {
194post-destroot {
195    file delete ${destroot}${prefix}/share/info/dir
196
197    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
198        set extension [file extension ${file}]
199        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
200
201        file rename ${file} ${newfile}
202    }
203
204    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} {
205        # Different OS versions (eg: Leopard) or architectures (eg: PPC) don't produce all the dylibs
206        # https://trac.macports.org/ticket/40098
207        # https://trac.macports.org/ticket/40100
208        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
209            delete ${destroot}${prefix}/lib/${name}/${dylib}
210            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
211        }
212
213        if {[variant_isset universal]} {
214            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
215                if {[file exists ${archdir}/${dylib}]} {
216                    delete ${archdir}/${dylib}
217                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
218                }
219            }
220        }
221    }
222}
223
224select.group        gcc
225select.file         ${filespath}/mp-${name}
226
227}
228
229platform powerpc {
230    configure.universal_archs ppc ppc64
231}
232platform i386 {
233    configure.universal_archs i386 x86_64
234}
235variant universal {
236    configure.args-delete --disable-multilib
237}
238# the generated compiler doesn't accept -arch
239configure.env-append CPP="${configure.cc} -E"
240build.env-append CPP="${configure.cc} -E"
241configure.cc-append [get_canonical_archflags]
242configure.cc_archflags
243configure.cxx-append ${configure.cxx_archflags}
244configure.cxx_archflags
245configure.objc_archflags
246configure.ld_archflags
247configure.universal_cflags
248configure.universal_cxxflags
249configure.universal_ldflags
250configure.universal_args
251
252livecheck.type      regex
253livecheck.url       http://gcc.gnu.org/gcc-4.9/
254livecheck.regex     GCC (4\\.9\\.\[0-9\])
Note: See TracBrowser for help on using the repository browser.