Ticket #54949: Portfile

File Portfile, 9.9 KB (added by nortcele, 7 years ago)

draft Portfile for gcc 5.5 release candidate

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
3PortSystem 1.0
4PortGroup select 1.0
5PortGroup compiler_blacklist_versions 1.0
6
7name                gcc5
8
9#epoch               2
10version             5.5.0
11#revision            3
12platforms           darwin
13categories          lang
14maintainers         nomaintainer
15# an exception in the license allows dependents to not be GPL
16license             {GPL-3+ Permissive}
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/
22#master_sites        ftp://ftp.funet.fi/pub/mirrors/sources.redhat.com/pub/gcc/releases/gcc-${version}/ \
23#                    ftp://ftp.gwdg.de/pub/linux/gcc/releases/gcc-${version}/ \
24#                    ftp://gcc.ftp.nluug.nl/mirror/languages/gcc/releases/gcc-${version}/ \
25#                    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version}/ \
26#                    gnu:gcc/gcc-${version} \
27#                    ftp://sourceware.org/pub/java/
28set release         RC-20171002
29
30master_sites        ftp://gcc.gnu.org/pub/gcc/snapshots/${version}-${release}/ \
31                    ftp://sourceware.org/pub/java/
32
33#distname            gcc-${version}
34#distname            gcc-${version}-${release}
35#use_bzip2           yes
36
37#extract.suffix      -${release}.tar.bz2
38
39#distfiles           gcc-${version}.tar.bz2 \
40#                    ecj-4.9.jar
41
42distfiles           gcc-${version}-${release}.tar.bz2 \
43                    ecj-4.9.jar
44
45extract.only        gcc-${version}-${release}.tar.bz2
46
47worksrcdir          gcc-${version}-${release}
48
49#checksums           gcc-${version}.tar.bz2 \
50#                    rmd160  7ae3413ca7e90bb21e65e637c02ddf2b675b45f4 \
51#                    sha256  608df76dec2d34de6558249d8af4cbee21eceddbcb580d666f7a5a583ca3303a \
52#                    ecj-4.9.jar \
53#                    rmd160  eb1b19d9ac0e9e265bf993f38b9576e3c710e91e \
54#                    sha256  9506e75b862f782213df61af67338eb7a23c35ff425d328affc65585477d34cd
55
56checksums           gcc-${version}-${release}.tar.bz2 \
57                    rmd160  0645fb833c2e7170cc97f5dbc4d45ebf9f391152 \
58                    sha256  2034063aa1ae199651eeb0f7dd0906bdb5fe0c22213e474e5173545d9556ba95 \
59                    ecj-4.9.jar \
60                    rmd160  eb1b19d9ac0e9e265bf993f38b9576e3c710e91e \
61                    sha256  9506e75b862f782213df61af67338eb7a23c35ff425d328affc65585477d34cd
62
63depends_lib         port:cctools \
64                    port:gmp \
65                    path:lib/pkgconfig/isl.pc:isl \
66                    port:ld64 \
67                    path:lib/libgcc/libgcc_s.1.dylib:libgcc \
68                    port:libiconv \
69                    port:libmpc \
70                    port:mpfr
71depends_run         port:gcc_select \
72                    port:libgcc6
73
74depends_skip_archcheck-append gcc_select ld64 cctools
75license_noconflict  gmp mpfr ppl libmpc
76
77# Handle OS X deployment targets correctly (GCC PR target/63810
78# <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63810>).
79#patchfiles-append   macosx-version-min.patch
80
81set major           [lindex [split ${version} .-] 0]
82
83# Provide linkage for MacPorts libiconv in gcj
84patchfiles-append   gcj-libiconv-linkage.patch
85
86#extract.only        gcc-${version}.tar.bz2
87
88platform darwin {
89    if {${os.major} > 14} {
90        # Hack around boehm-gc and associated gcj failures from recompilation
91        # of libunwind.dylib with Apple Clang 7.0 in El Capitan by reducing
92        # alignment to 2
93        patchfiles-append   boehm-gc-darwin15-hack.patch
94    }
95    configure.pre_args-append --build=${build_arch}-apple-darwin${os.major}
96}
97
98configure.dir       ${workpath}/build
99configure.cmd       ${worksrcpath}/configure
100configure.args      --enable-languages=c,c++,objc,obj-c++,lto,fortran,java \
101                    --libdir=${prefix}/lib/${name} \
102                    --includedir=${prefix}/include/${name} \
103                    --infodir=${prefix}/share/info \
104                    --mandir=${prefix}/share/man \
105                    --datarootdir=${prefix}/share/gcc-${major} \
106                    --with-local-prefix=${prefix} \
107                    --with-system-zlib \
108                    --disable-nls \
109                    --program-suffix=-mp-${major} \
110                    --with-gxx-include-dir=${prefix}/include/${name}/c++/ \
111                    --with-libiconv-prefix=${prefix} \
112                    --with-gmp=${prefix} \
113                    --with-mpfr=${prefix} \
114                    --with-mpc=${prefix} \
115                    --with-isl=${prefix} \
116                    --enable-stage1-checking \
117                    --disable-multilib \
118                    --enable-lto \
119                    --enable-libstdcxx-time \
120                    --with-build-config=bootstrap-debug \
121                    --with-as=${prefix}/bin/as \
122                    --with-ld=${prefix}/bin/ld \
123                    --with-ar=${prefix}/bin/ar \
124                    --with-bugurl=https://trac.macports.org/newticket
125
126# see https://lists.macports.org/pipermail/macports-dev/2017-August/036209.html
127# --disable-tls does not limit functionality
128# it only determines how std::call_once works
129configure.args-append \
130                    --disable-tls
131
132configure.env-append \
133                    AR_FOR_TARGET=${prefix}/bin/ar \
134                    AS_FOR_TARGET=${prefix}/bin/as \
135                    LD_FOR_TARGET=${prefix}/bin/ld \
136                    NM_FOR_TARGET=${prefix}/bin/nm \
137                    OBJDUMP_FOR_TARGET=${prefix}/bin/objdump \
138                    RANLIB_FOR_TARGET=${prefix}/bin/ranlib \
139                    STRIP_FOR_TARGET=${prefix}/bin/strip \
140                    OTOOL=${prefix}/bin/otool \
141                    OTOOL64=${prefix}/bin/otool
142
143post-extract {
144    copy ${distpath}/ecj-4.9.jar ${worksrcpath}/ecj.jar
145}
146
147pre-configure {
148    configure.args-append --with-pkgversion="MacPorts ${name} ${version}_${revision}${portvariants}"
149
150    if {${configure.sdkroot} ne ""} {
151        # We should be using --with-build-sysroot here.  Using --with-sysroot
152        # changes the behavior of the installed gcc to look in that sysroot
153        # by default instead of /.  Using --with-build-sysroot is supposed
154        # to be used during the build but not impact the installed product.
155        # Unfortunately, the build fails because the value doesn't get
156        # plumbed everywhere it is supposed to.
157        #
158        # https://trac.macports.org/ticket/53726
159        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79885
160        #
161        # Note that macports toolchains will fail to compile gcc unless
162        # the DevSDK is installed due to another gcc build system bug:
163        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80203
164        configure.args-append --with-sysroot="${configure.sdkroot}"
165    }
166
167    # TODO: Remove when base automatically creates configure.dir (2.2.1?).
168    file mkdir ${configure.dir}
169}
170
171# http://trac.macports.org/ticket/29067
172compiler.blacklist-append gcc-4.0
173
174# http://trac.macports.org/ticket/29104
175compiler.blacklist-append {llvm-gcc-4.2 < 2336.1}
176
177# https://trac.macports.org/ticket/47996
178compiler.blacklist-append {clang < 300}
179
180# "-stdlib" would be passed on to the bootstrap compiler if present
181configure.cxx_stdlib
182
183build.dir           ${configure.dir}
184build.target        bootstrap-lean
185
186# Temporary fix to disable parallel builds on macOS 10.13
187# See https://trac.macports.org/ticket/54829
188#     https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81797
189if { ${os.major} < 17 } {
190    use_parallel_build yes
191} else {
192    use_parallel_build no
193}
194
195destroot.target     install install-info-host
196
197post-destroot {
198    file delete ${destroot}${prefix}/share/info/dir
199
200    foreach file [glob ${destroot}${prefix}/share/{info,man/man7}/*] {
201        set extension [file extension ${file}]
202        set newfile [regsub "${extension}$" ${file} "-mp-${major}${extension}"]
203
204        file rename ${file} ${newfile}
205    }
206
207    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} {
208        # Different OS versions (e.g. Leopard) or architectures (e.g. PPC) don't produce all the dylibs
209        # https://trac.macports.org/ticket/40098
210        # https://trac.macports.org/ticket/40100
211        if {[file exists ${destroot}${prefix}/lib/${name}/${dylib}]} {
212            delete ${destroot}${prefix}/lib/${name}/${dylib}
213            ln -s ${prefix}/lib/libgcc/${dylib} ${destroot}${prefix}/lib/${name}/${dylib}
214        }
215
216        if {[variant_isset universal]} {
217            foreach archdir [glob ${destroot}${prefix}/lib/${name}/*/] {
218                if {[file exists ${archdir}/${dylib}]} {
219                    delete ${archdir}/${dylib}
220                    ln -s ${prefix}/lib/libgcc/${dylib} ${archdir}/${dylib}
221                }
222            }
223        }
224    }
225    move ${destroot}${prefix}/lib/${name}/pkgconfig/libgcj-${major}.pc ${destroot}${prefix}/lib/pkgconfig/
226}
227
228select.group        gcc
229select.file         ${filespath}/mp-${name}
230
231platform powerpc {
232    configure.universal_archs ppc ppc64
233}
234platform i386 {
235    configure.universal_archs i386 x86_64
236}
237variant universal {
238    configure.args-delete --disable-multilib
239}
240# the generated compiler doesn't accept -arch
241configure.env-append \
242    CPP="${configure.cc} -E" \
243    CXXCPP="${configure.cxx} -E"
244build.env-append \
245    CPP="${configure.cc} -E" \
246    CXXCPP="${configure.cxx} -E"
247configure.cc-append [get_canonical_archflags]
248configure.cc_archflags
249configure.cxx-append ${configure.cxx_archflags}
250configure.cxx_archflags
251configure.objc_archflags
252configure.ld_archflags
253configure.universal_cflags
254configure.universal_cxxflags
255configure.universal_ldflags
256configure.universal_args
257
258livecheck.type      regex
259livecheck.url       http://ftp.gnu.org/gnu/gcc/
260livecheck.regex     gcc-(${major}\\.\[0-9.\]+)/