Ticket #39365: Portfile-arpack.3.diff

File Portfile-arpack.3.diff, 10.1 KB (added by dstrubbe (David Strubbe), 11 years ago)
  • Portfile

    old new  
    55PortGroup  active_variants 1.1
    66
    77name          arpack
    8 version       3.1.2
    9 revision      1
     8version       3.1.3
    109categories    math
    1110license       BSD
    1211platforms     darwin
    1312maintainers             mmoll
    14 description             Package for solving large scale eigenvalue problems
     13description             Package for solving large-scale eigenvalue problems
    1514long_description  \
    1615    ARPACK is a collection of Fortran77 subroutines designed to solve large \
    1716    scale eigenvalue problems. Parallel ARPACK (PARPACK) is included if built with an MPI variant.
    1817homepage            http://forge.scilab.org/index.php/p/arpack-ng
    19 master_sites        ${homepage}/downloads/497
    20 distfiles           get
    21 dist_subdir         ${name}/${version}
    22 checksums           md5     7644e234f219ec1a29849b6d7811a6b1 \
    23                     sha1    f5453e2d576f131890ca023e1d853e18920f9c3c \
    24                     rmd160  2c55eca384cc0a1aebacdef527f88426932bf57b
    25 worksrcdir          ${name}-ng_${version}
     18master_sites        ${homepage}/downloads/get
     19distfiles           arpack-ng-${version}.tar.gz
     20checksums           md5     90ba42eae70b517ebdb72921cb4186df \
     21                    sha1    c1ac96663916a4e11618e9557636ba1bd1a7b556 \
     22                    rmd160  30a3b8a707417afeb3f8a794ee3aa0160fa3e745
     23worksrcdir          ${name}-ng-${version}
    2624
    2725configure.args-append home=${worksrcpath} --disable-mpi
    28 # LDFLAGS needs to be defined here to avoid it having also a "-arch" option, considered illegal by gfortran
    2926if { ${build_arch}=="x86_64" || ${build_arch}=="ppc64" } {
    30     configure.args-append FFLAGS='-O2 -m64' LDFLAGS='-L${prefix}/lib'
     27    configure.args-append FFLAGS='-O2 -m64'
    3128} else {
    32     configure.args-append FFLAGS='-O2 -m32' LDFLAGS='-L${prefix}/lib'
     29    configure.args-append FFLAGS='-O2 -m32'
    3330}
     31# LDFLAGS needs to be cleared to avoid it having a "-arch" option, considered illegal by gfortran
     32# also, if it has ${prefix}/lib it will prevent +accelerate from working if atlas is present.
     33configure.args-append LDFLAGS=''
    3434
    3535pre-fetch {
    36         if {"darwin" == ${os.platform} && ${os.major} < 9} {
    37                 ui_error "${name} ${version} requires Mac OS X 10.5 or greater"
    38                 return -code error "incompatible Mac OS X version"
    39         }
     36   if {"darwin" == ${os.platform} && ${os.major} < 9} {
     37        ui_error "${name} ${version} requires Mac OS X 10.5 or greater"
     38        return -code error "incompatible Mac OS X version"
     39   }
     40
     41   if {[variant_isset openmpi]} {
     42      if { ![active_variants openmpi gcc43] && ![active_variants openmpi gcc44] && \
     43           ![active_variants openmpi gcc45] && ![active_variants openmpi gcc46] && \
     44           ![active_variants openmpi gcc47] && ![active_variants openmpi gcc48] && \
     45           ![active_variants openmpi g95] } {
     46        ui_error "${name} with +openmpi requires that openmpi was built with a Fortran variant"
     47        return -code error "openmpi needs Fortran variant"
     48      }
     49   }
     50
     51   if {[variant_isset mpich]} {
     52      # mpich has a path dependency on mpif77, which could be satisfied by mpich-devel instead
     53      # Fortunately, if mpif77 is present, this check is not needed.
     54      if { [_portnameactive mpich] } {
     55         if { ![active_variants mpich gcc43] && ![active_variants mpich gcc44] && \
     56           ![active_variants mpich gcc45] && ![active_variants mpich gcc46] && \
     57           ![active_variants mpich gcc47] } {
     58          ui_error "${name} with +mpich requires that mpich was built with a Fortran variant"
     59          return -code error "mpich needs Fortran variant"
     60        }
     61      }
     62    }
     63
    4064}
    4165
    4266# Fortran compilers can not cross-compile
     
    4670    set universal_archs_supported "ppc ppc64"
    4771}
    4872
    49 variant openmpi description {build PARPACK, with OpenMPI} conflicts mpich universal {
    50     depends_lib-append    port:openmpi
    51     configure.args-delete --disable-mpi
    52     configure.args-append --enable-mpi
    53     configure.env-append  MPIF77=${prefix}/bin/openmpif77
     73variant openmpi description {build PARPACK, with OpenMPI} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 g95 mpich universal {
     74    depends_lib-append     port:openmpi
     75    configure.args-delete  --disable-mpi
     76    configure.args-append  --enable-mpi
     77    configure.env-append   F77=${prefix}/bin/openmpif77
     78    # see g95 variant below for explanation
     79    if { [active_variants openmpi g95] } {
     80      configure.args-append --disable-shared
     81    }
    5482}
    5583
    56 variant mpich description {build PARPACK, with MPICH} conflicts openmpi {
    57     depends_lib-append    path:bin/mpif77:mpich
    58     configure.args-delete --disable-mpi
    59     configure.args-append --enable-mpi
    60     configure.env-append  MPIF77=${prefix}/bin/mpif77
     84variant mpich description {build PARPACK, with MPICH} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 g95 openmpi {
     85    depends_lib-append     path:bin/mpif77:mpich
     86    # unfortunately, by default mpich builds without Fortran support, which won't work here. ticket #39428
     87    configure.args-delete  --disable-mpi
     88    configure.args-append  --enable-mpi
     89    configure.env-append   F77=${prefix}/bin/mpif77
    6190}
    6291
    63 if {![variant_isset mpich]} {
    64     default_variants +openmpi
     92if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] \
     93   && ![variant_isset gcc47] && ![variant_isset g95] && ![variant_isset mpich]} {
     94        default_variants +openmpi
    6595}
    6696
    6797
    68 variant gcc43 description {build with gfortran-mp-4.3} conflicts gcc44 gcc45 gcc46 gcc47 g95 universal {
     98variant gcc43 description {build with gfortran-mp-4.3} conflicts gcc44 gcc45 gcc46 gcc47 g95 universal openmpi mpich {
    6999        depends_build-append    port:gcc43
    70         configure.env-append F77=${prefix}/bin/gfortran-mp-4.3
    71         if {[variant_isset mpich]}   { require_active_variants mpich   gcc43 }
    72         if {[variant_isset openmpi]} { require_active_variants openmpi gcc43 }
     100        configure.compiler      macports-gcc-4.3
    73101}
    74102
    75 variant gcc44 description {build with gfortran-mp-4.4} conflicts gcc43 gcc45 gcc46 gcc47 g95 {
     103variant gcc44 description {build with gfortran-mp-4.4} conflicts gcc43 gcc45 gcc46 gcc47 g95 openmpi mpich {
    76104        depends_build-append    port:gcc44
    77         configure.env-append F77=${prefix}/bin/gfortran-mp-4.4
    78         if {[variant_isset mpich]}   { require_active_variants mpich   gcc44 }
    79         if {[variant_isset openmpi]} { require_active_variants openmpi gcc44 }
     105        configure.compiler      macports-gcc-4.4
    80106}
    81107
    82 variant gcc45 description {build with gfortran-mp-4.5} conflicts gcc43 gcc44 gcc46 gcc47 g95 {
     108variant gcc45 description {build with gfortran-mp-4.5} conflicts gcc43 gcc44 gcc46 gcc47 g95 openmpi mpich {
    83109        depends_build-append    port:gcc45
    84         configure.env-append F77=${prefix}/bin/gfortran-mp-4.5
    85         if {[variant_isset mpich]}   { require_active_variants mpich   gcc45 }
    86         if {[variant_isset openmpi]} { require_active_variants openmpi gcc45 }
     110        configure.compiler      macports-gcc-4.5
    87111}
    88112
    89 variant gcc46 description {build with gfortran-mp-4.6} conflicts gcc43 gcc44 gcc45 gcc47 g95 {
     113variant gcc46 description {build with gfortran-mp-4.6} conflicts gcc43 gcc44 gcc45 gcc47 g95 openmpi mpich {
    90114        depends_build-append    port:gcc46
    91         configure.env-append F77=${prefix}/bin/gfortran-mp-4.6
    92         if {[variant_isset mpich]}   { require_active_variants mpich   gcc46 }
    93         if {[variant_isset openmpi]} { require_active_variants openmpi gcc46 }
     115        configure.compiler      macports-gcc-4.6
    94116}
    95117
    96 variant gcc47 description {build with gfortran-mp-4.7} conflicts gcc43 gcc44 gcc45 gcc46 g95 {
     118variant gcc47 description {build with gfortran-mp-4.7} conflicts gcc43 gcc44 gcc45 gcc46 g95 openmpi mpich {
    97119        depends_build-append    port:gcc47
    98         configure.env-append F77=${prefix}/bin/gfortran-mp-4.7
    99         if {[variant_isset mpich]}   { require_active_variants mpich   gcc47 }
    100         if {[variant_isset openmpi]} { require_active_variants openmpi gcc47 }
     120        configure.compiler      macports-gcc-4.7
    101121}
    102 variant g95 description {build with g95} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 universal {
     122
     123# does not work without --shared-lib, will not accept -force_load in linking stage
     124variant g95 description {build with g95 (static only)} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 universal openmpi mpich {
    103125        depends_build-append    port:g95
    104         configure.env-append F77=${prefix}/bin/g95
    105         if {[variant_isset mpich]}   { require_active_variants mpich   g95 }
    106         if {[variant_isset openmpi]} { require_active_variants openmpi g95 }
     126        configure.args-append   --disable-shared
     127        configure.env-append    F77=${prefix}/bin/g95
    107128}
    108129
    109 if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset g95] } {
     130if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] \
     131   && ![variant_isset g95] && ![variant_isset openmpi] && ![variant_isset mpich]} {
    110132        default_variants      +gcc47
    111133}
    112134
    113135variant accelerate conflicts atlas description {build with Accelerate framework} {
    114     configure.args-append --with-blas=/usr/lib/libblas.dylib --with-lapack=/usr/lib/liblapack.dylib
    115     patchfiles-append patch-ARPACK-cdot-and-zdot.diff
     136    # the change of LDFLAGS is required to avoid linking against the ATLAS ones if they are present;
     137    # if we specify /usr/lib/libblas.dylib directly, the linking fails. http://forge.scilab.org/index.php/p/arpack-ng/issues/1220/
     138    configure.args-delete  LDFLAGS=''
     139    configure.args-append  LDFLAGS='/usr/lib/libblas.dylib /usr/lib/liblapack.dylib' --with-blas="-lblas -llapack"
     140    patchfiles-append      patch-ARPACK-cdot-and-zdot.diff
    116141    if {[variant_isset openmpi] || [variant_isset mpich]} {
    117142        patchfiles-append patch-PARPACK-cdot-and-zdot.diff
     143        # PARPACK unwisely uses 'second' from LAPACK (not provided by Accelerate) instead of internal 'arscnd' like ARPACK
     144        # so, we make a 'second' which wraps 'arscnd'. Really, 'second' should just be replaced in PARPACK source.
     145        # http://forge.scilab.org/index.php/p/arpack-ng/issues/1245/
     146        patchfiles-append patch-UTIL-second_NONE.f.diff
    118147    }
    119148}
    120149
    121150variant atlas description {build with atlas} {
    122151    depends_lib-append port:atlas
    123     configure.args-append --with-blas=${prefix}/lib/libsatlas.dylib
     152    configure.args-append --with-blas="-L${prefix}/lib -lsatlas"
    124153}
    125154
    126155if {![variant_isset atlas]} {