source: trunk/dports/graphics/pgplot/Portfile @ 111238

Last change on this file since 111238 was 111238, checked in by macsforever2000@…, 6 years ago

pgplot: Add gcc48 variant. Make gcc48 the default.

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