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