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

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

libstdcxx{,-devel}: Address a possible build failure, See #36116.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.3 KB
Line 
1# $Id: Portfile 97713 2012-09-12 22:33:23Z jeremyhu@macports.org $
2
3PortSystem 1.0
4PortGroup select 1.0
5
6name                gcc47
7subport             libstdcxx {}
8epoch               1
9version             4.7.1
10revision            6
11platforms           darwin
12categories          lang
13maintainers         mww openmaintainer
14license             GPL-3
15description         The GNU compiler collection
16long_description    The GNU compiler collection, including front ends for \
17                    C, C++, Objective-C, Objective-C++, Fortran and Java.
18
19homepage            http://gcc.gnu.org/
20master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/:gcc \
21                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/:gcc \
22                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/:gcc \
23                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/:gcc \
24                    gnu:gcc/gcc-${version}:gcc \
25                    ftp://sourceware.org/pub/java/:ecj \
26                    http://mirrors.kernel.org/sources.redhat.com/java/:ecj \
27                    http://www.mirrorservice.org/sites/sources.redhat.com/pub/java/:ecj \
28                    http://ftp-stud.fht-esslingen.de/pub/Mirrors/sourceware.org/java/:ecj
29
30use_bzip2           yes
31
32set ecj             ecj-4.5.jar
33
34distname            gcc-${version}
35
36distfiles           [suffix ${distname}]:gcc ${ecj}:ecj
37
38extract.only        [suffix ${distname}]
39
40checksums           [suffix ${distname}] \
41                    rmd160  4b52d867d06288a0b3bb33c845cac0112c22b513 \
42                    sha256  16093f6fa01732adf378d97fe338f113c933bdf56da22bf87c76beff13da406f \
43                    ${ecj} \
44                    rmd160  d3f4da657f086b6423f74e93f001132f4855368a \
45                    sha256  98fd128f1d374d9e42fd9d4836bdd249c6d511ebc6c0df17fbc1b9df96c3d781
46
47depends_lib         port:gmp port:mpfr port:libiconv port:libmpc port:ppl port:cloog
48depends_run         port:gcc_select port:ld64 port:cctools path:lib/.libstdcxx:libstdcxx
49
50depends_skip_archcheck-append gcc_select ld64 cctools
51
52patchfiles          ppc_fde_encoding.diff
53patch.dir           ${workpath}/gcc-${version}
54
55set major           4.7
56
57worksrcdir          build
58
59post-extract {
60    file mkdir ${worksrcpath}
61    copy ${distpath}/${ecj} ${workpath}/${distname}/ecj.jar
62}
63
64platform darwin {
65    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
66}
67
68configure.cmd       ../gcc-${version}/configure
69configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
70                    --libdir=${prefix}/lib/${name} \
71                    --includedir=${prefix}/include/${name} \
72                    --infodir=${prefix}/share/info \
73                    --mandir=${prefix}/share/man \
74                    --datarootdir=${prefix}/share/gcc-${major} \
75                    --with-libiconv-prefix=${prefix} \
76                    --with-local-prefix=${prefix} \
77                    --with-system-zlib \
78                    --disable-nls \
79                    --program-suffix=-mp-${major} \
80                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
81                    --with-gmp=${prefix} \
82                    --with-mpfr=${prefix} \
83                    --with-mpc=${prefix} \
84                    --with-ppl=${prefix} \
85                    --with-cloog=${prefix} --enable-cloog-backend=isl \
86                    --enable-stage1-checking \
87                    --disable-multilib \
88                    --enable-lto \
89                    --with-as=${prefix}/bin/as \
90                    --with-ld=${prefix}/bin/ld \
91                    --with-ar=${prefix}/bin/ar \
92                    --with-bugurl=https://trac.macports.org/newticket
93# remove this asap when upstream implements a check for ppl 1.0
94configure.args-append --disable-ppl-version-check
95
96configure.env-append \
97                    AR_FOR_TARGET=${prefix}/bin/ar \
98                    AS_FOR_TARGET=${prefix}/bin/as \
99                    LD_FOR_TARGET=${prefix}/bin/ld \
100                    NM_FOR_TARGET=${prefix}/bin/nm \
101                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
102                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
103                    STRIP_FOR_TARGET=${prefix}/bin/strip \
104                    OTOOL=${prefix}/bin/otool \
105                    OTOOL64=${prefix}/bin/otool
106
107pre-configure {
108    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
109}
110
111# http://trac.macports.org/ticket/29104
112if {${configure.compiler} == "llvm-gcc-4.2"} {
113    configure.compiler clang
114}
115
116build.target        bootstrap
117use_parallel_build  yes
118
119destroot.target     install install-info-host
120
121# TODO: Optimize this.  We don't need to actually bootstrap gcc to build libstdc++
122if {${subport} == "libstdcxx"} {
123    depends_run-delete path:lib/.libstdcxx:libstdcxx
124
125    configure.args-delete --libdir=${prefix}/lib/${name}
126
127    configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
128    configure.args-append --enable-languages=c++
129
130    # See http://trac.macports.org/ticket/36116 for why we can't do this yet
131    # configure.args-append --disable-bootstrap
132    # build.target        all
133
134    destroot.target     install-target-libstdc++-v3
135
136    post-destroot {
137        eval delete [glob ${destroot}${prefix}/lib/*{a,py}]
138        file delete -force ${destroot}${prefix}/share/gcc-${major}
139        file delete -force ${destroot}${prefix}/include/${name}
140
141        # base doesn't like the + in this depspec path:lib/libstdc++.dylib:libstdcxx
142        system "touch ${destroot}${prefix}/lib/.libstdcxx"
143
144        # Some linkers don't optimize this unused link away.  TODO: Fix this in the build system
145        system "install_name_tool -change ${prefix}/lib/libgcc_s.1.dylib /usr/lib/libgcc_s.1.dylib ${destroot}${prefix}/lib/libstdc++.6.dylib"
146    }
147} else {
148post-destroot {
149    file delete -force ${destroot}${prefix}/share/man/man7 \
150        ${destroot}${prefix}/share/info
151    # install/copy ffitarget.h only if we have it
152    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
153        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
154    }
155
156    # http://trac.macports.org/ticket/35770
157    eval delete [glob ${destroot}${prefix}/lib/${name}/libstdc++*]
158
159    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.dylib
160
161    # This symlink is provided as a transition aide and will be removed
162    # with a future revision of this port.
163    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.6.dylib
164}
165
166select.group        gcc
167select.file         ${filespath}/mp-${name}
168
169}
170
171platform powerpc {
172    configure.universal_archs ppc ppc64
173}
174platform i386 {
175    configure.universal_archs i386 x86_64
176}
177variant universal {
178    configure.args-delete --disable-multilib
179}
180# the generated compiler doesn't accept -arch
181configure.env-append CPP="${configure.cc} -E"
182build.env-append CPP="${configure.cc} -E"
183configure.cc-append [get_canonical_archflags]
184configure.cc_archflags
185configure.cxx_archflags
186configure.objc_archflags
187configure.ld_archflags
188configure.universal_cflags
189configure.universal_cxxflags
190configure.universal_ldflags
191configure.universal_args
192
193livecheck.type      regex
194livecheck.url       http://gcc.gnu.org/gcc-4.7/
195livecheck.regex     GCC (4\\.7\\.\[0-9\])
196
Note: See TracBrowser for help on using the repository browser.