source: trunk/dports/science/ncarg/Portfile

Last change on this file was 150946, checked in by takeshi@…, 12 months ago

hdf5-18, octave-devel, h4h5tools, hdfeos5, ncarg.netcdf: change prefix of hdf5-18, closing #51925

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.7 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 150946 2016-08-03 13:43:12Z ryandesign@macports.org $
3
4PortSystem                  1.0
5PortGroup                   active_variants 1.1
6PortGroup                   compilers 1.0
7
8compilers.choose            fc f77 f90
9compilers.setup             -clang -dragonegg -gfortran -llvm
10
11name                        ncarg
12version                     6.3.0
13revision                    7
14categories                  science
15platforms                   darwin
16maintainers                 takeshi openmaintainer
17license                     {UCAR-Unidata public-domain BSD LGPL-3 GPL-3}
18
19description                 language for scientific data processing and visualization
20long_description \
21    The NCAR Command Language (NCL), a product of           \
22    the Computational & Information Systems Laboratory      \
23    at the National Center for Atmospheric Research (NCAR)  \
24    and sponsored by the National Science Foundation,       \
25    is a free interpreted language designed specifically    \
26    for scientific data processing and visualization.
27
28homepage            http://www.ncl.ucar.edu/
29
30distname            ncl_${name}-${version}
31master_sites        http://www.ncl.ucar.edu/Download/files/:g2clib \
32                    "https://www.earthsystemgrid.org/download/fileDownload.htm?logicalFileId=bec58cb3-cd9b-11e4-bb80-00c0f03d5b7c&dummy=:ncl"
33
34set ncl_src             ${distname}${extract.suffix}
35
36set g2clib_version      1.5.0
37set g2clib_src          g2clib-${g2clib_version}-patch${extract.suffix}
38set g2clib_worksrcdir   g2clib-${g2clib_version}-patch
39
40distfiles           ${ncl_src}:ncl \
41                    ${g2clib_src}:g2clib
42
43checksums   ${ncl_src} \
44                    rmd160  99753e6319ef418ca60d6980fefc183c65a52e58 \
45                    sha256  79a01d1c51537426a1a657bb78c8f32453d071c774ec21495800d90d3688b2f3\
46            ${g2clib_src} \
47                    rmd160  221b308be9258ed3ec9ebe126d872aa451f879cf \
48                    sha256  1852aa7404426e4d2fecbf75dee47bb1ffeb2ef06c63644c068bad9b9433bfff
49
50depends_lib                 path:lib/pkgconfig/cairo.pc:cairo \
51                            port:proj       \
52                            port:gdal       \
53                            port:udunits2   \
54                            port:vis5d      \
55                            port:hdfeos     \
56                            port:hdfeos5    \
57                            port:wgrib2     \
58                            port:curl       \
59                            port:libpng     \
60                            port:libxml2    \
61                            port:xorg-libXaw
62depends_build               port:hdf5-18 \
63                            port:triangle \
64                            port:flex
65depends_run                 bin:ESMF_RegridWeightGen:esmf \
66                            port:rangs-gshhs-ncarg
67
68use_parallel_build          no
69universal_variant           no
70
71set usedap y
72
73patchfiles                  patch-Configure.diff \
74                            patch-ncarg2d-src-libncarg-Iftran-yMakefile.diff \
75                            patch-ncarview-src-bin-ictrans-yMakefile.diff
76if {$build_arch eq "x86_64"} {
77    patchfiles-append       patch-config-ymake.diff
78}
79if {[variant_isset accelerate]} {
80    patchfiles-append       patch-config-Project-accelerate.diff \
81                            patch-external-yMakefile.diff
82} else {
83    patchfiles-append       patch-config-Project.diff
84}
85
86pre-configure {
87    if {[file exists ${prefix}/lib/hdf5-18/bin/h5pcc]} {
88        configure.cc        ${prefix}/lib/hdf5-18/bin/h5pcc
89    } else {
90        configure.cc        ${prefix}/lib/hdf5-18/bin/h5cc
91    }
92    # build modified g2clib
93    reinplace "s|CC=cc|CC=${configure.cc}|" ${workpath}/${g2clib_worksrcdir}/makefile
94    reinplace "s|INC=-I/usr/local/include|INC=${configure.cppflags} ${configure.cflags}|" ${workpath}/${g2clib_worksrcdir}/makefile
95    reinplace "s|CC=gcc -fPIC|CC=${configure.cc}|" ${workpath}/${g2clib_worksrcdir}/makefile
96    if {$build_arch eq "x86_64" || $build_arch eq "ppc64"} {
97        reinplace "s|-DUSE_PNG$|-DUSE_PNG -D__64BIT__|" ${workpath}/${g2clib_worksrcdir}/makefile
98    }
99    system -W ${workpath}/${g2clib_worksrcdir} "make all"
100    file copy ${workpath}/${g2clib_worksrcdir}/libgrib2c.a ${worksrcpath}
101
102    # edit configurations
103    reinplace "s|g\\\\+\\\\+|${configure.cc}|" ${worksrcpath}/ni/src/ncl/yMakefile
104    foreach f {Darwin Darwin_Intel} {
105        if {[regexp clang ${configure.compiler}]} {
106            reinplace "s|-fopenmp||" ${worksrcpath}/config/${f}
107            reinplace "s| -lquadmath||" ${worksrcpath}/config/${f}
108        }
109        set fvar [fortran_variant_name]
110        if {[variant_isset g95]} {
111            reinplace "s|-lgfortran|-L${prefix}/lib/${fvar} -lf95|" ${worksrcpath}/config/${f}
112        } else {
113            reinplace "s|-lgfortran|-L${prefix}/lib/${fvar} -lgfortran -lgomp|" ${worksrcpath}/config/${f}
114        }
115        reinplace "s| gfortran$| ${configure.fc}|" ${worksrcpath}/config/${f} 
116        reinplace "s|gcc$|${configure.cc}|" ${worksrcpath}/config/${f}
117        reinplace "s|g++$|${configure.cxx}|" ${worksrcpath}/config/${f}
118        reinplace "/CcOptions/d" ${worksrcpath}/config/${f}
119        reinplace "/ArchRecLibSearch/d" ${worksrcpath}/config/${f}
120        reinplace "/ArchRecIncSearch/d" ${worksrcpath}/config/${f}
121        reinplace "s|-lXext$|-lXext\\
122#define ArchRecLibSearch    ${configure.ldflags} \\
123#define ArchRecIncSearch    ${configure.cppflags} \\
124#define CcOptions -fPIC -D_DARWIN_C_SOURCE \\
125#define COptimizeFlag ${configure.cflags}\\
126#define FOptimizeFlag ${configure.fflags}\\
127#define ManRoot ${destroot}${prefix}/share/man\\
128#define NetCDFlib -lnetcdf\\
129#define HDFEOS5lib -lhe5_hdfeos -lGctp|" ${worksrcpath}/config/${f}
130# A workaround for XQuartz 2.7.3 on Mountain Lion known as ncl.xq.fix
131        if {${os.version}>=12} {
132            reinplace "s|-D__UNIXOS2__|-D__UNIXOS2__ -D__JIRA1530__|" ${worksrcpath}/config/${f}
133        }
134    }
135    if {[variant_isset g95]} {
136        reinplace "s|-fno-range-check||" ${worksrcpath}/config/Darwin_Intel
137    }
138
139    # run ymake
140    system -W ${worksrcpath}/config \
141        "CC=${configure.cc} \
142        CFLAGS=${configure.cflags} \
143        make -f Makefile.ini; \
144        ./ymake -config `pwd`"
145
146    # copy triangle.[ch]
147    foreach ext "c h" {
148      file copy ${prefix}/share/triangle/triangle.${ext} ${worksrcpath}/ni/src/lib/hlu
149    }
150}
151
152configure {
153    system -W ${worksrcpath} "./Configure -v << EOF
154
155
156y
157${destroot}${prefix}
158
159y
160y
161y
162y
163y
164y
165y
166y
167y
168y
169y
170y
171y
172y
173${worksrcpath} ${prefix}/lib/hdfeos5/lib ${prefix}/lib
174${prefix}/include/freetype2 ${prefix}/include/udunits2 ${prefix}/lib/hdfeos5/include ${prefix}/include
175
176
177EOF"
178}
179post-configure {
180    system -W ${worksrcpath} "make Info"
181    system "cat ${worksrcpath}/config/Site.local"
182}
183
184build.target                Build
185if {${os.major}<10} {
186    if {[variant_isset g95]} {
187        build.args-append           EXTRA_CCOPTIONS=\"${configure.cc_archflags}\"
188    } else {
189        if {[string match *64* $build_arch]} {
190            build.args-append       EXTRA_CCOPTIONS=-m64
191        } else {
192            build.args-append       EXTRA_CCOPTIONS=-m32
193        }
194    }
195}
196
197# The build script ignores the build errors.
198# Check if ncl is built here.
199post-build {
200    if {![file exists ${worksrcpath}/ni/src/ncl/ncl]} {
201        return -code error "ncl did not get built"
202    }
203}
204
205if {![fortran_variant_isset]} {
206    default_variants-append +gcc5
207}
208
209if {[variant_isset g95]} {
210    configure.fflags-append -fno-second-underscore
211}
212
213variant accelerate description {use Accelerate.framework} {
214    depends_lib-append      port:vecLibFort
215}
216
217livecheck.type              regex
218livecheck.url               ${homepage}
219livecheck.regex             {Current Version:.* .*([0-9]+\.[0-9]+\.[0-9]+)}
Note: See TracBrowser for help on using the repository browser.