# $Id: Portfile 100652 2012-12-18 19:44:39Z vince@macports.org $ PortSystem 1.0 PortGroup muniversal 1.0 categories math license BSD name atlas version 3.10.0 revision 1 # additional versions set lapackversion 3.4.2 set lapackname lapack set atlasdist ${name}${version}.tar.bz2 set lapackdist ${lapackname}-${lapackversion}.tgz maintainers vince platforms darwin description Portable optimal linear algebra software long_description Provides a complete BLAS and LAPACK API.\ ATLAS achieves performance on par\ with machine-specific tuned libraries. homepage http://math-atlas.sourceforge.net/ master_sites sourceforge:math-atlas:atlas \ http://www.netlib.org/lapack:lapack distfiles ${atlasdist}:atlas \ ${lapackdist}:lapack patchfiles patch-atlcomp_txt.diff \ patch-emit_mm_c.diff \ patch-Make_ttune.diff \ patch-ATL_DecAtomicCount_ppc_S.diff \ patch-ATL_cmm4x4x128_av_c.diff checksums atlas3.10.0.tar.bz2 \ rmd160 4e969dfee2662c536e2f2bfc49b51e8ef5bc2c94 \ sha256 a90a2e3463504e3297b56edc13769d766732e82bd8f1de951cfc78444f148465 \ lapack-3.4.2.tgz \ rmd160 8740c35c9a85b71424fe1ffeed192256aebeb431 \ sha256 60a65daaf16ec315034675942618a2230521ea7adf85eea788ee54841072faf0 variant gcc47 conflicts gcc45 gcc46 clang mpclang31 mpclang32\ description {build using macports-gcc-4.7} { } variant gcc46 conflicts gcc45 gcc47 clang mpclang31 mpclang32\ description {build using macports-gcc-4.6} { } variant gcc45 conflicts gcc46 gcc47 clang mpclang31 mpclang32\ description {build using macports-gcc-4.5} { } variant clang conflicts gcc45 gcc46 gcc47 mpclang31 mpclang32\ description {build using system clang and gfortran} { } variant mpclang31 conflicts gcc45 gcc46 gcc47 clang mpclang32\ description {build using MPclang 3.1 and gfortran} { depends_build-append port:clang-3.1 } variant mpclang32 conflicts gcc45 gcc46 gcc47 clang mpclang31\ description {build using MPclang 3.2 and gfortran} { depends_build-append port:clang-3.2 } variant dragonegg conflicts gcc45 gcc46 gcc47\ description {use dragonegg with gcc46} { } variant nofortran description {Forgo use of fortran compiler} { } # Select proper gcc version (or clang) # The clang compiler bundled with Xcode < 4.3 is not suitable for # Atlas compiling. if {[vercmp $xcodeversion 4.3] < 0} { if {[variant_isset clang] || [variant_isset dragonegg]} { pre-fetch { return -code error "Use of Clang is disabled with this version of Xcode." } } if {[variant_isset gcc45]} { set gccversion 4.5 } elseif {[variant_isset gcc46]} { set gccversion 4.6 } elseif {[variant_isset gcc47]} { set gccversion 4.7 } elseif {[variant_isset mpclang31]} { configure.compiler macports-clang-3.1 } elseif {[variant_isset mpclang32]} { configure.cc ${prefix}/bin/clang-mp-3.2 } else { # Defaults to gcc45 set gccversion 4.5 default_variants +gcc45 } } else { # On Xcode > 4.2 we may use the standard Clang if {[variant_isset gcc45]} { set gccversion 4.5 } elseif {[variant_isset gcc46]} { set gccversion 4.6 } elseif {[variant_isset gcc47]} { set gccversion 4.7 } elseif {[variant_isset dragonegg]} { set gccversion 4.6 } elseif {[variant_isset mpclang31]} { configure.compiler macports-clang-3.1 } elseif {[variant_isset mpclang32]} { configure.cc ${prefix}/bin/clang-mp-3.2 } elseif {[variant_isset clang]} { configure.compiler clang } else { # Defaults to gcc45 set gccversion 4.5 default_variants +gcc45 } } depends_build port:bzip2 \ port:gzip if {[info exists gccversion]} { set gccnumber [join [split ${gccversion} .] ""] configure.compiler macports-gcc-${gccversion} depends_build-append port:gcc${gccnumber} } else { set use_clang 1 } # No cross-compilation possible if {${os.arch} == "i386"} { set universal_archs_supported {i386 x86_64} } else { set universal_archs_supported {ppc ppc64} } if {${build_arch} == "x86_64" || ${build_arch} == "ppc64" } { set my_arch 64 } else { set my_arch 32 } configure.args \ -C ac ${configure.cc} \ --with-netlib-lapack-tarfile=${distpath}/${lapackdist} \ -O 12 \ -v 5 \ -b ${my_arch} \ -Fa alg -fPIC \ --dylibs # Dragonegg if {[variant_isset dragonegg]} { configure.args-delete -Fa alg -fPIC configure.args-append -Fa alg '-fPIC -fplugin=${prefix}/lib/dragonegg46.so' } # Add the appropriate configure flag to specify if we do # or don’t have a fortran compiler if {[variant_isset nofortran]} { configure.args-append --nof77 } # Since ppc machine do have only one processor, disable threads if {${build_arch} == "ppc" || ${build_arch} == "ppc64"} { configure.args-append -t 0 } # MacPorts defaults to ppc on G4 and G5, so we must override 64-bit # detection by Atlas, even if we are on a G5 if {${build_arch} == "ppc" && ![variant_isset universal]} { configure.args-delete --cc=${configure.cc} \ -Fa alg -fPIC configure.args-append --cc='${configure.cc} -m32 -force_cpusubtype_ALL' \ -A 4 \ -Fa alg '-fPIC -m32 -force_cpusubtype_ALL' # On Leopard, we may warn the user that ppc is not as efficient as ppc64 if {${os.major} == 9} { pre-configure { if {![catch {sysctl hw.cpu64bit_capable} result] && $result == 1} { ui_msg "Compiling for G4 arch (ppc) on a G5 (ppc64) machine." ui_msg "This could lead to inferior performance." } } } } if {(${os.major} >= 11 && ![catch {sysctl hw.optional.avx1_0} result1] && $result1 == 1) || \ (${os.major} > 8 && ![catch {sysctl hw.cpufamily} result2] && $result2 == 1418770316)} { # Core i2 processors (AVX) # AVX instruction can’t be used with GCC because Apple bundled as(1) # does not support it. Use clang instead. if {![info exists use_clang]} { # Force Core i1 arch pre-fetch { ui_warn "GCC compilers on OS X do not support AVX instructions." } configure.args-append -A 25 } else { configure.args-append -Fa acg -fPIC } } if {[variant_isset universal]} { configure.universal_args-delete --disable-dependency-tracking configure.args-delete --cc=${configure.cc} \ -b ${my_arch} \ -Fa alg -fPIC lappend merger_configure_args(ppc) --cc='${configure.cc} -m32'\ -b 32 \ -A 4 \ -t 0 \ -s gas_ppc \ -Fa alg '-fPIC -m32 \ -force_cpusubtype_ALL' lappend merger_configure_args(ppc64) --cc='${configure.cc} -m64'\ -b 64 \ -A 5 \ -t 0 \ -s gas_ppc \ -Fa alg '-fPIC -m64 \ -force_cpusubtype_ALL' lappend merger_configure_args(i386) --cc='${configure.cc} -m32'\ -b 32 \ -A 24 \ -s gas_x86_32 \ -Fa alg '-fPIC -m32' lappend merger_configure_args(x86_64) --cc='${configure.cc} -m64'\ -b 64 \ -s gas_x86_64 \ -Fa alg '-fPIC -m64' } # If we use gcc >= 46, add OpenMP support if {[info exists gccversion] && ${gccnumber} > 45} { configure.args-append -Si omp 1 } extract { # extract Atlas and move to a consistent working directory name system -W ${workpath} "bunzip2 -dc ${distpath}/${atlasdist} | \ gnutar --no-same-owner -xf -" system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}" } post-patch { if { ${build_arch} == "ppc" || ${build_arch} == "ppc64" } { reinplace \ "s|cMVFLAGS=\\\\\"%s\\\\\"|cMVFLAGS=\\\\\"-force_cpusubtype_ALL\ %s\\\\\"|" \ ${worksrcpath}/include/atlas_mvtesttime.h } } # Change the default compilers pre-configure { set cc [lindex [split ${configure.cc} '/'] end] # Make gcc-mp-4.x and gfortran-mp-4.x be detected as GCC variants if {[info exists gccnumber]} { set ff [lindex [split ${configure.f77} '/'] end] reinplace "s|-MPGCC-|${cc}|" ${worksrcpath}/CONFIG/src/probe_comp.c reinplace "s|-MPFORTRAN-|${ff}|" ${worksrcpath}/CONFIG/src/probe_comp.c reinplace "s|-MPPATH-|${prefix}/bin|" ${worksrcpath}/CONFIG/src/probe_comp.c if {${build_arch} == "ppc"} { reinplace "s|XXX|'${cc}' '-O3 -maltivec \ -mabi=altivec -mcpu=7400 -mtune=7400 \ -fno-schedule-insns \ -fschedule-insns2'|" \ ${worksrcpath}/CONFIG/src/atlcomp.txt } elseif {${build_arch} == "ppc64"} { reinplace "s|XXX|'${cc}' '-O3 -maltivec \ -mabi=altivec -mcpu=970 -mtune=970 \ -mvrsave -mpowerpc64 \ -fno-schedule-insns \ -fno-schedule-insns2'|" \ ${worksrcpath}/CONFIG/src/atlcomp.txt } else { reinplace "s|XXX|'${cc}' '-fomit-frame-pointer \ -mfpmath=sse -msse3 -O2 -fno-schedule-insns2'|" \ ${worksrcpath}/CONFIG/src/atlcomp.txt } } else { reinplace "s|XXX|'${cc}' '-O2 -fomit-frame-pointer'|" \ ${worksrcpath}/CONFIG/src/atlcomp.txt } # Forces goodgcc reinplace -E "s|GOODGCC =.*|GOODGCC = ${configure.cc}\");|" \ ${worksrcpath}/CONFIG/src/SpewMakeInc.c # If we use clang, we must grasp a gfortran compiler to build # Fortran sources (do not impact overall Atlas performance) if {[info exists use_clang]} { ui_msg "Use of clang is still experimental and may result in\ reduced performance or misbehavior. Use with caution." } if {[info exists use_clang] && ![variant_isset nofortran]} { set gflist [glob -noc ${prefix}/bin/gfortran-mp-4.*] if {[llength ${gflist}] == 0} { # No fortran compiler found. Act as if +nofortran was set. ui_msg "No fortran compiler found. Disabling fortran interface." configure.args-append --nof77 } else { # Select most recent gfortran global gccnumber configure.f77 [lindex [lsort -dec ${gflist}] 0] set gccnumber \ [join [split [string range ${configure.f77} end-2 end] "."] ""] ui_msg "Selected gfortran${gccnumber}." } } # Select the proper gfortran and corresponding libgfortran library if {[info exists gccnumber] && ![variant_isset nofortran]} { configure.args-append -C if ${configure.f77} set libgfbasepath ${prefix}/lib/gcc${gccnumber} if {[variant_isset universal]} { foreach arch ${universal_archs_to_use} { set libgfarchpath ${libgfbasepath}/${arch} if {[file exists ${libgfarchpath}/libgfortran.dylib]} { lappend merger_configure_args($arch) \ -Ss f77lib ${libgfarchpath}/libgfortran.dylib } else { lappend merger_configure_args($arch) \ -Ss f77lib ${libgfbasepath}/libgfortran.dylib } } } else { configure.args-append -Ss f77lib ${libgfbasepath}/libgfortran.dylib } } # Create build trees if {[variant_isset universal]} { foreach arch ${universal_archs_to_use} { copy ${workpath}/${name}-${version} \ ${workpath}/${name}-${version}-${arch} } } reinplace "s|cc=gcc|cc=${configure.cc}|g" ${worksrcpath}/configure reinplace "s|-no-cpp-precomp||g" \ ${workpath}/${name}-${version}/CONFIG/src/atlcomp.txt # Get some system specific variables for maximum optimization set cpufreq [expr {[sysctl hw.cpufrequency]/1000000}] ui_debug "Setting CPU Frequency for: ${cpufreq}" if {${os.arch} == "powerpc"} { configure.args-append -D c -DWALL } else { configure.args-append -D c -DPentiumCPS=${cpufreq} } if {[variant_isset universal]} { foreach arch ${universal_archs_to_use} { file mkdir ${workpath}/${name}-${version}-${arch}/build } } else { file mkdir ${workpath}/${name}-${version}/build } } # We configure from the build directory configure.dir ${workpath}/${name}-${version}/build configure.cmd ../configure post-configure { if {[variant_isset universal]} { set archs ${universal_archs_to_use} } else { set archs ${build_arch} } foreach arch ${archs} { if {![variant_isset universal]} { set atlas_path ${workpath}/${name}-${version} } else { set atlas_path ${workpath}/${name}-${version}-${arch} } # Recursively remove directories ui_debug "patch to recursively remove directories on clean" reinplace "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile # Ensure libgomp is linked if {[info exists gccversion] && ${gccnumber} > 45} { reinplace -E "s|(LIBS =.*)|\\1 ${prefix}/lib/gcc${gccnumber}/libgomp.dylib|" \ ${atlas_path}/build/Make.inc } } } build.env-append "CC=${configure.cc} CXX=${configure.cxx}" use_parallel_build no build.target build build.dir ${workpath}/${name}-${version}/build post-build { if {! [variant_isset universal]} { reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \ ${build.dir}/lib/Makefile reinplace "s|dynamic|dynamiclib|g" \ ${build.dir}/lib/Makefile system "cd ${build.dir}/lib && ${build.cmd} shared_all" } else { foreach arch ${universal_archs_to_use} { reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \ ${workpath}/${name}-${version}-${arch}/build/lib/Makefile reinplace "s|dynamic|dynamiclib|g" \ ${workpath}/${name}-${version}-${arch}/build/lib/Makefile system "cd ${workpath}/${name}-${version}-${arch}/build/lib && \ ${build.cmd} shared_all" } } } destroot.dir ${build.dir} destroot.destdir DESTDIR=${destroot}${prefix} livecheck.name math-atlas livecheck.distname Stable