Ticket #42017: Portfile

File Portfile, 11.1 KB (added by cram5431@…, 10 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                abinit
8version             7.4.3
9categories          science
10platforms           darwin
11license             GPL-3
12maintainers         gmail.com:cram5431 \
13                    openmaintainer
14
15description         Full-featured atomic-scale first-principles simulation software
16
17long_description    ABINIT is a package whose main program allows one to find the total energy, \
18                    charge density and electronic structure of systems made of electrons and nuclei \
19                    (molecules and periodic solids) within Density Functional Theory (DFT), \
20                    using pseudopotentials and a planewave or wavelet basis. \
21                    ABINIT also includes options to optimize the geometry according to the DFT forces \
22                    and stresses, or to perform molecular dynamics simulations using these forces, \
23                    or to generate dynamical matrices, Born effective charges, and dielectric tensors, \
24                    based on Density-Functional Perturbation Theory, and many more properties. \
25                    Excited states can be computed within the Many-Body Perturbation Theory \
26                    (the GW approximation and the Bethe-Salpeter equation), and \
27                    Time-Dependent Density Functional Theory (for molecules). \
28                    In addition to the main ABINIT code, different utility programs are provided. \
29                    ABINIT is a project that favours development and collaboration
30
31homepage            http://www.abinit.org
32master_sites        http://ftp.abinit.org/
33
34checksums           rmd160  6e3629a94721440f8afacbcaf2b046b5c6e9b23d \
35                    sha256  3593dc96c124c0e1ad29a5ec13e9e8f8dc391b328cf06ed461e34f5a9298b246
36
37depends_lib         port:atlas
38
39configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
40configure.optflags  -O3
41
42build.cmd           make
43build.target        multi multi_nprocs=4
44use_parallel_build  no
45
46default_variants +etsf_io +libxc +wannier90
47if { ![variant_isset gcc46] && ![variant_isset gcc47] && ![variant_isset gcc48] } {
48    if { ![variant_isset openmpi] } {
49        default_variants    +mpich
50    } elseif { ![variant_isset mpich] } {
51        default_variants    +openmpi
52    } else {
53        default_variants    +gcc48
54    }
55}
56
57pre-fetch {
58    set fortran unknown
59    set fortrans { gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 g95 }
60
61    foreach fc_name ${fortrans} {
62        if { [variant_isset ${fc_name}] } {
63            set fortran ${fc_name}
64        } elseif { [variant_isset openmpi] } {
65            if { [active_variants openmpi ${fc_name}] } { set fortran ${fc_name} }
66        } elseif { [variant_isset mpich] } {
67            if { [_portnameactive mpich-default] } {
68                if { [active_variants mpich-default ${fc_name}] } { set fortran ${fc_name} }
69            } elseif { [_portnameactive mpich-devel-default] } {
70                if { [active_variants mpich-devel-default ${fc_name}] } { set fortran ${fc_name} }
71            }
72        }
73    }
74
75    if { ${fortran} == "unknown" } {
76        if { [variant_isset openmpi] } {
77            ui_error "Variant +openmpi requires openmpi to have been built with Fortran support."
78            return -code error "Variant +openmpi requires openmpi to have been built with Fortran support."
79        } elseif { [variant_isset mpich] } {
80            ui_error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
81            return -code error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
82        } else {
83            ui_error "Internal error: cannot determine Fortran compiler."
84            return -code error "Internal error: cannot determine Fortran compiler."
85        }
86    }
87
88    if { [variant_isset libxc] } {
89        if { ![active_variants libxc ${fortran}] } {
90            ui_error "libxc must have been built with +${fortran}."
91            return -code error "libxc must have been built with +${fortran}."
92        }
93    }
94
95    if { [variant_isset netcdf] } {
96        if {![active_variants netcdf-fortran ${fortran}] } {
97            ui_error "netcdf-fortran must have been built with +${fortran}."
98            return -code error "netcdf-fortran must have been built with +${fortran}."
99        }
100    }
101
102    if { [variant_isset etsf_io] } {
103        if {![active_variants etsf_io ${fortran}] } {
104            ui_error "etsf_io must have been built with +${fortran}."
105            return -code error "etsf_io must have been built with +${fortran}."
106        }
107    }
108
109#   No need to check compiler for wannier90
110#   No need to check compiler for fftw-3
111}
112
113pre-configure {
114    if { [variant_isset etsf_io] } {
115            configure.args-append  --with-trio-flavor="netcdf+etsf_io"
116        } elseif { [variant_isset netcdf] } {
117            configure.args-append  --with-trio-flavor="netcdf"
118        } else {
119            configure.args-append  --with-trio-flavor="none"
120    }
121
122    set dft-flavor "none" 
123    if { [variant_isset libxc] } {
124        if { ${dft-flavor} == "none" } { 
125            set dft-flavor "libxc"
126        } else {
127            set dft-flavor ${dft-flavor}"+libxc" 
128        }
129    }
130    if { [variant_isset wannier90] } {
131        if { ${dft-flavor} == "none" } { 
132            set dft-flavor "wannier90"
133        } else {
134            set dft-flavor ${dft-flavor}"+wannier90" 
135        }
136    }
137    if { [variant_isset bigdft] } {
138        if { ${dft-flavor} == "none" } { 
139            set dft-flavor "bigdft"
140        } else {
141            set dft-flavor ${dft-flavor}"+bigdft" 
142        }
143    }
144    if { [variant_isset atompaw] } {
145        if { ${dft-flavor} == "none" } { 
146            set dft-flavor "atompaw"
147        } else {
148            set dft-flavor ${dft-flavor}"+atompaw" 
149        }
150    }
151    configure.args-append  --with-dft-flavor="${dft-flavor}"
152}
153
154destroot {
155    xinstall ${worksrcpath}/src/98_main/abinit        ${destroot}${prefix}/bin/
156    xinstall ${worksrcpath}/src/98_main/aim           ${destroot}${prefix}/bin/
157    xinstall ${worksrcpath}/src/98_main/anaddb        ${destroot}${prefix}/bin/
158    xinstall ${worksrcpath}/src/98_main/band2eps      ${destroot}${prefix}/bin/
159    xinstall ${worksrcpath}/src/98_main/bsepostproc   ${destroot}${prefix}/bin/
160    xinstall ${worksrcpath}/src/98_main/conducti      ${destroot}${prefix}/bin/
161    xinstall ${worksrcpath}/src/98_main/cut3d         ${destroot}${prefix}/bin/
162    xinstall ${worksrcpath}/src/98_main/fftprof       ${destroot}${prefix}/bin/
163    xinstall ${worksrcpath}/src/98_main/ioprof        ${destroot}${prefix}/bin/
164    xinstall ${worksrcpath}/src/98_main/kss2wfk       ${destroot}${prefix}/bin/
165    xinstall ${worksrcpath}/src/98_main/lapackprof    ${destroot}${prefix}/bin/
166    xinstall ${worksrcpath}/src/98_main/lwf           ${destroot}${prefix}/bin/
167    xinstall ${worksrcpath}/src/98_main/macroave      ${destroot}${prefix}/bin/
168    xinstall ${worksrcpath}/src/98_main/mrgddb        ${destroot}${prefix}/bin/
169    xinstall ${worksrcpath}/src/98_main/mrggkk        ${destroot}${prefix}/bin/
170    xinstall ${worksrcpath}/src/98_main/mrgscr        ${destroot}${prefix}/bin/
171    xinstall ${worksrcpath}/src/98_main/optic         ${destroot}${prefix}/bin/
172    xinstall ${worksrcpath}/src/98_main/ujdet         ${destroot}${prefix}/bin/
173    xinstall ${worksrcpath}/src/98_main/vdw_kernelgen ${destroot}${prefix}/bin/
174    if { [variant_isset atompaw] } {
175        xinstall ${worksrcpath}/fallbacks/export/bin/atompaw-abinit ${destroot}${prefix}/bin/
176    }
177}
178
179#universal variant not allowed for libxc/etsf_io
180universal_variant   no
181
182test.run            yes
183test.target         check-full
184
185
186variant gcc46 conflicts gcc47 gcc48 openmpi mpich description {Build with GCC 4.6} {
187    configure.compiler  macports-gcc-4.6
188    configure.args-append  FCCPP="${configure.cpp} -ansi"
189}
190
191variant gcc47 conflicts gcc46 gcc48 openmpi mpich description {Build with GCC 4.7} {
192    configure.compiler  macports-gcc-4.7
193    configure.args-append  FCCPP="${configure.cpp} -ansi"
194}
195
196variant gcc48 conflicts gcc46 gcc47 openmpi mpich description {Build with GCC 4.8} {
197    configure.compiler  macports-gcc-4.8
198    configure.args-append  FCCPP="${configure.cpp} -ansi"
199}
200
201variant openmpi conflicts gcc46 gcc47 gcc48 mpich description {Build parallel version with OpenMPI} {
202    configure.cc           openmpicc
203    configure.fc           openmpif90
204    configure.args-append  FCCPP="${configure.cc} -E -ansi"
205    configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes" --with-mpi-level="1"
206    depends_lib-append     port:openmpi
207    test.env-append        MPIEXEC=${prefix}/bin/openmpiexec
208}
209
210variant mpich conflicts gcc46 gcc47 gcc48 openmpi description {Build parallel version with MPICH} {
211    configure.cc           mpicc-mp
212    configure.fc           mpif90-mp
213    configure.args-append  FCCPP="${configure.cc} -E -ansi"
214    configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes" 
215    depends_lib-append     path:bin/mpif90-mp:mpich-default
216    test.env-append        MPIEXEC=${prefix}/bin/mpiexec-mp
217}
218
219variant fftw-3 description {Build with support for fftw-3 FFT library} {
220    depends_lib-append      port:fftw-3
221    if { [variant_isset threads] } {
222        configure.args-append   --with-fft-flavor="fftw3-threads"
223        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3"
224    } else {
225        configure.args-append   --with-fft-flavor="fftw3"
226        configure.args-append   --with-fft-libs="-lfftw3"
227    }
228}
229
230variant threads description {Build with support for multi-thread support (openMP)} {
231    configure.args-append   --enable-openmp
232    configure.fcflags-append -fopenmp
233    configure.args-append   --with-linalg-libs="-L"${prefix}"/lib -ltatlas"
234    configure.args-append   --with-linalg-incs="-I"${prefix}"/include"
235}
236
237variant netcdf description {Build with support for NetCDF transferable I/O} {
238    depends_lib-append      port:netcdf-fortran
239    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
240    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
241}
242
243variant etsf_io description {Build with support for ETSF_IO transferable I/O} {
244    depends_lib-append      port:etsf_io
245    configure.args-append   --with-etsf-io-incs="-I"${prefix}"/include/gcc"
246    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
247    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
248}
249
250variant libxc description {Build with support for libXC exchange-correlation library} {
251    depends_lib-append      port:libxc
252    configure.args-append   --with-libxc-incs="-I"${prefix}"/include"
253}
254
255variant wannier90 description {Build with support for Wannier90} {
256    depends_lib-append      port:wannier90
257}
258
259variant bigdft description {Build with support for the wavelet BigDFT library} {
260}
261
262variant atompaw description {Build including AtomPAW atomic dataset generator} {
263}
264 
265livecheck.type      regex
266livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
267livecheck.regex     ABINIT (\[0-9.\]+)
268