source: trunk/dports/lang/gcc43/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: 8.4 KB
Line 
1# $Id: Portfile 102174 2013-01-29 07:53:39Z jeremyhu@macports.org $
2
3PortSystem 1.0
4PortGroup select 1.0
5
6name                gcc43
7version             4.3.6
8revision            7
9platforms           darwin
10categories          lang
11maintainers         mww openmaintainer
12# an exception in the license allows dependents to not be GPL
13license             {GPL-3+ GPL-2+ Permissive}
14description         The GNU compiler collection
15long_description    The GNU compiler collection, including front ends for \
16                    C, C++, Objective-C, Objective-C++, Fortran, and Java.
17
18homepage            http://gcc.gnu.org/
19master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/ \
20                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \
21                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \
22                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \
23                    gnu:gcc/gcc-${version}
24
25use_bzip2           yes
26
27set dcore           gcc-core-${version}.tar.bz2
28set dfort           gcc-fortran-${version}.tar.bz2
29set dcxx            gcc-g++-${version}.tar.bz2
30set djava           gcc-java-${version}.tar.bz2
31set dobjc           gcc-objc-${version}.tar.bz2
32
33distfiles           ${dcore} ${dfort} ${dcxx} ${djava} ${dobjc}
34 
35checksums           gcc-core-${version}.tar.bz2 \
36                    md5     43df9ad8b4bb314a46bac12f5aefaec2 \
37                    sha1    d9dc274ad558194e7d9bacc49c333a4870d7e613 \
38                    rmd160  d4bed0820d5eae5072e30fa66167fda4fc2f0bbc \
39                    gcc-fortran-${version}.tar.bz2 \
40                    md5     c6eeee73007015c52043716fbe8ffdc7 \
41                    sha1    20d9f1293857d24e4a69996f91875718e3217ae3 \
42                    rmd160  ca92b43af16f6837d99f839a76547cd0610fbc58 \
43                    gcc-g++-${version}.tar.bz2 \
44                    md5     ee7dc01b6e1a6a92a6e8d66adb8d2ab9 \
45                    sha1    91afb0336103204731d5d8156790b97005869d1f \
46                    rmd160  90e5836b9b5e16a378b93f093dec78e917ae3f9c \
47                    gcc-java-${version}.tar.bz2 \
48                    md5     b5c12ad38048c354686747d640f5d621 \
49                    sha1    0216314c694642e0b16418a1259bd0f90987107e \
50                    rmd160  bfc0ac76397e81ccfeb9334966359e668a961d8e \
51                    gcc-objc-${version}.tar.bz2 \
52                    md5     3fdb8158eabb765d1711f894bf71f7f5 \
53                    sha1    437833d7211118f8647941c1a78531ec125f97c2 \
54                    rmd160  cde38f66b4b952f52938dc50d7606a0e1ccc7d2f
55
56depends_lib         port:gmp port:mpfr port:libiconv
57depends_run         port:gcc_select port:ld64 port:cctools path:lib/libstdc\\\\+\\\\+.6.dylib:libstdcxx
58
59depends_skip_archcheck-append gcc_select ld64 cctools
60license_noconflict  gmp mpfr
61
62patchfiles          Make-lang.in.diff darwin10.diff i386_multilib.diff ppc_fde_encoding.diff
63patch.dir           ${workpath}/gcc-${version}
64
65set major           4.3
66
67worksrcdir          build
68
69post-extract {
70    file mkdir ${worksrcpath}
71}
72
73platform darwin {
74    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
75}
76
77configure.cmd       ../gcc-${version}/configure
78configure.args      --enable-languages=c,c++,objc,obj-c++,java,fortran \
79                    --libdir=${prefix}/lib/${name} \
80                    --includedir=${prefix}/include/${name} \
81                    --infodir=${prefix}/share/info \
82                    --mandir=${prefix}/share/man \
83                    --datadir=${prefix}/share/${name} \
84                    --with-local-prefix=${prefix} \
85                    --with-libiconv-prefix=${prefix} \
86                    --with-system-zlib \
87                    --disable-nls \
88                    --program-suffix=-mp-${major} \
89                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
90                    --with-gmp=${prefix} \
91                    --with-mpfr=${prefix} \
92                    --enable-stage1-checking \
93                    --disable-multilib \
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
99configure.env-append \
100                    AR_FOR_TARGET=${prefix}/bin/ar \
101                    AS_FOR_TARGET=${prefix}/bin/as \
102                    LD_FOR_TARGET=${prefix}/bin/ld \
103                    NM_FOR_TARGET=${prefix}/bin/nm \
104                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
105                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
106                    STRIP_FOR_TARGET=${prefix}/bin/strip \
107                    OTOOL=${prefix}/bin/otool \
108                    OTOOL64=${prefix}/bin/otool
109
110pre-configure {
111    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
112}
113
114# http://trac.macports.org/ticket/29067
115compiler.blacklist-append gcc-4.0
116
117# http://trac.macports.org/ticket/29104
118if {[vercmp $xcodeversion 4.2] < 0} {
119    compiler.blacklist-append llvm-gcc-4.2
120}
121
122# TODO: base should do this: http://trac.macports.org/ticket/32542
123if {[info exists portconfigure::compiler_name_map(${configure.compiler})]} {
124    depends_build-append port:$portconfigure::compiler_name_map(${configure.compiler})
125
126    # base 2.1.x ignores the argument and just use ${configure.compiler}
127    if {[portconfigure::arch_flag_supported ${configure.compiler}]} {
128        depends_skip_archcheck-append $portconfigure::compiler_name_map(${configure.compiler})
129    }
130
131    if {[string match macports-gcc* ${configure.compiler}]} {
132        depends_lib-append port:$portconfigure::compiler_name_map(${configure.compiler})
133    }
134}
135
136# STAGE1_CFLAGS="-O2 -fkeep-inline-functions" : from configure.ac
137# BOOT_CFLAGS="-O2 -g" : from Makefile.tpl
138# -std=gnu89 : for building with clang
139# -D_FORTIFY_SOURCE=0 : The built compiler might not understand newer builtins
140#                       exposed in libc headers for fortified string functions.
141#                       Yes, we need to set both BOOT_CFLAGS and STAGE1_CFLAGS
142#                       because STAGE1_CFLAGS is used with xgcc for libgcc
143build.args-append BOOT_CFLAGS="-O2 -g -D_FORTIFY_SOURCE=0" STAGE1_CFLAGS="-O2 -fkeep-inline-functions -D_FORTIFY_SOURCE=0 -std=gnu89"
144build.target        bootstrap
145use_parallel_build  yes
146
147destroot.target     install install-info-host
148
149post-destroot {
150    file delete -force ${destroot}${prefix}/share/man/man7 \
151        ${destroot}${prefix}/share/info
152    # install/copy ffitarget.h only if we have it
153    if {![catch {set ffitarget.h [glob ${destroot}${prefix}/lib/${name}/gcc/*/${version}/include/ffitarget.h]} result]} {
154        file copy ${ffitarget.h} ${destroot}${prefix}/include/${name}/
155    }
156
157    if {[variant_isset universal]} {
158        foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
159            if {[file exists ${archdir}/libstdc++.6.dylib]} {
160                eval delete [glob ${archdir}/libstdc++*]
161
162                # This symlink is provided as a transition aide and will be removed
163                # with a future revision of this port.
164                ln -s ${prefix}/lib/libstdc++.6.dylib ${archdir}/libstdc++.6.dylib
165            }
166        }
167    }
168
169    # http://trac.macports.org/ticket/35770
170    eval delete [glob ${destroot}${prefix}/lib/${name}/libstdc++*]
171
172    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.dylib
173
174    # This symlink is provided as a transition aide and will be removed
175    # with a future revision of this port.
176    ln -s ${prefix}/lib/libstdc++.6.dylib ${destroot}${prefix}/lib/${name}/libstdc++.6.dylib
177}
178
179select.group        gcc
180select.file         ${filespath}/mp-${name}
181
182# Java support does not compile on 10.4/x86
183platform darwin 8 i386 {
184    configure.args-delete   --enable-languages=c,c++,objc,obj-c++,java,fortran
185    configure.args-append   --enable-languages=c,c++,objc,obj-c++,fortran
186}
187
188platform powerpc {
189    configure.universal_archs ppc ppc64
190}
191platform i386 {
192    configure.universal_archs i386 x86_64
193}
194variant universal {
195    configure.args-delete --disable-multilib
196}
197# the generated compiler doesn't accept -arch
198configure.env-append CPP="${configure.cc} -E"
199build.env-append CPP="${configure.cc} -E"
200configure.cc-append [get_canonical_archflags]
201configure.cc_archflags
202configure.cxx_archflags
203configure.objc_archflags
204configure.ld_archflags
205configure.universal_cflags
206configure.universal_cxxflags
207configure.universal_ldflags
208configure.universal_args
209
210livecheck.type      regex
211livecheck.url       http://gcc.gnu.org/gcc-4.3/
212livecheck.regex     GCC (4\\.3\\.\[0-9\])
Note: See TracBrowser for help on using the repository browser.