1 | # $Id: Portfile 80831 2011-07-18 20:47:54Z jmr@macports.org $ |
---|
2 | |
---|
3 | PortSystem 1.0 |
---|
4 | PortGroup muniversal 1.0 |
---|
5 | |
---|
6 | categories math |
---|
7 | license BSD |
---|
8 | name atlas |
---|
9 | version 3.9.37 |
---|
10 | #revision 4 |
---|
11 | |
---|
12 | # additional versions |
---|
13 | set lapackversion 3.3.0 |
---|
14 | set lapackname lapack |
---|
15 | set atlasdist ${name}${version}.tar.bz2 |
---|
16 | set lapackdist ${lapackname}-${lapackversion}.tgz |
---|
17 | |
---|
18 | maintainers jameskyle |
---|
19 | platforms darwin |
---|
20 | |
---|
21 | description Portable optimal linear algebra software |
---|
22 | long_description The current version provides a complete BLAS and LAPACK API.\ |
---|
23 | For many operations, ATLAS achieves performance on par with\ |
---|
24 | machine-specific tuned libraries. |
---|
25 | |
---|
26 | homepage http://math-atlas.sourceforge.net/ |
---|
27 | |
---|
28 | master_sites sourceforge:math-atlas:atlas \ |
---|
29 | http://www.netlib.org/lapack:lapack |
---|
30 | |
---|
31 | distfiles ${atlasdist}:atlas \ |
---|
32 | ${lapackdist}:lapack |
---|
33 | |
---|
34 | patchfiles patch-SpewMakeInc.c.diff \ |
---|
35 | patch-emit_mm_c.diff \ |
---|
36 | patch-archinfo_freebsd_c.diff |
---|
37 | |
---|
38 | checksums atlas${version}.tar.bz2 \ |
---|
39 | sha1 71dd254dad1fc9ad3dec123a561706c9a1a5d7d1 \ |
---|
40 | rmd160 87bb689e7a956df74ea4091552ac3cfd30430093 \ |
---|
41 | lapack-${lapackversion}.tgz \ |
---|
42 | md5 84213fca70936cc5f1b59a7b1bf71697 \ |
---|
43 | sha1 4f0b103da52110e7f60d1d7676727103aca9785e \ |
---|
44 | rmd160 cc72e7c93ab13464fd892d684b00b910cbbd3b3e |
---|
45 | |
---|
46 | |
---|
47 | use_parallel_build no |
---|
48 | build.target build |
---|
49 | build.dir ${workpath}/${name}-${version}/build |
---|
50 | |
---|
51 | variant gcc45 conflicts gcc42 gcc43 gcc44 description {build using macports-gcc-4.5} {} |
---|
52 | variant gcc44 conflicts gcc42 gcc43 description {build using macports-gcc-4.4} {} |
---|
53 | variant gcc43 conflicts gcc42 gcc44 conflicts universal description {build using macports-gcc-4.3} {} |
---|
54 | variant gcc42 conflicts gcc43 gcc44 conflicts universal description {build using macports-gcc-4.2} {} |
---|
55 | |
---|
56 | if { [variant_isset gcc42] } { |
---|
57 | set gccversion 4.2 |
---|
58 | } elseif { [variant_isset gcc43] } { |
---|
59 | set gccversion 4.3 |
---|
60 | } elseif { [variant_isset gcc45 ] } { |
---|
61 | set gccversion 4.5 |
---|
62 | } else { |
---|
63 | default_variants +gcc44 |
---|
64 | set gccversion 4.4 |
---|
65 | } |
---|
66 | |
---|
67 | set gccnumber [join [split ${gccversion} .] ""] |
---|
68 | |
---|
69 | destroot.dir ${build.dir} |
---|
70 | destroot.destdir DESTDIR=${destroot}${prefix} |
---|
71 | depends_lib port:gcc${gccnumber} \ |
---|
72 | port:bzip2 \ |
---|
73 | port:gzip |
---|
74 | |
---|
75 | if {[info exists depends_skip_archcheck]} { |
---|
76 | depends_skip_archcheck gcc${gccnumber} |
---|
77 | } |
---|
78 | |
---|
79 | configure.compiler macports-gcc-${gccversion} |
---|
80 | |
---|
81 | if { ${os.arch}=="i386" } { |
---|
82 | set universal_archs_supported { i386 x86_64 } |
---|
83 | } else { |
---|
84 | set universal_archs_supported { ppc ppc64 } |
---|
85 | } |
---|
86 | |
---|
87 | if {${build_arch} == "x86_64" || ${build_arch} == "ppc64" } { |
---|
88 | set my_arch 64 |
---|
89 | } else { |
---|
90 | set my_arch 32 |
---|
91 | } |
---|
92 | |
---|
93 | configure.args -C xc ${configure.cc} \ |
---|
94 | -C gc ${configure.cc} \ |
---|
95 | -C if ${configure.f77} \ |
---|
96 | -C ic ${configure.cc} \ |
---|
97 | -C dm ${configure.cc} \ |
---|
98 | -C sm ${configure.cc} \ |
---|
99 | -C dk ${configure.cc} \ |
---|
100 | -C sk ${configure.cc} \ |
---|
101 | --cc=${configure.cc} \ |
---|
102 | --with-netlib-lapack-tarfile=${distpath}/${lapackdist} \ |
---|
103 | -O 12 \ |
---|
104 | -b ${my_arch} \ |
---|
105 | -Fa alg -fPIC |
---|
106 | |
---|
107 | # At this point, no threading for ppc/ppc64 |
---|
108 | |
---|
109 | if {${build_arch} == "ppc" || ${build_arch} == "ppc64"} { |
---|
110 | configure.args-append -t 0 |
---|
111 | } |
---|
112 | |
---|
113 | # MacPorts defaults to ppc on G4 and G5, so we must override 64-bit detection |
---|
114 | # by Atlas, even if we are on a G5 |
---|
115 | |
---|
116 | if {${build_arch} == "ppc" && ! [variant_isset universal]} { |
---|
117 | configure.args-delete --cc=${configure.cc} \ |
---|
118 | -Fa alg -fPIC |
---|
119 | |
---|
120 | configure.args-append --cc='${configure.cc} -m32' \ |
---|
121 | -A 4 \ |
---|
122 | -Fa alg '-fPIC -m32' |
---|
123 | |
---|
124 | # On Leopard, we may warn the user that ppc is not as efficient as ppc64 |
---|
125 | if {${os.major} == 9} { |
---|
126 | if {[exec sysctl -n hw.cpu64bit_capable] == 1} { |
---|
127 | ui_msg "--- Compiling for G4 arch (ppc) on a G5 (ppc64) machine." |
---|
128 | ui_msg "--- This will lead to inferior performance." |
---|
129 | } |
---|
130 | } |
---|
131 | } |
---|
132 | |
---|
133 | if { [variant_isset universal] } { |
---|
134 | configure.universal_args-delete --disable-dependency-tracking |
---|
135 | configure.args-delete --cc=${configure.cc} \ |
---|
136 | -b ${my_arch} \ |
---|
137 | -Fa alg -fPIC |
---|
138 | |
---|
139 | lappend merger_configure_args(ppc) --cc='${configure.cc} -m32' \ |
---|
140 | -b 32 \ |
---|
141 | -A 4 \ |
---|
142 | -t 0 \ |
---|
143 | -s gas_ppc \ |
---|
144 | -Fa alg '-fPIC -m32' |
---|
145 | lappend merger_configure_args(ppc64) --cc='${configure.cc} -m64' \ |
---|
146 | -b 64 \ |
---|
147 | -A 5 \ |
---|
148 | -t 0 \ |
---|
149 | -s gas_ppc \ |
---|
150 | -Fa alg '-fPIC -m64' |
---|
151 | lappend merger_configure_args(i386) --cc='${configure.cc} -m32' \ |
---|
152 | -b 32 \ |
---|
153 | -s gas_x86_32 \ |
---|
154 | -Fa alg '-fPIC -m32' |
---|
155 | lappend merger_configure_args(x86_64) --cc='${configure.cc} -m64' \ |
---|
156 | -b 64 \ |
---|
157 | -s gas_x86_64 \ |
---|
158 | -Fa alg '-fPIC -m64' |
---|
159 | } else { |
---|
160 | lappend merger_configure_args(ppc) |
---|
161 | lappend merger_configure_args(ppc64) |
---|
162 | lappend merger_configure_args(i386) |
---|
163 | lappend merger_configure_args(x86_64) |
---|
164 | } |
---|
165 | |
---|
166 | build.env-append "CC=${configure.cc} CXX=${configure.cxx}" |
---|
167 | |
---|
168 | # we are configuring from the build directory |
---|
169 | configure.dir ${workpath}/${name}-${version}/build |
---|
170 | configure.cmd ../configure |
---|
171 | |
---|
172 | |
---|
173 | # change the default compilers to those of gcc and make into shared library |
---|
174 | extract { |
---|
175 | # extract atlas and move to a consistent working directory name |
---|
176 | system "cd ${workpath} && bunzip2 -dc ${distpath}/${atlasdist} | \ |
---|
177 | gnutar --no-same-owner -xf -" |
---|
178 | system "mv ${workpath}/ATLAS ${workpath}/${name}-${version}" |
---|
179 | } |
---|
180 | |
---|
181 | post-patch { |
---|
182 | reinplace "s|__MACPORTS_GCC__|${configure.cc}|g" \ |
---|
183 | ${workpath}/${name}-${version}/CONFIG/src/SpewMakeInc.c |
---|
184 | } |
---|
185 | |
---|
186 | # Bug in 3.9.37 |
---|
187 | proc bug3_9_37 {arch path} { |
---|
188 | switch ${arch} { |
---|
189 | |
---|
190 | x86_64 { |
---|
191 | reinplace -E \ |
---|
192 | "s|ATL_thread_exit.o ATL_thread_join.o|\ |
---|
193 | ATL_thread_exit.o ATL_thread_join.o\ |
---|
194 | ATL_DecAtomicCount_amd64.o|" ${path} |
---|
195 | } |
---|
196 | |
---|
197 | i386 { |
---|
198 | reinplace -E \ |
---|
199 | "s|ATL_thread_exit.o ATL_thread_join.o|\ |
---|
200 | ATL_thread_exit.o ATL_thread_join.o\ |
---|
201 | ATL_DecAtomicCount_ia32.o|" ${path} |
---|
202 | } |
---|
203 | |
---|
204 | ppc64 { |
---|
205 | reinplace -E \ |
---|
206 | "s|ATL_thread_exit.o ATL_thread_join.o|\ |
---|
207 | ATL_thread_exit.o ATL_thread_join.o\ |
---|
208 | ATL_DecAtomicCount_ppc.o|" ${path} |
---|
209 | } |
---|
210 | |
---|
211 | ppc { |
---|
212 | reinplace -E \ |
---|
213 | "s|ATL_thread_exit.o ATL_thread_join.o|\ |
---|
214 | ATL_thread_exit.o ATL_thread_join.o\ |
---|
215 | ATL_DecAtomicCount_ppc.o|" ${path} |
---|
216 | } |
---|
217 | } |
---|
218 | } |
---|
219 | |
---|
220 | pre-configure { |
---|
221 | if { [variant_isset universal] } { |
---|
222 | foreach arch ${universal_archs_to_use} { |
---|
223 | copy ${workpath}/${name}-${version} ${workpath}/${name}-${version}-${arch} |
---|
224 | } |
---|
225 | } |
---|
226 | |
---|
227 | reinplace "s|cc=gcc|cc=${configure.cc}|g" ${worksrcpath}/configure |
---|
228 | reinplace "s|-no-cpp-precomp||g" ${workpath}/${name}-${version}/CONFIG/src/atlcomp.txt |
---|
229 | |
---|
230 | # Get some system specific variables for maximum optimization |
---|
231 | set cpufreq [expr {[exec sysctl -n hw.cpufrequency]/1000000}] |
---|
232 | ui_debug "Setting CPU Frequency for: ${cpufreq}" |
---|
233 | |
---|
234 | if {[string equal "${os.arch}" "powerpc"]} { |
---|
235 | configure.args-append -D c -DWALL |
---|
236 | } else { |
---|
237 | configure.args-append -D c -DPentiumCPS=${cpufreq} |
---|
238 | } |
---|
239 | |
---|
240 | if { [variant_isset universal] } { |
---|
241 | set archs ${universal_archs_to_use} |
---|
242 | } else { |
---|
243 | set archs ${build_arch} |
---|
244 | } |
---|
245 | |
---|
246 | foreach arch ${archs} { |
---|
247 | |
---|
248 | if { ! [variant_isset universal] } { |
---|
249 | set atlas_path ${workpath}/${name}-${version} |
---|
250 | } else { |
---|
251 | set atlas_path ${workpath}/${name}-${version}-${arch} |
---|
252 | } |
---|
253 | |
---|
254 | file mkdir ${atlas_path}/build |
---|
255 | |
---|
256 | # Correct a bug in 3.9.37 |
---|
257 | set mkt ${atlas_path}/makes/Make.thr |
---|
258 | bug3_9_37 ${arch} ${mkt} |
---|
259 | } |
---|
260 | } |
---|
261 | |
---|
262 | post-configure { |
---|
263 | if { [variant_isset universal] } { |
---|
264 | set archs ${universal_archs_to_use} |
---|
265 | } else { |
---|
266 | set archs ${build_arch} |
---|
267 | } |
---|
268 | |
---|
269 | foreach arch ${archs} { |
---|
270 | if { ! [variant_isset universal] } { |
---|
271 | set atlas_path ${workpath}/${name}-${version} |
---|
272 | } else { |
---|
273 | set atlas_path ${workpath}/${name}-${version}-${arch} |
---|
274 | } |
---|
275 | |
---|
276 | # recursively remove directories |
---|
277 | ui_debug "reinplace for make to recursively remove directories on clean" |
---|
278 | reinplace "s|rm -f|rm -rf|g" ${atlas_path}/build/Makefile |
---|
279 | } |
---|
280 | } |
---|
281 | |
---|
282 | proc make_dylib { lib lib_dir arch libs } { |
---|
283 | global destroot prefix gccnumber |
---|
284 | system "cd ${lib_dir} && \ |
---|
285 | ( test ! -e ${lib}.a || \ |
---|
286 | /usr/bin/ld -arch ${arch} -dynamic -dylib -single_module -dead_strip \ |
---|
287 | -x -all_load -L. -L${prefix}/lib/gcc${gccnumber}/${arch} \ -L${prefix}/lib/gcc${gccnumber} -ldylib1.o \ |
---|
288 | -dylib_install_name ${prefix}/lib/${lib}.dylib \ |
---|
289 | ${lib}.a -o ${lib}.dylib ${libs} )" |
---|
290 | } |
---|
291 | |
---|
292 | post-build { |
---|
293 | # We have to manually create the dylib shared libs as the default build does not do this |
---|
294 | |
---|
295 | set ncpu [exec sysctl -n hw.ncpu] |
---|
296 | |
---|
297 | if { [variant_isset universal] } { |
---|
298 | set archs ${universal_archs_to_use} |
---|
299 | } else { |
---|
300 | set archs ${build_arch} |
---|
301 | } |
---|
302 | |
---|
303 | foreach arch ${archs} { |
---|
304 | if { ! [variant_isset universal] } { |
---|
305 | set atlas_path ${workpath}/${name}-${version} |
---|
306 | } else { |
---|
307 | set atlas_path ${workpath}/${name}-${version}-${arch} |
---|
308 | } |
---|
309 | set lib_dir ${atlas_path}/build/lib |
---|
310 | |
---|
311 | make_dylib libatlas ${lib_dir} ${arch} { -lSystem } |
---|
312 | |
---|
313 | if {${ncpu} == "1" } { |
---|
314 | # there are no threaded libraries (libpt*) on single-core machines |
---|
315 | make_dylib libcblas ${lib_dir} ${arch} { -latlas -lSystem } |
---|
316 | make_dylib libf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } |
---|
317 | } else { |
---|
318 | make_dylib libptcblas ${lib_dir} ${arch} { -latlas -lSystem } |
---|
319 | make_dylib libptf77blas ${lib_dir} ${arch} { -lgfortran -latlas -lSystem } |
---|
320 | } |
---|
321 | |
---|
322 | make_dylib liblapack ${lib_dir} ${arch} { -lf77blas -lcblas -latlas -lgfortran -lgcc_s.1 -lSystem } |
---|
323 | } |
---|
324 | } |
---|
325 | |
---|
326 | pre-destroot { |
---|
327 | if { [variant_isset universal] } { |
---|
328 | set archs ${universal_archs_to_use} |
---|
329 | } else { |
---|
330 | set archs ${build_arch} |
---|
331 | } |
---|
332 | |
---|
333 | foreach arch ${archs} { |
---|
334 | if { ! [variant_isset universal] } { |
---|
335 | set atlas_path ${workpath}/${name}-${version} |
---|
336 | set dest_path ${destroot}${prefix}/lib/ |
---|
337 | } else { |
---|
338 | set atlas_path ${workpath}/${name}-${version}-${arch} |
---|
339 | set dest_path ${destroot}-${arch}${prefix}/lib/ |
---|
340 | } |
---|
341 | set lib_dir ${atlas_path}/build/lib |
---|
342 | |
---|
343 | file mkdir ${dest_path} |
---|
344 | eval xinstall -m 755 [glob ${lib_dir}/*.dylib] ${dest_path} |
---|
345 | } |
---|
346 | } |
---|
347 | |
---|
348 | post-destroot { |
---|
349 | if { ![file exists ${destroot}${prefix}/lib/libcblas.dylib] && [file exists ${destroot}${prefix}/lib/libptcblas.dylib]} { |
---|
350 | ln -s libptcblas.dylib ${destroot}${prefix}/lib/libcblas.dylib |
---|
351 | } |
---|
352 | if { ![file exists ${destroot}${prefix}/lib/libf77blas.dylib] && [file exists ${destroot}${prefix}/lib/libptf77blas.dylib]} { |
---|
353 | ln -s libptf77blas.dylib ${destroot}${prefix}/lib/libf77blas.dylib |
---|
354 | } |
---|
355 | } |
---|
356 | |
---|
357 | livecheck.name math-atlas |
---|
358 | livecheck.distname Stable |
---|