source: trunk/dports/lang/g95/Portfile

Last change on this file was 141644, checked in by dstrubbe@…, 2 years ago

g95: libtool is a build dependency (the typical case), not a library dependency. Also, it does not seem to be true for several years that "Innovations and optimizations continue to be worked on" unfortunately.

  • 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 141644 2015-10-24 22:58:38Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup               compiler_blacklist_versions 1.0
6
7name            g95
8version         0.93
9revision        4
10platforms       darwin
11categories      lang
12license         GPL-2
13maintainers     takeshi openmaintainer
14description     Another GNU Fortran 95 compiler
15long_description \
16                G95 is a stable, production Fortran 95 compiler \
17                available for multiple cpu architectures and operating systems. \
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 port:libtool
59depends_lib     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
96compiler.blacklist-append   {clang < 500}
97
98configure.cflags-append -std=gnu89
99pre-configure {
100    file mkdir ${workpath}/gcc-${version_gcc}/${name}
101    reinplace "s|tjmp %%edx|tjmp *%%edx|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/i386.c
102    if {${build_arch} eq "i386"} {
103        reinplace "s|i686|i386|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/darwin.h
104    }
105#    set gcc_configargs "--with-as=/usr/bin/as --with-ld=/usr/bin/ld --with-nm=/usr/bin/nm"
106#    set gcc_configargs "--with-as=${prefix}/bin/as --with-ld=${prefix}/bin/ld --with-nm=${prefix}/bin/nm"
107    system "export CC=\"${configure.cc}\"; \
108            export CPPFLAGS=\"${configure.cppflags}\"; \
109            export CFLAGS=\"${configure.cflags} ${configure.cc_archflags}\"; \
110            export CFLAGS_FOR_BUILD=\"${configure.cflags} ${configure.cc_archflags}\"; \
111            export CFLAGS_FOR_TARGET=\"${configure.cflags}\"; \
112            export LDFLAGS=\"${configure.ldflags} ${configure.cc_archflags}\"; \
113            export MAKEINFO=missing;\
114            cd ${workpath}/gcc-${version_gcc}/${name}; \
115            ../configure --prefix=${prefix}/${gcclib} \
116                         --enable-languages=c \
117                         --disable-multilib \
118                         --with-included-gettext \
119                         --with-libiconv=${prefix} \
120                         --libdir=${prefix}/${gcclib} \
121                         --with-as=${prefix}/bin/as \
122                         --with-ld=${prefix}/bin/ld \
123                         --with-nm=${prefix}/bin/nm \
124                         ${buildhost}; \
125            make"
126    if {![variant_isset gcc40]} {
127        system "cd ${workpath}/gcc-${version_gcc}/${name}/gcc; \
128                ar d libbackend.a options.o; \
129                cd ${workpath}/gcc-${version_gcc}/gcc/; \
130                patch -p0 < ${portpath}/files/patch-gcc.c.diff" 
131    }
132}
133
134configure.args  --with-gcc-dir=${workpath}/gcc-${version_gcc} ${buildhost}
135
136post-configure {
137    if {![variant_isset gcc40]} {
138        reinplace "s|\(f951_LDADD\)|(f951_LDADD) ${workpath}/gcc-${version_gcc}/g95/libdecnumber/*.o|" ${worksrcpath}/Makefile
139    }
140}
141
142pre-build {
143    if {![variant_isset gcc40] && ${os.arch} eq "i386"} {
144        reinplace "s|\(g95_LDADD\)|(g95_LDADD) ${workpath}/gcc-${version_gcc}/g95/gcc/driver-i386.o|" ${worksrcpath}/Makefile
145    }
146}
147
148post-build {
149    system "cd ${worksrcpath}/libf95.a-${version}; \
150           export CC=\"${configure.cc}\"; \
151           export CFLAGS=\"${configure.cflags} ${configure.cc_archflags}\"; \
152           ./configure --prefix=${prefix} ${buildhost}; \
153           make"
154}
155
156post-destroot {
157    system "cd ${worksrcpath}/libf95.a-${version}; \
158            make install DESTDIR=${destroot}; \
159            ranlib ${destroot}${prefix}/${gcclib}/libf95.a; \
160            ranlib ${destroot}${prefix}/${gcclib}/libgcc.a; \
161            ranlib ${destroot}${prefix}/${gcclib}/libgcc_eh.a"
162    xinstall -d ${destroot}${prefix}/share/doc/${name}
163    xinstall -m 644 ${worksrcpath}/G95Manual.pdf ${destroot}${prefix}/share/doc/${name}
164
165    ln -s ${prefix}/${gcclib}/libf95.a ${destroot}${prefix}/lib/libf95.a
166
167    if {[variant_isset gcc40]} {
168        delete ${destroot}${prefix}/${gcclib}/libgcc_s.1.0.dylib
169        ln -s ${prefix}/lib/libgcc/libgcc_s.1.dylib ${destroot}${prefix}/${gcclib}/libgcc_s.1.0.dylib
170    } else {
171        delete ${destroot}${prefix}/${gcclib}/libgcc_s.1.dylib
172        ln -s ${prefix}/lib/libgcc/libgcc_s.1.dylib ${destroot}${prefix}/${gcclib}/libgcc_s.1.dylib
173    }
174}
175
176variant gcc40 description {build against gcc-4.0.x} {
177    patchfiles-delete   patch-lang.opt.diff patch-darwin.h.diff
178    patchfiles-append   patch-host-darwin.c.diff patch-darwin-fallback.c.diff
179}
180
181livecheck.type      regex
182livecheck.url       http://g95.org/downloads.shtml
183livecheck.regex     Stable version (\[0-9.\]+)
Note: See TracBrowser for help on using the repository browser.