From 3a5b5897db832f725b9f7a74e736f159e12e1753 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Tue, 6 Dec 2016 09:26:29 +0000 Subject: [PATCH] mpfr@2: import from homebrew/versions. --- Formula/mpfr@2.rb | 63 ++++++++++++++++++++++++++++++++++++++++++++ formula_renames.json | 1 + 2 files changed, 64 insertions(+) create mode 100644 Formula/mpfr@2.rb diff --git a/Formula/mpfr@2.rb b/Formula/mpfr@2.rb new file mode 100644 index 0000000000..a5354874b9 --- /dev/null +++ b/Formula/mpfr@2.rb @@ -0,0 +1,63 @@ +class MpfrAT2 < Formula + desc "Multiple-precision floating-point computations C lib" + homepage "http://www.mpfr.org/" + # Track gcc infrastructure releases. + url "http://www.mpfr.org/mpfr-2.4.2/mpfr-2.4.2.tar.bz2" + mirror "ftp://gcc.gnu.org/pub/gcc/infrastructure/mpfr-2.4.2.tar.bz2" + sha256 "c7e75a08a8d49d2082e4caee1591a05d11b9d5627514e678f02d66a124bcf2ba" + + keg_only "Older version of mpfr" + + depends_on "gmp@4" + + fails_with :clang do + build 421 + cause <<-EOS.undent + clang build 421 segfaults while building in superenv; + see https://github.com/mxcl/homebrew/issues/15061 + EOS + end + + def install + args = %W[ + --disable-dependency-tracking + --prefix=#{prefix} + --with-gmp=#{Formula["gmp@4"].opt_prefix} + ] + + # Build 32-bit where appropriate, and help configure find 64-bit CPUs + # Note: This logic should match what the GMP formula does. + if MacOS.prefer_64_bit? && !build.build_32_bit? + ENV.m64 + args << "--build=x86_64-apple-darwin" + else + ENV.m32 + args << "--build=none-apple-darwin" + end + + system "./configure", *args + system "make" + system "make", "check" + system "make", "install" + end + + test do + (testpath/"test.c").write <<-EOS.undent + #include + #include + + int main() + { + mpfr_t x; + mpfr_init(x); + mpfr_clear(x); + return 0; + } + EOS + gmp = Formula["gmp@4"] + system ENV.cc, "test.c", "-o", "test", + "-lgmp", "-I#{gmp.include}", "-L#{gmp.lib}", + "-lmpfr", "-I#{include}", "-L#{lib}" + system "./test" + end +end diff --git a/formula_renames.json b/formula_renames.json index 4dc216793b..d1eaf21a64 100644 --- a/formula_renames.json +++ b/formula_renames.json @@ -30,6 +30,7 @@ "libmongoclient": "mongo-cxx-driver", "libmpc08": "libmpc@0.8", "mongo-c": "mongo-c-driver", + "mpfr2": "mpfr@2", "mpich2": "mpich", "mysql55": "mysql@5.5", "mysql56": "mysql@5.6",