source: trunk/dports/lang/gcc47/Portfile @ 102174

Last change on this file since 102174 was 102174, checked in by jeremyhu@…, 7 years ago

misc: Update compiler dependency workaround for #32542, see #37817

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.5 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 102174 2013-01-29 07:53:39Z jeremyhu@macports.org $
3
4PortSystem 1.0
5PortGroup select 1.0
6
7name                gcc47
8subport             libstdcxx {}
9epoch               1
10
11version             4.7.2
12revision            2
13platforms           darwin
14categories          lang
15maintainers         mww openmaintainer
16license             GPL-3
17description         The GNU compiler collection
18long_description    The GNU compiler collection, including front ends for \
19                    C, C++, Objective-C, Objective-C++, Fortran and Java.
20
21homepage            http://gcc.gnu.org/
22master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/:gcc \
23                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/:gcc \
24                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/:gcc \
25                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/:gcc \
26                    gnu:gcc/gcc-${version}:gcc \
27                    ftp://sourceware.org/pub/java/:ecj \
28                    http://mirrors.kernel.org/sources.redhat.com/java/:ecj \
29                    http://www.mirrorservice.org/sites/sources.redhat.com/pub/java/:ecj \
30                    http://ftp-stud.fht-esslingen.de/pub/Mirrors/sourceware.org/java/:ecj
31
32use_bzip2           yes
33
34set ecj             ecj-4.5.jar
35
36distname            gcc-${version}
37
38distfiles           [suffix ${distname}]:gcc ${ecj}:ecj
39
40extract.only        [suffix ${distname}]
41
42checksums           [suffix ${distname}] \
43                    rmd160  fc281ade14b47d2a9c2ced4f7082c74bfbae31c1 \
44                    sha256  8a9283d7010fb9fe5ece3ca507e0af5c19412626384f8a5e9434251ae100b084 \
45                    ${ecj} \
46                    rmd160  d3f4da657f086b6423f74e93f001132f4855368a \
47                    sha256  98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
48
49depends_lib         port:gmp port:mpfr port:libiconv port:libmpc port:ppl port:cloog
50depends_run         port:gcc_select port:ld64 port:cctools path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
51
52depends_skip_archcheck-append gcc_select ld64 cctools
53license_noconflict  gmp mpfr ppl
54
55patchfiles          ppc_fde_encoding.diff  gcc-PR-53453.patch
56patch.dir           ${workpath}/gcc-${version}
57
58set major           4.7
59
60worksrcdir          build
61
62post-extract {
63    file mkdir ${worksrcpath}
64    copy ${distpath}/${ecj} ${workpath}/${distname}/ecj.jar
65}
66
67platform darwin {
68    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
69}
70
71configure.cmd       ../gcc-${version}/configure
72configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
73                    --libdir=${prefix}/lib/${name} \
74                    --includedir=${prefix}/include/${name} \
75                    --infodir=${prefix}/share/info \
76                    --mandir=${prefix}/share/man \
77                    --datarootdir=${prefix}/share/gcc-${major} \
78                    --with-libiconv-prefix=${prefix} \
79                    --with-local-prefix=${prefix} \
80                    --with-system-zlib \
81                    --disable-nls \
82                    --program-suffix=-mp-${major} \
83                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
84                    --with-gmp=${prefix} \
85                    --with-mpfr=${prefix} \
86                    --with-mpc=${prefix} \
87                    --with-ppl=${prefix} \
88                    --with-cloog=${prefix} --enable-cloog-backend=isl \
89                    --disable-cloog-version-check \
90                    --enable-stage1-checking \
91                    --disable-multilib \
92                    --enable-lto \
93                    --enable-libstdcxx-time \
94                    --with-as=${prefix}/bin/as \
95                    --with-ld=${prefix}/bin/ld \
96                    --with-ar=${prefix}/bin/ar \
97                    --with-bugurl=https://trac.macports.org/newticket
98# remove this asap when upstream implements a check for ppl 1.0
99configure.args-append --disable-ppl-version-check
100
101configure.env-append \
102                    AR_FOR_TARGET=${prefix}/bin/ar \
103                    AS_FOR_TARGET=${prefix}/bin/as \
104                    LD_FOR_TARGET=${prefix}/bin/ld \
105                    NM_FOR_TARGET=${prefix}/bin/nm \
106                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
107                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
108                    STRIP_FOR_TARGET=${prefix}/bin/strip \
109                    OTOOL=${prefix}/bin/otool \
110                    OTOOL64=${prefix}/bin/otool
111
112pre-configure {
113    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
114}
115
116# http://trac.macports.org/ticket/29067
117compiler.blacklist-append gcc-4.0
118
119# http://trac.macports.org/ticket/29104
120if {[vercmp $xcodeversion 4.2] < 0} {
121    compiler.blacklist-append llvm-gcc-4.2
122}
123
124# TODO: base should do this: http://trac.macports.org/ticket/32542
125if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
126    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
127
128    # base 2.1.x ignores the argument and just use ${configure.compiler}
129    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
130        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
131    }
132
133    if {[string match macports-gcc* ${configure.compiler}]} {
134        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
135    }
136}
137
138build.target        bootstrap
139use_parallel_build  yes
140
141destroot.target     install install-info-host
142
143# TODO: Optimize this.  We don't need to actually bootstrap gcc to build libstdc++
144if {${subport} == "libstdcxx"} {
145    conflicts       libstdcxx-devel
146
147    patchfiles-append  force-static-gcc.patch
148
149    depends_run-delete path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
150
151    configure.args-delete --libdir=${prefix}/lib/${name}
152
153    configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
154    configure.args-append --enable-languages=c++
155
156    # See http://trac.macports.org/ticket/36116 for why we can't do this yet
157    # configure.args-append --disable-bootstrap
158    # build.target        all
159
160    destroot.target     install-target-libstdc++-v3
161
162    post-destroot {
163        eval file delete [glob ${destroot}${prefix}/lib/*{a,py}]
164        file delete -force ${destroot}${prefix}/share/gcc-${major}
165        file delete -force ${destroot}${prefix}/include/${name}
166
167        # Don't install the linktime symlink.  The compilers will place this
168        # in their libdir, and we don't want to break other toolchains by having
169        # them link against this libstdc++ (at least not until it is built on
170        # top of libc++abi).
171        file delete ${destroot}${prefix}/lib/libstdc++.dylib
172
173        # For compatibility.  Delete this eventually.
174        system "touch ${destroot}${prefix}/lib/.libstdcxx"
175
176        if {[variant_isset universal]} {
177            foreach archdir [glob ${destroot}${prefix}/lib/*/] {
178                if {[file exists ${archdir}/libstdc++.6.dylib]} {
179                    system "install_name_tool -id ${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib"
180                    system "lipo -create -output ${destroot}${prefix}/lib/libstdc++.6.dylib~ ${destroot}${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib && mv ${destroot}${prefix}/lib/libstdc++.6.dylib~ ${destroot}${prefix}/lib/libstdc++.6.dylib"
181                }
182                file delete -force ${archdir}
183            }
184        }
185    }
186} else {
187post-destroot {
188    file delete -force ${destroot}${prefix}/share/man/man7 \
189        ${destroot}${prefix}/share/info
190    # install/copy ffitarget.h only if we have it
191    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
192        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
193    }
194
195    if {[variant_isset universal]} {
196        foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
197            if {[file exists ${archdir}/libstdc++.6.dylib]} {
198                eval delete [glob ${archdir}/libstdc++*]
199
200                # This symlink is provided as a transition aide and will be removed
201                # with a future revision of this port.
202                ln -s ${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib
203            }
204        }
205    }
206
207    # http://trac.macports.org/ticket/35770
208    eval delete [glob ${destroot}${prefix}/lib/${name}/libstdc++*]
209
210    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.dylib
211
212    # This symlink is provided as a transition aide and will be removed
213    # with a future revision of this port.
214    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.6.dylib
215}
216
217select.group        gcc
218select.file         ${filespath}/mp-${name}
219
220}
221
222platform powerpc {
223    configure.universal_archs ppc ppc64
224}
225platform i386 {
226    configure.universal_archs i386 x86_64
227}
228variant universal {
229    configure.args-delete --disable-multilib
230}
231# the generated compiler doesn't accept -arch
232configure.env-append CPP="${configure.cc} -E"
233build.env-append CPP="${configure.cc} -E"
234configure.cc-append [get_canonical_archflags]
235configure.cc_archflags
236configure.cxx_archflags
237configure.objc_archflags
238configure.ld_archflags
239configure.universal_cflags
240configure.universal_cxxflags
241configure.universal_ldflags
242configure.universal_args
243
244livecheck.type      regex
245livecheck.url       http://gcc.gnu.org/gcc-4.7/
246livecheck.regex     GCC (4\\.7\\.\[0-9\])
247
Note: See TracBrowser for help on using the repository browser.