pantry/projects/gnu.org/mpfr/package.yml
Max Howell 81e7a5e16f
pkgx
2023-10-01 14:44:42 -04:00

47 lines
1 KiB
YAML

distributable:
url: https://ftp.gnu.org/gnu/mpfr/mpfr-{{ version.raw }}.tar.gz
strip-components: 1
versions:
url: https://ftp.gnu.org/gnu/mpfr/
match: /mpfr-\d+\.\d+(\.\d+)?\.tar\.gz/
strip:
- /mpfr-/
- /.tar.gz/
build:
dependencies:
gnu.org/gmp: '>=4.2'
script: |
./configure --prefix={{ prefix }}
make --jobs {{ hw.concurrency }} install
test:
make test
test:
dependencies:
gnu.org/gmp: '>=4.2'
script: |
mv $FIXTURE test.c
gcc -lgmp -lmpfr test.c -o test
test $(./test) = '{{version}}'
fixture: |
#include <mpfr.h>
#include <math.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main() {
mpfr_t x, y;
mpfr_inits2 (256, x, y, NULL);
mpfr_set_ui (x, 2, MPFR_RNDN);
mpfr_rootn_ui (y, x, 2, MPFR_RNDN);
mpfr_pow_si (x, y, 4, MPFR_RNDN);
mpfr_add_si (y, x, -4, MPFR_RNDN);
mpfr_abs (y, y, MPFR_RNDN);
if (fabs(mpfr_get_d (y, MPFR_RNDN)) > 1.e-30) abort();
printf("%s", mpfr_get_version());
return 0;
}