Ignore:
Timestamp:
Feb 26, 2013, 2:35:03 PM (7 years ago)
Author:
vince@…
Message:

Uses a sysctl to detect the number of processors on the machine and build threaded or non-threaded accordingly. On non-threaded builds, make libtatlas a symlink to libsatlas so that dependencies like qrupdate build correctly without to have to figure out which atlas library is present.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dports/math/atlas/Portfile

    r103159 r103464  
    88name                    atlas
    99version                 3.10.1
    10 revision                1
     10revision                2
    1111
    1212# additional versions
     
    220220
    221221    configure.args-append   --nof77
    222 }
    223 
    224 if {${build_arch} == "ppc" || ${build_arch} == "ppc64"} {
    225 
    226     configure.args-append   -t 0
    227222}
    228223
     
    320315}
    321316
     317pre-fetch {
     318    # If we run on a mono-processor machine (PPC), then disable threading
     319
     320    if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
     321    configure.args-append    -t 0
     322    ui_msg "Building sequential only version of atlas."
     323    }
     324}
     325
     326
    322327extract {
    323328    # extract Atlas and move to a consistent working directory name
     
    500505        # Ensure libgomp is linked
    501506        if {[info exists gccversion] && ${gccnumber} > 45} {
    502                         set gmpfx       ${prefix}/lib/gcc${gccnumber}
    503                         if {[file exists ${gmpfx}/${arch}/libgomp.dylib]} {
    504                                 reinplace -E \
    505                                         "s|(LIBS =.*)|\\1 ${gmpfx}/${arch}/libgomp.dylib|" \
    506                                         ${atlas_path}/build/Make.inc
    507                         } else {
    508                                 reinplace -E \
    509                                         "s|(LIBS =.*)|\\1 ${gmpfx}/libgomp.dylib|" \
    510                                         ${atlas_path}/build/Make.inc
    511                         }
     507            set gmpfx    ${prefix}/lib/gcc${gccnumber}
     508            if {[file exists ${gmpfx}/${arch}/libgomp.dylib]} {
     509                reinplace -E \
     510                    "s|(LIBS =.*)|\\1 ${gmpfx}/${arch}/libgomp.dylib|" \
     511                    ${atlas_path}/build/Make.inc
     512            } else {
     513                reinplace -E \
     514                    "s|(LIBS =.*)|\\1 ${gmpfx}/libgomp.dylib|" \
     515                    ${atlas_path}/build/Make.inc
     516            }
    512517        }
    513518    }
     
    521526post-build {
    522527    if {! [variant_isset universal]} {
     528        set libdir ${build.dir}/lib
    523529        reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
    524             ${build.dir}/lib/Makefile
    525         reinplace "s|dynamic|dynamiclib|g" \
    526             ${build.dir}/lib/Makefile
    527         system "cd ${build.dir}/lib && ${build.cmd} shared_all"
     530            ${libdir}/Makefile
     531        reinplace "s|dynamic|dynamiclib|g" ${libdir}/Makefile
     532
     533        # On mono-processors machines, build libsatlas.dylib only
     534        if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
     535            system -W ${libdir} "${build.cmd} dylib"
     536        } else {
     537            system -W ${libdir} "${build.cmd} shared_all"
     538        }
    528539    } else {
    529540        foreach arch ${universal_archs_to_use} {
     541            set libdir ${workpath}/${name}-${version}-${arch}/build/lib
    530542            reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \
    531                 ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
    532             reinplace "s|dynamic|dynamiclib|g" \
    533                 ${workpath}/${name}-${version}-${arch}/build/lib/Makefile
    534             system "cd ${workpath}/${name}-${version}-${arch}/build/lib && \
    535                     ${build.cmd} shared_all"
     543                ${libdir}/Makefile
     544            reinplace "s|dynamic|dynamiclib|g" ${libdir}/Makefile
     545
     546        # Same as above
     547            if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
     548                system -W ${libdir} "${build.cmd} dylib"
     549            } else {
     550                system -W ${libdir} "${build.cmd} shared_all"
     551            }
    536552        }
    537553    }
     
    541557destroot.destdir      DESTDIR=${destroot}${prefix}
    542558
     559post-destroot {
     560    # On monoprocessor machines, make tatlas and satlas synonymous
     561    if {![catch {sysctl hw.logicalcpu} result] && $result == 1} {
     562        set libdir ${destroot}${prefix}/lib
     563        system -W ${libdir} "ln -s libsatlas.dylib libtatlas.dylib"
     564    }
     565}
     566   
    543567livecheck.name        math-atlas
    544568livecheck.distname    Stable
Note: See TracChangeset for help on using the changeset viewer.