Ticket #43933: Portfile

File Portfile, 5.5 KB (added by smaret (Sebastien Maret), 10 years ago)
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 119604 2014-05-02 09:12:57Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           compilers 1.0
6
7name                gildas
8version             201406a
9set my_version      [string tolower [clock format [clock scan 2000-[string range ${version} 4 5]-10] -format %b]][string range ${version} 2 3][string range ${version} 6 end]
10categories          science
11platforms           darwin
12maintainers         gmail.com:sebastien.maret
13license             permissive
14
15description         Radioastronomy data analysis software
16
17long_description    GILDAS is a collection of state-of-the-art softwares \
18                    oriented toward (sub-)millimeter radioastronomical \
19                    applications (either single-dish or interferometer). \
20                    It is daily used to reduce all data acquired with the \
21                    IRAM 30M telescope and Plateau de Bure Interferometer \
22                    PDBI (except VLBI observations). GILDAS is easily \
23                    extensible. GILDAS is written in Fortran-90, with a \
24                    few parts in C/C++ (mainly keyboard interaction, \
25                    plotting, widgets).
26
27homepage            http://www.iram.fr/IRAMFR/GILDAS/gildas.html
28master_sites        http://www.iram.fr/~gildas/dist/
29distname            ${name}-src-${my_version}
30
31checksums           rmd160  8f8b99c03e8d32048ff325a2c07fe6f96f413dbd \
32                    sha256  080fe64969a59c7d4d5389f847cfe3e0a73ebaa047d4c0d4b7fdb597c6fece36
33
34patch.pre_args      -p1
35patchfiles          patch-admin-Makefile.def.diff \
36                    patch-admin-Makefile.stdcxxlib.diff \
37                    patch-admin-Makefile.python.diff \
38                    patch-admin-gildas-env.sh.diff \
39                    patch-admin-define-system.sh.diff \
40                    patch-lapack.diff
41
42depends_lib         port:gtk2 \
43                    port:libpng \
44                    port:python27 \
45                    port:py27-numpy
46
47depends_build       port:cfitsio \
48                    port:pkgconfig \
49                    port:slatec
50
51# need x11 and cannot be used with quartz; see ticket #42886
52require_active_variants gtk2 x11 quartz
53
54compilers.choose    fc
55compilers.setup     -g95 -gcc44 -gcc45 -gcc46 require_fortran
56configure.python    ${prefix}/bin/python2.7
57
58if {![fortran_variant_isset]} {
59    default_variants-append +gcc48
60}
61
62set cxxstdlib {}
63platform darwin {
64    if {[info exists configure.cxx_stdlib] &&
65        ${configure.cxx_stdlib} ne {} &&
66        [string match *clang* ${configure.cxx}]} {
67        set cxxstdlib ${configure.cxx_stdlib}
68    } elseif {[string match *clang* ${configure.cxx}] &&
69              ${os.major} >= 13} {
70        set cxxstdlib libc++
71    } else {
72        set cxxstdlib libstdc++
73    }
74
75    if {[string length ${cxxstdlib}]} {
76        set cxxstdlib [string map {lib -l} ${cxxstdlib}]
77    }
78}
79
80post-extract {
81    if {![gcc_variant_isset]} {
82        reinplace -W ${worksrcpath}/admin "s|-Wrealloc-lhs-all||" define-system.sh
83    }
84}
85
86configure {
87    reinplace -W ${worksrcpath}/admin "s|@CC@|${configure.cc}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
88    reinplace -W ${worksrcpath}/admin "s|@CCFLAGS@|${configure.cflags}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
89    reinplace -W ${worksrcpath}/admin "s|@FC@|${configure.fc}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
90    reinplace -W ${worksrcpath}/admin "s|@FCFLAGS@|${configure.fcflags}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
91    reinplace -W ${worksrcpath}/admin "s|@CXX@|${configure.cxx}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
92    reinplace -W ${worksrcpath}/admin "s|@CPP@|${configure.cpp}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
93    reinplace -W ${worksrcpath}/admin "s|@CPPFLAGS@|${configure.cppflags}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
94    reinplace -W ${worksrcpath}/admin "s|@LDFLAGS@|${configure.ldflags}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
95    reinplace -W ${worksrcpath}/admin "s|@PYTHON@|${configure.python}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
96    reinplace -W ${worksrcpath}/admin "s|@STDCXXLIB@|${cxxstdlib}|g" Makefile.def Makefile.python gildas-env.sh define-system.sh
97}
98
99build {
100    system -W ${worksrcpath} "source admin/gildas-env.sh -c ${configure.fc} -s ${prefix}/include:${prefix}/lib:/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Versions/Current/ && export GAG_SLDFLAGS='-shared -o ${prefix}/lib/gildas/x86_64-darwin-gfortran/lib/\$(notdir \$@) -install_name ${prefix}/lib/gildas/x86_64-darwin-gfortran/lib/\$(notdir \$@)' && export DYLD_LIBRARY_PATH=${worksrcpath}/integ/x86_64-darwin-gfortran/lib && make install"
101}
102
103destroot {
104    copy ${workpath}/gildas-exe-${my_version} ${destroot}${prefix}/lib/gildas
105
106    xinstall ${filespath}/astro.in ${destroot}${prefix}/bin/astro
107    xinstall ${filespath}/class.in ${destroot}${prefix}/bin/class
108    xinstall ${filespath}/clic.in ${destroot}${prefix}/bin/clic
109    xinstall ${filespath}/greg.in ${destroot}${prefix}/bin/greg
110    xinstall ${filespath}/mapping.in ${destroot}${prefix}/bin/mapping
111    xinstall ${filespath}/mira.in ${destroot}${prefix}/bin/mira
112    xinstall ${filespath}/sic.in ${destroot}${prefix}/bin/sic
113
114    reinplace -W ${destroot}${prefix}/bin s|@PREFIX@|${prefix}|g astro class clic greg mapping mira sic
115}