Ticket #41320: Portfile

File Portfile, 4.7 KB (added by dstrubbe (David Strubbe), 11 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$
3
4PortSystem          1.0
5PortGroup           active_variants 1.1
6
7name                xcrysden
8version             1.5.53
9categories          science
10platforms           darwin
11license             GPL-2+
12maintainers         gmail.com:dstrubbe
13
14description         X-windows CRYstalline Structures and DENsities
15
16long_description    XCrySDen is a crystalline and molecular structure visualisation program aiming at display of \
17                    isosurfaces and contours, which can be superimposed on crystalline structures and interactively \
18                    rotated and manipulated.
19
20homepage            http://www.xcrysden.org/
21master_sites        ${homepage}/download
22
23checksums           rmd160  2ae5fdf510e5900e36047533e730c841cc18755f \
24                    sha1    7bf5432412982747923f446494f5e5e7437ba645
25
26require_active_variants tk x11
27
28depends_lib         port:fftw-3 port:mesa702 port:tcl port:tk \
29                    port:xorg-libXmu port:xorg-libX11 port:xorg-libXext
30depends_run         port:BWidget
31
32set prefix_share ${prefix}/share/${distname}
33notes               "You can test this installation via the command:\
34                    XCRYSDEN_TOPDIR=${prefix_share} XCRYSDEN_SCRATCH=/tmp ${prefix_share}/tests/run_test.sh structures" \
35                    "Additional functionality can be enabled by installing any of these ports, detected at runtime:\
36                    netpbm (for ppmtompeg), openbabel, whirlgif, imagemagick, mplayer (for mencoder), gifsicle."
37
38# Patched issues:
39# Makefile did not respect DESTDIR, or install tests
40# CRYSTAL tests should only be run if CRYSTAL package is available
41# WIEN2K conversion (str2xcr) wrote into working directory not scratch
42
43patchfiles          patch-Makefile.diff \
44                    patch-tests-crystals.tcl.diff \
45                    patch-Tcl-wnOpen.tcl.diff
46
47configure {
48    system -W ${worksrcpath} "echo '
49CC=${configure.cc}
50CFLAGS=-O3 -DUSE_INTERP_RESULT
51FC=${configure.f90}
52FFLAGS=-O3
53COMPILE_TCLTK=no
54COMPILE_MESA=no
55COMPILE_FFTW=no
56FFTW3_LIB=${prefix}/lib/libfftw3.dylib
57X_LIB=${prefix}/lib/libXmu.dylib ${prefix}/lib/libX11.dylib ${prefix}/lib/libXext.dylib
58TK_LIB=${prefix}/lib/libtk.dylib
59TCL_LIB=${prefix}/lib/libtcl.dylib
60GL_LIB=${prefix}/lib/mesa702/libGL.dylib
61GLU_LIB=${prefix}/lib/mesa702/libGLU.dylib
62FFTW3_INCDIR=-I${prefix}/include/mesa702 -I${prefix}/include' > Make.sys"
63}
64# for simplicity and to control order (mesa702 first) put it all in one variable
65
66use_parallel_build  yes
67universal_variant   no
68
69build.target xcrysden
70
71destroot.env prefix=${prefix}
72
73# replace path to where XCrySDen would install BWidget itself
74post-build {
75    reinplace -W ${worksrcpath}/Tcl "s|\$system(TOPDIR)/external/lib/bwidget-\*|${prefix}/lib/BWidget|" xcInit.tcl
76}
77
78# Doesn't work to run test, I guess X11 display cannot be used in that. Error message:
79# cannot application-specific initialization failed: couldn't connect to display "/tmp/launch-TfisC0/org.macosforge.xquartz:0"
80# See way to run by hand in notes above.
81
82#test {
83#    xinstall -W ${worksrcpath} C/xcrys bin/xcrys
84#    system -W ${worksrcpath}/tests "sh run_test.sh structures"
85#}
86
87set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
88set default_fortran_variant +gcc48
89set g95_conflicts {}
90
91foreach ver ${gcc_versions} {
92    set ver_no_dot [join [split ${ver} "."] ""]
93
94    set variant_line {variant gcc${ver_no_dot} description "build with gfortran from gcc${ver_no_dot}" conflicts g95}
95
96    foreach over ${gcc_versions} {
97        if {${ver} == ${over}} {
98            continue
99        }
100
101        set over_no_dot [join [split ${over} "."] ""]
102        append variant_line " conflicts gcc${over_no_dot}"
103    }
104    append variant_line { {}}
105
106    eval $variant_line
107
108    append g95_conflicts " conflicts gcc${ver_no_dot}"
109
110    if {[variant_isset gcc${ver_no_dot}]} {
111        set default_fortran_variant ""
112    }
113}
114
115eval [concat {variant g95 description {build with g95}} $g95_conflicts {{}}]
116
117if {[variant_isset g95]} {
118    set default_fortran_variant ""
119}
120
121if {${default_fortran_variant} != ""} {
122    default_variants-append "${default_fortran_variant}"
123}
124
125foreach ver ${gcc_versions} {
126    set ver_no_dot [join [split ${ver} "."] ""]
127
128    if {[variant_isset gcc${ver_no_dot}]} {
129        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
130        depends_build-append port:gcc${ver_no_dot}
131
132        configure.f90 ${prefix}/bin/gfortran-mp-${ver}
133    }
134}
135
136if {[variant_isset g95]} {
137    depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
138    depends_build-append port:g95
139
140    configure.f90 ${prefix}/bin/g95
141}
142
143livecheck.type      regex
144livecheck.url       [lindex ${master_sites} 0]
145livecheck.regex     xcrysden-(\[0-9.\]+)${extract.suffix}