Ticket #45617: Portfile-abinit.diff

File Portfile-abinit.diff, 10.2 KB (added by dstrubbe (David Strubbe), 9 years ago)
  • Portfile

     
    22# $Id$
    33
    44PortSystem          1.0
    5 PortGroup           active_variants 1.1
     5PortGroup           mpi 1.0
    66
    77name                abinit
    8 version             7.10.2
     8version             7.10.5
    99revision            2
    1010categories          science
    1111platforms           darwin
     
    3232homepage            http://www.abinit.org
    3333master_sites        http://ftp.abinit.org/
    3434
    35 checksums           rmd160  cf4078c1eab2cc3200e084379738939cafda5ba2 \
    36                     sha256  cbead80096d97f1c8d08ccb3b9b2851ac1e56accaebe551d9ab29757e9cd531e
     35checksums           rmd160  f77a9db5bcd97bcc46ea11a96bbf8f17cb1a19b3 \
     36                    sha256  e9376a3e34790bce90992f28e5fa8554b51ba467bf5709c7fd25d300e7c4f56a
    3737
    38 depends_lib         port:atlas
     38# or vecLibFort, or OpenBLAS(-devel)
     39depends_lib-append  port:atlas
    3940
    40 configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
     41compilers.choose    cc fc
     42# g95 is not compatible with OpenMP
     43mpi.setup           default require_fortran -g95
     44
     45configure.args-append  --with-linalg-flavor="atlas" --enable-gw-dpc --enable-fox
    4146configure.optflags  -O3
    4247
    43 # FIXME: not right for g95? would be -ffree-line-length-huge. This is really the configure script's job? Not easy to set this right for MPI g95.
    44 # If this is not set, there will be some compilation failures, due to inadequate provisions by the code for compilers that don't accept long lines.
    45 configure.fcflags-append -ffree-line-length-none
    46 
    47 build.cmd           make
    4848use_parallel_build  yes
    4949
    5050# We do not need to use ABINIT's own approach to parallel builds, which only is relevant if
     
    5454
    5555default_variants +etsf_io +libxc
    5656# Do not put +wannier90 since tests fail for wannier90 use.
    57 if { ![variant_isset gcc46] && ![variant_isset gcc47] && ![variant_isset gcc48] && ![variant_isset gcc49] } {
    58     if { ![variant_isset openmpi] } {
    59         default_variants    +mpich
    60     } elseif { ![variant_isset mpich] } {
    61         default_variants    +openmpi
    62     } else {
    63         default_variants    +gcc49
    64     }
    65 }
    6657
    67 # FIXME: use compiler and MPI port groups
    68 
    69 pre-fetch {
    70     set fortran unknown
    71     set fortrans { gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 g95 }
    72 
    73     foreach fc_name ${fortrans} {
    74         if { [variant_isset ${fc_name}] } {
    75             set fortran ${fc_name}
    76         } elseif { [variant_isset openmpi] } {
    77             if { [_portnameactive openmpi-default] } {
    78                 if { [active_variants openmpi-default ${fc_name}] } { set fortran ${fc_name} }
    79             } elseif { [_portnameactive openmpi-devel-default] } {
    80                 if { [active_variants openmpi-devel-default ${fc_name}] } { set fortran ${fc_name} }
    81             }
    82         } elseif { [variant_isset mpich] } {
    83             if { [_portnameactive mpich-default] } {
    84                 if { [active_variants mpich-default ${fc_name}] } { set fortran ${fc_name} }
    85             } elseif { [_portnameactive mpich-devel-default] } {
    86                 if { [active_variants mpich-devel-default ${fc_name}] } { set fortran ${fc_name} }
    87             }
     58pre-configure {
     59    if {[fortran_variant_name] eq "g95"} {
     60        configure.fcflags-append -ffree-line-length-huge
     61        if {[variant_isset threads]} {
     62            ui_error "You can select only one of +g95 and +threads."
     63            return -code error "+g95 and +threads are not compatible since g95 does not support OpenMP."
    8864        }
     65    } else {
     66        configure.fcflags-append -ffree-line-length-none
    8967    }
    9068
    91     if { ${fortran} eq "unknown" } {
    92         if { [variant_isset openmpi] } {
    93             ui_error "Variant +openmpi requires openmpi to have been built with Fortran support."
    94             return -code error "Variant +openmpi requires openmpi to have been built with Fortran support."
    95         } elseif { [variant_isset mpich] } {
    96             ui_error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
    97             return -code error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
    98         } else {
    99             ui_error "Internal error: cannot determine Fortran compiler."
    100             return -code error "Internal error: cannot determine Fortran compiler."
    101         }
    102     }
    103 
    104     if { [variant_isset libxc] } {
    105         if { ![active_variants libxc ${fortran}] } {
    106             ui_error "libxc must have been built with +${fortran}."
    107             return -code error "libxc must have been built with +${fortran}."
    108         }
    109     }
    110 
    111     if { [variant_isset netcdf] } {
    112         if {![active_variants netcdf-fortran ${fortran}] } {
    113             ui_error "netcdf-fortran must have been built with +${fortran}."
    114             return -code error "netcdf-fortran must have been built with +${fortran}."
    115         }
    116     }
    117 
    11869    if { [variant_isset etsf_io] } {
    119         if {![active_variants etsf_io ${fortran}] } {
    120             ui_error "etsf_io must have been built with +${fortran}."
    121             return -code error "etsf_io must have been built with +${fortran}."
    122         }
    123     }
    124 
    125 #   No need to check compiler for wannier90
    126 #   No need to check compiler for fftw-3
    127 }
    128 
    129 pre-configure {
    130     if { [variant_isset etsf_io] } {
    13170            configure.args-append  --with-trio-flavor="netcdf+etsf_io"
    13271        } elseif { [variant_isset netcdf] } {
    13372            configure.args-append  --with-trio-flavor="netcdf"
     
    187126test.target         built-in fast
    188127# wannier90 test will probably fail.
    189128
    190 variant gcc46 conflicts gcc47 gcc48 gcc49 openmpi mpich description {Build with GCC 4.6} {
    191     configure.compiler  macports-gcc-4.6
    192     configure.args-append  FCCPP="${configure.cpp} -ansi"
    193 }
    194 
    195 variant gcc47 conflicts gcc46 gcc48 gcc49 openmpi mpich description {Build with GCC 4.7} {
    196     configure.compiler  macports-gcc-4.7
    197     configure.args-append  FCCPP="${configure.cpp} -ansi"
    198 }
    199 
    200 variant gcc48 conflicts gcc46 gcc47 gcc49 openmpi mpich description {Build with GCC 4.8} {
    201     configure.compiler  macports-gcc-4.8
    202     configure.args-append  FCCPP="${configure.cpp} -ansi"
    203 }
    204 
    205 variant gcc49 conflicts gcc46 gcc47 gcc48 openmpi mpich description {Build with GCC 4.9} {
    206     configure.compiler  macports-gcc-4.9
    207     configure.args-append  FCCPP="${configure.cpp} -ansi"
    208 }
    209 
    210 variant openmpi conflicts gcc46 gcc47 gcc48 gcc49 mpich description {Build parallel version with OpenMPI} {
    211     depends_lib-append     path:bin/mpif90-openmpi-mp:openmpi-default
    212     configure.fc           mpif90-openmpi-mp
    213     configure.cc           mpicc-openmpi-mp
    214     configure.cxx          mpicxx-openmpi-mp
     129pre-configure {
    215130    configure.args-append  FCCPP="${configure.cc} -E -ansi"
    216     configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes" --with-mpi-level="1"
    217     configure.args-append  MPI_RUNNER=${prefix}/bin/mpiexec-openmpi-mp
    218     test.env-append        MPIEXEC=${prefix}/bin/mpiexec-openmpi-mp
     131    if {[mpi_variant_isset]} {
     132        configure.args-append  MPI_RUNNER=${mpi.exec}
     133        test.env-append        MPIEXEC=${mpi.exec}
     134        configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
     135    } else {
     136        configure.args-append  --enable-mpi="no"
     137    }
    219138}
    220139
    221 variant mpich conflicts gcc46 gcc47 gcc48 gcc49 openmpi description {Build parallel version with MPICH} {
    222     depends_lib-append     path:bin/mpif90-mpich-mp:mpich-default
    223     configure.fc           mpif90-mpich-mp
    224     configure.cc           mpicc-mpich-mp
    225     configure.cxx          mpicxx-mpich-mp
    226     configure.args-append  FCCPP="${configure.cc} -E -ansi"
    227     configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
    228     configure.args-append  MPI_RUNNER=${prefix}/bin/mpiexec-mpich-mp
    229     test.env-append        MPIEXEC=${prefix}/bin/mpiexec-mpich-mp
    230 }
    231 
    232140variant fftw3 description {Build with support for fftw-3 FFT library} {
    233     # FIXME: these need to be installed with some Fortran variant
    234     depends_lib-append      port:fftw-3
    235     depends_lib-append      port:fftw-3-single
     141    depends_lib-append      port:fftw-3 port:fftw-3-single
     142    compilers.enforce_some_fortran fftw-3 fftw-3-single
     143   
    236144    if { [variant_isset threads] } {
    237145        configure.args-append   --with-fft-flavor="fftw3-threads"
    238146        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
     
    242150    }
    243151}
    244152
    245 variant threads description {Build with support for multi-thread support (openMP)} {
     153variant threads description {Build with support for OpenMP threads} {
     154    # not compatible with g95. What about threaded FFTW3?
    246155    configure.args-append   --enable-openmp
    247156    configure.fcflags-append -fopenmp
    248157    configure.args-append   --with-linalg-libs="-L${prefix}/lib -ltatlas"
     
    251160
    252161variant netcdf description {Build with support for NetCDF transferable I/O} {
    253162    depends_lib-append      port:netcdf-fortran
     163    compilers.enforce_fortran netcdf-fortran
    254164    configure.args-append   --with-netcdf-incs="-I${prefix}/include"
    255165    configure.args-append   --with-netcdf-libs="-L${prefix}/lib -lnetcdf -lnetcdff"
    256166}
     
    257167
    258168variant etsf_io requires netcdf description {Build with support for ETSF_IO transferable I/O} {
    259169    depends_lib-append      port:etsf_io
     170    compilers.enforce_fortran etsf_io
    260171    configure.args-append   --with-etsf-io-incs="-I${prefix}/include/gcc"
    261172}
    262173
    263174variant libxc description {Build with support for libXC exchange-correlation library} {
    264175    depends_lib-append      port:libxc
     176    compilers.enforce_fortran libxc
    265177    configure.args-append   --with-libxc-incs="-I${prefix}/include"
    266178}
    267179
     
    281193#    patchfiles-append       patch-fallbacks-sources-bigdft-1.7.0.93-src-Makefile.in.diff
    282194#}
    283195
    284 variant atompaw description {Build including AtomPAW atomic dataset generator} {
    285 }
     196# FIXME: same problem as for BigDFT, it gets downloaded. Make a separate port.
     197#variant atompaw description {Build including AtomPAW atomic dataset generator} {
     198#}
    286199 
    287200livecheck.type      regex
    288 livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
    289 livecheck.regex     ABINIT (\[0-9.\]+)
     201livecheck.url       ${homepage}/downloads/abinit-packages
     202livecheck.regex     ABINIT v (\[0-9.\]+)