gmp: use assembly in static library

Closes #25470.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
FX Coudert 2018-03-19 17:09:08 +01:00
parent b77bde211d
commit f110bc509f

View file

@ -4,7 +4,7 @@ class Gmp < Formula
url "https://gmplib.org/download/gmp/gmp-6.1.2.tar.xz"
mirror "https://ftp.gnu.org/gnu/gmp/gmp-6.1.2.tar.xz"
sha256 "87b565e89a9a684fe4ebeeddb8399dce2599f9c9049854ca8c0dfbdea0e21912"
revision 1
revision 2
bottle do
cellar :any
@ -14,16 +14,13 @@ class Gmp < Formula
end
def install
args = %W[--prefix=#{prefix} --enable-cxx]
# Enable --with-pic to avoid linking issues with the static library
args = %W[--prefix=#{prefix} --enable-cxx --with-pic]
args << "--build=core2-apple-darwin#{`uname -r`.to_i}" if build.bottle?
system "./configure", "--disable-static", *args
system "./configure", *args
system "make"
system "make", "check"
system "make", "install"
system "make", "clean"
system "./configure", "--disable-shared", "--disable-assembly", *args
system "make"
lib.install Dir[".libs/*.a"]
end
test do
@ -41,7 +38,12 @@ class Gmp < Formula
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lgmp", "-o", "test"
system "./test"
# Test the static library to catch potential linking issues
system ENV.cc, "test.c", "#{lib}/libgmp.a", "-o", "test"
system "./test"
end
end