# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4 PortSystem 1.0 PortGroup cmake 1.1 PortGroup compilers 1.0 PortGroup github 1.0 PortGroup muniversal 1.1 PortGroup xcode_workaround 1.0 name OpenBLAS categories math science license BSD maintainers {nicos @NicosPavlov} {michaelld @michaelld} {@catap korins.ky:kirill} openmaintainer description OpenBLAS is an optimized BLAS library based on GotoBLAS2 long_description {*}${description} # Block compilers that do not support thread-local storage. compiler.cxx_standard 2011 compiler.c_standard 2011 compiler.thread_local_storage yes if {${os.major} < 9} { # For older versions, we force native variant as there is no PPCG3 target in OpenBLAS default_variants-append +native } subport OpenBLAS-devel {} if {[string first "-devel" $subport] > 0} { github.setup OpenMathLib OpenBLAS e1eef56e0510fecd5a05df9a8fddaf63a3d91ef0 github.tarball_from archive version 20240704-[string range ${github.version} 0 7] checksums rmd160 0612839aa8727b4cc76a4ac35b93bac8ea3920a9 \ sha256 6f501ad13a94eef28c55b301018b85ec4b7eb4c38f4ac4b021ef953d7de581e4 \ size 24634029 revision 0 conflicts OpenBLAS patchfiles patch-OpenBLAS-i386-Apple.diff github.livecheck.branch develop # Not using precompiled binaries in -devel support default_variants-append +native } else { github.setup OpenMathLib OpenBLAS 0.3.27 v github.tarball_from releases checksums rmd160 1ca534ed13409fb55ea384e294b9ff0fcfcdc483 \ sha256 aa2d68b1564fe2b13bc292672608e9cdeeeb6dc34995512e65c3b10f4599e897 \ size 24493704 revision 0 conflicts OpenBLAS-devel patchfiles patch-libnoarch.release.diff \ patch-OpenBLAS-i386-Apple.diff \ patch-cc.cmake-add-optflags-for-G5-and-G4-kernels.diff \ patch-cc.cmake-use-force_cpusubtype_ALL-for-Darwin-PPC.diff \ patch-PPC970-drop-mcpu-970-which-seems-to-produce-faulty-c.diff if {![variant_isset native]} { notes " This version is built based on a base architecture for convenience, which may not be optimized for your system. To build a version customized for your machine, use the +native variant" } } compilers.choose fc compilers.setup default_fortran variant lapack description "Add Lapack/CLapack support to the library" { } default_variants-append +lapack variant native description "Force compilation on machine to get fully optimized library" { # Prevent precompiled binaries to let compilation optimise the library for the user processor archive_sites } # Workaround for test failure :- # > ./sblat2 < ./sblat2.dat # Program received signal SIGSEGV: Segmentation fault - invalid memory reference. xcode_workaround.fixed_xcode_version 11.2 xcode_workaround.type append_to_compiler_name if {${muniversal.build_arch} in [list arm64 ppc64 x86_64]} { configure.args-append \ -DBINARY64=ON } configure.cflags -O3 configure.args-append \ -DCOMMON_PROF=-pg if {![variant_isset lapack]} { configure.args-append \ -DBUILD_WITHOUT_LAPACK=ON } if {![variant_isset native]} { # Do not limit threads to the number on buildbots configure.args-append \ -DNUM_THREADS=56 switch ${muniversal.build_arch} { arm64 { configure.args-append \ -DTARGET=ARMV8 } x86_64 { if {${os.major} >= 18} { configure.args-append \ -DTARGET=NEHALEM } else { configure.args-append \ -DTARGET=CORE2 } } i386 { configure.args-append \ -DTARGET=YONAH } ppc { configure.args-append \ -DTARGET=PPCG4 } ppc64 { configure.args-append \ -DTARGET=PPC970 } default { } } } if {${muniversal.build_arch} ni [list i386 x86_64]} { # not on x86 of some sort; just disable AVX configure.args-append \ -DNO_AVX=ON \ -DNO_AVX2=ON \ -DNO_AVX512=ON } else { if {![avx_compiler_isset]} { configure.args-append \ -DNO_AVX=ON } # Disable AVX2 on OSX10.6 and older only. # On newer platforms AVX2 is now supported via # https://github.com/macports/macports-ports/pull/3486 if { ${os.major} <= 10 } { configure.args-append \ -DNO_AVX2=ON } # Deactivating AVX512 instructions which do not build # at this point. Keeping them in -devel subport. See # https://trac.macports.org/ticket/57912 if {[string first "-devel" $subport] < 1} { configure.args-append \ -DNO_AVX512=ON } } configure.args-append -DCMAKE_AR=${prefix}/bin/ar \ -DCMAKE_NM=${prefix}/bin/nm \ -DCMAKE_OBJDUMP=${prefix}/bin/objdump \ -DCMAKE_RANLIB=${prefix}/bin/ranlib \ -DCMAKE_STRIP=${prefix}/bin/strip \ -DCMAKE_LINKER=${prefix}/bin/ld depends_build-append path:libexec/coreutils/libstdbuf.so:coreutils \ port:cctools \ port:ld64 depends_skip_archcheck coreutils \ cctools \ ld64 muniversal.combine ${prefix}/lib/pkgconfig/openblas.pc # Build a shared library, not static! configure.args-append -DBUILD_SHARED_LIBS=ON # compilers PG adds its own rpath to make GC happy, and cmake adds rpath which # leads to two rpath and Sonoma linker failed on duplicated rpath. To avoid that # mess let me remove cmake's rpath. configure.pre_args-delete -DCMAKE_INSTALL_RPATH=${prefix}/lib configure.pre_args-replace -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=ON \ -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF cmake.install_rpath compilers.add_gcc_rpath_support no post-destroot { # For compatibility, put header files in ${prefix}/include foreach h [glob -tails -directory "${destroot}${prefix}/include/openblas" *.h] { if {${h} eq "cblas.h"} { ln -s openblas/${h} ${destroot}${prefix}/include/cblas_openblas.h } else { ln -s openblas/${h} ${destroot}${prefix}/include/${h} } } if {${muniversal.build_arch} ne ${configure.build_arch}} { reinplace "s|^openblas_config=|#openblas_config=|" ${destroot}${prefix}/lib/pkgconfig/openblas.pc } }