Ticket #39408: Portfile

File Portfile, 14.7 KB (added by rms414@…, 11 years ago)

Plplot Portfile

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 103786 2013-03-07 12:53:13Z and.damore@macports.org $
3
4PortSystem      1.0
5
6name            plplot
7version         5.9.9
8revision        12
9platforms       darwin
10maintainers     takeshi openmaintainer
11categories      science
12license         LGPL
13description     Scientific plotting package, double precision version
14master_sites    sourceforge
15checksums           md5     9f2c8536a58875d97ab6b29bbed67d26 \
16                    sha1    3df8fc21723e14af62fea4098e4ef019e1b52a54 \
17                    rmd160  403d56896714336e6f8d65ef51563e7c28c7e588
18homepage        http://plplot.sourceforge.net/
19set description_base "PLplot is a cross-platform software package for \
20creating scientific plots. To help accomplish that task it is organized as a \
21core C library, language bindings for that library, and device drivers which \
22control how the plots are presented in non-interactive and interactive \
23plotting contexts."
24
25long_description    ${description_base} This port uses double precision.
26
27depends_build   port:cmake \
28                path:bin/pkg-config:pkgconfig
29depends_lib     port:expat \
30                port:qhull \
31                port:fontconfig \
32                port:freefont-ttf \
33                port:freetype \
34                port:libiconv \
35                port:libLASi \
36                port:libpng \
37                path:lib/pkgconfig/pango.pc:pango \
38                port:swig-tcl \
39                port:tcl \
40                port:tk \
41                port:zlib
42
43#post-patch {
44#    reinplace "s|-ObjC|-ObjC -framework AquaTerm|" ${worksrcpath}/cmake/modules/aqt.cmake
45#    reinplace "s|-framework AquaTerm|-F${frameworks_dir} -framework AquaTerm|" ${worksrcpath}/cmake/modules/aqt.cmake
46#    if {[variant_isset python26]} {
47#        reinplace "s|\${CMAKE_INSTALL_EXEC_PREFIX}|${frameworks_dir}/Python.framework/Versions/2.6|" \
48#                            ${worksrcpath}/cmake/modules/python.cmake
49#    } elseif {[variant_isset python27]} {
50#       reinplace "s|find_package(PythonLibs)||" ${worksrcpath}/cmake/modules/python.cmake
51#       reinplace "s|get_python_lib\(1,0,prefix='$\{CMAKE_INSTALL_EXEC_PREFIX\}'\)|get_python_lib()|" ${worksrcpath}/cmake/modules/python.cmakee
52#    }
53#
54#}
55
56post-patch {
57#    reinplace "s|-framework AquaTerm|-F${prefix}/Library/Frameworks -framework AquaTerm|" ${worksrcpath}/cmake/modules/aqt.cmake
58    reinplace "s|-ObjC|-ObjC -framework AquaTerm|" ${worksrcpath}/cmake/modules/aqt.cmake
59    reinplace "s|-framework AquaTerm|-F${frameworks_dir} -framework AquaTerm|" ${worksrcpath}/cmake/modules/aqt.cmake
60    if {[variant_isset python]} {
61        reinplace "s|find_package(PythonLibs)||" ${worksrcpath}/cmake/modules/python.cmake
62        reinplace "s|get_python_lib\(1,0,prefix='$\{CMAKE_INSTALL_EXEC_PREFIX\}'\)|get_python_lib()|" ${worksrcpath}/cmake/modules/python.cmake
63    }
64}
65
66configure.cppflags-append   -DUSE_INTERP_RESULT \
67                            -DTcl_Import_TCL_DECLARED
68if {[variant_isset universal]} {
69    set cflags "${configure.cppflags} ${configure.cflags} ${configure.universal_cflags}"
70    set cxxflags "${configure.cppflags} ${configure.cxxflags} ${configure.universal_cxxflags}"
71} else {
72    set cflags "${configure.cppflags} ${configure.cflags}"
73    set cxxflags "${configure.cppflags} ${configure.cxxflags}"
74}
75
76configure.dir           ${workpath}/build
77configure.cmd           cmake
78configure.env           HOME=${workpath}
79configure.pre_args      -DCMAKE_INSTALL_PREFIX=${prefix}
80configure.args          -DCMAKE_VERBOSE_MAKEFILE=ON \
81                        -DCMAKE_C_COMPILER=${configure.cc} \
82                        -DCMAKE_C_FLAGS=\"${cflags}\" \
83                        -DCMAKE_CXX_COMPILER=${configure.cxx} \
84                        -DCMAKE_CXX_FLAGS=\"${cxxflags}\" \
85                        -DCMAKE_INCLUDE_PATH=${prefix}/include \
86                        -DCMAKE_LIBRARY_PATH=${prefix}/lib \
87                        -DTCL_INCLUDE_PATH=${prefix}/include \
88                        -DTCL_LIBRARY=${prefix}/lib/libtcl.dylib \
89                        -DTK_INCLUDE_PATH=${prefix}/include \
90                        -DTK_LIBRARY=${prefix}/lib/libtk.dylib \
91                        -DFREETYPE_INCLUDE_DIR=${prefix}/include/freetype2 \
92                        -DFREETYPE_LIBRARY=${prefix}/lib/libfreetype.dylib \
93                        -DPL_FREETYPE_FONT_PATH=${prefix}/share/fonts/freefont-ttf \
94                        -DWITH_FREETYPE=ON \
95                        -DQHULL_INCLUDE_DIR=${prefix}/include \
96                        -DPLD_aqt=OFF \
97                        -DPLD_extcairo=ON \
98                        -DPLD_memcairo=ON \
99                        -DPLD_ps=ON \
100                        -DPLD_psttf=ON \
101                        -DPLD_pscairo=ON  \
102                        -DPLD_pdfcairo=ON \
103                        -DPLD_pngcairo=ON \
104                        -DPLD_svgcairo=ON \
105                        -DPLD_tk=ON \
106                        -DPLD_wxwidgets=OFF \
107                        -DPLD_xcairo=OFF  \
108                        -DPLD_xwin=OFF \
109                        -DPLD_xfig=OFF \
110                        -DPLD_tkwin=OFF \
111                        -DENABLE_ada=OFF \
112                        -DENABLE_d=OFF \
113                        -DENABLE_f77=OFF \
114                        -DENABLE_f95=OFF \
115                        -DENABLE_itcl=OFF \
116                        -DENABLE_itk=OFF \
117                        -DENABLE_java=OFF \
118                        -DENABLE_lua=OFF \
119                        -DENABLE_ocaml=OFF \
120                        -DENABLE_octave=OFF \
121                        -DENABLE_pdl=OFF \
122                        -DENABLE_pyqt4=OFF \
123                        -DENABLE_python=OFF \
124                        -DENABLE_qt=OFF \
125                        -DENABLE_tcl=ON \
126                        -DENABLE_tk=ON \
127                        -DENABLE_wxwidgets=OFF \
128                        -DBUILD_TEST=OFF \
129                        -DHAVE_AGG=OFF \
130                        -DSWIG_DIR=${prefix}/bin
131configure.post_args     ../${distname}
132
133pre-configure {
134    file mkdir ${workpath}/build
135}
136
137if {[variant_isset universal]} {
138    configure.args-append -DCMAKE_OSX_ARCHITECTURES=\"[strsed ${configure.universal_archs} "g| |;|"]\" -DENABLE_f77:BOOL=OFF -DENABLE_f95:BOOL=OFF
139} else {
140# Adhoc fix
141# cmake passes -arch to Fortran compiler
142# g95 ignores -arch but gfortran fails with it
143    if {[variant_isset g95]} {
144        configure.args-append -DCMAKE_OSX_ARCHITECTURES=\"[strsed ${build_arch} "g| |;|"]\"
145    }
146}
147
148build.dir               ${workpath}/build
149
150pre-destroot {
151    set mods "${workpath}/build/bindings/f95/plplot.mod
152              ${workpath}/build/bindings/f95/plplotp.mod
153              ${workpath}/build/bindings/f95/plplot_flt.mod"
154    foreach m $mods {
155        if {[file exists $m]} {
156            file copy $m ${workpath}/build/
157        }
158    }
159}
160
161#platform i386 {
162#    configure.args-append   -DCMAKE_MODULE_LINKER_FLAGS=\"-undefined dynamic_lookup\" \
163#                            -DCMAKE_EXE_LINKER_FLAGS=\"-undefined dynamic_lookup\"
164#}
165
166if {${os.platform}=="darwin"} {
167    default_variants    +aquaterm
168}
169default_variants-append +x11
170
171subport ${name}-single {
172    description     Scientific plotting package, single precision version
173    long_description    ${description_base} This port uses single precision.
174
175    configure.pre_args      -DCMAKE_INSTALL_PREFIX=${prefix}/lib/${subport}
176    configure.args-append   -DPL_DOUBLE=OFF
177}
178
179# variant gcw is deleted since it has been deprecated
180# gd driver (gif, jpeg, png, svg) has been deprecated
181
182# Fortran notes:
183# * In build/language_tests/Fortran, FC and LDFLAGS are used.
184# * CMAKE_Fortran_COMPILER is used later in build.
185# * To avoid -arch ${build_arch} to be passed configure.ld_archflags is unset.
186
187variant gcc43 conflicts g95 gcc44 gcc45 gcc46 gcc47 universal description {Add support for fortran using gfortran-mp-4.3} {
188    depends_lib-append      port:gcc43
189    configure.ld_archflags  ""
190    configure.fc            ${prefix}/bin/gfortran-mp-4.3
191    configure.args-delete   -DENABLE_f77=OFF \
192                            -DENABLE_f95=OFF
193    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
194                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags}\"
195}
196variant gcc44 conflicts g95 gcc43 gcc45 gcc46 gcc47 universal description {Add support for fortran using gfortran-mp-4.4} {
197    depends_lib-append      port:gcc44
198    configure.fc            ${prefix}/bin/gfortran-mp-4.4
199    configure.ld_archflags  ""
200    configure.args-delete   -DENABLE_f77=OFF \
201                            -DENABLE_f95=OFF
202    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
203                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags}\"
204}
205variant gcc45 conflicts g95 gcc43 gcc44 gcc46 gcc47 universal description {Add support for fortran using gfortran-mp-4.5} {
206    depends_lib-append      port:gcc45
207    configure.fc            ${prefix}/bin/gfortran-mp-4.5
208    configure.ld_archflags  ""
209    configure.args-delete   -DENABLE_f77=OFF \
210                            -DENABLE_f95=OFF
211    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
212                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags}\"
213}
214variant gcc46 conflicts g95 gcc43 gcc44 gcc45 gcc47 universal description {Add support for fortran using gfortran-mp-4.6} {
215    depends_lib-append      port:gcc46
216    configure.ld_archflags  ""
217    configure.fc            ${prefix}/bin/gfortran-mp-4.6
218    configure.args-delete   -DENABLE_f77=OFF \
219                            -DENABLE_f95=OFF
220    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
221                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags}\"
222}
223variant gcc47 conflicts g95 gcc43 gcc44 gcc45 gcc46 universal description {Add support for fortran using gfortran-mp-4.7} {
224    depends_lib-append      port:gcc47
225    configure.fc            ${prefix}/bin/gfortran-mp-4.7
226    configure.ld_archflags  ""
227    configure.args-delete   -DENABLE_f77=OFF \
228                            -DENABLE_f95=OFF
229    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
230                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags}\"
231}
232variant g95 conflicts gcc43 gcc44 gcc45 gcc46 gcc47 universal description {Add support for fortran using g95} {
233    depends_lib-append      port:g95
234    configure.fc            ${prefix}/bin/g95
235    configure.ld_archflags  ""
236    configure.args-delete   -DENABLE_f77=OFF \
237                            -DENABLE_f95=OFF
238    configure.args-append   -DCMAKE_Fortran_COMPILER=\"${configure.fc}\" \
239                            -DCMAKE_OSX_DEPLOYMENT_TARGET=\"\" \
240                            -DCMAKE_Fortran_FLAGS=\"${configure.fflags} -fno-second-underscore\"
241# Ad hoc fix to enable build of f95 binding by disabling some features
242    if {${os.major}<10} {
243        patchfiles-append       patch-sfstubsf95.f90.diff
244    }
245}
246
247variant octave description {Add support for Octave} {
248    depends_lib-append       port:swig-octave
249    configure.args-delete   -DENABLE_octave=OFF
250    configure.args-append   -DENABLE_octave=ON
251    license-append  GPL-2+
252}
253
254variant java description {Add support for Java} {
255    depends_lib-append       port:swig-java
256    configure.args-delete   -DENABLE_java=OFF
257    configure.args-append   -DENABLE_java=ON
258}
259
260variant python25 conflicts python26 python27 description {Add support for python25} {
261    depends_lib-append      port:python25 \
262                            port:py25-numpy \
263                            port:swig-python
264    configure.args-delete   -DENABLE_python=OFF
265    configure.args-append   -DENABLE_python=ON \
266                            -DHAVE_NUMPY:BOOL=ON \
267                            -DPYTHON_INCLUDE_PATH=${prefix}/include/python2.5
268}
269variant python26 conflicts python25 python27 description {Add support for python26} {
270    depends_lib-append      port:python26 \
271                            port:py26-numpy \
272                            port:swig-python
273    configure.args-delete   -DENABLE_python=OFF
274    configure.args-append   -DENABLE_python=ON \
275                            -DHAVE_NUMPY:BOOL=ON \
276                            -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/2.6/Headers
277}
278
279variant python27 description {Add support for python27} {
280    depends_lib-append      port:python27 \
281                            port:py27-numpy \
282                            port:swig-python
283    configure.args-delete   -DENABLE_python=OFF
284    configure.args-append   -DENABLE_python=ON \
285                            -DHAVE_NUMPY:BOOL=ON \
286                            -DPYTHON_INCLUDE_PATH=/opt/local/Library/Frameworks/Python.framework/Versions/Current/include/python2.7 \
287                            -DPYTHON_LIBRARIES=/opt/local/Library/Frameworks/Python.framework/Versions/Current/lib/libpython2.7.dylib
288}
289
290variant python27 conflicts python25 python26 description {Add support for python27} {
291    depends_lib-append      port:python27 \
292                            port:py27-numpy \
293                            port:swig-python
294    configure.args-delete   -DENABLE_python=OFF
295    configure.args-append   -DENABLE_python=ON \
296                            -DHAVE_NUMPY:BOOL=ON \
297                            -DPYTHON_INCLUDE_PATH=${frameworks_dir}/Python.framework/Versions/2.7/Headers
298}
299
300variant py25_pyqt4 requires python25 description {Add support for pyQT4 using python25} {
301    depends_lib-append     port:py25-pyqt4
302    configure.args-delete   -DENABLE_pyqt4=OFF
303    configure.args-append   -DENABLE_pyqt4=ON
304}
305variant py26_pyqt4 requires python26 description {Add support for pyQT4 using python26} {
306    depends_lib-append     port:py26-pyqt4
307    configure.args-delete   -DENABLE_pyqt4=OFF
308    configure.args-append   -DENABLE_pyqt4=ON
309}
310variant py27_pyqt4 requires python27 description {Add support for pyQT4 using python27} {
311    depends_lib-append     port:py27-pyqt4
312    configure.args-delete   -DENABLE_pyqt4=OFF
313    configure.args-append   -DENABLE_pyqt4=ON
314}
315
316variant gdc description {Add support for D} {
317    depends_lib-append      port:gdc
318    configure.args-delete   -DENABLE_d=OFF
319    configure.args-append   -DENABLE_d=ON
320}
321
322variant aquaterm description {Add support for Aquaterm} {
323    depends_lib-append      port:aquaterm
324    configure.args-delete   -DPLD_aqt=OFF
325    configure.args-append   -DPLD_aqt=ON \
326                            -DAQT_FRAMEWORK=${frameworks_dir}/AquaTerm.framework
327}
328
329variant no_x11 conflicts x11 description {Deprecated dummy variant} {
330}
331
332variant x11 conflicts no_x11 {
333    configure.args-append   -DPLD_xcairo=ON  \
334                            -DPLD_xwin=ON \
335                            -DPLD_xfig=ON
336    configure.args-delete   -DPLD_xcairo=OFF \
337                            -DPLD_xwin=OFF \
338                            -DPLD_xfig=OFF
339}