gmp@4: import from homebrew/versions.

This commit is contained in:
Mike McQuaid 2016-12-06 09:25:48 +00:00
parent a573b2183b
commit e23fbf1288
2 changed files with 80 additions and 0 deletions

79
Formula/gmp@4.rb Normal file
View file

@ -0,0 +1,79 @@
class GmpAT4 < Formula
desc "GNU multiple precision arithmetic library"
homepage "http://gmplib.org/"
# Track gcc infrastructure releases.
url "https://ftpmirror.gnu.org/gmp/gmp-4.3.2.tar.bz2"
mirror "https://ftp.gnu.org/gnu/gmp/gmp-4.3.2.tar.bz2"
mirror "ftp://ftp.gmplib.org/pub/gmp-4.3.2/gmp-4.3.2.tar.bz2"
mirror "ftp://gcc.gnu.org/pub/gcc/infrastructure/gmp-4.3.2.tar.bz2"
sha256 "936162c0312886c21581002b79932829aa048cfaf9937c6265aeaa14f1cd1775"
keg_only "Older version of gmp"
fails_with :gcc_4_0 do
cause "Reports of problems using gcc 4.0 on Leopard: https://github.com/mxcl/homebrew/issues/issue/2302"
end
# Patches gmp.h to remove the __need_size_t define, which
# was preventing libc++ builds from getting the ptrdiff_t type
# Applied upstream in http://gmplib.org:8000/gmp/raw-rev/6cd3658f5621
patch :DATA
def install
args = ["--prefix=#{prefix}", "--enable-cxx"]
# Build 32-bit where appropriate, and help configure find 64-bit CPUs
if MacOS.prefer_64_bit? && !build.build_32_bit?
ENV.m64
args << "--build=x86_64-apple-darwin"
else
ENV.m32
args << "--host=none-apple-darwin"
end
system "./configure", *args
system "make"
ENV.j1 # Doesn't install in parallel on 8-core Mac Pro
system "make", "install"
# Different compilers and options can cause tests to fail even
# if everything compiles, so yes, we want to do this step.
system "make", "check"
end
test do
(testpath/"test.c").write <<-EOS.undent
#include <gmp.h>
int main()
{
mpz_t integ;
mpz_init (integ);
mpz_clear (integ);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lgmp", "-I#{include}", "-o", "test"
system "./test"
end
end
__END__
diff --git a/gmp-h.in b/gmp-h.in
index d7fbc34..3c57c48 100644
--- a/gmp-h.in
+++ b/gmp-h.in
@@ -46,13 +46,11 @@ along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#ifndef __GNU_MP__
#define __GNU_MP__ 4
-#define __need_size_t /* tell gcc stddef.h we only want size_t */
#if defined (__cplusplus)
#include <cstddef> /* for size_t */
#else
#include <stddef.h> /* for size_t */
#endif
-#undef __need_size_t
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)

View file

@ -14,6 +14,7 @@
"fig": "docker-compose",
"geode": "apache-geode",
"glfw3": "glfw",
"gmp4": "gmp@4",
"go-app-engine-32": "app-engine-go-32",
"go-app-engine-64": "app-engine-go-64",
"google-app-engine": "app-engine-python",