Skip to content

Commit e227f74

Browse files
committed
gmp-freestanding 6.2.1
1 parent 7fd9d1c commit e227f74

File tree

4 files changed

+96
-0
lines changed

4 files changed

+96
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
libdir=${pcfiledir}/../gmp-freestanding
2+
includedir=${libdir}/include
3+
4+
Name: gmp-freestanding
5+
Version: 6.2.1
6+
URL: https://gmplib.org
7+
Description: The GNU Multiple Precision Arithmetic Library
8+
Cflags: -I${includedir}
9+
Libs: -L${libdir} -lgmp-freestanding
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/sh -ex
2+
if [ -z "$PREFIX" ]; then
3+
PREFIX="`opam config var prefix`/lib/gmp-freestanding"
4+
fi
5+
6+
PKG_CONFIG_DEPS="ocaml-freestanding"
7+
check_deps () {
8+
pkg-config --print-errors --exists ${PKG_CONFIG_DEPS}
9+
}
10+
11+
if ! check_deps 2>/dev/null; then
12+
# rely on `opam` if deps are unavailable
13+
export PKG_CONFIG_PATH="`opam config var prefix`/lib/pkgconfig"
14+
fi
15+
check_deps || exit 1
16+
17+
#
18+
# ocaml-freestanding does not provide a real cross compiler, so we fake it:
19+
#
20+
# - set CC to stop configure trying to find a host compiler
21+
# - set CPPFLAGS to ocaml-freestanding CFLAGS, this prevents inclusion of
22+
# system headers
23+
# - manually override tests for missing functions
24+
# - manually trim the components (SUBDIRS) of libgmp we build to the subset
25+
# actually used by zarith-freestanding (our sole dependency)
26+
# - set -Werror=implicit-function-declaration at *build* time to catch any
27+
# undefined symbols
28+
#
29+
# Further, with the introduction of -fstack-protector-strong in Solo5, override
30+
# this during './configure' to prevent it complaining that the compiler does not
31+
# work, and reinstate it again during 'make'.
32+
#
33+
FREESTANDING_CFLAGS="$(pkg-config --cflags ${PKG_CONFIG_DEPS})"
34+
ac_cv_func_obstack_vprintf=no \
35+
ac_cv_func_localeconv=no \
36+
./configure \
37+
--host=$(uname -m)-unknown-none --enable-fat --disable-shared --with-pic=no \
38+
CC=cc "CPPFLAGS=${FREESTANDING_CFLAGS} -fno-stack-protector"
39+
40+
make SUBDIRS="mpn mpz mpq mpf" \
41+
PRINTF_OBJECTS= SCANF_OBJECTS= \
42+
CPPFLAGS="${FREESTANDING_CFLAGS}" \
43+
CFLAGS+=-Werror=implicit-function-declaration
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh -ex
2+
if [ -z "$PREFIX" ]; then
3+
PREFIX=`opam config var prefix`
4+
fi
5+
PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
6+
LIBDIR=${PREFIX}/lib/gmp-freestanding
7+
8+
mkdir -p ${PKG_CONFIG_PATH}
9+
cp gmp-freestanding.pc ${PKG_CONFIG_PATH}
10+
mkdir -p ${LIBDIR}
11+
cp .libs/libgmp.a ${LIBDIR}/libgmp-freestanding.a
12+
touch ${LIBDIR}/META
13+
mkdir -p ${LIBDIR}/include
14+
cp gmp.h ${LIBDIR}/include
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
opam-version: "2.0"
2+
maintainer: "Martin Lucina <[email protected]>"
3+
homepage: "https://gmplib.org/"
4+
license: ["LGPL-3.0-only" "LGPL-2.0-only"]
5+
authors: "Torbjörn Granlund and contributors"
6+
bug-reports: "[email protected]"
7+
8+
build: ["sh" "-ex" "./mirage-build.sh"]
9+
install: ["sh" "-ex" "./mirage-install.sh"]
10+
remove: [
11+
"rm" "-rf"
12+
"%{prefix}%/lib/pkgconfig/gmp-freestanding.pc"
13+
"%{prefix}%/lib/gmp-freestanding"
14+
]
15+
depends: [
16+
"ocaml"
17+
"ocaml-freestanding" {>= "0.4.1"}
18+
]
19+
synopsis: "The GNU Multiple Precision Arithmetic Library"
20+
description: "Freestanding build of GNU GMP."
21+
flags: light-uninstall
22+
extra-files: [
23+
["mirage-install.sh" "md5=aca9a1c985326f95daa51aedef55b318"]
24+
["mirage-build.sh" "md5=c4b411f29867c13595470011d3b77f6c"]
25+
["gmp-freestanding.pc" "md5=314f83a7d574bb4d1afe0dabffa5fbe0"]
26+
]
27+
url {
28+
src: "https://gmplib.org/download/gmp/gmp-6.2.1.tar.xz"
29+
checksum: "sha512=c99be0950a1d05a0297d65641dd35b75b74466f7bf03c9e8a99895a3b2f9a0856cd17887738fa51cf7499781b65c049769271cbcb77d057d2e9f1ec52e07dd84"
30+
}

0 commit comments

Comments
 (0)