Ticket #45617: Portfile-rev0-rev1.diff

File Portfile-rev0-rev1.diff, 12.0 KB (added by cram5431@…, 10 years ago)

Portfile rev0 vs rev1

  • (a) Portfile_0 vs. (b) Portfile_1

    a b  
    33
    44PortSystem          1.0
    55PortGroup           active_variants 1.1
     6PortGroup           mpi 1.0
    67
    78name                abinit
    89version             7.8.2
     10revision            1
    911categories          science
    1012platforms           darwin
    1113license             GPL-3
     
    3941configure.args      --with-linalg-flavor="atlas" --enable-gw-dpc
    4042configure.optflags  -O3
    4143
    42 # This is a temporary measure for debugging configure failure on Mountain Lion buildslave.
    43 
     44#This is a temporary measure for debugging configure failure on Mountain Lion buildslave.
    4445#checking for gcc... mpicc-mpich-mp
    4546#checking whether the C compiler works... no
    46 
    47 configure.cmd       ./configure || true
    48 post-configure {
    49     system -W ${worksrcpath} "cat config.log"
    50 }
     47#configure.cmd       ./configure || true
     48#post-configure {
     49#    system -W ${worksrcpath} "cat config.log"
     50#}
    5151
    5252build.cmd           make
    5353use_parallel_build  yes
    54 
    5554# We do not need to use ABINIT's own approach to parallel builds, which only is relevant if
    5655# the "fallbacks" are used, namely if we asked for etsf_io, libxc, wannier90, etc. support
    5756# but did not provide the libraries. That situation should never happen for this port.
    5857#build.target        multi multi_nprocs=4
    5958
    6059default_variants +etsf_io +libxc +wannier90
    61 if { ![variant_isset gcc46] && ![variant_isset gcc47] && ![variant_isset gcc48] } {
    62     if { ![variant_isset openmpi] } {
    63         default_variants    +mpich
    64     } elseif { ![variant_isset mpich] } {
    65         default_variants    +openmpi
    66     } else {
    67         default_variants    +gcc48
    68     }
    69 }
    7060
    71 # FIXME: use compiler and MPI port groups
    72 
    73 pre-fetch {
    74     set fortran unknown
    75     set fortrans { gcc42 gcc43 gcc44 gcc45 gcc46 gcc47 gcc48 gcc49 g95 }
    76 
    77     foreach fc_name ${fortrans} {
    78         if { [variant_isset ${fc_name}] } {
    79             set fortran ${fc_name}
    80         } elseif { [variant_isset openmpi] } {
    81             if { [_portnameactive openmpi-default] } {
    82                 if { [active_variants openmpi-default ${fc_name}] } { set fortran ${fc_name} }
    83             } elseif { [_portnameactive openmpi-devel-default] } {
    84                 if { [active_variants openmpi-devel-default ${fc_name}] } { set fortran ${fc_name} }
    85             }
    86         } elseif { [variant_isset mpich] } {
    87             if { [_portnameactive mpich-default] } {
    88                 if { [active_variants mpich-default ${fc_name}] } { set fortran ${fc_name} }
    89             } elseif { [_portnameactive mpich-devel-default] } {
    90                 if { [active_variants mpich-devel-default ${fc_name}] } { set fortran ${fc_name} }
     61#Restrict to gcc/clang because of dependencies
     62compilers.choose    fc cc cxx cpp
     63compilers.setup     -clang -dragonegg -llvm
     64mpi.setup
     65
     66#Select mpi/gcc default:
     67#  If a MPI variant is given, take it
     68#  If not, check if there is a selected MPI; if yes, take it
     69#  If there is no defaut MPI, take mpich
     70#  If "sequential" or "-mpi(default)" variant, take no MPI
     71set current_mpi "none"
     72set mpi_default mpich
     73set sequential [variant_isset sequential]
     74if {!${sequential} } {
     75    if { [mpi_variant_isset] } {
     76        set current_mpi [mpi_variant_name]
     77    } else {
     78        if {![catch {set current_mpi [file link ${prefix}/etc/select/mpi/current]}]} {
     79            if { ${current_mpi} eq "base" } { set current_mpi "none" }
     80        }
     81        if { ${current_mpi} eq "none"} {
     82            if {[info exists variations(${mpi_default})] && \
     83                $variations(${mpi_default}) eq "-"} {
     84                set sequential 1
     85            } else {
     86                set current_mpi ${mpi_default}
     87                default_variants-append +${mpi_default}
    9188            }
    9289        }
    9390    }
    94 
    95     if { ${fortran} eq "unknown" } {
    96         if { [variant_isset openmpi] } {
    97             ui_error "Variant +openmpi requires openmpi to have been built with Fortran support."
    98             return -code error "Variant +openmpi requires openmpi to have been built with Fortran support."
    99         } elseif { [variant_isset mpich] } {
    100             ui_error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
    101             return -code error "Variant +mpich requires mpich-default/mpich-devel-default to have been built with Fortran support."
    102         } else {
    103             ui_error "Internal error: cannot determine Fortran compiler."
    104             return -code error "Internal error: cannot determine Fortran compiler."
    105         }
     91}
     92if {${sequential}} {
     93    if { [gcc_variant_isset] } {
     94        default_variants-append +[c_variant_name]
     95    } else {
     96        default_variants-append +gcc48
    10697    }
     98}
    10799
     100pre-fetch {
    108101    if { [variant_isset libxc] } {
    109         if { ![active_variants libxc ${fortran}] } {
    110             ui_error "libxc must have been built with +${fortran}."
    111             return -code error "libxc must have been built with +${fortran}."
     102        if { ![active_variants libxc [c_variant_name]] } {
     103            ui_error "libxc must have been built with +[c_variant_name]"
     104            return -code error "libxc must have been built with +[c_variant_name]"
    112105        }
    113106    }
    114 
    115107    if { [variant_isset netcdf] } {
    116         if {![active_variants netcdf-fortran ${fortran}] } {
    117             ui_error "netcdf-fortran must have been built with +${fortran}."
    118             return -code error "netcdf-fortran must have been built with +${fortran}."
     108        if {![active_variants netcdf-fortran [c_variant_name]] } {
     109            ui_error "netcdf-fortran must have been built with +[c_variant_name]"
     110            return -code error "netcdf-fortran must have been built with +[c_variant_name]"
    119111        }
    120112    }
    121 
    122113    if { [variant_isset etsf_io] } {
    123         if {![active_variants etsf_io ${fortran}] } {
    124             ui_error "etsf_io must have been built with +${fortran}."
    125             return -code error "etsf_io must have been built with +${fortran}."
     114        if {![active_variants etsf_io [fortran_variant_name]] } {
     115            ui_error "etsf_io must have been built with +[fortran_variant_name]"
     116            return -code error "etsf_io must have been built with +[fortran_variant_name]"
     117        }
     118    }
     119    if { [variant_isset fftw3] } {
     120        if {![active_variants fftw-3 gfortran] || \
     121            ![active_variants fftw-3-single gfortran]} {
     122            ui_error "fftw-3 and nfftw-3-single must have been built with +gfortran:"
     123            ui_error "This can be achieved by : sudo port -f install fftw-3-single +gfortran"
     124            return -code error "fftw-3/fftw-3-single must have been built with +gfortran"
    126125        }
    127126    }
    128 
    129 #   No need to check compiler for wannier90
    130 #   No need to check compiler for fftw-3
    131127}
    132128
    133 # fix unnecessary rejection of libxc 2.1.0
    134 patchfiles patch-configure.diff
     129#Fix unnecessary rejection of libxc 2.1.0
     130#Fix a openMP syntax error
     131patchfiles patch-configure.diff \
     132           patch-src-71_bse-haydock.F90.diff
    135133
    136134pre-configure {
    137135    if { [variant_isset etsf_io] } {
     
    141139        } else {
    142140            configure.args-append  --with-trio-flavor="none"
    143141    }
    144 
    145142    set dft-flavor "none"
    146143    if { [variant_isset libxc] } {
    147144        if { ${dft-flavor} eq "none" } {
     
    157154            set dft-flavor ${dft-flavor}"+wannier90"
    158155        }
    159156    }
    160     if { [variant_isset bigdft] } {
    161         if { ${dft-flavor} eq "none" } {
    162             set dft-flavor "bigdft"
    163         } else {
    164             set dft-flavor ${dft-flavor}"+bigdft"
    165         }
    166     }
    167157    if { [variant_isset atompaw] } {
    168158        if { ${dft-flavor} eq "none" } {
    169159            set dft-flavor "atompaw"
     
    171161            set dft-flavor ${dft-flavor}"+atompaw"
    172162        }
    173163    }
     164#    if { [variant_isset bigdft] } {
     165#        if { ${dft-flavor} eq "none" } {
     166#            set dft-flavor "bigdft"
     167#        } else {
     168#            set dft-flavor ${dft-flavor}"+bigdft"
     169#        }
     170#    }
    174171    configure.args-append  --with-dft-flavor="${dft-flavor}"
     172
     173    configure.args-append  FCCPP="${configure.cpp} -ansi"
     174
     175    if { ${current_mpi} ne "none"} {
     176        configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
     177        if {[string match *openmpi* ${current_mpi}]} {
     178            configure.args-append   --with-mpi-level="1"
     179        }
     180        if { ![mpi_variant_isset] } {
     181            configure.fc     ${mpi.fc}
     182            configure.cc     ${mpi.cc}
     183            configure.cxx    ${mpi.cxx}
     184        }
     185        if { ${mpi.exec} ne "" } {
     186            configure.args-append  MPI_RUNNER=${mpi.exec}
     187            test.env-append        MPIEXEC=${mpi.exec}
     188        }
     189    } else {
     190        configure.args-append  --enable-mpi="no" --enable-mpi-io="no"
     191    }
    175192}
    176193
    177194destroot {
     
    193210# test.run            yes
    194211# test.target         check-full
    195212
    196 variant gcc46 conflicts gcc47 gcc48 openmpi mpich description {Build with GCC 4.6} {
    197     configure.compiler  macports-gcc-4.6
    198     configure.args-append  FCCPP="${configure.cpp} -ansi"
    199 }
    200 
    201 variant gcc47 conflicts gcc46 gcc48 openmpi mpich description {Build with GCC 4.7} {
    202     configure.compiler  macports-gcc-4.7
    203     configure.args-append  FCCPP="${configure.cpp} -ansi"
    204 }
    205 
    206 variant gcc48 conflicts gcc46 gcc47 openmpi mpich description {Build with GCC 4.8} {
    207     configure.compiler  macports-gcc-4.8
    208     configure.args-append  FCCPP="${configure.cpp} -ansi"
    209 }
    210 
    211 variant openmpi conflicts gcc46 gcc47 gcc48 mpich description {Build parallel version with OpenMPI} {
    212     depends_lib-append     path:bin/mpif90-openmpi-mp:openmpi-default
    213     configure.fc           mpif90-openmpi-mp
    214     configure.cc           mpicc-openmpi-mp
    215     configure.cxx          mpicxx-openmpi-mp
    216     configure.args-append  FCCPP="${configure.cc} -E -ansi"
    217     configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes" --with-mpi-level="1"
    218     configure.args-append  MPI_RUNNER=${prefix}/bin/mpiexec-openmpi-mp
    219     test.env-append        MPIEXEC=${prefix}/bin/mpiexec-openmpi-mp
    220 }
    221 
    222 variant mpich conflicts gcc46 gcc47 gcc48 openmpi description {Build parallel version with MPICH} {
    223     depends_lib-append     path:bin/mpif90-mpich-mp:mpich-default
    224     configure.fc           mpif90-mpich-mp
    225     configure.cc           mpicc-mpich-mp
    226     configure.cxx          mpicxx-mpich-mp
    227     configure.args-append  FCCPP="${configure.cc} -E -ansi"
    228     configure.args-append  --enable-mpi="yes" --enable-mpi-io="yes"
    229     configure.args-append  MPI_RUNNER=${prefix}/bin/mpiexec-mpich-mp
    230     test.env-append        MPIEXEC=${prefix}/bin/mpiexec-mpich-mp
    231 }
    232 
    233213variant fftw3 description {Build with support for fftw-3 FFT library} {
    234214    depends_lib-append      port:fftw-3
     215    depends_lib-append      port:fftw-3-single
     216#   require_active_variants fftw-3 gfortran
     217#   require_active_variants fftw-3-single gfortran
    235218    if { [variant_isset threads] } {
    236219        configure.args-append   --with-fft-flavor="fftw3-threads"
    237         configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3"
     220        configure.args-append   --with-fft-libs="-lfftw3_threads -lfftw3 -lfftw3f"
    238221    } else {
    239222        configure.args-append   --with-fft-flavor="fftw3"
    240         configure.args-append   --with-fft-libs="-lfftw3"
     223        configure.args-append   --with-fft-libs="-lfftw3 -lfftw3f"
    241224    }
    242225}
    243226
     
    270253    depends_lib-append      port:wannier90
    271254}
    272255
     256variant atompaw description {Build including AtomPAW atomic dataset generator} {
     257}
     258
     259variant sequential conflicts mpich mpich_devel openmpi openmpi_devel description {Build without MPI support} {
     260}
     261
    273262# FIXME: the code's build system will download BigDFT itself, which is contrary to the
    274263# way MacPorts should work. Make a bigdft port to support this.
    275264# There is an error compiling anyway, which could be fixed with a patch,
     
    282271#    patchfiles-append       patch-fallbacks-sources-bigdft-1.7.0.93-src-Makefile.in.diff
    283272#}
    284273
    285 variant atompaw description {Build including AtomPAW atomic dataset generator} {
    286 }
    287  
    288274livecheck.type      regex
    289275livecheck.url       ${homepage}/downloads/source-packages/abinit-1/releases/index.html
    290276livecheck.regex     ABINIT (\[0-9.\]+)
     277