Ticket #28288: Portfile

File Portfile, 4.7 KB (added by Veence (Vincent), 14 years ago)

Portfile

Line 
1# $Id: Portfile 75415 2011-01-24 18:40:37Z jmr@macports.org $
2
3PortSystem 1.0
4
5name            SuiteSparse
6version     3.6.0
7categories      math science
8maintainers     stechert
9platforms       darwin
10description     Sparse matrix routines
11long_description \
12                SuiteSparse is a single archive that contains all packages \
13                authored by Tim Davis.
14
15homepage        http://www.cise.ufl.edu/research/sparse/SuiteSparse/
16master_sites    http://www.cise.ufl.edu/research/sparse/SuiteSparse/
17distname        SuiteSparse-$version
18worksrcdir      ${name}
19
20depends_build   port:metis \
21                                port:atlas
22
23use_parallel_build      no
24
25patchfiles                      patch_UFconfig_makefile.diff
26
27# cflags recommended for Macs in ${worksrcpath}/UFconfig/UFconfig.mk
28configure.cflags -O3 -fno-common -no-cpp-precomp -fexceptions
29
30use_configure   no
31build.target
32
33checksums           md5     8ccb9e90b478b5d55b1d9a794e8ed676 \
34                    sha1    bc430a051de5681d31f819b40b7f0ea0be178e04 \
35                    rmd160  019a974113a74cc091f5497c9117499956233229
36
37variant universal {}
38if {[variant_isset universal]} {
39    append configure.cflags " " ${configure.universal_cflags}
40    append configure.cxxflags " " ${configure.universal_cxxflags}
41} else {
42    append configure.cflags " " ${configure.cc_archflags}
43}
44
45variant gcc45 {
46
47        depends_build-append    port:gcc45
48        configure.cflags-delete -no-cpp-precomp
49}
50
51post-patch {
52        # Metis is included with SuiteSparse, but we want to use
53        #   the MacPorts version
54       
55        # -I$(METIS_PATH)/Lib -> -I$(METIS_PATH)/include
56        reinplace \
57                "s|-I\$(METIS_PATH)/Lib|-I\$(METIS_PATH)/include|g" \
58                ${worksrcpath}/CHOLMOD/Lib/Makefile
59       
60        # #include "metis.h" -> #include <metis/metis.h>
61        reinplace \
62                "s|#include \"metis.h\"|#include <metis/metis.h>|g" \
63                ${worksrcpath}/CHOLMOD/Partition/cholmod_metis.c
64       
65        # klu_version.h defines Real and Imag which conflicts with math.h on ppc
66        reinplace -E \
67                "s|(\[^a-zA-Z\])Real(\[^a-zA-Z\])|\\1RealPart\\2|g" \
68                ${worksrcpath}/KLU/Include/klu_version.h
69        reinplace -E \
70                "s|(\[^a-zA-Z\])Imag(\[^a-zA-Z\])|\\1ImagPart\\2|g" \
71                ${worksrcpath}/KLU/Include/klu_version.h
72        # ranlib after ar
73        reinplace "s|ccolamd_global\.o|ccolamd_global.o\\
74        - \$(RANLIB) libccolamd.a|" ${worksrcpath}/CCOLAMD/Lib/Makefile
75        reinplace "s|colamd_global\.o|colamd_global.o\\
76        - \$(RANLIB) libcolamd.a|" ${worksrcpath}/COLAMD/Lib/Makefile
77}
78
79post-configure  {
80        # SuiteSparse does not use configure, so the variables must be
81        #    set manually.
82        # This is done in post-configure so that ${configure.cc} is
83        #    set to its default value.
84       
85        if {[variant_isset gcc45]} {
86                file copy ${filespath}/c-wrapper-template ${worksrcpath}/c-wrapper
87                file copy ${filespath}/c-wrapper-template ${worksrcpath}/cxx-wrapper
88               
89                reinplace "s|@@@|${prefix}/bin/gcc-mp-4.5|" ${worksrcpath}/c-wrapper
90                reinplace "s|&&&|\\\\.c|" ${worksrcpath}/c-wrapper
91               
92                reinplace "s|@@@|${prefix}/bin/g++-mp-4.5|" ${worksrcpath}/cxx-wrapper
93                reinplace "s|&&&|\\\\.cpp|" ${worksrcpath}/cxx-wrapper
94               
95                set configure.cc        ${worksrcpath}/c-wrapper
96                set configure.cxx       ${worksrcpath}/cxx-wrapper
97        }
98       
99        reinplace -E \
100                "s|^CC = .*$|CC = ${configure.cc}|g" \
101                ${worksrcpath}/UFconfig/UFconfig.mk \
102                ${worksrcpath}/CSparse/Demo/Makefile \
103                ${worksrcpath}/CSparse/Lib/Makefile
104        reinplace -E \
105                "s|^CPLUSPLUS = .*$|CPLUSPLUS = ${configure.cxx}|g" \
106                ${worksrcpath}/UFconfig/UFconfig.mk
107        reinplace -E \
108                "s|^CFLAGS = .*$|CFLAGS = ${configure.cflags}|g" \
109                ${worksrcpath}/UFconfig/UFconfig.mk
110        reinplace -E \
111                "s|^CFLAGS = -O|CFLAGS = ${configure.cflags}|g" \
112                ${worksrcpath}/CSparse/Demo/Makefile \
113                ${worksrcpath}/CSparse/Lib/Makefile
114               
115        if {[file exists ${prefix}/lib/libptcblas.dylib]} {
116                reinplace -E \
117                        "s|^BLAS = .*$|BLAS = -lptf77blas|g" \
118                        ${worksrcpath}/UFconfig/UFconfig.mk
119        } else {
120                reinplace -E \
121                        "s|^BLAS = .*$|BLAS = -lcblas|g" \
122                        ${worksrcpath}/UFconfig/UFconfig.mk
123        }
124       
125        reinplace -E \
126                "s|^LAPACK = .*$|LAPACK = -llapack|g" \
127                ${worksrcpath}/UFconfig/UFconfig.mk
128        reinplace -E \
129                "s|^METIS_PATH = .*$|METIS_PATH = ${prefix}|g" \
130                ${worksrcpath}/UFconfig/UFconfig.mk
131        reinplace -E \
132                "s|^METIS = .*$|METIS = ${prefix}/lib/libmetis.a|g" \
133                ${worksrcpath}/UFconfig/UFconfig.mk
134        reinplace "s|(CC)|(CC) \$(CFLAGS)|" ${worksrcpath}/CXSparse/Demo/Makefile
135}
136
137destroot        {
138        # SuiteSparse does not support "make install"
139       
140        eval xinstall -m 644 \
141                [glob ${worksrcpath}/*/Lib/*.a] \
142                ${destroot}${prefix}/lib
143       
144        xinstall -m 755 -d ${destroot}${prefix}/include/ufsparse
145        eval xinstall -m 644 \
146                [glob ${worksrcpath}/*/Include/*.h] \
147                ${worksrcpath}/UFconfig/UFconfig.h \
148                ${destroot}${prefix}/include/ufsparse
149       
150        xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
151        eval xinstall -m 644 \
152                [glob ${worksrcpath}/*/Doc/*.pdf] \
153                ${destroot}${prefix}/share/doc/${name}
154}
155
156livecheck.type  regex
157livecheck.regex ${name}-(\\d+(\\.\\d+)*)${extract.suffix}