source: trunk/dports/math/OpenBLAS-devel/Portfile @ 126722

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

OpenBLAS-devel: update to latest commit, reuse patch-linkLib

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