diff --git a/recipes/mpfr/build.sh b/recipes/mpfr/build.sh new file mode 100755 index 0000000000000..a3a046d4a6eb5 --- /dev/null +++ b/recipes/mpfr/build.sh @@ -0,0 +1,8 @@ +#!/bin/bash + +./configure --prefix=$PREFIX \ + --with-gmp=$PREFIX \ + --enable-static +make +make check +make install diff --git a/recipes/mpfr/meta.yaml b/recipes/mpfr/meta.yaml new file mode 100644 index 0000000000000..5bf22c6458bbf --- /dev/null +++ b/recipes/mpfr/meta.yaml @@ -0,0 +1,39 @@ +{% set version = "3.1.4" %} + +package: + name: mpfr + version: {{ version }} + +source: + fn: mpfr-{{ version }}.tar.bz2 + url: http://ftp.gnu.org/gnu/mpfr/mpfr-{{ version }}.tar.gz + md5: 482ab3c120ffc959f631b4ba9ec59a46 + +build: + number: 0 + skip: true # [win] + +requirements: + build: + - autoconf + - m4 + - libtool + - gmp + run: + - gmp + +test: + commands: + - test -f ${PREFIX}/lib/libmpfr.a # [unix] + - test -f ${PREFIX}/lib/libmpfr.dylib # [osx] + - test -f ${PREFIX}/lib/libmpfr.so # [linux] + +about: + home: http://www.mpfr.org/ + license: LGPL 3 + summary: The MPFR library is a C library for multiple-precision floating-point computations with correct rounding. + +extra: + recipe-maintainers: + - isuruf + - jakirkham diff --git a/recipes/mpfr/run_test.sh b/recipes/mpfr/run_test.sh new file mode 100644 index 0000000000000..04987010dc309 --- /dev/null +++ b/recipes/mpfr/run_test.sh @@ -0,0 +1,2 @@ +cc -L$PREFIX/lib -I$PREFIX/include -lmpfr -lgmp -Wl,-rpath,$PREFIX/lib $RECIPE_DIR/test.c -o test.o +./test.o diff --git a/recipes/mpfr/test.c b/recipes/mpfr/test.c new file mode 100644 index 0000000000000..726b23453dd58 --- /dev/null +++ b/recipes/mpfr/test.c @@ -0,0 +1,32 @@ +/* From http://www.mpfr.org/sample.html */ + +#include + +#include +#include + +int main (void) +{ + unsigned int i; + mpfr_t s, t, u; + + mpfr_init2 (t, 200); + mpfr_set_d (t, 1.0, MPFR_RNDD); + mpfr_init2 (s, 200); + mpfr_set_d (s, 1.0, MPFR_RNDD); + mpfr_init2 (u, 200); + for (i = 1; i <= 100; i++) + { + mpfr_mul_ui (t, t, i, MPFR_RNDU); + mpfr_set_d (u, 1.0, MPFR_RNDD); + mpfr_div (u, u, t, MPFR_RNDD); + mpfr_add (s, s, u, MPFR_RNDD); + } + printf ("Sum is "); + mpfr_out_str (stdout, 10, 0, s, MPFR_RNDD); + putchar ('\n'); + mpfr_clear (s); + mpfr_clear (t); + mpfr_clear (u); + return 0; +}