55 lines
1.7 KiB
Ruby
55 lines
1.7 KiB
Ruby
class Libmpc < Formula
|
|
desc "C library for the arithmetic of high precision complex numbers"
|
|
homepage "http://multiprecision.org"
|
|
url "https://ftp.gnu.org/gnu/mpc/mpc-1.0.3.tar.gz"
|
|
mirror "http://multiprecision.org/mpc/download/mpc-1.0.3.tar.gz"
|
|
sha256 "617decc6ea09889fb08ede330917a00b16809b8db88c29c31bfbb49cbf88ecc3"
|
|
revision 1
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "94016748ba9688fa05324d6bd1a0fbfc5e4924a4715d9611cfde464f85bb25cd" => :high_sierra
|
|
sha256 "16ddbf6cf6c187a58f932cc907cf9c545b5a7f056282d5c01df849db7490e53e" => :sierra
|
|
sha256 "5527bea12285c11434ba29cd94de47d693ac5f9400d9e1ab161907604dcecfb4" => :el_capitan
|
|
sha256 "fa1789c2694894febb26850ef356689e7bfc19251f6f84f77b65c2ba677fb2a1" => :yosemite
|
|
end
|
|
|
|
depends_on "gmp"
|
|
depends_on "mpfr"
|
|
|
|
def install
|
|
args = %W[
|
|
--prefix=#{prefix}
|
|
--disable-dependency-tracking
|
|
--with-gmp=#{Formula["gmp"].opt_prefix}
|
|
--with-mpfr=#{Formula["mpfr"].opt_prefix}
|
|
]
|
|
|
|
system "./configure", *args
|
|
system "make"
|
|
system "make", "check"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <mpc.h>
|
|
#include <assert.h>
|
|
#include <math.h>
|
|
|
|
int main() {
|
|
mpc_t x;
|
|
mpc_init2 (x, 256);
|
|
mpc_set_d_d (x, 1., INFINITY, MPC_RNDNN);
|
|
mpc_tanh (x, x, MPC_RNDNN);
|
|
assert (mpfr_nan_p (mpc_realref (x)) && mpfr_nan_p (mpc_imagref (x)));
|
|
mpc_clear (x);
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cc, "test.c", "-L#{lib}", "-L#{Formula["mpfr"].opt_lib}",
|
|
"-L#{Formula["gmp"].opt_lib}", "-lmpc", "-lmpfr",
|
|
"-lgmp", "-o", "test"
|
|
system "./test"
|
|
end
|
|
end
|