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