source: trunk/dports/graphics/pgplot/Portfile

Last change on this file was 142116, checked in by mojca@…, 2 years ago

pgplot: remove no_x11 (#39383)

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.2 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 142116 2015-11-04 07:39:33Z ryandesign@macports.org $
3
4PortSystem          1.0
5PortGroup           compilers 1.0
6
7name                pgplot
8conflicts           miriad
9version             5.2.2
10revision            10
11categories          graphics devel
12license             Noncommercial
13platforms           darwin
14maintainers         mcalhoun openmaintainer
15
16description         C/Fortran graphics library
17
18long_description    The PGPLOT Graphics Subroutine Library is a Fortran- or \
19                    C-callable, device-independent graphics package for making \
20                    simple scientific graphs. It is intended for making \
21                    graphical images of publication quality with minimum \
22                    effort on the part of the user. For most applications, the \
23                    program can be device-independent, and the output can be \
24                    directed to the appropriate device at run time.
25
26
27homepage            http://www.astro.caltech.edu/~tjp/pgplot/
28# mirroring pgplot requires "a clear link to the original site http://www.astro.caltech.edu/~tjp/pgplot/"
29# see #35956
30master_sites        ftp://ftp.astro.caltech.edu/pub/pgplot/
31
32distname            ${name}[join [split ${version} .] ""]
33worksrcdir          ${name}
34configure.dir       ${workpath}/build
35build.dir           ${configure.dir}
36
37checksums           rmd160  4c21cad6613772f4104c65ac3d8d9a42e3c4afe1 \
38                    sha256  a5799ff719a510d84d26df4ae7409ae61fe66477e3f1e8820422a9a4727a5be4
39
40depends_build       bin:perl:perl5 \
41                    port:pkgconfig
42
43depends_lib         port:libpng \
44                    port:zlib
45
46patchfiles          patch-makemake.diff \
47                    patch-drivers.list.patch \
48                    patch-drivers-pndriv.c.diff \
49                    patch-proccom.c.diff
50
51# See #37551
52if { [string match *64 ${build_arch}] } {
53    patchfiles-append patch-64bit.diff
54}
55
56# Tell the compiler not to treat backslash characters as C-style escape sequences.
57configure.fcflags-append -fno-backslash
58
59set compat_version  [join [lrange [split ${version} .] 0 0] .]
60
61post-extract {
62    file mkdir ${build.dir}
63}
64
65post-patch {
66    # Ensure MacPorts libraries are being used.
67    reinplace "s|\\(-L\\\\`pwd\\\\`\\)|\\1 -L${prefix}/lib|" ${worksrcpath}/makemake
68
69    # Look in the correct place for run-time data files.
70    reinplace "s|/usr/local/pgplot/|${prefix}/share/${name}/|" ${worksrcpath}/src/grgfil.f
71
72    # /usr/local/bin/perl may not exist.
73    reinplace "s|#!/usr/local/bin/perl|#!/usr/bin/env perl|" ${worksrcpath}/makehtml ${worksrcpath}/maketex
74
75    copy ${worksrcpath}/drivers.list ${build.dir}
76
77    set drivers "GIF VGIF LATEX PNG TPNG PS VPS CPS VCPS"
78
79    if {[variant_isset x11]} {
80        # XDISP does not work because the program figdisp can not be found.
81        lappend drivers XWINDOW XSERVE
82    }
83
84    if {[variant_isset aquaterm]} {
85        lappend drivers AQT
86    }
87
88    foreach driver ${drivers} {
89        reinplace "s|!\\(.*/${driver} .*\\)| \\1|" ${build.dir}/drivers.list
90    }
91}
92
93pre-configure {
94    set shlib_opts \
95        "-dynamiclib -single_module -current_version ${version} -compatibility_version ${compat_version}"
96
97    if {[variant_isset x11]} {
98        # XQuartz or MacPorts X11 (pkg-config gives precedence to MacPorts X11)
99        eval configure.ldflags-append   [exec pkg-config x11 --libs-only-L]
100        set x11Libs                     [exec pkg-config x11 --libs-only-l]
101        eval configure.cppflags-append  [exec pkg-config x11 --cflags]
102    } else {
103        set x11Libs ""
104    }
105
106    if {[variant_isset aquaterm]} {
107        set aqtLibs "-Wl,-framework -Wl,AquaTerm -Wl,-framework -Wl,Foundation -F${frameworks_dir}"
108    } else {
109        set aqtLibs ""
110    }
111
112    # Create configuration file.
113    #    For a description of options, see ${worksrcpath}/sys_linux/g77_gcc.conf
114    lappend options XINCL           "${configure.cppflags} -F${frameworks_dir}"
115    lappend options MOTIF_INCL      ""
116    lappend options ATHENA_INCL     ""
117    lappend options TK_INCL         ""
118    lappend options RV_INCL         ""
119    lappend options FCOMPL          "${configure.fc}"
120    lappend options FFLAGC          "${configure.fcflags}"
121    lappend options FFLAGD          ""
122    lappend options CCOMPL          "${configure.cc}"
123    lappend options CFLAGC          "${configure.cppflags} ${configure.cflags}"
124    lappend options CFLAGD          ""
125    lappend options PGBIND_FLAGS    "bsd"
126    lappend options LIBS            "${configure.ldflags} ${x11Libs} ${aqtLibs}"
127    lappend options MOTIF_LIBS      ""
128    lappend options ATHENA_LIBS     ""
129    lappend options TK_LIBS         ""
130    lappend options RANLIB          "/usr/bin/ranlib"
131    lappend options SHARED_LIB      "libpgplot${version}.dylib"
132    lappend options SHARED_LD       "${configure.fc} ${shlib_opts} ${configure.ldflags} ${x11Libs} -install_name ${prefix}/lib/libpgplot${compat_version}.dylib"
133    lappend options SHARED_LIB_LIBS "${configure.ldflags} -lpng ${aqtLibs}"
134    lappend options MCOMPL          "${configure.objc}"
135    lappend options MFLAGC          "${configure.objcflags}"
136    lappend options SYSDIR          "\\\$SYSDIR"
137
138    # The following variables are not part of the unpatched pgplot.
139    #     They have been added to facilitate building a shared C library.
140    lappend options CSHARED_LIB     "libcpgplot${version}.dylib"
141    lappend options CSHARED_LD      "${configure.fc} ${shlib_opts} ${configure.ldflags} ${x11Libs} -install_name ${prefix}/lib/libcpgplot${compat_version}.dylib"
142
143    file mkdir ${worksrcpath}/sys_darwin
144    foreach {var val} ${options} {
145        system "/bin/echo \"   ${var}=\\\"${val}\\\"\" >> ${worksrcpath}/sys_darwin/macports.conf"
146    }
147
148    # Create optional routine which makemake will find and compile.
149    system "/bin/echo \"int iand_ (int *a, int *b) { return *a & *b;}\" >> ${worksrcpath}/sys_darwin/iand.c"
150}
151
152configure.cmd       ${worksrcpath}/makemake
153configure.pre_args
154configure.args      ${worksrcpath} ${os.platform}
155
156# When linking against fortran code, PG_PPU gets number of underscores correct.
157configure.cppflags-append -DPG_PPU
158
159# Build the C PGPLOT wrapper library, HTML documentation, and TeX files.
160build.target-append cpg pgplot.html pgplot-routines.tex
161
162destroot {
163    # pgxwin_server is only built if the X11 drivers are requested.
164    # pgdisp is only built if the XDISP driver is requested.
165    foreach fl [glob -directory ${destroot.dir} -nocomplain pgxwin_server pgdisp] {
166        xinstall -m 755 ${fl} ${destroot}${prefix}/bin
167    }
168
169    foreach fl [glob -directory ${destroot.dir} -nocomplain *.dylib] {
170        xinstall -m 755 ${fl} ${destroot}${prefix}/lib
171    }
172
173    foreach fl [glob -directory ${destroot.dir} -nocomplain *.a] {
174        xinstall -m 644 ${fl} ${destroot}${prefix}/lib
175    }
176
177    foreach fl [glob -directory ${destroot.dir} -nocomplain *.h] {
178        xinstall -m 644 ${fl} ${destroot}${prefix}/include
179    }
180
181    # Install run-time data files.
182    xinstall -d -m 755 ${destroot}${prefix}/share/${name}
183    foreach fl [glob -directory ${destroot.dir} -nocomplain *.dat *.txt] {
184        xinstall -m 644 ${fl} ${destroot}${prefix}/share/${name}
185    }
186
187    # Install docs.
188    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
189    xinstall -m 644 ${worksrcpath}/copyright.notice ${destroot}${prefix}/share/doc/${name}
190    foreach fl [glob -directory ${destroot.dir} -nocomplain *.doc *.html *.pdf] {
191        xinstall -m 644 ${fl} ${destroot}${prefix}/share/doc/${name}
192    }
193
194    # Install examples.
195    xinstall -d -m 755 ${destroot}${prefix}/share/${name}/examples
196    foreach fl [glob -directory ${worksrcpath} examples/pgdemo*.f cpg/cpgdemo*.c drivers/*/pg*demo.*] {
197        xinstall -m 644 ${fl} ${destroot}${prefix}/share/${name}/examples
198    }
199    foreach fl [glob -directory ${destroot.dir} *demo*] {
200        xinstall -m 755 ${fl} ${destroot}${prefix}/share/${name}/examples
201    }
202
203    # Create more library names.
204    ln -s libcpgplot${version}.dylib ${destroot}${prefix}/lib/libcpgplot.dylib
205    ln -s libcpgplot${version}.dylib ${destroot}${prefix}/lib/libcpgplot[join [lrange [split ${version} .] 0 0] .].dylib
206    ln -s libcpgplot${version}.dylib ${destroot}${prefix}/lib/libcpgplot[join [lrange [split ${version} .] 0 1] .].dylib
207
208    ln -s libpgplot${version}.dylib ${destroot}${prefix}/lib/libpgplot.dylib
209    ln -s libpgplot${version}.dylib ${destroot}${prefix}/lib/libpgplot[join [lrange [split ${version} .] 0 0] .].dylib
210    ln -s libpgplot${version}.dylib ${destroot}${prefix}/lib/libpgplot[join [lrange [split ${version} .] 0 1] .].dylib
211}
212
213use_parallel_build  no
214
215universal_variant   no
216
217variant x11 {
218    depends_lib-append      port:xorg-libX11
219}
220
221default_variants    +x11
222
223variant aquaterm description {install driver for aquaterm} {
224    depends_lib-append  port:aquaterm
225
226    post-extract {
227        copy ${prefix}/share/aquaterm/adapters/pgplot/aqdriv.m ${worksrcpath}/drivers
228    }
229}
230
231compilers.choose    fc
232compilers.setup     require_fortran
233
234variant docs description {Create and install docs} {
235    depends_build-append bin:pdflatex:texlive
236
237    post-build {
238        system -W ${build.dir} "pdflatex pgplot-routines.tex && pdflatex pgplot-routines.tex"
239    }
240}
241
242livecheck.type      regex
243livecheck.regex     {The current version of PGPLOT is <b>(\d+(?:\.\d+)*)</b>}
Note: See TracBrowser for help on using the repository browser.