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

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

gcc*: Add build dependency on compiler if needed

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.1 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 102108 2013-01-28 06:22:45Z 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 {[portconfigure::compiler_is_port ${configure.compiler}]} {
126    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
127    depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
128}
129
130build.target        bootstrap
131use_parallel_build  yes
132
133destroot.target     install install-info-host
134
135# TODO: Optimize this.  We don't need to actually bootstrap gcc to build libstdc++
136if {${subport} == "libstdcxx"} {
137    conflicts       libstdcxx-devel
138
139    patchfiles-append  force-static-gcc.patch
140
141    depends_run-delete path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
142
143    configure.args-delete --libdir=${prefix}/lib/${name}
144
145    configure.args-delete --enable-languages=c,c++,objc,obj-c++,lto,fortran,java
146    configure.args-append --enable-languages=c++
147
148    # See http://trac.macports.org/ticket/36116 for why we can't do this yet
149    # configure.args-append --disable-bootstrap
150    # build.target        all
151
152    destroot.target     install-target-libstdc++-v3
153
154    post-destroot {
155        eval file delete [glob ${destroot}${prefix}/lib/*{a,py}]
156        file delete -force ${destroot}${prefix}/share/gcc-${major}
157        file delete -force ${destroot}${prefix}/include/${name}
158
159        # Don't install the linktime symlink.  The compilers will place this
160        # in their libdir, and we don't want to break other toolchains by having
161        # them link against this libstdc++ (at least not until it is built on
162        # top of libc++abi).
163        file delete ${destroot}${prefix}/lib/libstdc++.dylib
164
165        # For compatibility.  Delete this eventually.
166        system "touch ${destroot}${prefix}/lib/.libstdcxx"
167
168        if {[variant_isset universal]} {
169            foreach archdir [glob ${destroot}${prefix}/lib/*/] {
170                if {[file exists ${archdir}/libstdc++.6.dylib]} {
171                    system "install_name_tool -id ${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib"
172                    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"
173                }
174                file delete -force ${archdir}
175            }
176        }
177    }
178} else {
179post-destroot {
180    file delete -force ${destroot}${prefix}/share/man/man7 \
181        ${destroot}${prefix}/share/info
182    # install/copy ffitarget.h only if we have it
183    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
184        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
185    }
186
187    if {[variant_isset universal]} {
188        foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
189            if {[file exists ${archdir}/libstdc++.6.dylib]} {
190                eval delete [glob ${archdir}/libstdc++*]
191
192                # This symlink is provided as a transition aide and will be removed
193                # with a future revision of this port.
194                ln -s ${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib
195            }
196        }
197    }
198
199    # http://trac.macports.org/ticket/35770
200    eval delete [glob ${destroot}${prefix}/lib/${name}/libstdc++*]
201
202    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.dylib
203
204    # This symlink is provided as a transition aide and will be removed
205    # with a future revision of this port.
206    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.6.dylib
207}
208
209select.group        gcc
210select.file         ${filespath}/mp-${name}
211
212}
213
214platform powerpc {
215    configure.universal_archs ppc ppc64
216}
217platform i386 {
218    configure.universal_archs i386 x86_64
219}
220variant universal {
221    configure.args-delete --disable-multilib
222}
223# the generated compiler doesn't accept -arch
224configure.env-append CPP="${configure.cc} -E"
225build.env-append CPP="${configure.cc} -E"
226configure.cc-append [get_canonical_archflags]
227configure.cc_archflags
228configure.cxx_archflags
229configure.objc_archflags
230configure.ld_archflags
231configure.universal_cflags
232configure.universal_cxxflags
233configure.universal_ldflags
234configure.universal_args
235
236livecheck.type      regex
237livecheck.url       http://gcc.gnu.org/gcc-4.7/
238livecheck.regex     GCC (4\\.7\\.\[0-9\])
239
Note: See TracBrowser for help on using the repository browser.