1 | # $Id: Portfile 114328 2013-12-05 10:21:52Z ryandesign@macports.org $ |
---|
2 | set ports_ignore_different "yes" |
---|
3 | |
---|
4 | PortSystem 1.0 |
---|
5 | PortGroup muniversal 1.0 |
---|
6 | |
---|
7 | categories math |
---|
8 | license BSD |
---|
9 | name atlas |
---|
10 | version 3.11.28 |
---|
11 | use_bzip2 yes |
---|
12 | |
---|
13 | # additional versions |
---|
14 | set lapackversion 3.5.0 |
---|
15 | set lapackname lapack |
---|
16 | set atlasdist ${name}${version}${extract.suffix} |
---|
17 | set lapackdist ${lapackname}-${lapackversion}.tgz |
---|
18 | |
---|
19 | maintainers vince |
---|
20 | platforms darwin |
---|
21 | |
---|
22 | description Portable optimal linear algebra software |
---|
23 | long_description Provides a complete BLAS and LAPACK API.\nATLAS\ |
---|
24 | achieves performance on par\ |
---|
25 | with machine-specific tuned libraries. |
---|
26 | |
---|
27 | # No precompiled binaries |
---|
28 | #archive_sites |
---|
29 | |
---|
30 | homepage http://math-atlas.sourceforge.net/ |
---|
31 | |
---|
32 | master_sites sourceforge:http://downloads.sourceforge.net/project/math-atlas/Developer%20%28unstable%29/${version} \ |
---|
33 | http://www.netlib.org/lapack:lapack |
---|
34 | |
---|
35 | distfiles ${atlasdist}:atlas \ |
---|
36 | ${lapackdist}:lapack |
---|
37 | |
---|
38 | extract.only ${atlasdist} |
---|
39 | |
---|
40 | #patchfiles #patch-emit_mm_c.diff |
---|
41 | #patchfiles patch-ATL_cmm4x4x128_av_c.diff |
---|
42 | # patch-makes-Make.lib.diff |
---|
43 | # patch-makes-Make.lib.diff |
---|
44 | |
---|
45 | checksums atlas${version}.tar.bz2 \ |
---|
46 | rmd160 44b13ce300617367626500c2b22b4f9e83c47355 \ |
---|
47 | sha256 4484f3006e34085a60a125a2914163b5e96bcfed640d4f6e8df172db4dbbf8a1 \ |
---|
48 | lapack-${lapackversion}.tgz \ |
---|
49 | rmd160 d803308ef28f3c6cffb051850823395e2cb29b6a \ |
---|
50 | sha256 9ad8f0d3f3fb5521db49f2dd716463b8fb2b6bc9dc386a9956b8c6144f726352 |
---|
51 | |
---|
52 | worksrcdir ATLAS |
---|
53 | |
---|
54 | compiler.blacklist macports-clang-3.2 macports-clang-3.1 \ |
---|
55 | macports-clang-3.0 macports-clang-2.9 |
---|
56 | |
---|
57 | set gcc_version 0 |
---|
58 | set use_clang "" |
---|
59 | |
---|
60 | variant gcc49 conflicts gcc47 gcc48 clang mpclang34 perf\ |
---|
61 | description {build using macports-gcc-4.9} { |
---|
62 | |
---|
63 | configure.compiler macports-gcc-4.9 |
---|
64 | } |
---|
65 | |
---|
66 | if {[variant_isset gcc49]} { |
---|
67 | |
---|
68 | set gcc_version 49 |
---|
69 | set use_clang "" |
---|
70 | |
---|
71 | } |
---|
72 | |
---|
73 | variant gcc48 conflicts gcc47 gcc49 clang mpclang34 perf \ |
---|
74 | description {build using macports-gcc-4.8} { |
---|
75 | |
---|
76 | configure.compiler macports-gcc-4.8 |
---|
77 | } |
---|
78 | |
---|
79 | if {[variant_isset gcc48]} { |
---|
80 | |
---|
81 | set gcc_version 48 |
---|
82 | set use_clang "" |
---|
83 | } |
---|
84 | |
---|
85 | variant gcc47 conflicts gcc48 gcc49 clang mpclang34 perf \ |
---|
86 | description {build using macports-gcc-4.7} { |
---|
87 | |
---|
88 | configure.compiler macports-gcc-4.7 |
---|
89 | } |
---|
90 | |
---|
91 | if {[variant_isset gcc47]} { |
---|
92 | |
---|
93 | set gcc_version 47 |
---|
94 | set use_clang "" |
---|
95 | } |
---|
96 | |
---|
97 | |
---|
98 | variant clang conflicts gcc47 gcc48 gcc49 mpclang34 \ |
---|
99 | description {use XCode clang and gfortran} { |
---|
100 | |
---|
101 | pre-fetch { |
---|
102 | if {[vercmp ${xcodeversion} 5.0] < 0} { |
---|
103 | return -code error "This clang version is not supported.\ |
---|
104 | Please upgrade to Xcode 5." |
---|
105 | } |
---|
106 | } |
---|
107 | |
---|
108 | configure.compiler clang |
---|
109 | } |
---|
110 | |
---|
111 | if {[variant_isset clang]} { |
---|
112 | |
---|
113 | set use_clang "XCode" |
---|
114 | set gcc_version 0 |
---|
115 | } |
---|
116 | |
---|
117 | variant mpclang34 conflicts gcc47 gcc48 gcc49 clang perf\ |
---|
118 | description {use mp-clang-3.4 and gfortran} { |
---|
119 | |
---|
120 | configure.compiler macports-clang-3.4 |
---|
121 | } |
---|
122 | |
---|
123 | if {[variant_isset mpclang34]} { |
---|
124 | |
---|
125 | set use_clang "34" |
---|
126 | set gcc_version 0 |
---|
127 | } |
---|
128 | |
---|
129 | variant perf conflicts gcc47 gcc48 gcc49 mpclang34 clang \ |
---|
130 | description {Uses clang-mp-3.4 for C and dragonegg-3.4 for Fortran} { |
---|
131 | |
---|
132 | if {[vercmp ${xcodeversion} 5.0] < 0} { |
---|
133 | configure.compiler macports-clang-3.4 |
---|
134 | } else { |
---|
135 | set use_clang "XCode" |
---|
136 | set gcc_version 0 |
---|
137 | } |
---|
138 | |
---|
139 | depends_build-append port:dragonegg-3.4-gcc-4.8 |
---|
140 | configure.f77 ${prefix}/bin/dragonegg-3.4-gfortran-mp-4.8 |
---|
141 | |
---|
142 | set clang_flags "-O3 -fPIC -fomit-frame-pointer" |
---|
143 | set gcc_flags "${clang_flags} \ |
---|
144 | -specs=${prefix}/libexec/dragonegg/llvm34gcc48-integrated-as.specs" |
---|
145 | } |
---|
146 | |
---|
147 | if {[variant_isset perf]} { |
---|
148 | |
---|
149 | set use_clang "34" |
---|
150 | set gcc_version 48 |
---|
151 | } |
---|
152 | |
---|
153 | variant nofortran description {Forgo use of fortran compiler} { |
---|
154 | } |
---|
155 | |
---|
156 | # AVX or higher? |
---|
157 | |
---|
158 | if {(${os.major} > 11 && \ |
---|
159 | (![catch {sysctl hw.optional.fma} result1] && $result1 == 1)) || |
---|
160 | (![catch {sysctl hw.cpufamily} result2] && $result2 == 280134364)} { |
---|
161 | |
---|
162 | set has_fma "yes" |
---|
163 | } else { |
---|
164 | |
---|
165 | set has_fma "no" |
---|
166 | } |
---|
167 | |
---|
168 | if {(${os.major} > 11 && \ |
---|
169 | (![catch {sysctl hw.optional.avx2_0} result1] && $result1 == 1)) || |
---|
170 | (![catch {sysctl hw.cpufamily} result2] && $result2 == 280134364)} { |
---|
171 | |
---|
172 | set has_avx2 "yes" |
---|
173 | } else { |
---|
174 | |
---|
175 | set has_avx2 "no" |
---|
176 | } |
---|
177 | |
---|
178 | if {(${os.major} > 10 && \ |
---|
179 | (![catch {sysctl hw.optional.avx1_0} result1] && $result1 == 1)) || |
---|
180 | (![catch {sysctl hw.cpufamily} result2] && $result2 == 1418770316)} { |
---|
181 | |
---|
182 | set has_avx "yes" |
---|
183 | } else { |
---|
184 | |
---|
185 | set has_avx "no" |
---|
186 | } |
---|
187 | |
---|
188 | # If none of the above variants is chosen, make gcc47 the default for |
---|
189 | # up to SSE4.2 (Core i1) capable processors, and XCode-clang for newer |
---|
190 | |
---|
191 | if {![variant_isset gcc47] && ![variant_isset gcc48] && \ |
---|
192 | ![variant_isset gcc49] && ![variant_isset clang] && \ |
---|
193 | ![variant_isset perf] && ![variant_isset mpclang34]} { |
---|
194 | |
---|
195 | if {${has_avx} == "no"} { |
---|
196 | |
---|
197 | # Defaults to gcc47 |
---|
198 | default_variants +gcc47 |
---|
199 | set gcc_version 47 |
---|
200 | set use_clang "" |
---|
201 | } else { |
---|
202 | |
---|
203 | # Use an appropriate version of Clang |
---|
204 | set gcc_version 0 |
---|
205 | if {[vercmp ${xcodeversion} 5.0] >= 0} { |
---|
206 | # With XCode 5.0+, defaults to Xcode-clang |
---|
207 | default_variants +clang |
---|
208 | set use_clang "XCode" |
---|
209 | } else { |
---|
210 | # Otherwise use Macports clang 3.4 |
---|
211 | default_variants +mpclang34 |
---|
212 | set use_clang "34" |
---|
213 | } |
---|
214 | } |
---|
215 | } |
---|
216 | |
---|
217 | set universal [variant_isset universal] |
---|
218 | |
---|
219 | # Finds the type of CPU we are running on |
---|
220 | set native_arch ${build_arch} |
---|
221 | |
---|
222 | if {${os.arch} eq "i386"} { |
---|
223 | |
---|
224 | set universal_archs_supported {i386 x86_64} |
---|
225 | if {![catch {exec sysctl -n hw.machine} result]} { |
---|
226 | set native_arch ${result} |
---|
227 | } |
---|
228 | } elseif {${os.arch} eq "powerpc"} { |
---|
229 | |
---|
230 | set universal_archs_supported {ppc ppc64} |
---|
231 | if {![catch {exec sysctl -n hw.cpusubtype} result] && $result == 100} { |
---|
232 | set native_arch "ppc64" |
---|
233 | } else { |
---|
234 | |
---|
235 | set native_arch "ppc" |
---|
236 | } |
---|
237 | } |
---|
238 | |
---|
239 | configure.args \ |
---|
240 | --with-netlib-lapack-tarfile=${distpath}/${lapackdist} \ |
---|
241 | -O 12 \ |
---|
242 | -v 5 \ |
---|
243 | --dylibs |
---|
244 | |
---|
245 | # Chose the right flags for GCC and Clang compilers |
---|
246 | |
---|
247 | if {${build_arch} eq "i386" || ${build_arch} eq "x86_64"} { |
---|
248 | |
---|
249 | # General flags |
---|
250 | # GCC |
---|
251 | set gcc_flags "-fomit-frame-pointer -mfpmath=sse -O3\ |
---|
252 | -fno-schedule-insns2 -fPIC" |
---|
253 | |
---|
254 | # Clang |
---|
255 | set clang_flags "-O3 -fomit-frame-pointer -fPIC" |
---|
256 | |
---|
257 | # Vectorizing unit flags |
---|
258 | if {${has_fma} == "yes"} { |
---|
259 | |
---|
260 | # Only Clang handles AVX+ correctly |
---|
261 | set gvct_flag "-msse4.2" |
---|
262 | # downgrade FMA to AVX for the time being |
---|
263 | set cvct_flag "-mfma" |
---|
264 | if {${use_clang} != ""} { |
---|
265 | |
---|
266 | configure.args-append -A 28 -V 976 |
---|
267 | } else { |
---|
268 | |
---|
269 | # No AVX when using GCC 4.x |
---|
270 | configure.args-append -A 26 -V 448 |
---|
271 | } |
---|
272 | } elseif {${has_avx2} == "yes"} { |
---|
273 | |
---|
274 | set gvct_flag "-msse4.2" |
---|
275 | set cvct_flag "-mavx" |
---|
276 | } elseif {${has_avx} == "yes"} { |
---|
277 | |
---|
278 | set gvct_flag "-msse4.2" |
---|
279 | set cvct_flag "-mavx" |
---|
280 | } elseif {${os.major} > 9 && \ |
---|
281 | ![catch {sysctl hw.optional.sse4_2} result1] && $result1 == 1} { |
---|
282 | |
---|
283 | set gvct_flag "-msse4.2" |
---|
284 | set cvct_flag "-msse4.2" |
---|
285 | } elseif {${os.major} > 9 && \ |
---|
286 | ![catch {sysctl hw.optional.sse4_1} result1] && $result1 == 1} { |
---|
287 | |
---|
288 | set gvct_flag "-msse4.1" |
---|
289 | set cvct_flag "-msse4.1" |
---|
290 | } elseif {${os.major} > 8 && \ |
---|
291 | ![catch {sysctl hw.optional.supplementalsse3} result1] && $result1 == 1} { |
---|
292 | |
---|
293 | set gvct_flag "-mssse3" |
---|
294 | set cvct_flag "-mssse3" |
---|
295 | } else { |
---|
296 | |
---|
297 | # Default vectorization flag is sse3 (CoreSolo / CoreDuo) |
---|
298 | set gvct_flag "-msse3" |
---|
299 | set cvct_flag "-msse3" |
---|
300 | } |
---|
301 | } elseif {${build_arch} eq "ppc"} { |
---|
302 | |
---|
303 | # PPC |
---|
304 | set gcc_flags "-O3 -mcpu=7400 -mtune=7400\ |
---|
305 | -fno-schedule-insns -fschedule-insns2 -fPIC \ |
---|
306 | -force_cpusubtype_ALL" |
---|
307 | set clang_flags "-O3 -arch ppc -fPIC" |
---|
308 | |
---|
309 | set gvct_flag "-maltivec -mabi=altivec" |
---|
310 | set cvct_flag "-maltivec" |
---|
311 | |
---|
312 | configure.args-append -A 4 |
---|
313 | |
---|
314 | # On Leopard, we may warn the user that ppc |
---|
315 | # is not as efficient as ppc64 |
---|
316 | pre-fetch { |
---|
317 | if {${native_arch} eq "ppc64"} { |
---|
318 | |
---|
319 | ui_msg "Compiling for ppc on a G5 machine.\ |
---|
320 | This could lead to reduced performance." |
---|
321 | } |
---|
322 | } |
---|
323 | |
---|
324 | } else { |
---|
325 | |
---|
326 | # PPC64 |
---|
327 | set gcc_flags "-mcpu=970 -mtune=970 -mvrsave -mpowerpc64\ |
---|
328 | -fno-schedule-insns -fschedule-insns2 -fPIC \ |
---|
329 | -force_cpusubtype_ALL" |
---|
330 | # Clang has no PPC64 target so compile for PPC |
---|
331 | set clang_flags "-O3 -arch ppc -fPIC" |
---|
332 | |
---|
333 | set gvct_flag "-maltivec -mabi=altivec" |
---|
334 | set cvct_flag "-maltivec" |
---|
335 | } |
---|
336 | |
---|
337 | # Basic universal config |
---|
338 | # Advanced config (flags) is done during pre-configure phase |
---|
339 | |
---|
340 | if {${universal} == 1} { |
---|
341 | |
---|
342 | configure.universal_args-delete --disable-dependency-tracking |
---|
343 | |
---|
344 | lappend merger_configure_args(ppc) --cflags=-m32 \ |
---|
345 | -b 32 \ |
---|
346 | -A 4 \ |
---|
347 | -V 4 \ |
---|
348 | -s gas_ppc \ |
---|
349 | -Fa alg -force_cpusubtype_ALL |
---|
350 | |
---|
351 | lappend merger_configure_args(ppc64) --cflags=-m64 \ |
---|
352 | -b 64 \ |
---|
353 | -A 5 \ |
---|
354 | -V 4 \ |
---|
355 | -s gas_ppc \ |
---|
356 | -Fa alg -force_cpusubtype_ALL |
---|
357 | |
---|
358 | lappend merger_configure_args(i386) --cflags=-m32 \ |
---|
359 | -b 32 \ |
---|
360 | -A 22 \ |
---|
361 | -V 448 \ |
---|
362 | -t 2 \ |
---|
363 | -s gas_x86_32 |
---|
364 | |
---|
365 | lappend merger_configure_args(x86_64) --cflags=-m64 \ |
---|
366 | -b 64 \ |
---|
367 | -s gas_x86_64 |
---|
368 | } |
---|
369 | |
---|
370 | # Threading |
---|
371 | # If we run on a mono-processor machine (PPC), then disable threading |
---|
372 | |
---|
373 | if {![catch {sysctl hw.logicalcpu} result] && $result == 1} { |
---|
374 | |
---|
375 | configure.args-append -t 0 |
---|
376 | set no_threads 1 |
---|
377 | } else { |
---|
378 | |
---|
379 | set no_threads 0 |
---|
380 | |
---|
381 | # Threading relies on OpenMP if gcc compilers are selected |
---|
382 | # Does not seem to work reliably. Disabled. |
---|
383 | #if {${gcc_version} != 0} { |
---|
384 | |
---|
385 | configure.args-append -Si omp 0 |
---|
386 | #} |
---|
387 | } |
---|
388 | |
---|
389 | # Phases |
---|
390 | # Work around some bugs in the 3.10.1 tarball: |
---|
391 | # https://code.google.com/p/libarchive/issues/detail?id=299 |
---|
392 | # https://sourceforge.net/p/math-atlas/support-requests/884 |
---|
393 | |
---|
394 | extract.post_args-replace -xf -xkf |
---|
395 | extract.post_args-append {|| true} |
---|
396 | |
---|
397 | post-patch { |
---|
398 | if {${build_arch} eq "ppc" || ${build_arch} eq "ppc64"} { |
---|
399 | |
---|
400 | reinplace \ |
---|
401 | "s|cMVFLAGS=\\\\\"%s\\\\\"|cMVFLAGS=\\\\\"-force_cpusubtype_ALL\ %s\\\\\"|" \ |
---|
402 | ${worksrcpath}/include/atlas_mvtesttime.h |
---|
403 | } |
---|
404 | |
---|
405 | if {${no_threads} == 1} { |
---|
406 | exec sed -i bak -E "/.*threads.*/d" ${worksrcpath}/Make.top |
---|
407 | } |
---|
408 | } |
---|
409 | |
---|
410 | # Change the default compilers |
---|
411 | pre-configure { |
---|
412 | |
---|
413 | # Inform user of selected C compiler |
---|
414 | ui_msg "Selected C compiler: ${configure.cc}" |
---|
415 | |
---|
416 | # Fortran stuff |
---|
417 | set fortran [expr ! [variant_isset nofortran]] |
---|
418 | |
---|
419 | # If we use clang, we must grasp a gfortran compiler to build |
---|
420 | # Fortran sources (do not impact overall Atlas performance) |
---|
421 | |
---|
422 | if {${use_clang} != "" && ${fortran} == 1} { |
---|
423 | |
---|
424 | if {![variant_isset perf]} { |
---|
425 | set gflist [glob -noc ${prefix}/bin/gfortran-mp-4.*] |
---|
426 | if {[llength ${gflist}] == 0} { |
---|
427 | |
---|
428 | # No fortran compiler found, bail out |
---|
429 | return -code error "Atlas could not detect any fortran compiler.\ |
---|
430 | If you really don’t need the fortran interface\ |
---|
431 | to be built, please use the +nofortran option,\ |
---|
432 | else install a fortran compiler (e.g. gcc4X)\ |
---|
433 | before building Atlas." |
---|
434 | } else { |
---|
435 | |
---|
436 | # Select most recent gfortran |
---|
437 | global gcc_version |
---|
438 | |
---|
439 | configure.f77 [lindex [lsort -dec ${gflist}] 0] |
---|
440 | set gcc_version \ |
---|
441 | [join [split [string range ${configure.f77} end-2 end] "."] ""] |
---|
442 | } |
---|
443 | } else { |
---|
444 | set libgccpath ${prefix}/lib/gcc48 |
---|
445 | } |
---|
446 | } |
---|
447 | |
---|
448 | if {${fortran} == 1} { |
---|
449 | |
---|
450 | # Output the F77 selected compiler |
---|
451 | if {[variant_isset perf]} { |
---|
452 | ui_msg "Using dragonegg-3.4-gfortran-mp-4.8 as Fortran compiler." |
---|
453 | } else { |
---|
454 | ui_msg "Selected F77 compiler: gfortran${gcc_version}" |
---|
455 | } |
---|
456 | } else { |
---|
457 | |
---|
458 | # No Fortran |
---|
459 | configure.args-append --nof77 |
---|
460 | } |
---|
461 | |
---|
462 | # Now set the flags according to the compiler family chosen |
---|
463 | # Also set “width” of the processor (32 or 64-bit) |
---|
464 | |
---|
465 | if {${gcc_version} != 0} { |
---|
466 | set libgccpath ${prefix}/lib/gcc${gcc_version} |
---|
467 | } |
---|
468 | |
---|
469 | # Some tweaks on the original source before universal build |
---|
470 | # duplicates it |
---|
471 | # Overrides goodgcc |
---|
472 | reinplace -E "s|GOODGCC =.*|GOODGCC = ${configure.cc}\");|" \ |
---|
473 | ${worksrcpath}/CONFIG/src/SpewMakeInc.c |
---|
474 | |
---|
475 | # Some further tweaks |
---|
476 | reinplace "s|cc=gcc|cc=${configure.cc}|g" \ |
---|
477 | ${worksrcpath}/configure |
---|
478 | reinplace "s|-no-cpp-precomp||g" \ |
---|
479 | ${worksrcpath}/CONFIG/src/atlcomp.txt |
---|
480 | |
---|
481 | # Non-universal builds |
---|
482 | if {${universal} == 0} { |
---|
483 | |
---|
484 | configure.args-append -C acg ${configure.cc} |
---|
485 | |
---|
486 | # If we build for the CPU of the machine, use |
---|
487 | # machine arch tuning (except on ppc) |
---|
488 | # -march=natives supersedes -msse4.2 so disable it on AVX |
---|
489 | # capable machines |
---|
490 | if {${has_avx} == "no" && ${build_arch} ne "ppc"} { |
---|
491 | |
---|
492 | append gcc_flags " -march=native" |
---|
493 | } |
---|
494 | append clang_flags " -march=native" |
---|
495 | |
---|
496 | # AVX stuff. GCC compilers cannot use AVX instruction set because the |
---|
497 | # system as(1) is outdated |
---|
498 | # Clang 3.4 is fine |
---|
499 | |
---|
500 | if {${has_avx} == "yes" && ${use_clang} == ""} { |
---|
501 | |
---|
502 | # Force Core i1 arch for ASM kernels |
---|
503 | ui_warn "GCC compilers on MacOS do not support AVX:\ |
---|
504 | downgrading." |
---|
505 | configure.args-append -A 25 |
---|
506 | } |
---|
507 | |
---|
508 | if {${build_arch} eq "ppc"} { |
---|
509 | |
---|
510 | # ppc uses altivec vectorizing unit |
---|
511 | configure.args-append -V 4 |
---|
512 | } |
---|
513 | |
---|
514 | if {${use_clang} == ""} { |
---|
515 | |
---|
516 | # GCC |
---|
517 | configure.args-append -F acg "'${gcc_flags} ${gvct_flag}'" |
---|
518 | |
---|
519 | if {${fortran} == 1} { |
---|
520 | |
---|
521 | configure.args-append -C if ${configure.f77} |
---|
522 | configure.args-append -F if "'${gcc_flags} ${gvct_flag}'" |
---|
523 | configure.args-append -Ss f77lib \ |
---|
524 | ${libgccpath}/libgfortran.dylib |
---|
525 | } |
---|
526 | if {${build_arch} eq "x86_64" || ${build_arch} eq "ppc64"} { |
---|
527 | |
---|
528 | configure.args-append -b 64 |
---|
529 | } else { |
---|
530 | |
---|
531 | configure.args-append -b 32 |
---|
532 | } |
---|
533 | } else { |
---|
534 | |
---|
535 | # clang |
---|
536 | if {[variant_isset perf]} { |
---|
537 | |
---|
538 | append cvct_flag " -march=native" |
---|
539 | set gvct_flag ${cvct_flag} |
---|
540 | } |
---|
541 | configure.args-append -F acg "'${clang_flags} ${cvct_flag}'" |
---|
542 | |
---|
543 | if {${fortran} == 1} { |
---|
544 | |
---|
545 | configure.args-append -C if ${configure.f77} |
---|
546 | configure.args-append -F if "'${gcc_flags} ${gvct_flag}'" |
---|
547 | configure.args-append -Ss f77lib \ |
---|
548 | ${libgccpath}/libgfortran.dylib |
---|
549 | } |
---|
550 | |
---|
551 | if {${build_arch} eq "x86_64"} { |
---|
552 | |
---|
553 | configure.args-append -b 64 |
---|
554 | } else { |
---|
555 | |
---|
556 | # Clang has no ppc64 target so ppc64 ➸ regular ppc (32 bit) |
---|
557 | configure.args-append -b 32 |
---|
558 | } |
---|
559 | } |
---|
560 | |
---|
561 | # Create build directory |
---|
562 | file mkdir ${worksrcpath}/build |
---|
563 | } else { |
---|
564 | |
---|
565 | # Universal builds |
---|
566 | foreach arch ${universal_archs_to_use} { |
---|
567 | |
---|
568 | # Init ‘universal’ flags |
---|
569 | set gcc_univ_flags ${gcc_flags} |
---|
570 | set gvct_univ_flag ${gvct_flag} |
---|
571 | set clang_univ_flags ${clang_flags} |
---|
572 | set cvct_univ_flag ${cvct_flag} |
---|
573 | set gcc_supp_flags "" |
---|
574 | set clang_supp_flags "" |
---|
575 | |
---|
576 | # We build for the native architecture |
---|
577 | if {${arch} eq ${native_arch} && ${build_arch} ne "ppc"} { |
---|
578 | |
---|
579 | # Don’t add -march=native to a GCC build on an AVX |
---|
580 | # machine because this flag overrides -msse4.2 |
---|
581 | if {${has_avx} == "no"} { |
---|
582 | |
---|
583 | append gcc_supp_flags "-march=native " |
---|
584 | } |
---|
585 | append clang_supp_flags "-march=native " |
---|
586 | } |
---|
587 | |
---|
588 | # Non-native targets. Apply a priori flags. |
---|
589 | |
---|
590 | # Clamp i386 optimization to -sse3 in universal builds and |
---|
591 | # forces clang/gcc to use -m32 flag |
---|
592 | if {${arch} eq "i386" && ${native_arch} ne "i386"} { |
---|
593 | |
---|
594 | set gvct_univ_flag "-msse3" |
---|
595 | set cvct_univ_flag "-msse3" |
---|
596 | |
---|
597 | append gcc_supp_flags "-m32" |
---|
598 | append clang_supp_flags "-m32" |
---|
599 | } |
---|
600 | |
---|
601 | # For x86_64 builds, be conservative and use only -ssse3 |
---|
602 | # Core2 CPU and SSE3 ASM kernels |
---|
603 | if {${arch} eq "x86_64" && ${native_arch} ne "x86_64"} { |
---|
604 | |
---|
605 | set gvct_univ_flag "-mssse3" |
---|
606 | set cvct_univ_flag "-mssse3" |
---|
607 | |
---|
608 | append gcc_supp_flags "-m64" |
---|
609 | append clang_supp_flags "-m64" |
---|
610 | |
---|
611 | lappend merger_configure_args("x86_64") -A 25 -V 448 |
---|
612 | } |
---|
613 | |
---|
614 | # ppc (on Intel or ppc64 machines) |
---|
615 | if {${arch} eq "ppc" && ${native_arch} ne "ppc"} { |
---|
616 | |
---|
617 | set gcc_univ_flags "-O3 -mcpu=7400 -mtune=7400\ |
---|
618 | -fno-schedule-insns -fschedule-insns2\ |
---|
619 | -fPIC" |
---|
620 | set clang_univ_flags "-O3 -arch ppc -fPIC" |
---|
621 | |
---|
622 | set gvct_univ_flag "-maltivec -mabi=altivec" |
---|
623 | set cvct_univ_flag "-maltivec" |
---|
624 | |
---|
625 | append gcc_supp_flags "-m32" |
---|
626 | append clang_supp_flags "-m32" |
---|
627 | } |
---|
628 | |
---|
629 | # ppc64 (only for gcc, for clang this is taken to be the |
---|
630 | # same target as ppc) |
---|
631 | if {${arch} eq "ppc64" && ${native_arch} ne "ppc64"} { |
---|
632 | |
---|
633 | set gcc_univ_flags "-mcpu=970 -mtune=970 -mvrsave \ |
---|
634 | -mpowerpc64 -fno-schedule-insns\ |
---|
635 | -fschedule-insns2 -fPIC" |
---|
636 | set clang_univ_flags "-O3 -arch ppc -fPIC" |
---|
637 | |
---|
638 | set gvct_univ_flag "-maltivec -mabi=altivec" |
---|
639 | set cvct_univ_flag "-maltivec" |
---|
640 | |
---|
641 | append gcc_supp_flags "-m64" |
---|
642 | append clang_supp_flags "-m64" |
---|
643 | } |
---|
644 | |
---|
645 | # Now add the flags to merger_configure_args(${arch}) |
---|
646 | # Same code as the non-universal case |
---|
647 | lappend merger_configure_args(${arch}) -C acg ${configure.cc} |
---|
648 | if {${use_clang} == ""} { |
---|
649 | |
---|
650 | # GCC |
---|
651 | lappend merger_configure_args(${arch}) \ |
---|
652 | -F acg "'${gcc_univ_flags} ${gcc_supp_flags}\ |
---|
653 | ${gvct_univ_flag}'" |
---|
654 | |
---|
655 | if {${fortran} == 1} { |
---|
656 | |
---|
657 | lappend merger_configure_args(${arch}) \ |
---|
658 | -C if ${configure.f77} \ |
---|
659 | -F if "'${gcc_univ_flags} ${gcc_supp_flags}\ |
---|
660 | ${gvct_univ_flag}'" |
---|
661 | |
---|
662 | set libgccarchpath ${libgccpath}/${arch} |
---|
663 | if {[file exists ${libgccarchpath}/libgfortran.dylib]} { |
---|
664 | |
---|
665 | lappend merger_configure_args(${arch}) \ |
---|
666 | -Ss f77lib ${libgccarchpath}/libgfortran.dylib |
---|
667 | } else { |
---|
668 | |
---|
669 | lappend merger_configure_args(${arch}) \ |
---|
670 | -Ss f77lib ${libgccpath}/libgfortran.dylib |
---|
671 | } |
---|
672 | } |
---|
673 | } else { |
---|
674 | |
---|
675 | # clang |
---|
676 | lappend merger_configure_args(${arch}) \ |
---|
677 | -F acg "'${clang_univ_flags} ${clang_supp_flags}\ |
---|
678 | ${cvct_univ_flag}'" |
---|
679 | |
---|
680 | if {${fortran} == 1} { |
---|
681 | |
---|
682 | lappend merger_configure_args(${arch}) \ |
---|
683 | -C if ${configure.f77} \ |
---|
684 | -F if "'${gcc_univ_flags} ${gcc_supp_flags}\ |
---|
685 | ${gvct_univ_flag}'" |
---|
686 | |
---|
687 | set libgccarchpath ${libgccpath}/${arch} |
---|
688 | if {[file exists ${libgccarchpath}/libgfortran.dylib]} { |
---|
689 | |
---|
690 | lappend merger_configure_args(${arch}) \ |
---|
691 | -Ss f77lib ${libgccarchpath}/libgfortran.dylib |
---|
692 | } else { |
---|
693 | |
---|
694 | lappend merger_configure_args(${arch}) \ |
---|
695 | -Ss f77lib ${libgccpath}/libgfortran.dylib |
---|
696 | } |
---|
697 | } |
---|
698 | } |
---|
699 | |
---|
700 | # Remove spurious { } from arguments list |
---|
701 | set merger_configure_args(${arch}) \ |
---|
702 | [join [split $merger_configure_args(${arch}) "{}"]] |
---|
703 | |
---|
704 | # Create ${arch} build tree |
---|
705 | copy ${worksrcpath} ${worksrcpath}-${arch} |
---|
706 | file mkdir ${worksrcpath}-${arch}/build |
---|
707 | } |
---|
708 | } |
---|
709 | |
---|
710 | # On PPC64 we need extra flags for configuring |
---|
711 | if {${native_arch} eq "ppc64"} { |
---|
712 | configure.args-append --cc="\"${configure.cc} -m32 \ |
---|
713 | -force_cpusubtype_ALL\"" |
---|
714 | } |
---|
715 | |
---|
716 | # Get some system specific variables for maximum optimization |
---|
717 | set cpufreq [expr {[sysctl hw.cpufrequency] / 1000000}] |
---|
718 | |
---|
719 | if {${os.arch} eq "powerpc"} { |
---|
720 | |
---|
721 | configure.args-append -D c -DWALL |
---|
722 | } else { |
---|
723 | |
---|
724 | configure.args-append -D c -DPentiumCPS=${cpufreq} |
---|
725 | } |
---|
726 | } |
---|
727 | |
---|
728 | # We configure from the build directory |
---|
729 | configure.dir ${worksrcpath}/build |
---|
730 | configure.cmd ../configure |
---|
731 | |
---|
732 | post-configure { |
---|
733 | |
---|
734 | # Store in ${atlas_paths} the ${worksrcpath}s corresponding to the |
---|
735 | # archs Atlas is being built for. |
---|
736 | set atlas_paths {} |
---|
737 | if {${universal} == 1} { |
---|
738 | |
---|
739 | foreach arch ${universal_archs_to_use} { |
---|
740 | |
---|
741 | lappend atlas_paths ${worksrcpath}-${arch} |
---|
742 | } |
---|
743 | } else { |
---|
744 | |
---|
745 | lappend atlas_paths ${worksrcpath} |
---|
746 | } |
---|
747 | |
---|
748 | foreach path ${atlas_paths} { |
---|
749 | |
---|
750 | # Recursively remove directories |
---|
751 | ui_debug "Patch to recursively remove directories on clean." |
---|
752 | reinplace "s|rm -f|rm -rf|g" ${path}/build/Makefile |
---|
753 | |
---|
754 | # Threading — ensure libgomp is correctly pulled in during link |
---|
755 | #if {${gcc_version} != 0 && ${no_threads} == 0} { |
---|
756 | |
---|
757 | # set gmpfx ${prefix}/lib/gcc${gcc_version} |
---|
758 | # set arch [lindex [split [lindex [split $path "/"] end] "-"] 2] |
---|
759 | # if {${arch} ne "" && \ |
---|
760 | # [file exists ${gmpfx}/${arch}/libgomp.dylib]} { |
---|
761 | |
---|
762 | # reinplace -E \ |
---|
763 | # "s|(LIBS =.*)|\\1 ${gmpfx}/${arch}/libgomp.dylib|" \ |
---|
764 | # ${path}/build/Make.inc |
---|
765 | # } else { |
---|
766 | |
---|
767 | # reinplace -E \ |
---|
768 | # "s|(LIBS =.*)|\\1 ${gmpfx}/libgomp.dylib|" \ |
---|
769 | # ${path}/build/Make.inc |
---|
770 | # } |
---|
771 | #} |
---|
772 | } |
---|
773 | } |
---|
774 | |
---|
775 | build.env-append "CC=${configure.cc} CXX=${configure.cxx}" |
---|
776 | use_parallel_build no |
---|
777 | build.target build |
---|
778 | build.dir ${worksrcpath}/build |
---|
779 | |
---|
780 | #post-build { |
---|
781 | # if {${universal} == 0} { |
---|
782 | # |
---|
783 | # set libdir ${build.dir}/lib |
---|
784 | # reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \ |
---|
785 | # ${libdir}/Makefile |
---|
786 | |
---|
787 | # On mono-processors machines, build libsatlas.dylib only |
---|
788 | # if {${no_threads} == 1} { |
---|
789 | # |
---|
790 | # system -W ${libdir} "${build.cmd} dylib" |
---|
791 | # } else { |
---|
792 | # |
---|
793 | # system -W ${libdir} "${build.cmd} shared_all" |
---|
794 | # } |
---|
795 | # } else { |
---|
796 | # |
---|
797 | # foreach arch ${universal_archs_to_use} { |
---|
798 | |
---|
799 | # set libdir ${worksrcpath}-${arch}/build/lib |
---|
800 | # reinplace "s|^LIBTOOL=.*$|LIBTOOL=\$\(GCC\) \$\(GCCFLAGS\)|" \ |
---|
801 | # ${libdir}/Makefile |
---|
802 | |
---|
803 | # Same as above |
---|
804 | # if {${no_threads} == 1} { |
---|
805 | |
---|
806 | # system -W ${libdir} "${build.cmd} dylib" |
---|
807 | # } else { |
---|
808 | |
---|
809 | # system -W ${libdir} "${build.cmd} shared_all" |
---|
810 | # } |
---|
811 | # } |
---|
812 | # } |
---|
813 | #} |
---|
814 | |
---|
815 | destroot.dir ${build.dir} |
---|
816 | destroot.destdir DESTDIR=${destroot}${prefix} |
---|
817 | |
---|
818 | post-destroot { |
---|
819 | # On monoprocessor machines, make tatlas and satlas synonymous |
---|
820 | if {${no_threads} == 1} { |
---|
821 | |
---|
822 | set libdir ${destroot}${prefix}/lib |
---|
823 | system -W ${libdir} "ln -s libsatlas.dylib libtatlas.dylib" |
---|
824 | } |
---|
825 | } |
---|
826 | |
---|
827 | livecheck.name math-atlas |
---|
828 | livecheck.distname Stable |
---|