Ticket #45617: Portfile.2

File Portfile.2, 10.6 KB (added by cram5431@…, 10 years ago)

New version of the Portfile

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.8.2
10categories          science
11platforms           darwin
12license             GPL-3
13maintainers         gmail.com:cram5431 \
14                    openmaintainer
15
16description         Full-featured atomic-scale first-principles simulation software
17
18long_description    ABINIT is a package whose main program allows one to find the total energy, \
19                    charge density and electronic structure of systems made of electrons and nuclei \
20                    (molecules and periodic solids) within Density Functional Theory (DFT), \
21                    using pseudopotentials and a planewave or wavelet basis. \
22                    ABINIT also includes options to optimize the geometry according to the DFT forces \
23                    and stresses, or to perform molecular dynamics simulations using these forces, \
24                    or to generate dynamical matrices, Born effective charges, and dielectric tensors, \
25                    based on Density-Functional Perturbation Theory, and many more properties. \
26                    Excited states can be computed within the Many-Body Perturbation Theory \
27                    (the GW approximation and the Bethe-Salpeter equation), and \
28                    Time-Dependent Density Functional Theory (for molecules). \
29                    In addition to the main ABINIT code, different utility programs are provided. \
30                    ABINIT is a project that favours development and collaboration.
31
32homepage            http://www.abinit.org
33master_sites        http://ftp.abinit.org/
34
35checksums           rmd160  c82fcc454ab7f337728fad33ca2d563887c15cba \
36                    sha256  793b8b5698f8a4231e34e62711e7d5f56fb276aa5bb3bad8303af0ae2f74aead
37
38depends_lib         port:atlas
39
40configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
41configure.optflags  -O3
42
43#This is a temporary measure for debugging configure failure on Mountain Lion buildslave.
44#checking for gcc... mpicc-mpich-mp
45#checking whether the C compiler works... no
46#configure.cmd       ./configure || true
47#post-configure {
48#    system -W ${worksrcpath} "cat config.log"
49#}
50
51build.cmd           make
52use_parallel_build  yes
53# We do not need to use ABINIT's own approach to parallel builds, which only is relevant if
54# the "fallbacks" are used, namely if we asked for etsf_io, libxc, wannier90, etc. support
55# but did not provide the libraries. That situation should never happen for this port.
56#build.target        multi multi_nprocs=4
57
58default_variants +etsf_io +libxc +wannier90
59
60#Restrict to gcc/clang because of dependencies
61compilers.choose    fc cc cxx cpp
62compilers.setup     -clang -dragonegg -llvm
63mpi.setup
64
65#Select mpi/gcc default:
66#  If a MPI variant is given, take it
67#  If not, check if there is a selected MPI; if yes, take it
68#  If there is no defaut MPI, take mpich
69#  If "sequential" or "-mpi(default)" variant, take no MPI
70set current_mpi "none"
71set mpi_default mpich
72set sequential [variant_isset sequential]
73if {!${sequential} } {
74    if { [mpi_variant_isset] } {
75        set current_mpi [mpi_variant_name]
76    } else {
77        if {![catch {set current_mpi [file link ${prefix}/etc/select/mpi/current]}]} {
78            if { ${current_mpi} eq "base" } { set current_mpi "none" }
79        }
80        if { ${current_mpi} eq "none"} { 
81            if {[info exists variations(${mpi_default})] && \
82                $variations(${mpi_default}) eq "-"} {
83                set sequential 1
84            } else {
85                set current_mpi ${mpi_default}
86                default_variants-append +${mpi_default}
87            }
88        }
89    }
90}
91if {${sequential}} {
92    if { [gcc_variant_isset] } {
93        default_variants-append +[c_variant_name]
94    } else {
95        default_variants-append +gcc48
96    }
97}
98
99pre-fetch {
100    if { [variant_isset libxc] } {
101        if { ![active_variants libxc [c_variant_name]] } {
102            ui_error "libxc must have been built with +[c_variant_name]"
103            return -code error "libxc must have been built with +[c_variant_name]"
104        }
105    }
106    if { [variant_isset netcdf] } {
107        if {![active_variants netcdf-fortran [c_variant_name]] } {
108            ui_error "netcdf-fortran must have been built with +[c_variant_name]"
109            return -code error "netcdf-fortran must have been built with +[c_variant_name]"
110        }
111    }
112    if { [variant_isset etsf_io] } {
113        if {![active_variants etsf_io [fortran_variant_name]] } {
114            ui_error "etsf_io must have been built with +[fortran_variant_name]"
115            return -code error "etsf_io must have been built with +[fortran_variant_name]"
116        }
117    }
118    if { [variant_isset fftw3] } {
119        if {![active_variants fftw-3 gfortran] || \
120            ![active_variants fftw-3-single gfortran]} {
121            ui_error "fftw-3 and fftw-3-single must have been built with +gfortran:"
122            ui_error "This can be achieved by : sudo port -f install fftw-3-single +gfortran"
123            return -code error "fftw-3/fftw-3-single must have been built with +gfortran"
124        }
125    }
126}
127
128#Fix unnecessary rejection of libxc 2.1.0
129#Fix a openMP syntax error
130patchfiles patch-configure.diff \
131           patch-src-71_bse-haydock.F90.diff
132
133pre-configure {
134    if { [variant_isset etsf_io] } {
135            configure.args-append  --with-trio-flavor="netcdf+etsf_io"
136        } elseif { [variant_isset netcdf] } {
137            configure.args-append  --with-trio-flavor="netcdf"
138        } else {
139            configure.args-append  --with-trio-flavor="none"
140    }
141    set dft-flavor "none"
142    if { [variant_isset libxc] } {
143        if { ${dft-flavor} eq "none" } {
144            set dft-flavor "libxc"
145        } else {
146            set dft-flavor ${dft-flavor}"+libxc"
147        }
148    }
149    if { [variant_isset wannier90] } {
150        if { ${dft-flavor} eq "none" } {
151            set dft-flavor "wannier90"
152        } else {
153            set dft-flavor ${dft-flavor}"+wannier90"
154        }
155    }
156    if { [variant_isset atompaw] } {
157        if { ${dft-flavor} eq "none" } {
158            set dft-flavor "atompaw"
159        } else {
160            set dft-flavor ${dft-flavor}"+atompaw"
161        }
162    }
163#    if { [variant_isset bigdft] } {
164#        if { ${dft-flavor} eq "none" } {
165#            set dft-flavor "bigdft"
166#        } else {
167#            set dft-flavor ${dft-flavor}"+bigdft"
168#        }
169#    }
170    configure.args-append  --with-dft-flavor="${dft-flavor}"
171
172    configure.args-append  FCCPP="${configure.cpp} -ansi"
173
174    if { ${current_mpi} ne "none"} {
175        configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
176        if {[string match *openmpi* ${current_mpi}]} {
177            configure.args-append   --with-mpi-level="1"
178        }
179        if { ![mpi_variant_isset] } {
180            configure.fc     ${mpi.fc}
181            configure.cc     ${mpi.cc}
182            configure.cxx    ${mpi.cxx}
183        }
184        if { ${mpi.exec} ne "" } {
185            configure.args-append  MPI_RUNNER=${mpi.exec}
186            test.env-append        MPIEXEC=${mpi.exec}
187        }
188    } else {
189        configure.args-append  --enable-mpi="no" --enable-mpi-io="no"
190    }
191}
192
193destroot {
194    xinstall -W ${worksrcpath}/src/98_main \
195     abinit aim anaddb band2eps bsepostproc conducti cut3d \
196     fftprof ioprof kss2wfk lapackprof macroave mrgddb \
197     mrggkk mrgscr optic ujdet vdw_kernelgen \
198     ${destroot}${prefix}/bin
199    if { [variant_isset atompaw] } {
200        xinstall -W ${worksrcpath}/fallbacks/exports/bin \
201         atompaw-abinit ${destroot}${prefix}/bin
202    }
203}
204
205#universal variant not allowed for libxc/etsf_io
206universal_variant   no
207
208test.run            yes
209test.cmd            tests/runtests.py
210test.target         built-in fast
211
212variant fftw3 description {Build with support for fftw-3 FFT library} {
213    depends_lib-append      port:fftw-3
214    depends_lib-append      port:fftw-3-single
215#   require_active_variants fftw-3 gfortran
216#   require_active_variants fftw-3-single gfortran
217    if { [variant_isset threads] } {
218        configure.args-append   --with-fft-flavor="fftw3-threads"
219        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
220    } else {
221        configure.args-append   --with-fft-flavor="fftw3"
222        configure.args-append   --with-fft-libs="-lfftw3 -lfftw3f"
223    }
224}
225
226variant threads description {Build with support for multi-thread support (openMP)} {
227    configure.args-append   --enable-openmp
228    configure.fcflags-append -fopenmp
229    configure.args-append   --with-linalg-libs="-L"${prefix}"/lib -ltatlas"
230    configure.args-append   --with-linalg-incs="-I"${prefix}"/include"
231}
232
233variant netcdf description {Build with support for NetCDF transferable I/O} {
234    depends_lib-append      port:netcdf-fortran
235    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
236    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
237}
238
239variant etsf_io description {Build with support for ETSF_IO transferable I/O} {
240    depends_lib-append      port:etsf_io
241    configure.args-append   --with-etsf-io-incs="-I"${prefix}"/include/gcc"
242    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
243    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
244}
245
246variant libxc description {Build with support for libXC exchange-correlation library} {
247    depends_lib-append      port:libxc
248    configure.args-append   --with-libxc-incs="-I"${prefix}"/include"
249}
250
251variant wannier90 description {Build with support for Wannier90} {
252    depends_lib-append      port:wannier90
253}
254
255variant atompaw description {Build including AtomPAW atomic dataset generator} {
256}
257
258variant sequential conflicts mpich mpich_devel openmpi openmpi_devel description {Build without MPI support} {
259}
260
261# FIXME: the code's build system will download BigDFT itself, which is contrary to the
262# way MacPorts should work. Make a bigdft port to support this.
263# There is an error compiling anyway, which could be fixed with a patch,
264# but it is unpatchable since the download occurs after the patch phase.
265
266#variant bigdft description {Build with support for the wavelet BigDFT library} {
267    # avoid this error (and equivalent with OpenCL)
268    # :info:build ar cru libCUDA.a 
269    # :info:build ar: no archive members specified
270#    patchfiles-append       patch-fallbacks-sources-bigdft-1.7.0.93-src-Makefile.in.diff
271#}
272
273livecheck.type      regex
274livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
275livecheck.regex     ABINIT (\[0-9.\]+)
276