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 51050 2009-05-17 01:13:19Z takeshi@macports.org $ |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | |
---|
6 | name g95 |
---|
7 | version 0.91 |
---|
8 | revision 2 |
---|
9 | platforms darwin |
---|
10 | categories lang |
---|
11 | maintainers takeshi |
---|
12 | description Another GNU Fortran 95 compiler |
---|
13 | long_description \ |
---|
14 | G95 is a stable, production Fortran 95 compiler \ |
---|
15 | available for multiple cpu architectures and operating systems. \ |
---|
16 | Innovations and optimizations continue to be worked on. \ |
---|
17 | Parts of the F2003 standard have been implemented in g95. |
---|
18 | homepage http://g95.org/ |
---|
19 | master_sites ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.0.4/:gcc \ |
---|
20 | http://ftp.g95.org/v${version}/:g95 |
---|
21 | |
---|
22 | set version_gcc 4.0.4 |
---|
23 | set dcore gcc-core-${version_gcc}.tar.bz2 |
---|
24 | dist_subdir gcc40 |
---|
25 | set dg95 ${name}_source.tgz |
---|
26 | set gcclib lib/gcc-lib/${os.arch}-apple-${os.platform}${os.version}/${version_gcc} |
---|
27 | distfiles ${dcore}:gcc ${dg95}:g95 |
---|
28 | |
---|
29 | checksums ${dcore} md5 193e0a7a471cca70e374974bc5a60137 \ |
---|
30 | ${dcore} sha1 55c664b33a4dc6b2130c47da28a1d6daab732ce9 \ |
---|
31 | ${dcore} rmd160 af67dc8385942450f6b27ad83a6b9e3d22f779a1 \ |
---|
32 | ${dg95} md5 35e1852e09b69555bc07f30d0ab4b6ba \ |
---|
33 | ${dg95} sha1 aa58510c04e357439a4bf34c54d380e9079395d5 \ |
---|
34 | ${dg95} rmd160 f0a8325c0e930d69d2def16eaa3c6c21dfd2b5a8 |
---|
35 | |
---|
36 | patchfiles patch-Makefile.in.diff |
---|
37 | |
---|
38 | universal_variant no |
---|
39 | |
---|
40 | extract.only ${dg95} |
---|
41 | |
---|
42 | pre-fetch { |
---|
43 | file delete ${distpath}/${dg95} |
---|
44 | } |
---|
45 | |
---|
46 | post-extract { |
---|
47 | system "tar jxvf ${distpath}/${dcore} -C ${workpath}" |
---|
48 | } |
---|
49 | |
---|
50 | pre-configure { |
---|
51 | file mkdir ${workpath}/gcc-${version_gcc}/${name} |
---|
52 | reinplace "s|tjmp %%edx|tjmp *%%edx|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/i386.c |
---|
53 | if {[variant_isset darwin_8]} { |
---|
54 | reinplace "s|/usr/bin/libtool|${prefix}/bin/odlibtool|" ${workpath}/gcc-${version_gcc}/gcc/config/darwin.h |
---|
55 | set gcc_configargs "--with-as=${prefix}/bin/odas --with-ld=${prefix}/bin/odld --with-nm=${prefix}/bin/odnm" |
---|
56 | } else { |
---|
57 | reinplace "s|i686|i386|" ${workpath}/gcc-${version_gcc}/gcc/config/i386/darwin.h |
---|
58 | set gcc_configargs "--with-as=/usr/bin/as --with-ld=/usr/bin/ld --with-nm=/usr/bin/nm" |
---|
59 | } |
---|
60 | if {[info exists build_arch] && ${os.platform} == "darwin"} { |
---|
61 | if {(${os.arch} == "i386" && $build_arch == "i386") || \ |
---|
62 | (${os.arch} == "powerpc" && $build_arch == "ppc")} { |
---|
63 | set cflags_target "-m32 ${configure.cflags}" |
---|
64 | } elseif {(${os.arch} == "i386" && $build_arch == "x86_64") || \ |
---|
65 | (${os.arch} == "powerpc" && $build_arch == "ppc64")} { |
---|
66 | set cflags_target "-m64 ${configure.cflags}" |
---|
67 | } else { |
---|
68 | pre-fetch { |
---|
69 | return -code error "Cannot build $name for $build_arch" |
---|
70 | } |
---|
71 | } |
---|
72 | set cflags_build "${configure.cc_archflags} ${configure.cflags}" |
---|
73 | configure.cc_archflags |
---|
74 | configure.cxx_archflags |
---|
75 | configure.objc_archflags |
---|
76 | } |
---|
77 | system "export CPPFLAGS=${configure.cppflags}; \ |
---|
78 | export CFLAGS_FOR_BUILD=${cflags_build}; \ |
---|
79 | export CFLAGS_FOR_TARGET=${cflags_target}; \ |
---|
80 | export LDFLAGS=${configure.ldflags}; \ |
---|
81 | cd ${workpath}/gcc-${version_gcc}/${name}; \ |
---|
82 | ../configure --prefix=${prefix}/${gcclib} --with-libiconv-prefix=${prefix}/include \ |
---|
83 | --enable-languages=c ${gcc_configargs} --with-included-gettext; \ |
---|
84 | make" |
---|
85 | } |
---|
86 | |
---|
87 | configure.args --with-gcc-dir=${workpath}/gcc-${version_gcc} |
---|
88 | |
---|
89 | post-build { |
---|
90 | system "cd ${worksrcpath}; tar zxvf libf95.a-${version}.tar.gz; \ |
---|
91 | cd libf95.a-${version}; \ |
---|
92 | export CFLAGS='-O2 -fno-common'; \ |
---|
93 | ./configure --prefix=${prefix}; \ |
---|
94 | make" |
---|
95 | } |
---|
96 | |
---|
97 | pre-destroot { |
---|
98 | reinplace "s|${prefix}/${gcclib}|${destroot}${prefix}/${gcclib}|g" ${worksrcpath}/Makefile |
---|
99 | reinplace "s|${prefix}/${gcclib}|${destroot}${prefix}/${gcclib}|g" ${worksrcpath}/libf95.a-${version}/Makefile |
---|
100 | } |
---|
101 | |
---|
102 | destroot { |
---|
103 | system "cd ${worksrcpath}; \ |
---|
104 | make install prefix=${destroot}${prefix}; \ |
---|
105 | cd libf95.a-${version}; \ |
---|
106 | make install prefix=${destroot}${prefix}; \ |
---|
107 | ranlib ${destroot}${prefix}/${gcclib}/libf95.a; \ |
---|
108 | ranlib ${destroot}${prefix}/${gcclib}/libgcc.a; \ |
---|
109 | ranlib ${destroot}${prefix}/${gcclib}/libgcc_eh.a" |
---|
110 | file mkdir ${destroot}${prefix}/share/doc/${name} |
---|
111 | file rename ${destroot}${prefix}/G95Manual.pdf ${destroot}${prefix}/share/doc/${name} |
---|
112 | system "ln -sf ${prefix}/${gcclib}/libf95.a ${destroot}${prefix}/lib/libf95.a" |
---|
113 | file mkdir ${destroot}${prefix}/${gcclib}/lib |
---|
114 | system "ln -sf ${prefix}/${gcclib}/libgcc_s.1.0.dylib ${destroot}${prefix}/${gcclib}/lib/libgcc_s.1.0.dylib" |
---|
115 | system "ln -sf ${prefix}/${gcclib}/libgcc_s.1.0.dylib ${destroot}${prefix}/${gcclib}/lib/libgcc_s.dylib" |
---|
116 | } |
---|
117 | |
---|
118 | platform darwin 8 { |
---|
119 | depends_lib-append port:odcctools |
---|
120 | } |
---|
121 | |
---|
122 | platform darwin 9 10 { |
---|
123 | patchfiles-append patch-host-darwin.c.diff patch-darwin-fallback.c.diff |
---|
124 | } |
---|