Ticket #43121: Portfile

File Portfile, 8.8 KB (added by cram5431@…, 7 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
6PortGroup           mpi 1.0
7
8name                abinit
9version             7.4.3
10revision            1
11categories          science
12platforms           darwin
13license             GPL-3
14maintainers         gmail.com:cram5431 \
15                    openmaintainer
16
17description         Full-featured atomic-scale first-principles simulation software
18
19long_description    ABINIT is a package whose main program allows one to find the total energy, \
20                    charge density and electronic structure of systems made of electrons and nuclei \
21                    (molecules and periodic solids) within Density Functional Theory (DFT), \
22                    using pseudopotentials and a planewave or wavelet basis. \
23                    ABINIT also includes options to optimize the geometry according to the DFT forces \
24                    and stresses, or to perform molecular dynamics simulations using these forces, \
25                    or to generate dynamical matrices, Born effective charges, and dielectric tensors, \
26                    based on Density-Functional Perturbation Theory, and many more properties. \
27                    Excited states can be computed within the Many-Body Perturbation Theory \
28                    (the GW approximation and the Bethe-Salpeter equation), and \
29                    Time-Dependent Density Functional Theory (for molecules). \
30                    In addition to the main ABINIT code, different utility programs are provided. \
31                    ABINIT is a project that favours development and collaboration.
32
33homepage            http://www.abinit.org
34master_sites        http://ftp.abinit.org/
35
36checksums           rmd160  6e3629a94721440f8afacbcaf2b046b5c6e9b23d \
37                    sha256  3593dc96c124c0e1ad29a5ec13e9e8f8dc391b328cf06ed461e34f5a9298b246
38
39#Restrict to gcc/clang because of dependencies
40compilers.choose    fc cc cxx cpp
41compilers.setup     -clang -dragonegg -llvm
42mpi.setup
43
44depends_lib         port:atlas
45
46configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
47configure.optflags  -O3
48
49build.cmd           make
50build.target        multi multi_nprocs=4
51use_parallel_build  no
52
53default_variants +etsf_io +libxc +wannier90
54
55#Select mpi/gcc default
56set current_mpi "none"
57if { ![variant_isset no_mpi] } {
58    if { [mpi_variant_isset] } {
59        set current_mpi [mpi_variant_name]
60    } else {
61        if {![catch {set current_mpi [file link ${prefix}/etc/select/mpi/current]}]} {
62            if { ${current_mpi} eq "base" } { set current_mpi "none" }
63        }
64        if { ${current_mpi} eq "none"} {
65            default_variants-append +mpich
66        }
67    }
68} else {
69    default_variants-append +gcc48
70}
71
72pre-fetch {
73    if { [variant_isset libxc] } {
74        if { ![active_variants libxc [c_variant_name]] } {
75            ui_error "\nlibxc must have been built with +[c_variant_name]\n"
76            return -code error "libxc must have been built with +[c_variant_name]"
77        }
78    }
79    if { [variant_isset netcdf] } {
80        if {![active_variants netcdf-fortran [c_variant_name]] } {
81            ui_error "\nnetcdf-fortran must have been built with +[c_variant_name]\n"
82            return -code error "netcdf-fortran must have been built with +[c_variant_name]"
83        }
84    }
85    if { [variant_isset etsf_io] } {
86        if {![active_variants etsf_io [fortran_variant_name]] } {
87            ui_error "\netsf_io must have been built with +[fortran_variant_name]\n"
88            return -code error "etsf_io must have been built with +[fortran_variant_name]"
89        }
90    }
91    if { [variant_isset fftw3] } {
92        if {![active_variants fftw-3 gfortran] || \
93            ![active_variants fftw-3-single gfortran]} {
94            ui_error "\nfftw-3 and nfftw-3-single must have been built with +gfortran:"
95            ui_error "This can be achieved by : sudo port -f install fftw-3-single +gfortran\n"
96            return -code error "fftw-3/fftw-3-single must have been built with +gfortran"
97        }
98    }
99}
100
101pre-configure {
102    if { [variant_isset etsf_io] } {
103            configure.args-append  --with-trio-flavor="netcdf+etsf_io"
104        } elseif { [variant_isset netcdf] } {
105            configure.args-append  --with-trio-flavor="netcdf"
106        } else {
107            configure.args-append  --with-trio-flavor="none"
108    }
109    set dft-flavor "none"
110    if { [variant_isset libxc] } {
111        if { ${dft-flavor} eq "none" } {
112            set dft-flavor "libxc"
113        } else {
114            set dft-flavor ${dft-flavor}"+libxc"
115        }
116    }
117    if { [variant_isset wannier90] } {
118        if { ${dft-flavor} eq "none" } {
119            set dft-flavor "wannier90"
120        } else {
121            set dft-flavor ${dft-flavor}"+wannier90"
122        }
123    }
124    if { [variant_isset bigdft] } {
125        if { ${dft-flavor} eq "none" } {
126            set dft-flavor "bigdft"
127        } else {
128            set dft-flavor ${dft-flavor}"+bigdft"
129        }
130    }
131    if { [variant_isset atompaw] } {
132        if { ${dft-flavor} eq "none" } {
133            set dft-flavor "atompaw"
134        } else {
135            set dft-flavor ${dft-flavor}"+atompaw"
136        }
137    }
138    configure.args-append  --with-dft-flavor="${dft-flavor}"
139
140    configure.args-append  FCCPP="${configure.cpp} -ansi"
141
142    if { ${current_mpi} ne "none"} {
143        configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
144        if {[string match *openmpi* ${current_mpi}]} {
145            configure.args-append   --with-mpi-level="1"
146        }
147        if { ![mpi_variant_isset] } {
148            configure.fc     ${mpi.fc}
149            configure.cc     ${mpi.cc}
150            configure.cxx    ${mpi.cxx}
151        }
152        if { ${mpi.exec} ne "" } {
153            configure.args-append  MPI_RUNNER=${mpi.exec}
154            test.env-append        MPIEXEC=${mpi.exec}
155        }
156    } else {
157        configure.args-append  --enable-mpi="no" --enable-mpi-io="no"
158    }
159}
160
161destroot {
162    xinstall -W ${worksrcpath}/src/98_main \
163     abinit aim anaddb band2eps bsepostproc conducti cut3d \
164     fftprof ioprof kss2wfk lapackprof lwf macroave mrgddb \
165     mrggkk mrgscr optic ujdet vdw_kernelgen \
166     ${destroot}${prefix}/bin
167    if { [variant_isset atompaw] } {
168        xinstall -W ${worksrcpath}/fallbacks/exports/bin \
169         atompaw-abinit ${destroot}${prefix}/bin
170    }
171}
172
173#universal variant not allowed for libxc/etsf_io
174universal_variant   no
175
176test.run            yes
177test.target         check-full
178
179variant fftw3 description {Build with support for fftw-3 FFT library} {
180    depends_lib-append      port:fftw-3
181    depends_lib-append      port:fftw-3-single
182#   require_active_variants fftw-3 gfortran
183#   require_active_variants fftw-3-single gfortran
184    if { [variant_isset threads] } {
185        configure.args-append   --with-fft-flavor="fftw3-threads"
186        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
187    } else {
188        configure.args-append   --with-fft-flavor="fftw3"
189        configure.args-append   --with-fft-libs="-lfftw3 -lfftw3f"
190    }
191}
192
193variant threads description {Build with support for multi-thread support (openMP)} {
194    configure.args-append   --enable-openmp
195    configure.fcflags-append -fopenmp
196    configure.args-append   --with-linalg-libs="-L"${prefix}"/lib -ltatlas"
197    configure.args-append   --with-linalg-incs="-I"${prefix}"/include"
198}
199
200variant netcdf description {Build with support for NetCDF transferable I/O} {
201    depends_lib-append      port:netcdf-fortran
202    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
203    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
204}
205
206variant etsf_io description {Build with support for ETSF_IO transferable I/O} {
207    depends_lib-append      port:etsf_io
208    configure.args-append   --with-etsf-io-incs="-I"${prefix}"/include/gcc"
209    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
210    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
211}
212
213variant libxc description {Build with support for libXC exchange-correlation library} {
214    depends_lib-append      port:libxc
215    configure.args-append   --with-libxc-incs="-I"${prefix}"/include"
216}
217
218variant wannier90 description {Build with support for Wannier90} {
219    depends_lib-append      port:wannier90
220}
221
222variant bigdft description {Build with support for the wavelet BigDFT library} {
223#   Patch bigdft-abi-1.0.4 (missing config.sub and config.guess)
224    patchfiles-append       patch-bigdft-config.diff
225}
226
227variant atompaw description {Build including AtomPAW atomic dataset generator} {
228}
229
230variant no_mpi conflicts mpich mpich_devel openmpi openmpi_devel description {Build without MPI support} {
231}
232
233livecheck.type      regex
234livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
235livecheck.regex     ABINIT (\[0-9.\]+)
236