Ticket #40309: Portfile.2

File Portfile.2, 3.6 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
5
6name                berkeleygw
7version             1.0.5
8categories          science
9platforms           darwin
10license             BSD
11maintainers         gmail.com:dstrubbe
12
13description         GW/Bethe-Salpeter equation
14long_description    BerkeleyGW is a set of computer codes that calculate the quasiparticle properties \
15                    and the optical responses of a large variety of materials from bulk periodic crystals \
16                    to nanostructures such as slabs, wires and molecules, using many-body perturbation theory.
17homepage            http://www.berkeleygw.org
18master_sites        http://www.berkeleygw.org/releases
19
20checksums           rmd160  308826cb7157d368f4d113ae694a9fbc8c46044e \
21                    sha256  f5706b2daab66bdc22328695c0fb71f6e62577947db1f7d5706e4e9fd64bf9de
22
23depends_lib         port:fftw \
24                    port:atlas
25
26distfiles           BGW-${version}.tar.gz
27
28configure {
29    system -W ${worksrcpath} "sed 's|/opt/local|${prefix}|' < config/generic.serial.macos.mk > arch.mk"
30}
31
32build.target        all-flavors
33use_parallel_build  yes
34
35destroot.post_args  INSTDIR=${destroot}${prefix}
36
37test.run            yes
38test.cmd            make
39test.target         check
40
41# more options that could be added: threads, openmpi, mpich
42
43# This is from the Fortran recipe, but with some customization
44set gcc_versions {4.3 4.4 4.5 4.6 4.7 4.8 4.9}
45set default_fortran_variant +gcc48
46set g95_conflicts {}
47
48foreach ver ${gcc_versions} {
49    set ver_no_dot [join [split ${ver} "."] ""]
50
51    set variant_line {variant gcc${ver_no_dot} description "build with gcc${ver_no_dot}" conflicts g95}
52
53    foreach over ${gcc_versions} {
54        if {${ver} == ${over}} {
55            continue
56        }
57
58        set over_no_dot [join [split ${over} "."] ""]
59        append variant_line " conflicts gcc${over_no_dot}"
60    }
61    append variant_line { {}}
62
63    eval $variant_line
64
65    append g95_conflicts " conflicts gcc${ver_no_dot}"
66
67    if {[variant_isset gcc${ver_no_dot}]} {
68        if {${default_fortran_variant} != "+gcc${ver_no_dot}"} {
69            set default_fortran_variant ""
70        }
71    }
72}
73
74eval [concat {variant g95 description {build with clang/g95}} $g95_conflicts {{}}]
75
76if {[variant_isset g95]} {
77    if {${default_fortran_variant} != "+g95"} {
78        set default_fortran_variant ""
79    }
80}
81
82if {${default_fortran_variant} != ""} {
83    default_variants-append "${default_fortran_variant}"
84}
85
86foreach ver ${gcc_versions} {
87    set ver_no_dot [join [split ${ver} "."] ""]
88
89    if {[variant_isset gcc${ver_no_dot}]} {
90        depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
91        depends_build-append port:gcc${ver_no_dot}
92
93        build.args VERSION=-mp-${ver}
94    }
95}
96
97if {[variant_isset g95]} {
98    depends_lib-append path:lib/libgcc/libgcc_s.1.dylib:libgcc
99    depends_build-append port:g95
100
101    build.args COMPFLAG="-DG95" FCPP="${configure.cc} -P -E -ansi" LINK="${prefix}/bin/g95" \
102        F90free="${prefix}/bin/g95 -ffree-form -ffree-line-length-huge -fno-second-underscore" \
103        MOD_OPT="-fmod=" CC_COMP=${configure.cxx} C_COMP=${configure.cc} C_LINK=${configure.cxx} \
104        LAPACKLIB="-L${prefix}/lib/ -lsatlas"
105    # test, destroot args needed just to avoid trying to build in the test/openmp directory unnecessarily
106    test.args COMPFLAG="-DG95"
107    destroot.args COMPFLAG="-DG95"
108    patchfiles-append patch-Common-common-rules.mk.diff
109}
110
111livecheck.type      regex
112livecheck.url       ${master_sites}
113livecheck.regex     BGW-(\[0-9.\]+).tar