[107140] trunk/dports/math/arpack

Lawrence Velázquez larryv at macports.org
Wed Jun 19 09:36:05 PDT 2013


On Jun 19, 2013, at 10:37 AM, mmoll at macports.org wrote:

> Revision: 107140
>          https://trac.macports.org/changeset/107140
> Author:   mmoll at macports.org
> Date:     2013-06-19 07:37:04 -0700 (Wed, 19 Jun 2013)
> Log Message:
> -----------
> math/arpack: update to version 3.1.3. various changes to use the right compiler. closes #39365

> Modified: trunk/dports/math/arpack/Portfile
> ===================================================================
> --- trunk/dports/math/arpack/Portfile	2013-06-19 10:12:02 UTC (rev 107139)
> +++ trunk/dports/math/arpack/Portfile	2013-06-19 14:37:04 UTC (rev 107140)

> pre-fetch {
> -	if {"darwin" == ${os.platform} && ${os.major} < 9} {
> -		ui_error "${name} ${version} requires Mac OS X 10.5 or greater"
> -		return -code error "incompatible Mac OS X version"
> -	}
> +   if {"darwin" == ${os.platform} && ${os.major} < 9} {
> +	ui_error "${name} ${version} requires Mac OS X 10.5 or greater"
> +	return -code error "incompatible Mac OS X version"
> +   }
> +
> +   if {[variant_isset openmpi]} {
> +      if { ![active_variants openmpi gcc43] && ![active_variants openmpi gcc44] && \
> +           ![active_variants openmpi gcc45] && ![active_variants openmpi gcc46] && \
> +           ![active_variants openmpi gcc47] && ![active_variants openmpi gcc48] && \
> +           ![active_variants openmpi g95] } {
> +	ui_error "${name} with +openmpi requires that openmpi was built with a Fortran variant"
> +	return -code error "openmpi needs Fortran variant"
> +      }
> +   }
> +
> +   if {[variant_isset mpich]} {
> +      # mpich has a path dependency on mpif77, which could be satisfied by mpich-devel instead
> +      # Fortunately, if mpif77 is present, this check is not needed.
> +      if { [_portnameactive mpich] } {
> +         if { ![active_variants mpich gcc43] && ![active_variants mpich gcc44] && \
> +           ![active_variants mpich gcc45] && ![active_variants mpich gcc46] && \
> +           ![active_variants mpich gcc47] } {
> +	  ui_error "${name} with +mpich requires that mpich was built with a Fortran variant"
> +	  return -code error "mpich needs Fortran variant"
> +        }
> +      }
> +    }
> +
> }
> 
> # Fortran compilers can not cross-compile

You can't directly use active_variants like this in a pre-fetch script because there's no guarantee that openmpi or mpich are present at this point. MacPorts doesn't necessary install library dependencies when the fetch phase runs (for example, when running "port fetch" manually). This should be done in pre-configure.

> @@ -46,81 +70,86 @@
>     set universal_archs_supported "ppc ppc64"
> }
> 
> -variant openmpi description {build PARPACK, with OpenMPI} conflicts mpich universal {
> -    depends_lib-append    port:openmpi
> -    configure.args-delete --disable-mpi
> -    configure.args-append --enable-mpi
> -    configure.env-append  MPIF77=${prefix}/bin/openmpif77
> +variant openmpi description {build PARPACK, with OpenMPI} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 g95 mpich universal {
> +    depends_lib-append     port:openmpi
> +    configure.args-delete  --disable-mpi
> +    configure.args-append  --enable-mpi
> +    configure.env-append   F77=${prefix}/bin/openmpif77
> +    # see g95 variant below for explanation
> +    if { [active_variants openmpi g95] } {
> +      configure.args-append --disable-shared
> +    }
> }
> 
> -variant mpich description {build PARPACK, with MPICH} conflicts openmpi {
> -    depends_lib-append    path:bin/mpif77:mpich
> -    configure.args-delete --disable-mpi
> -    configure.args-append --enable-mpi
> -    configure.env-append  MPIF77=${prefix}/bin/mpif77
> +variant mpich description {build PARPACK, with MPICH} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 g95 openmpi {
> +    depends_lib-append     path:bin/mpif77:mpich
> +    # unfortunately, by default mpich builds without Fortran support, which won't work here. ticket #39428
> +    configure.args-delete  --disable-mpi
> +    configure.args-append  --enable-mpi
> +    configure.env-append   F77=${prefix}/bin/mpif77
> }
> 
> -if {![variant_isset mpich]} {
> -    default_variants +openmpi
> +if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] \
> +   && ![variant_isset gcc47] && ![variant_isset g95] && ![variant_isset mpich]} {
> +        default_variants +openmpi
> }
> 
> 
> -variant gcc43 description {build with gfortran-mp-4.3} conflicts gcc44 gcc45 gcc46 gcc47 g95 universal {
> +variant gcc43 description {build with gfortran-mp-4.3} conflicts gcc44 gcc45 gcc46 gcc47 g95 universal openmpi mpich {
> 	depends_build-append    port:gcc43
> -	configure.env-append F77=${prefix}/bin/gfortran-mp-4.3
> -	if {[variant_isset mpich]}   { require_active_variants mpich   gcc43 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi gcc43 }
> +	configure.compiler      macports-gcc-4.3
> }
> 
> -variant gcc44 description {build with gfortran-mp-4.4} conflicts gcc43 gcc45 gcc46 gcc47 g95 {
> +variant gcc44 description {build with gfortran-mp-4.4} conflicts gcc43 gcc45 gcc46 gcc47 g95 openmpi mpich {
> 	depends_build-append    port:gcc44
> -	configure.env-append F77=${prefix}/bin/gfortran-mp-4.4
> -	if {[variant_isset mpich]}   { require_active_variants mpich   gcc44 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi gcc44 }
> +	configure.compiler      macports-gcc-4.4
> }
> 
> -variant gcc45 description {build with gfortran-mp-4.5} conflicts gcc43 gcc44 gcc46 gcc47 g95 {
> +variant gcc45 description {build with gfortran-mp-4.5} conflicts gcc43 gcc44 gcc46 gcc47 g95 openmpi mpich {
> 	depends_build-append    port:gcc45
> -	configure.env-append F77=${prefix}/bin/gfortran-mp-4.5
> -	if {[variant_isset mpich]}   { require_active_variants mpich   gcc45 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi gcc45 }
> +	configure.compiler      macports-gcc-4.5
> }
> 
> -variant gcc46 description {build with gfortran-mp-4.6} conflicts gcc43 gcc44 gcc45 gcc47 g95 {
> +variant gcc46 description {build with gfortran-mp-4.6} conflicts gcc43 gcc44 gcc45 gcc47 g95 openmpi mpich {
> 	depends_build-append    port:gcc46
> -	configure.env-append F77=${prefix}/bin/gfortran-mp-4.6
> -	if {[variant_isset mpich]}   { require_active_variants mpich   gcc46 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi gcc46 }
> +	configure.compiler      macports-gcc-4.6
> }
> 
> -variant gcc47 description {build with gfortran-mp-4.7} conflicts gcc43 gcc44 gcc45 gcc46 g95 {
> +variant gcc47 description {build with gfortran-mp-4.7} conflicts gcc43 gcc44 gcc45 gcc46 g95 openmpi mpich {
> 	depends_build-append    port:gcc47
> -	configure.env-append F77=${prefix}/bin/gfortran-mp-4.7
> -	if {[variant_isset mpich]}   { require_active_variants mpich   gcc47 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi gcc47 }
> +	configure.compiler      macports-gcc-4.7
> }
> -variant g95 description {build with g95} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 universal {
> +
> +# does not work without --shared-lib, will not accept -force_load in linking stage
> +variant g95 description {build with g95 (static only)} conflicts gcc43 gcc44 gcc45 gcc46 gcc47 universal openmpi mpich {
>         depends_build-append    port:g95
> -        configure.env-append F77=${prefix}/bin/g95
> -	if {[variant_isset mpich]}   { require_active_variants mpich   g95 }
> -	if {[variant_isset openmpi]} { require_active_variants openmpi g95 }
> +        configure.args-append   --disable-shared
> +        configure.env-append    F77=${prefix}/bin/g95
> }
> 
> -if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset g95] } {
> +if { ![variant_isset gcc43] && ![variant_isset gcc44] && ![variant_isset gcc45] && ![variant_isset gcc46] \
> +   && ![variant_isset g95] && ![variant_isset openmpi] && ![variant_isset mpich]} {
> 	default_variants      +gcc47
> }
> 
> variant accelerate conflicts atlas description {build with Accelerate framework} {
> -    configure.args-append --with-blas=/usr/lib/libblas.dylib --with-lapack=/usr/lib/liblapack.dylib
> -    patchfiles-append patch-ARPACK-cdot-and-zdot.diff
> +    # the change of LDFLAGS is required to avoid linking against the ATLAS ones if they are present;
> +    # if we specify /usr/lib/libblas.dylib directly, the linking fails. http://forge.scilab.org/index.php/p/arpack-ng/issues/1220/
> +    configure.args-delete  LDFLAGS=''
> +    configure.args-append  LDFLAGS='/usr/lib/libblas.dylib /usr/lib/liblapack.dylib' --with-blas="-lblas -llapack"
> +    patchfiles-append      patch-ARPACK-cdot-and-zdot.diff
>     if {[variant_isset openmpi] || [variant_isset mpich]} {
>         patchfiles-append patch-PARPACK-cdot-and-zdot.diff
> +	# PARPACK unwisely uses 'second' from LAPACK (not provided by Accelerate) instead of internal 'arscnd' like ARPACK
> +        # so, we make a 'second' which wraps 'arscnd'. Really, 'second' should just be replaced in PARPACK source.
> +        # http://forge.scilab.org/index.php/p/arpack-ng/issues/1245/
> +	patchfiles-append patch-UTIL-second_NONE.f.diff
>     }
> }

Similarly, you can't use any of the active_variants procs directly in variant scripts because there's no guarantee that the dependencies are present when the Portfile is processed. The arpack Portfile fails to execute on my machine during "port sync" because I don't have openmpi installed. It's also disappeared from the pregenerated PortIndex.

http://www.macports.org/ports.php?by=name&substr=arpack

These calls need to be in pre-configure scripts. You can put them all in one script with variant checks, if you'd like.

vq


More information about the macports-dev mailing list