Skip to content

Commit

Permalink
mpfr: Add a recipe to build mpfr. [skip appveyor]
Browse files Browse the repository at this point in the history
  • Loading branch information
jakirkham committed Mar 27, 2016
1 parent 3976d6b commit 7b1915c
Show file tree
Hide file tree
Showing 4 changed files with 81 additions and 0 deletions.
8 changes: 8 additions & 0 deletions recipes/mpfr/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

./configure --prefix=$PREFIX \
--with-gmp=$PREFIX \
--enable-static
make
make check
make install
39 changes: 39 additions & 0 deletions recipes/mpfr/meta.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions recipes/mpfr/run_test.sh
Original file line number Diff line number Diff line change
@@ -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
32 changes: 32 additions & 0 deletions recipes/mpfr/test.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* From http://www.mpfr.org/sample.html */

#include <stdio.h>

#include <gmp.h>
#include <mpfr.h>

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;
}

0 comments on commit 7b1915c

Please sign in to comment.