Skip to content

Commit

Permalink
gmp: use assembly in static library
Browse files Browse the repository at this point in the history
Closes #25470.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
  • Loading branch information
fxcoudert committed Mar 19, 2018
1 parent b77bde2 commit f110bc5
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions Formula/gmp.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -41,7 +38,12 @@ def install
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

0 comments on commit f110bc5

Please sign in to comment.