source: trunk/dports/lang/g95/Portfile @ 136067

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

misc: Remove license_noconflict ld64 (#47702)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.4 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 136067 2015-05-11 16:31:52Z jeremyhu@macports.org $
3
4PortSystem 1.0
5
6name            g95
7version         0.93
8revision        4
9platforms       darwin
10categories      lang
11license         GPL-2
12maintainers     takeshi openmaintainer
13description     Another GNU Fortran 95 compiler
14long_description \
15                G95 is a stable, production Fortran 95 compiler \
16                available for multiple cpu architectures and operating systems. \
17                Innovations and optimizations continue to be worked on. \
18                Parts of the F2003 standard have been implemented in g95.
19homepage        http://g95.org/
20dist_subdir     ${name}/${version}
21
22if {${os.major} < 10 || ${build_arch} eq "ppc" || ${build_arch} eq "i386"} {
23    default_variants +gcc40
24}
25
26set triple ""
27if {[variant_isset gcc40]} {
28    set version_gcc 4.0.4
29    set triple  ${os.arch}-apple-darwin${os.major}
30    set dcore   gcc-core-${version_gcc}.tar.bz2
31    checksums   ${dcore} md5    193e0a7a471cca70e374974bc5a60137         \
32                ${dcore} sha1   55c664b33a4dc6b2130c47da28a1d6daab732ce9 \
33                ${dcore} rmd160 af67dc8385942450f6b27ad83a6b9e3d22f779a1
34} else {
35    license         GPL-3
36    set version_gcc 4.2.4
37    array set barch {ppc powerpc ppc64 powerpc64 i386 i386 x86_64 x86_64}
38    if {[info exists barch(${build_arch})]} {
39        set triple  $barch(${build_arch})-apple-darwin${os.major}
40    }
41    set dcore   gcc-core-${version_gcc}.tar.bz2
42    checksums   ${dcore} md5     b7a4c167f6a05301591b139b356e36d0 \
43                ${dcore} sha1    540fa6949415ded321a7cbe80bbf8befe85e3566 \
44                ${dcore} rmd160  d54581d0a2ecc22718e6be101c6dc524a4a88463
45}
46master_sites    ftp://gcc.gnu.org/pub/gcc/releases/gcc-${version_gcc}/:gcc \
47                http://ftp.g95.org/v${version}/:g95
48set buildhost   "--build=${triple} --host=${triple}"
49
50set dg95        ${name}_source.tgz
51set gcclib      lib/${name}/${triple}/${version_gcc}
52distfiles       ${dcore}:gcc ${dg95}:g95
53
54checksums-append    ${dg95}  md5     f9552aef0975c1dcf70950b6e6b18ff1 \
55                    ${dg95}  sha1    b5e503fd6459b65cbda73190685f9490230d9cff \
56                    ${dg95}  rmd160  98d03e9a1835f4b3553a72a798bdf1d90a757176
57
58depends_build   port:ld64 port:cctools
59depends_lib     port:libtool port:libiconv path:lib/libgcc/libgcc_s.1.dylib:libgcc
60
61patchfiles      patch-Makefile.in.diff \
62                patch-darwin.h.diff \
63                patch-lang.opt.diff \
64                patch-libf95-intrinsics-dot_product10.c.diff \
65                patch-libf95-intrinsics-matmul10.c.diff \
66                patch-libf95-intrinsics-random.c.diff \
67                patch-libf95-io-read.c.diff \
68                patch-libf95-math-ff.c.diff \
69                patch-libf95-math-x87.S.diff \
70                patch-libf95-quad-power16.c.diff
71
72universal_variant no
73use_parallel_build  no
74
75extract.only    ${dg95}
76
77post-extract {
78    system "tar jxvf ${distpath}/${dcore} -C ${workpath}; \
79            cd ${worksrcpath}; tar zxvf libf95.a-${version}.tar.gz"
80}
81
82pre-patch {
83    ln -s ${workpath}/gcc-${version_gcc} ${worksrcpath}
84}
85
86post-patch {
87    reinplace "s|gcc-lib|$name|" ${worksrcpath}/configure
88    reinplace "s|gcc-lib|$name|" ${worksrcpath}/libf95.a-${version}/configure
89    reinplace "s|CFLAGS_FOR_TARGET = -O2 \$(CFLAGS)|CFLAGS_FOR_TARGET = ${configure.cflags}|" ${workpath}/gcc-${version_gcc}/Makefile.in
90    reinplace "s|^stage1_cflags=\"|stage1_cflags=\"${configure.cflags} ${configure.cc_archflags} |" ${workpath}/gcc-${version_gcc}/configure
91    if {![variant_isset gcc40]} {
92        reinplace "s|named_section|get_named_section|" ${worksrcpath}/trans-decl.c
93    }
94}
95
96if {${os.major} == 11 || ${os.major} == 12} {
97    compiler.blacklist-append   *clang*
98}
99configure.cflags-append -std=gnu89
100pre-configure {
101    file mkdir ${workpath}/gcc-${version_gcc}/${name}
102    reinplace "s|tjmp %%edx|tjmp *%%edx|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/i386.c
103    if {${build_arch} eq "i386"} {
104        reinplace "s|i686|i386|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/darwin.h
105    }
106#    set gcc_configargs "--with-as=/usr/bin/as --with-ld=/usr/bin/ld --with-nm=/usr/bin/nm"
107#    set gcc_configargs "--with-as=${prefix}/bin/as --with-ld=${prefix}/bin/ld --with-nm=${prefix}/bin/nm"
108    system "export CC=\"${configure.cc}\"; \
109            export CPPFLAGS=\"${configure.cppflags}\"; \
110            export CFLAGS=\"${configure.cflags} ${configure.cc_archflags}\"; \
111            export CFLAGS_FOR_BUILD=\"${configure.cflags} ${configure.cc_archflags}\"; \
112            export CFLAGS_FOR_TARGET=\"${configure.cflags}\"; \
113            export LDFLAGS=\"${configure.ldflags} ${configure.cc_archflags}\"; \
114            export MAKEINFO=missing;\
115            cd ${workpath}/gcc-${version_gcc}/${name}; \
116            ../configure --prefix=${prefix}/${gcclib} \
117                         --enable-languages=c \
118                         --disable-multilib \
119                         --with-included-gettext \
120                         --with-libiconv=${prefix} \
121                         --libdir=${prefix}/${gcclib} \
122                         --with-as=${prefix}/bin/as \
123                         --with-ld=${prefix}/bin/ld \
124                         --with-nm=${prefix}/bin/nm \
125                         ${buildhost}; \
126            make"
127    if {![variant_isset gcc40]} {
128        system "cd ${workpath}/gcc-${version_gcc}/${name}/gcc; \
129                ar d libbackend.a options.o; \
130                cd ${workpath}/gcc-${version_gcc}/gcc/; \
131                patch -p0 < ${portpath}/files/patch-gcc.c.diff" 
132    }
133}
134
135configure.args  --with-gcc-dir=${workpath}/gcc-${version_gcc} ${buildhost}
136
137post-configure {
138    if {![variant_isset gcc40]} {
139        reinplace "s|\(f951_LDADD\)|(f951_LDADD) ${workpath}/gcc-${version_gcc}/g95/libdecnumber/*.o|" ${worksrcpath}/Makefile
140    }
141}
142
143pre-build {
144    if {![variant_isset gcc40] && ${os.arch} eq "i386"} {
145        reinplace "s|\(g95_LDADD\)|(g95_LDADD) ${workpath}/gcc-${version_gcc}/g95/gcc/driver-i386.o|" ${worksrcpath}/Makefile
146    }
147}
148
149post-build {
150    system "cd ${worksrcpath}/libf95.a-${version}; \
151           export CC=\"${configure.cc}\"; \
152           export CFLAGS=\"${configure.cflags} ${configure.cc_archflags}\"; \
153           ./configure --prefix=${prefix} ${buildhost}; \
154           make"
155}
156
157post-destroot {
158    system "cd ${worksrcpath}/libf95.a-${version}; \
159            make install DESTDIR=${destroot}; \
160            ranlib ${destroot}${prefix}/${gcclib}/libf95.a; \
161            ranlib ${destroot}${prefix}/${gcclib}/libgcc.a; \
162            ranlib ${destroot}${prefix}/${gcclib}/libgcc_eh.a"
163    xinstall -d ${destroot}${prefix}/share/doc/${name}
164    xinstall -m 644 ${worksrcpath}/G95Manual.pdf ${destroot}${prefix}/share/doc/${name}
165
166    ln -s ${prefix}/${gcclib}/libf95.a ${destroot}${prefix}/lib/libf95.a
167
168    if {[variant_isset gcc40]} {
169        delete ${destroot}${prefix}/${gcclib}/libgcc_s.1.0.dylib
170        ln -s ${prefix}/lib/libgcc/libgcc_s.1.dylib ${destroot}${prefix}/${gcclib}/libgcc_s.1.0.dylib
171    } else {
172        delete ${destroot}${prefix}/${gcclib}/libgcc_s.1.dylib
173        ln -s ${prefix}/lib/libgcc/libgcc_s.1.dylib ${destroot}${prefix}/${gcclib}/libgcc_s.1.dylib
174    }
175}
176
177variant gcc40 description {build against gcc-4.0.x} {
178    patchfiles-delete   patch-lang.opt.diff patch-darwin.h.diff
179    patchfiles-append   patch-host-darwin.c.diff patch-darwin-fallback.c.diff
180}
Note: See TracBrowser for help on using the repository browser.