Ticket #35595: Portfile

File Portfile, 4.3 KB (added by jerahmie@…, 12 years ago)
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 93792 2012-05-31 09:18:09Z and.damore@macports.org $
3
4PortSystem                      1.0
5PortGroup           muniversal 1.0
6
7name                qrupdate
8version             1.1.2
9revision            1
10# upstream follows a weird folder naming policy, we need last two digits of version separated by a dot
11set branch          [join [lrange [split ${version} .] 1 2] .]
12categories          math
13license             GPL-3+
14maintainers         nomaintainer
15description         library for fast updates of QR and Cholesky decompositions
16long_description \
17    a Fortran library for fast updates of QR and Cholesky decompositions
18homepage            http://sourceforge.net/projects/${name}/
19platforms           darwin
20master_sites        sourceforge:project/qrupdate/qrupdate/${branch}
21
22checksums           rmd160  9d23b2d13278c335f6208ebb6775df4b4049785c \
23                    sha256  e2a1c711dc8ebc418e21195833814cb2f84b878b90a2774365f0166402308e08
24
25use_configure       no
26build.target        lib solib
27
28build.args          PREFIX=${prefix}
29destroot.args       PREFIX=${prefix}
30test.args           PREFIX=${prefix}
31
32patchfiles          patch-Makefile.diff
33
34post-patch {
35    # Mac install program does not support -D flag.
36    reinplace "s|install -D|install|"  ${worksrcpath}/src/Makefile
37
38    # Running ranlib on static libraries make universal builds a little more complicated.
39    reinplace "s|ar -cr |libtool -o |"  ${worksrcpath}/src/Makefile
40}
41
42# Fortran compilers can not cross-compile
43if { ${os.arch}=="i386" } {
44    set universal_archs_supported "i386 x86_64"
45} else {
46    set universal_archs_supported "ppc ppc64"
47}
48
49post-configure {
50    if { ! [variant_isset universal] } {
51        if { ${build_arch} == "x86_64" || ${build_arch} == "ppc64" } {
52            reinplace "s|^FFLAGS=|FFLAGS=-m64 |"  ${worksrcpath}/Makeconf
53        } else {
54            reinplace "s|^FFLAGS=|FFLAGS=-m32 |"  ${worksrcpath}/Makeconf
55        }
56    } else {
57        foreach arch ${universal_archs_to_use} {
58            if { ${arch}=="x86_64" || ${arch}=="ppc64" } {
59                reinplace "s|^FFLAGS=|FFLAGS=-m64 |"  ${worksrcpath}-${arch}/Makeconf
60            } else {
61                reinplace "s|^FFLAGS=|FFLAGS=-m32 |"  ${worksrcpath}-${arch}/Makeconf
62            }
63        }
64    }
65}
66
67
68variant no_atlas description {Legacy compatibility variant} {}
69
70variant atlas description {build with atlas instead of Accelerate framework} {
71    depends_lib-append      port:atlas
72    build.args-append       BLAS="-L${prefix}/lib -latlas" LAPACK="-L${prefix}/lib -llapack"
73    destroot.args-append    BLAS="-L${prefix}/lib -latlas" LAPACK="-L${prefix}/lib -llapack"
74    test.args-append        BLAS="-L${prefix}/lib -latlas" LAPACK="-L${prefix}/lib -llapack"
75}
76if {![variant_isset atlas]} {
77    build.args-append       BLAS="-framework Accelerate" LAPACK="-framework Accelerate"
78    destroot.args-append    BLAS="-framework Accelerate" LAPACK="-framework Accelerate"
79    test.args-append        BLAS="-framework Accelerate" LAPACK="-framework Accelerate"
80}
81
82if {[variant_isset g95] || [variant_isset no_atlas]} {
83    default_variants -atlas
84} else {
85    default_variants +atlas
86}
87
88
89variant g95 conflicts gcc45 gcc46 gcc47 universal description {build with g95} {
90    depends_build-append    port:g95
91    post-patch {
92        reinplace "s|Makeconf|Makeconf.g95|" ${worksrcpath}/Makefile
93        reinplace "s|Makeconf|Makeconf.g95|" ${worksrcpath}/src/Makefile
94    }
95}
96
97variant gcc45 conflicts g95 gcc46 gcc47 universal description {build with gcc45 fortran} {
98    depends_lib-append    port:gcc45
99    post-patch {
100        reinplace "s|gfortran|gfortran-mp-4.5|" ${worksrcpath}/Makeconf
101    }
102}
103
104variant gcc46 conflicts g95 gcc45 gcc47 description {build with gcc46 fortran} {
105    depends_lib-append    port:gcc46
106    post-patch {
107        reinplace "s|gfortran|gfortran-mp-4.6|" ${worksrcpath}/Makeconf
108    }
109}
110
111variant gcc47 conflicts g95 gcc45 gcc46 description {build with gcc47 fortran} {
112    depends_lib-append    port:gcc47
113    post-patch {
114        reinplace "s|gfortran|gfortran-mp-4.7|" ${worksrcpath}/Makeconf
115    }
116}
117
118if {![variant_isset gcc46] && ![variant_isset gcc47] \
119        && ![variant_isset g95]} {
120    default_variants +gcc45
121}
122
123
124test.run yes