Ticket #42926: Portfile

File Portfile, 9.0 KB (added by cram5431@…, 11 years ago)

New improved 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.6.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  07fd2c968a251635d03d57b244516409845637bc \
36                    sha256  79645461f7611aaf007bcddb662d21a042c64ac4085d14057387f036f9dae2c5
37
38#Restrict to gcc/clang because of dependencies
39compilers.choose    fc cc cxx cpp
40compilers.setup     -clang -dragonegg -llvm
41mpi.setup
42
43depends_lib         port:atlas
44
45configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
46configure.optflags  -O3
47
48#Workaround to bypass "newline" CPP macros not expanding correctly (v7.6.2 only)
49configure.fcflags-append -DHAVE_FC_LONG_LINES -ffree-line-length-none
50
51build.cmd           make
52build.target        multi multi_nprocs=4
53use_parallel_build  no
54
55default_variants +etsf_io +libxc +wannier90
56
57#Select mpi/gcc default
58set current_mpi "none"
59if { ![variant_isset no_mpi] } {
60    if { [mpi_variant_isset] } {
61        set current_mpi [mpi_variant_name]
62    } else {
63        if {![catch {set current_mpi [file link ${prefix}/etc/select/mpi/current]}]} {
64            if { ${current_mpi} eq "base" } { set current_mpi "none" }
65        }
66        if { ${current_mpi} eq "none"} {
67            default_variants-append +mpich
68        }
69    }
70} else {
71    default_variants-append +gcc48
72}
73
74pre-fetch {
75    if { [variant_isset libxc] } {
76        if { ![active_variants libxc [c_variant_name]] } {
77            ui_error "\nlibxc must have been built with +[c_variant_name]\n"
78            return -code error "libxc must have been built with +[c_variant_name]"
79        }
80    }
81    if { [variant_isset netcdf] } {
82        if {![active_variants netcdf-fortran [c_variant_name]] } {
83            ui_error "\nnetcdf-fortran must have been built with +[c_variant_name]\n"
84            return -code error "netcdf-fortran must have been built with +[c_variant_name]"
85        }
86    }
87    if { [variant_isset etsf_io] } {
88        if {![active_variants etsf_io [fortran_variant_name]] } {
89            ui_error "\netsf_io must have been built with +[fortran_variant_name]\n"
90            return -code error "etsf_io must have been built with +[fortran_variant_name]"
91        }
92    }
93    if { [variant_isset fftw3] } {
94        if {![active_variants fftw-3 gfortran] || \
95            ![active_variants fftw-3-single gfortran]} {
96            ui_error "\nfftw-3 and nfftw-3-single must have been built with +gfortran:"
97            ui_error "This can be achieved by : sudo port -f install fftw-3-single +gfortran\n"
98            return -code error "fftw-3/fftw-3-single must have been built with +gfortran"
99        }
100    }
101}
102
103pre-configure {
104    if { [variant_isset etsf_io] } {
105            configure.args-append  --with-trio-flavor="netcdf+etsf_io"
106        } elseif { [variant_isset netcdf] } {
107            configure.args-append  --with-trio-flavor="netcdf"
108        } else {
109            configure.args-append  --with-trio-flavor="none"
110    }
111
112    set dft-flavor "none" 
113    if { [variant_isset libxc] } {
114        if { ${dft-flavor} eq "none" } { 
115            set dft-flavor "libxc"
116        } else {
117            set dft-flavor ${dft-flavor}"+libxc" 
118        }
119    }
120    if { [variant_isset wannier90] } {
121        if { ${dft-flavor} eq "none" } { 
122            set dft-flavor "wannier90"
123        } else {
124            set dft-flavor ${dft-flavor}"+wannier90" 
125        }
126    }
127    if { [variant_isset bigdft] } {
128        if { ${dft-flavor} eq "none" } { 
129            set dft-flavor "bigdft"
130        } else {
131            set dft-flavor ${dft-flavor}"+bigdft" 
132        }
133    }
134    if { [variant_isset atompaw] } {
135        if { ${dft-flavor} eq "none" } { 
136            set dft-flavor "atompaw"
137        } else {
138            set dft-flavor ${dft-flavor}"+atompaw" 
139        }
140    }
141    configure.args-append  --with-dft-flavor="${dft-flavor}"
142
143    configure.args-append  FCCPP="${configure.cpp} -ansi"
144
145    if { ${current_mpi} ne "none"} {
146        configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
147        if {[string match *openmpi* ${current_mpi}]} {
148            configure.args-append   --with-mpi-level="1"
149        }
150        if { ![mpi_variant_isset] } {
151            configure.fc     ${mpi.fc}
152            configure.cc     ${mpi.cc}
153            configure.cxx    ${mpi.cxx}
154        }
155        if { ${mpi.exec} ne "" } {
156            configure.args-append  MPI_RUNNER=${mpi.exec}
157            test.env-append        MPIEXEC=${mpi.exec}
158        }
159    } else {
160        configure.args-append  --enable-mpi="no" --enable-mpi-io="no"
161    }
162}
163
164destroot {
165    xinstall -W ${worksrcpath}/src/98_main \
166     abinit aim anaddb band2eps bsepostproc conducti cut3d \
167     fftprof ioprof kss2wfk lapackprof lwf macroave mrgddb \
168     mrggkk mrgscr optic ujdet vdw_kernelgen \
169     ${destroot}${prefix}/bin
170    if { [variant_isset atompaw] } {
171        xinstall -W ${worksrcpath}/fallbacks/exports/bin \
172         atompaw-abinit ${destroot}${prefix}/bin
173    }
174}
175
176#universal variant not allowed for libxc/etsf_io
177universal_variant   no
178
179test.run            yes
180test.target         check-full
181
182variant fftw3 description {Build with support for fftw-3 FFT library} {
183    depends_lib-append      port:fftw-3
184    depends_lib-append      port:fftw-3-single
185#   require_active_variants fftw-3 gfortran
186#   require_active_variants fftw-3-single gfortran
187    if { [variant_isset threads] } {
188        configure.args-append   --with-fft-flavor="fftw3-threads"
189        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
190    } else {
191        configure.args-append   --with-fft-flavor="fftw3"
192        configure.args-append   --with-fft-libs="-lfftw3 -lfftw3f"
193    }
194}
195
196variant threads description {Build with support for multi-thread support (openMP)} {
197    configure.args-append   --enable-openmp
198    configure.fcflags-append -fopenmp
199    configure.args-append   --with-linalg-libs="-L"${prefix}"/lib -ltatlas"
200    configure.args-append   --with-linalg-incs="-I"${prefix}"/include"
201}
202
203variant netcdf description {Build with support for NetCDF transferable I/O} {
204    depends_lib-append      port:netcdf-fortran
205    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
206    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
207}
208
209variant etsf_io description {Build with support for ETSF_IO transferable I/O} {
210    depends_lib-append      port:etsf_io
211    configure.args-append   --with-etsf-io-incs="-I"${prefix}"/include/gcc"
212    configure.args-append   --with-netcdf-incs="-I"${prefix}"/include"
213    configure.args-append   --with-netcdf-libs="-L"${prefix}"/lib -lnetcdf -lnetcdff"
214}
215
216variant libxc description {Build with support for libXC exchange-correlation library} {
217    depends_lib-append      port:libxc
218    configure.args-append   --with-libxc-incs="-I"${prefix}"/include"
219}
220
221variant wannier90 description {Build with support for Wannier90} {
222    depends_lib-append      port:wannier90
223}
224
225variant bigdft description {Build with support for the wavelet BigDFT library} {
226#   Patch bigdft-abi-1.0.4 (missing config.sub and config.guess)
227    patchfiles-append       patch-bigdft-config.diff
228}
229
230variant atompaw description {Build including AtomPAW atomic dataset generator} {
231}
232 
233variant no_mpi conflicts mpich mpich_devel openmpi openmpi_devel description {Build without MPI support} {
234}
235
236livecheck.type      regex
237livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
238livecheck.regex     ABINIT (\[0-9.\]+)
239