Ticket #13814: patch.fftw3

File patch.fftw3, 2.5 KB (added by Veence (Vincent), 15 years ago)

patch for universal variant of fftw-3

Line 
1--- /usr/pkg/var/macports/sources/rsync.macports.org/release/ports/math/fftw-3/Portfile 2008-11-16 06:33:48.000000000 +0100
2+++ Portfile_fftw3_universal    2008-12-10 11:09:39.000000000 +0100
3@@ -50,7 +50,7 @@
4 test.run     yes
5 test.target  check
6 
7-universal_variant no
8+universal_variant yes
9 use_parallel_build yes
10 
11 variant gcc42 description {create Fortran wrappers using gcc42} conflicts gcc43 g95 {
12@@ -71,6 +71,70 @@
13        configure.args-delete --disable-fortran
14 }
15 
16+if {![info exists universal_archs]} {
17+    set universal_archs {i386 x86_64 ppc ppc64}
18+}
19+set first_arch [lindex ${universal_archs} 0]
20+
21+set my_worksrcpaths ${worksrcpath}
22+
23+variant universal {
24+       set my_worksrcpaths {}
25+       foreach arch ${universal_archs} {
26+               lappend my_worksrcpaths ${workpath}/${arch}
27+       }
28+
29+       post-patch {
30+               foreach arch ${universal_archs} {
31+                       if {[string equal ${arch} ${first_arch}]} {
32+                               move ${worksrcpath} ${workpath}/${first_arch}
33+                       } else {
34+                               copy ${workpath}/${first_arch} ${workpath}/${arch}
35+                       }
36+               }
37+       }
38+   
39+       configure {
40+               foreach arch ${universal_archs} {
41+                       set my_arch_flag "-arch ${arch}"
42+                       set my_cflags "${configure.cflags} -isysroot ${sysroot} ${my_arch_flag}"
43+                       set my_ldflags "${configure.ldflags} ${my_arch_flag}"
44+                       system "cd ${workpath}/${arch} && CFLAGS=\"${my_cflags}\" CXXFLAGS=\"${my_cflags}\" LDFLAGS=\"${my_ldflags}\" ${configure.cmd} ${configure.pre_args} ${configure.args}"
45+               }
46+       }
47+   
48+       build {
49+               foreach arch ${universal_archs} {
50+                       system "cd ${workpath}/${arch} && ${build.cmd} ${build.pre_args}"
51+       }
52+       }
53+
54+       destroot {
55+               system "cd ${workpath}/${first_arch} && ${destroot.cmd} ${destroot.pre_args} ${destroot.post_args}"
56+               foreach lib {libfftw3.3.dylib libfftw3.a} {
57+                       set output_lib ${destroot}${prefix}/lib/${lib}
58+                       set lipo_args {}
59+                       foreach arch ${universal_archs} {
60+                               lappend lipo_args -arch ${arch} ${workpath}/${arch}/.libs/${lib}
61+                       }
62+                       lappend lipo_args -create -output ${output_lib}
63+                       delete ${output_lib}
64+                       system "lipo ${lipo_args}"
65+               }
66+
67+               foreach lib {libfftw3_threads.3.dylib libfftw3_threads.a} {
68+                       set output_lib ${destroot}${prefix}/lib/${lib}
69+                       set lipo_args {}
70+                       foreach arch ${universal_archs} {
71+                               lappend lipo_args -arch ${arch} ${workpath}/${arch}/threads/.libs/${lib}
72+                       }
73+                       lappend lipo_args -create -output ${output_lib}
74+                       delete ${output_lib}
75+                       system "lipo ${lipo_args}"
76+               }
77+       }
78+}
79+
80 livecheck.check regex
81 livecheck.url   ${homepage}
82-livecheck.regex {FFTW (\d+(?:\.\d+)*) is the latest}
83+livecheck.regex {FFTW (\d+(?:\.\d+)*) is the latest}
84\ No newline at end of file