Ticket #42160: Portfile

File Portfile, 25.2 KB (added by Veence (Vincent), 10 years ago)

New "more up-to-date" Portfile

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