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