Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix MPFR link issue #4

Merged
merged 2 commits into from
Mar 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions recipes/mpfr/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

export LD_LIBRARY_PATH=$PREFIX/lib:$LD_LIBRARY_PATH

./configure --prefix=$PREFIX \
--with-gmp=$PREFIX \
--enable-static

make
make check
make install
38 changes: 38 additions & 0 deletions recipes/mpfr/meta.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{% 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:
- 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;
}