source: trunk/dports/math/OpenBLAS/Portfile @ 129653

Last change on this file since 129653 was 129653, checked in by nicos@…, 5 years ago

OpenBLAS: update to 0.2.13

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.0 KB
Line 
1# -*- 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
2# $Id: Portfile 129653 2014-12-18 03:13:02Z nicos@macports.org $
3
4PortSystem          1.0
5PortGroup           github 1.0
6PortGroup           muniversal 1.0
7
8github.setup        xianyi OpenBLAS 0.2.13 v
9
10conflicts           OpenBLAS-devel
11categories          math science
12license             BSD
13maintainers         nicos openmaintainer
14description         OpenBLAS is an optimized BLAS library based on GotoBLAS2
15long_description    ${description}
16platforms           darwin
17
18# Prevent precompiled binaries to let compilation optimise the library
19# for the user processor
20archive_sites
21
22patchfiles          patch-libnoarch.diff \
23                    patch-linkLib.diff
24
25checksums           rmd160  bdd695af4cfb4741eb61d32992c49d5735eb1057 \
26                    sha256  d36c874fb7672c585fb153b2254b6ca14e94c115d20b58e4eb378ed0632d4fab
27
28variant gcc45 conflicts gcc46 gcc47 gcc48 gcc49 clang \
29    description "Use Gcc45 as compiler" { 
30    configure.compiler  macports-gcc-4.5
31}
32
33variant gcc46 conflicts gcc45 gcc47 gcc48 gcc49 clang \
34    description "Use Gcc46 as compiler" { 
35    configure.compiler  macports-gcc-4.6
36}
37
38variant gcc47 conflicts gcc45 gcc46 gcc48 gcc49 clang \
39    description "Use Gcc47 as compiler" { 
40    configure.compiler  macports-gcc-4.7
41}
42
43variant gcc48 conflicts gcc45 gcc46 gcc47 gcc49 clang \
44    description "Use Gcc48 as compiler" { 
45    configure.compiler  macports-gcc-4.8
46}
47
48variant gcc49 conflicts gcc45 gcc46 gcc47 gcc48 clang \
49    description "Use Gcc49 as compiler" { 
50    configure.compiler  macports-gcc-4.9
51}
52
53variant clang conflicts gcc45 gcc46 gcc47 gcc48 gcc49 \
54    description "Use Clang as compiler" {
55    if {[vercmp $xcodeversion 5.0] >= 0} {
56        configure.compiler      clang
57    } else {
58        # Xcode's clang < 5.0 does not support avx
59        configure.compiler      macports-clang-3.3
60    }
61    #Also need a compiler for fortran code: forcing to dragonegg to
62    #ensure AVX-capable fortran compiler
63    depends_build-append    port:dragonegg-3.3-gcc-4.8
64    configure.fc            ${prefix}/bin/dragonegg-3.3-gfortran-mp-4.8
65
66}
67
68if {![variant_isset gcc45] && ![variant_isset gcc46] && ![variant_isset gcc47] && \
69    ![variant_isset gcc48] && ![variant_isset gcc49] && ![variant_isset clang]} {
70    if { ![catch {sysctl hw.optional.avx1_0} has_avx] && $has_avx == 1 } {
71        #Use clang if the processor has avx instructions
72        default_variants +clang       
73    } else {
74        #Else, use gcc48 as default
75        default_variants +gcc48
76    }
77}
78
79variant lapack description "Add Lapack/CLapack support to the library" { }
80
81use_configure       no
82
83pre-build {
84    if {[variant_isset universal]} {
85        foreach arch ${universal_archs_to_use} {
86            set makeINC [open ${worksrcpath}-${arch}/Makefile.rule "w"]
87            puts $makeINC "VERSION = ${version}"
88            puts $makeINC "LIBNAMESUFFIX = "
89
90            puts $makeINC "CC = ${configure.cc}"
91            puts $makeINC "FC = ${configure.fc}"
92
93            if {${arch} eq "x86_64" || ${arch} eq "ppc64"} {
94                puts $makeINC "BINARY = 64"
95            } else {
96                puts $makeINC "BINARY = 32"
97            }
98            if {![variant_isset clang]} {
99                 puts $makeINC "COMMON_OPT = -O3 -march=native"
100            } else {
101                #Ensure to use the AVX-capable assembler
102                puts $makeINC "COMMON_OPT = -O3 -march=native \
103                    -specs=${prefix}/libexec/dragonegg/llvm33gcc48-integrated-as.specs"
104            }
105            puts $makeINC "COMMON_PROF = -pg"
106   
107            if {![variant_isset lapack]} {
108                puts $makeINC "NO_LAPACK = 1"
109            }
110            if {![variant_isset clang]} {
111                puts $makeINC "NO_AVX = 1"
112            }
113            close $makeINC
114        }
115    } else {
116        set makeINC [open ${worksrcpath}/Makefile.rule "w"]
117        puts $makeINC "VERSION = ${version}"
118        puts $makeINC "LIBNAMESUFFIX = "
119
120        puts $makeINC "CC = ${configure.cc}"
121        puts $makeINC "FC = ${configure.fc}"
122
123        if {${build_arch} eq "x86_64" || ${build_arch} eq "ppc64"} {
124            puts $makeINC "BINARY = 64"
125        } else {
126            puts $makeINC "BINARY = 32"
127        }
128        if {![variant_isset clang]} {
129            puts $makeINC "COMMON_OPT = -O3 -march=native"
130        } else {
131            #Ensure to use the AVX-capable assembler
132            puts $makeINC "COMMON_OPT = -O3 -march=native \
133                -specs=${prefix}/libexec/dragonegg/llvm33gcc48-integrated-as.specs"
134        }       
135        puts $makeINC "COMMON_PROF = -pg"
136
137        if {![variant_isset lapack]} {
138            puts $makeINC "NO_LAPACK = 1"
139        }
140        if {![variant_isset clang]} {
141            puts $makeINC "NO_AVX = 1"
142        }
143        close $makeINC
144    }
145}
146#Using system ones as default is set to bin/gcc-ar which does not exist,
147#and using gcc-mp ones end up in an error about a missing plugin
148#(see ticket #38551 for example)
149build.args          "AR=/usr/bin/ar RANLIB=/usr/bin/ranlib"
150destroot.args       "PREFIX=${prefix}"
151
152post-destroot {
153    #Avoid conflict with Atlas
154    move ${destroot}${prefix}/include/cblas.h \
155        ${destroot}${prefix}/include/cblas_openblas.h
156    #Correct library name
157    system "install_name_tool -id \
158        ${prefix}/lib/libopenblas-r${version}.dylib \
159        ${destroot}${prefix}/lib/libopenblas-r${version}.dylib"
160    if {[variant_isset lapack]} {
161        #Install lapacke headers too
162        xinstall -m 755 ${worksrcpath}/lapack-netlib/lapacke/include/lapacke_config.h \
163            ${destroot}/${prefix}/include/lapacke_config.h
164        xinstall -m 755 ${worksrcpath}/lapack-netlib/lapacke/include/lapacke_mangling.h \
165            ${destroot}/${prefix}/include/lapacke_mangling.h
166        xinstall -m 755 ${worksrcpath}/lapack-netlib/lapacke/include/lapacke_utils.h \
167            ${destroot}/${prefix}/include/lapacke_utils.h
168        xinstall -m 755 ${worksrcpath}/lapack-netlib/lapacke/include/lapacke.h \
169            ${destroot}/${prefix}/include/lapacke.h
170    }
171}
Note: See TracBrowser for help on using the repository browser.