source: trunk/dports/devel/gmp/Portfile

Last change on this file was 150035, checked in by devans@…, 17 months ago

gmp: update to version 6.1.1.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 7.8 KB
Line 
1# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
2# $Id: Portfile 150035 2016-07-09 00:54:54Z ryandesign@macports.org $
3
4PortSystem 1.0
5PortGroup  muniversal  1.0
6
7name            gmp
8version         6.1.1
9categories      devel math
10license         LGPL-3+
11maintainers     mcalhoun openmaintainer
12platforms       darwin
13description     GNU multiple precision arithmetic library
14long_description \
15    GNU MP is a library for arbitrary precision arithmetic, operating on\
16    signed integers, rational numbers, and floating point numbers. It   \
17    has a rich set of functions, and the functions have a regular       \
18    interface. GNU MP is designed to be as fast as possible, both for   \
19    small operands and for huge operands. The speed is achieved by using\
20    fullwords as the basic arithmetic type, by using fast algorithms, by\
21    carefully optimized assembly code for the most common inner loops   \
22    for a lots of CPUs, and by a general emphasis on speed (instead of  \
23    simplicity or elegance).
24
25homepage        http://gmplib.org/
26master_sites    gnu
27
28checksums           rmd160  833b1dea9d3ce993e63cb3c629ab792e1e7197bb \
29                    sha256  a8109865f2893f1373b0a8ed5ff7429de8db696fc451b1036bd7bdf95bbeffd6
30
31use_bzip2       yes
32use_parallel_build yes
33
34patchfiles \
35    patch-Makefile.in.diff
36
37configure.args  --enable-cxx
38
39# Prevent precompiled binaries.
40# See #41614.
41# might not be needed if we decide to add:
42#default_variants +core2
43archive_sites
44
45configure.universal_args-delete --disable-dependency-tracking
46
47# The gmp configure script looks for gawk, mawk, nawk, then awk last.
48# Search for /usr/bin/awk first.
49# nawk, at least, fails (see #43773).
50configure.env-append AWK=/usr/bin/awk
51
52# Clear all options that affect CFLAGS and CXXFLAGS, since the configure
53# script tries to build the fastest library for the build machine if
54# CFLAGS and CXXFLAGS are undefined.
55#
56# On PowerPC machines, CFLAGS must be empty to get -force_cpusubtype_ALL.
57#
58# Append all extra flags to compiler name, which is a far from ideal solution.
59
60# the following code must run BEFORE configure.cc is modified
61set configure_cc_save ${configure.cc}
62#
63# do not let configure set CC in gmp-h.in because we modify CC later and
64#    we do not want these modifications to end up in the installed header file
65# ugly workaround for #49801
66# for upstream discussion, see https://gmplib.org/list-archives/gmp-discuss/2015-November/thread.html#5910
67post-patch {
68    reinplace "s|\"@CC@\"|\"${configure_cc_save}\"|g" ${worksrcpath}/gmp-h.in
69}
70
71# Append the -stdlib flags to CXX, since we still want to select the C++ STL.
72set cxx_stdlibflags {}
73if {[string match *clang* ${configure.cxx}]} {
74    configure.cxx-append -stdlib=${configure.cxx_stdlib}
75    configure.cxx_stdlib
76}
77
78# See #43262
79if {${configure.sdkroot} ne ""} {
80    configure.cc-append     -isysroot${configure.sdkroot}
81    configure.cxx-append    -isysroot${configure.sdkroot}
82    configure.sdkroot
83}
84
85configure.cc_archflags
86configure.cxx_archflags
87configure.ld_archflags
88configure.cflags
89configure.cxxflags
90configure.pipe  no
91
92test.run        yes
93test.target     check
94
95# see configure.ac for possible CPU values and what each does
96set processors {core2}
97
98foreach processor ${processors} {
99
100    # only one processor variant can be used, so create a list of every other processor variant to conflict with
101    set conflicts_list ""
102    foreach processor_conflict ${processors} {
103        if { ${processor_conflict} ne ${processor} } {
104            lappend conflicts_list ${processor_conflict}
105        }
106    }
107
108    # use eval to ensure a list of conflicts works properly
109    eval "variant ${processor} conflicts ${conflicts_list} description {do not let ${name} determine CPU type; build for ${processor}} { }"
110}
111
112# if any of the processor variants are active, CPU is not auto-detected
113set auto_cpu true
114foreach processor ${processors} {
115    if { [variant_isset ${processor}] } {
116        configure.args-append --build=${processor}-apple-${os.platform}${os.version}
117        set auto_cpu false
118    }
119}
120
121# config.guess: "Print the host system CPU-VENDOR-OS."
122# config.guess calls configfsf.guess and then tries to improve the result
123#
124# prior to 5.0.2, configfsf.guess returned
125#   i386-apple-darwinX.X.X or powerpc-apple-darwinX.X.X
126#    even on 64-bit processors
127# if config.guess were unable to improve on the result
128#    (e.g. a new unrecognized processor), then the configure script
129#    used i386 or powerpc as the CPU type and a 64-bit build attempt
130#    resulted in an error (see #28892)
131# as of 5.0.2, configfsf.guess can return
132#    x86_64-apple-darwinX.X.X and powerpc64-apple-darwinX.X.X, which,
133#    if not improved, would at least produce a (slow) 64-bit build
134#
135# up to 6.0.0a, all improved CPU types on x86 macs were of the form
136#    core2 or corei* (coreisbr for Sandy Bridge, coreihwl for Haswell, etc.)
137# starting with 6.1.0, improved CPU types on x86 macs have less uniform
138#    names (sandybridge for Sandy Bridge, haswell for Haswell, etc.)
139#
140# in an attempt to accommodate all situations,
141#    test if the CPU was improved and warn if it was not
142#
143if { ${auto_cpu} } {
144    pre-configure {
145        set build_triplet [split [exec -ignorestderr /usr/bin/env CC=${configure.cc} ${worksrcpath}/config.guess] -]
146        set build_cpu     [lindex $build_triplet 0]
147        if { ${build_cpu} eq "x86_64" || ${build_cpu} eq "i386" || ${build_cpu} eq "powerpc64" || ${build_cpu} eq "powerpc" } {
148            ui_warn "No processor dependent assembly code being used. gmp might be slower."
149            # version 5.0.2 should make the following unnecessary
150            #configure.args-append --build=core2-[join [lrange $build_triplet 1 end] -]
151        }
152    }
153}
154
155if {![variant_isset universal]} {
156    if {${build_arch} eq "x86_64"} {
157        configure.env-append   ABI=64
158    } elseif {${build_arch} eq "ppc64"} {
159        configure.env-append   ABI=mode64
160    } else {
161        configure.env-append   ABI=32
162    }
163} else {
164    # Keep configure.cflags and configure.cxxflags empty.
165    set merger_arch_flag no
166
167    array set merger_configure_env {
168        ppc     ABI=32
169        i386    ABI=32
170        ppc64   ABI=mode64
171        x86_64  ABI=64
172    }
173
174    # Since CFLAGS and CXXFLAGS must be empty, append -arch ... to CC and CXX.
175    merger_arch_compiler yes
176
177    # -arch i386 on causes the test suite to fail, so override muniversal_get_arch_flag in muniversal portgroup
178    # Only append -arch ... to compiler if cross compiling.
179    # i386 code is generated by setting ABI=32
180    proc muniversal_get_arch_flag {arch {fortran ""}} {
181        global os.arch
182
183        if {${os.arch} eq "i386" && (${arch} eq "i386" || ${arch} eq "x86_64")} {
184            set archf ""
185        } elseif {${os.arch} eq "powerpc" && (${arch} eq "ppc" && ${arch} eq "ppc64")} {
186            set archf ""
187        } else {
188            set archf "-arch ${arch}"
189        }
190        return ${archf}
191    }
192
193    # universal_archs_to_use might not be set before pre-fetch.
194    pre-destroot {
195        global merger_dont_diff merger_configure_env
196
197        # PortGroup muniversal has difficulty merging three files.
198        if  { [llength ${universal_archs_to_use}] == 3 } {
199            set merger_dont_diff "${prefix}/include/gmp.h"
200        }
201    }
202
203    # For cross-compiling, set C compiler and pre-processor.
204    if {${os.arch} eq "i386"} {
205        if { ${os.major} >= 10 } {
206            lappend merger_configure_env(ppc)  CC_FOR_BUILD=${configure.cc} CPP_FOR_BUILD=${configure.cpp}
207        }
208        lappend merger_configure_env(ppc64)    CC_FOR_BUILD=${configure.cc} CPP_FOR_BUILD=${configure.cpp}
209    } else {
210        lappend merger_configure_env(i386)     CC_FOR_BUILD=${configure.cc} CPP_FOR_BUILD=${configure.cpp}
211        lappend merger_configure_env(x86_64)   CC_FOR_BUILD=${configure.cc} CPP_FOR_BUILD=${configure.cpp}
212    }
213}
214
215platform powerpc {
216    # See #9053
217    patchfiles-append  patch-config.guess.diff
218}
Note: See TracBrowser for help on using the repository browser.