Ticket #11014: patch-SuiteSparse-Portfile

File patch-SuiteSparse-Portfile, 10.6 KB (added by namely_void@…, 18 years ago)

Patch for building SuiteSparse on powerpc

Line 
1diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/Portfile ./Portfile
2--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/Portfile      2006-11-08 04:32:46.000000000 +0200
3+++ ./Portfile  2006-11-20 10:03:54.000000000 +0200
4@@ -3,7 +3,7 @@
5 PortSystem 1.0
6 name           SuiteSparse
7 version                2.1.1
8-revision       0
9+revision       1
10 categories     math science
11 maintainers     andre@splunk.com
12 platforms      darwin
13@@ -20,18 +20,18 @@
14 
15 checksums      md5 bc01ef2f26e6ad3eed83b4ad62e46a68
16 
17+patchfiles     patch-complex-type \
18+               patch-size_t-fix \
19+               patch-powerpc-nanotime \
20+               patch-config \
21+               patch-macports-metis \
22+               patch-disable-demos
23+
24 use_configure  no
25 
26 pre-configure  {
27-               reinplace "s,#define SIZE_T_MAX ((size_t) (-1)),," ${worksrcpath}/AMD/Include/amd_internal.h
28-               reinplace "s,#define SIZE_T_MAX ((size_t) (-1)),," ${worksrcpath}/CAMD/Include/camd_internal.h
29                reinplace "s,METIS_PATH = ../../metis-4.0,METIS_PATH = ${prefix}/include," ${worksrcpath}/UFconfig/UFconfig.mk
30                reinplace "s,METIS = ../../metis-4.0/libmetis.a,METIS = ${prefix}/lib/libmetis.a," ${worksrcpath}/UFconfig/UFconfig.mk
31-               reinplace "s,BLAS = -lgoto -lgfortran,BLAS = -L${prefix}/lib -lblas," ${worksrcpath}/UFconfig/UFconfig.mk
32-               reinplace "s,-I\$(METIS_PATH)/Lib,-I\$(METIS_PATH)," ${worksrcpath}/CHOLMOD/Lib/Makefile
33-               reinplace "s,f77,gfortran-dp-4.2," ${worksrcpath}/CXSparse/Demo/Makefile
34-               reinplace "s,( cd metis-4.0 ; \$(MAKE) ),# ( cd metis-4.0 ; \$(MAKE) )," ${worksrcpath}/Makefile
35-               reinplace "s,#include \"metis.h\",#include \"metis/metis.h\"," ${worksrcpath}/CHOLMOD/Partition/cholmod_metis.c
36 }
37 
38 build.target   default
39diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-complex-type ./files/patch-complex-type
40--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-complex-type      1970-01-01 02:00:00.000000000 +0200
41+++ ./files/patch-complex-type  2006-11-20 09:29:35.000000000 +0200
42@@ -0,0 +1,23 @@
43+diff -Nru ../SuiteSparse/KLU/Include/klu_version.h ./KLU/Include/klu_version.h
44+--- ../SuiteSparse/KLU/Include/klu_version.h   2006-05-23 22:32:28.000000000 +0300
45++++ ./KLU/Include/klu_version.h        2006-11-20 09:18:27.000000000 +0200
46+@@ -203,6 +203,8 @@
47+
48+ */
49+
50++#include <math.h>
51++#if !defined(__complex_t) /* Mac OS X PowerPC defines this */
52+ typedef struct
53+ {
54+     double component [2] ;    /* real and imaginary parts */
55+@@ -213,6 +215,10 @@
56+ #define Entry DoubleComplex
57+ #define Real component [0]
58+ #define Imag component [1]
59++#else
60++typedef struct __complex_s Unit ;
61++#define Entry __complex_t
62++#endif
63+
64+ /* for flop counts */
65+ #define MULTSUB_FLOPS 8.      /* c -= a*b */
66diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-config ./files/patch-config
67--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-config    1970-01-01 02:00:00.000000000 +0200
68+++ ./files/patch-config        2006-11-20 09:31:53.000000000 +0200
69@@ -0,0 +1,14 @@
70+diff -Nru ../SuiteSparse/UFconfig/UFconfig.mk ./UFconfig/UFconfig.mk
71+--- ../SuiteSparse/UFconfig/UFconfig.mk        2006-09-11 21:23:15.000000000 +0300
72++++ ./UFconfig/UFconfig.mk     2006-11-20 09:13:02.000000000 +0200
73+@@ -77,8 +77,8 @@
74+ # These settings will probably not work, since there is no fixed convention for
75+ # naming the BLAS and LAPACK library (*.a or *.so) files.  Assume the Goto
76+ # BLAS are available.
77+-BLAS = -lgoto -lgfortran
78+-LAPACK = -llapack
79++BLAS = -framework Accelerate
80++LAPACK = -framework Accelerate
81+
82+ # The BLAS might not contain xerbla, an error-handling routine for LAPACK and
83+ # the BLAS.  Also, the standard xerbla requires the Fortran I/O library, and
84diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-disable-demos ./files/patch-disable-demos
85--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-disable-demos     1970-01-01 02:00:00.000000000 +0200
86+++ ./files/patch-disable-demos 2006-11-20 10:03:16.000000000 +0200
87@@ -0,0 +1,22 @@
88+diff -Nru ../SuiteSparse/CSparse/Makefile ./CSparse/Makefile
89+--- ../SuiteSparse/CSparse/Makefile    2006-03-03 15:25:21.000000000 +0200
90++++ ./CSparse/Makefile 2006-11-20 09:25:10.000000000 +0200
91+@@ -2,7 +2,6 @@
92+
93+ C:
94+       ( cd Source ; $(MAKE) )
95+-      ( cd Demo ; $(MAKE) )
96+
97+ all: C tcov
98+
99+diff -Nru ../SuiteSparse/CXSparse/Makefile ./CXSparse/Makefile
100+--- ../SuiteSparse/CXSparse/Makefile   2006-03-03 15:35:33.000000000 +0200
101++++ ./CXSparse/Makefile        2006-11-20 09:25:24.000000000 +0200
102+@@ -2,7 +2,6 @@
103+
104+ C:
105+       ( cd Source ; $(MAKE) )
106+-      ( cd Demo ; $(MAKE) )
107+
108+ all: C tcov
109+
110diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-macports-metis ./files/patch-macports-metis
111--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-macports-metis    1970-01-01 02:00:00.000000000 +0200
112+++ ./files/patch-macports-metis        2006-11-20 09:30:37.000000000 +0200
113@@ -0,0 +1,54 @@
114+diff -Nru ../SuiteSparse/CHOLMOD/Lib/Makefile ./CHOLMOD/Lib/Makefile
115+--- ../SuiteSparse/CHOLMOD/Lib/Makefile        2006-08-25 16:44:11.000000000 +0300
116++++ ./CHOLMOD/Lib/Makefile     2006-11-20 09:08:00.000000000 +0200
117+@@ -116,7 +116,7 @@
118+ $(OBJ): $(INC)
119+
120+ I = -I../../AMD/Include -I../../AMD/Source -I../../COLAMD \
121+-      -I$(METIS_PATH)/Lib -I../../CCOLAMD -I../../CAMD/Include -I../Include \
122++      -I$(METIS_PATH) -I../../CCOLAMD -I../../CAMD/Include -I../Include \
123+       -I../../UFconfig
124+
125+
126+diff -Nru ../SuiteSparse/CHOLMOD/Partition/cholmod_metis.c ./CHOLMOD/Partition/cholmod_metis.c
127+--- ../SuiteSparse/CHOLMOD/Partition/cholmod_metis.c   2006-08-25 20:15:55.000000000 +0300
128++++ ./CHOLMOD/Partition/cholmod_metis.c        2006-11-20 09:08:48.000000000 +0200
129+@@ -46,7 +46,7 @@
130+
131+ #ifndef NPARTITION
132+
133+-#include "metis.h"
134++#include <metis/metis.h>
135+ /* METIS has its own ASSERT that it reveals to the user, so remove it here: */
136+ #undef ASSERT
137+
138+diff -Nru ../SuiteSparse/Makefile ./Makefile
139+--- ../SuiteSparse/Makefile    2006-07-27 22:49:43.000000000 +0300
140++++ ./Makefile 2006-11-20 09:12:01.000000000 +0200
141+@@ -19,7 +19,7 @@
142+       ( cd CSparse ; $(MAKE) )
143+       ( cd CXSparse ; $(MAKE) )
144+ #     ( cd LPDASA ; $(MAKE) )
145+-      ( cd metis-4.0 ; $(MAKE) )
146++#     ( cd metis-4.0 ; $(MAKE) )
147+ #     ( cd PARAKLETE ; $(MAKE) )
148+
149+ library: default
150+@@ -52,7 +52,7 @@
151+       ( cd CSparse ; $(MAKE) purge )
152+       ( cd CXSparse ; $(MAKE) purge )
153+ #     ( cd LPDASA ; $(MAKE) purge )
154+-      ( cd metis-4.0 ; $(MAKE) realclean )
155++#     ( cd metis-4.0 ; $(MAKE) realclean )
156+ #     ( cd PARAKLETE ; $(MAKE) purge )
157+
158+ # Remove all files not in the original distribution, but keep the libraries
159+@@ -70,7 +70,7 @@
160+       ( cd CSparse ; $(MAKE) clean )
161+       ( cd CXSparse ; $(MAKE) clean )
162+ #     ( cd LPDASA ; $(MAKE) clean )
163+-      ( cd metis-4.0 ; $(MAKE) clean )
164++#     ( cd metis-4.0 ; $(MAKE) clean )
165+ #     ( cd PARAKLETE ; $(MAKE) clean )
166+
167+ distclean: purge
168diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-powerpc-nanotime ./files/patch-powerpc-nanotime
169--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-powerpc-nanotime  1970-01-01 02:00:00.000000000 +0200
170+++ ./files/patch-powerpc-nanotime      2006-11-20 10:06:49.000000000 +0200
171@@ -0,0 +1,57 @@
172+diff -Nru ../SuiteSparse/KLU/Demo/dsecnd.c ./KLU/Demo/dsecnd.c
173+--- ../SuiteSparse/KLU/Demo/dsecnd.c   2006-05-02 02:35:44.000000000 +0300
174++++ ./KLU/Demo/dsecnd.c        2006-11-20 09:48:01.000000000 +0200
175+@@ -2,13 +2,29 @@
176+
177+ /* from http://www.ncsa.uiuc.edu/UserInfo/Resources/Hardware/IA32LinuxCluster/Doc/timing.html */
178+
179++#ifdef __POWERPC__
180++unsigned long long int nanotime_powerpc(void)
181++{
182++    unsigned long lo, hi, hi2;
183++    __asm__ __volatile__("1:  mftbu  %0\n"
184++                         "    mftb   %1\n"
185++                         "    mftbu  %2\n"
186++                         "    cmpw   %2,%0\n"
187++                         "    bne-   1b\n"
188++                         : "=r" (hi),
189++                           "=r" (lo), "=r" (hi2));
190++    return ((unsigned long long int)hi << 32) | lo;
191++}
192++#else
193+ unsigned long long int nanotime_ia32(void)
194+ {
195+     unsigned long long int val;
196+     __asm__ __volatile__("rdtsc" : "=A" (val) : );
197+     return(val);
198+ }
199++#endif
200+
201++/* #define SPARSE    33333333 */        /* Apple PowerPC */
202+ #define SPARSE    3192963000.         /* persimmon */
203+ /* #define SPARSE 1994171000. */      /* Dell Latitude C840 ("sparse") */
204+ /* #define SPARSE 1395738000. */      /* IBM Thinkpad */
205+@@ -21,7 +37,11 @@
206+
207+ double dsecnd_ (void) /* Include an '_' if you will be calling from Fortan */
208+ {
209++#ifdef __POWERPC__
210++    return (((double) nanotime_powerpc ( )) / SPARSE) ;
211++#else
212+     return (((double) nanotime_ia32 ( )) / SPARSE) ;
213++#endif
214+ }
215+
216+
217+diff -Nru ../SuiteSparse/KLU/Demo/dsecnd.h ./KLU/Demo/dsecnd.h
218+--- ../SuiteSparse/KLU/Demo/dsecnd.h   2004-07-02 00:28:24.000000000 +0300
219++++ ./KLU/Demo/dsecnd.h        2006-11-20 09:44:20.000000000 +0200
220+@@ -1,3 +1,7 @@
221++#ifdef __POWERPC__
222++unsigned long long int nanotime_powerpc (void) ;
223++#else
224+ unsigned long long int nanotime_ia32 (void) ;
225++#endif
226+ double dsecnd_ (void) ;
227+
228+
229diff -Nru /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-size_t-fix ./files/patch-size_t-fix
230--- /opt/local/var/db/dports/sources/rsync.rsync.darwinports.org_dpupdate_dports/math/SuiteSparse/files/patch-size_t-fix        1970-01-01 02:00:00.000000000 +0200
231+++ ./files/patch-size_t-fix    2006-11-20 09:28:08.000000000 +0200
232@@ -0,0 +1,26 @@
233+diff -Nru ../SuiteSparse/AMD/Include/amd_internal.h ./AMD/Include/amd_internal.h
234+--- ../SuiteSparse/AMD/Include/amd_internal.h  2006-05-02 14:11:29.000000000 +0300
235++++ ./AMD/Include/amd_internal.h       2006-11-20 09:06:31.000000000 +0200
236+@@ -153,7 +153,9 @@
237+ #define NULL 0
238+
239+ /* largest value of size_t */
240++#ifndef SIZE_T_MAX
241+ #define SIZE_T_MAX ((size_t) (-1))
242++#endif
243+
244+ /* ------------------------------------------------------------------------- */
245+ /* integer type for AMD: int or UF_long */
246+diff -Nru ../SuiteSparse/CAMD/Include/camd_internal.h ./CAMD/Include/camd_internal.h
247+--- ../SuiteSparse/CAMD/Include/camd_internal.h        2006-06-28 00:43:39.000000000 +0300
248++++ ./CAMD/Include/camd_internal.h     2006-11-20 09:07:07.000000000 +0200
249+@@ -154,7 +154,9 @@
250+ #define NULL 0
251+
252+ /* largest value of size_t */
253++#ifndef SIZE_T_MAX
254+ #define SIZE_T_MAX ((size_t) (-1))
255++#endif
256+
257+ /* ------------------------------------------------------------------------- */
258+ /* integer type for CAMD: int or UF_long */