Skip to content

Commit

Permalink
add gmp-xen.6.0.0-1 and gmp-freestanding.6.0.0-1 (which are 6.0.0 + w…
Browse files Browse the repository at this point in the history
…ith-pic)

depend in zarith-{xen,freestanding}.1.6 on "> gmp-{xen,freestanding}.6.0.0"
  • Loading branch information
hannesm committed Oct 2, 2017
1 parent 429c364 commit acfe7bf
Show file tree
Hide file tree
Showing 16 changed files with 178 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/gmp-freestanding/gmp-freestanding.6.0.0-1/descr
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
The GNU Multiple Precision Arithmetic Library

Freestanding build of GNU GMP.
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
libdir=${pcfiledir}/../gmp-freestanding
includedir=${libdir}/include

Name: gmp-freestanding
Version: 6.0.0
URL: https://gmplib.org
Description: The GNU Multiple Precision Arithmetic Library
Cflags: -I${includedir}
Libs: -L${libdir} -lgmp-freestanding
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/sh -ex
if [ -z "$PREFIX" ]; then
PREFIX="`opam config var prefix`/lib/gmp-freestanding"
fi

PKG_CONFIG_DEPS="ocaml-freestanding"
check_deps () {
pkg-config --print-errors --exists ${PKG_CONFIG_DEPS}
}

if ! check_deps 2>/dev/null; then
# rely on `opam` if deps are unavailable
export PKG_CONFIG_PATH="`opam config var prefix`/lib/pkgconfig"
fi
check_deps || exit 1

#
# ocaml-freestanding does not provide a real cross compiler, so we fake it:
#
# - set CC to stop configure trying to find a host compiler
# - set CPPFLAGS to ocaml-freestanding CFLAGS, this prevents inclusion of
# system headers
# - manually override tests for missing functions
# - manually trim the components (SUBDIRS) of libgmp we build to the subset
# actually used by zarith-freestanding (our sole dependency)
# - set -Werror=implicit-function-declaration at *build* time to catch any
# undefined symbols
#
ac_cv_func_obstack_vprintf=no \
ac_cv_func_localeconv=no \
./configure \
--host=x86_64-unknown-none --enable-fat --disable-shared --with-pic \
CC=cc "CPPFLAGS=$(pkg-config --cflags ${PKG_CONFIG_DEPS})"

make SUBDIRS="mpn mpz mpq mpf" \
PRINTF_OBJECTS= SCANF_OBJECTS= \
CFLAGS+=-Werror=implicit-function-declaration
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/sh -ex
if [ -z "$PREFIX" ]; then
PREFIX=`opam config var prefix`
fi
PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
LIBDIR=${PREFIX}/lib/gmp-freestanding

mkdir -p ${PKG_CONFIG_PATH}
cp gmp-freestanding.pc ${PKG_CONFIG_PATH}
mkdir -p ${LIBDIR}
cp .libs/libgmp.a ${LIBDIR}/libgmp-freestanding.a
touch ${LIBDIR}/META
mkdir -p ${LIBDIR}/include
cp gmp.h ${LIBDIR}/include
17 changes: 17 additions & 0 deletions packages/gmp-freestanding/gmp-freestanding.6.0.0-1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "1.2"
maintainer: "Martin Lucina <martin@lucina.net>"
homepage: "https://gmplib.org/"
license: "GNU LGPL v3 and GNU GPL v2"
authors: "Torbjörn Granlund and contributors"
bug-reports: "mirageos-devel@lists.xenproject.org"

build: ["sh" "-ex" "./mirage-build.sh"]
install: ["sh" "-ex" "./mirage-install.sh"]
remove: [
"rm" "-rf"
"%{prefix}%/lib/pkgconfig/gmp-freestanding.pc"
"%{prefix}%/lib/gmp-freestanding"
]
depends: [
"ocaml-freestanding"
]
2 changes: 2 additions & 0 deletions packages/gmp-freestanding/gmp-freestanding.6.0.0-1/url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
archive: "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz"
checksum: "1e6da4e434553d2811437aa42c7f7c76"
1 change: 1 addition & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/descr
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The GNU Multiple Precision Arithmetic Library
20 changes: 20 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/files/gmp-6a.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- gmp-6.0.0.orig.orig/config.guess 2014-03-25 14:37:55.000000000 +0000
+++ gmp-6.0.0.orig/config.guess 2014-09-16 15:46:57.457485087 +0000
@@ -173,7 +173,7 @@
;;

arm*-*-*)
- cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null`
+ cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo | head -1 2>/dev/null`
case "$cpu_code" in
0xa10 | 0xa11 | 0xb11) # v4 strongarm/sa1100
exact_cpu="armsa1";;
@@ -200,7 +200,7 @@
0xc15) exact_cpu="armcortexr5";; # v7r
0xc23) exact_cpu="armcortexm3";; # v7m
esac
- exact_cpu="${exact_cpu}`sed -n 's;^Features.*\(neon\).*;\1;p' /proc/cpuinfo 2>/dev/null`"
+ exact_cpu="${exact_cpu}`sed -n 's;^Features.*\(neon\).*;\1;p' /proc/cpuinfo | head -1 2>/dev/null`"
;;

ia64*-*-*)
9 changes: 9 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/files/gmp-xen.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
libdir=${pcfiledir}/../gmp-xen
includedir=${libdir}/include

Name: gmp-xen
Version: 6.0.0
URL: https://gmplib.org
Description: The GNU Multiple Precision Arithmetic Library
Cflags: -I${includedir}
Libs: -L${libdir} -lgmp-xen
31 changes: 31 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/files/mirage-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh -ex
if [ -z "$PREFIX" ]; then
PREFIX="`opam config var prefix`/lib/gmp-xen"
fi

PKG_CONFIG_DEPS="mirage-xen-posix"
check_deps () {
pkg-config --print-errors --exists ${PKG_CONFIG_DEPS}
}

if ! check_deps 2>/dev/null; then
# rely on `opam` if deps are unavailable
export PKG_CONFIG_PATH="`opam config var prefix`/lib/pkgconfig"
fi
check_deps || exit 1

CPPFLAGS="$CPPFLAGS `pkg-config $PKG_CONFIG_DEPS --cflags` -O2 -pedantic -fomit-frame-pointer -fno-builtin -D_FORTIFY_SOURCE=0 -Wmissing-prototypes --std=gnu99"
# Use different --host and --build to trigger cross-compilation mode (don't try to test binaries during configure)
# Set CC to stop it trying to find a separate compiler for HOST.
# Pass CPPFLAGS (not just CFLAGS) to stop it finding the Linux headers (just generates warnings).
# Use -Werror=missing-prototypes because we're not running the tests due to cross-compiling.
HOST="`uname -m`-unknown-none"
BUILD=`./config.guess`
./configure --host="$HOST" --build="$BUILD" --enable-fat CC=gcc --prefix="$PREFIX" --disable-shared CPPFLAGS="$CPPFLAGS" --with-pic
# Because we're cross-compiling, configurate can't tell whether a function
# actually exists and just assumes they all do. For localeconv, this is wrong.
sed -e '/HAVE_LOCALECONV/d' \
-e '/HAVE_OBSTACK_VPRINTF/d'\
-i config.status
./config.status
make
13 changes: 13 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/files/mirage-install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh -ex
if [ -z "$PREFIX" ]; then
PREFIX=`opam config var prefix`
fi
LIBDIR="$PREFIX/lib/gmp-xen"
PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig"
export PKG_CONFIG_PATH

make install
mkdir -p "$PKG_CONFIG_PATH"
cp gmp-xen.pc "$PKG_CONFIG_PATH/"
mkdir -p "$LIBDIR"
cp .libs/libgmp.a "$LIBDIR/libgmp-xen.a"
17 changes: 17 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/opam
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
opam-version: "1.2"
maintainer: "Thomas Leonard <talex5@gmail.com>"
homepage: "https://gmplib.org/"
license: "GNU LGPL v3 and GNU GPL v2"
authors: "Torbjörn Granlund and contributors"

patches: ["gmp-6a.diff"]
build: ["sh" "-ex" "./mirage-build.sh"]
install: ["sh" "-ex" "./mirage-install.sh"]
remove: [
"rm" "-rf"
"%{prefix}%/lib/pkgconfig/gmp-xen.pc"
"%{prefix}%/lib/gmp-xen"
]
depends: [
"mirage-xen-posix"
]
2 changes: 2 additions & 0 deletions packages/gmp-xen/gmp-xen.6.0.0-1/url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
archive: "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.xz"
checksum: "1e6da4e434553d2811437aa42c7f7c76"
1 change: 1 addition & 0 deletions packages/gmp-xen/gmp-xen.6.0.0/opam
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ opam-version: "1.2"
maintainer: "Thomas Leonard <talex5@gmail.com>"
homepage: "https://gmplib.org/"
license: "GNU LGPL v3 and GNU GPL v2"
authors: "Torbjörn Granlund and contributors"

patches: ["gmp-6a.diff"]
build: ["sh" "-ex" "./mirage-build.sh"]
Expand Down
2 changes: 1 addition & 1 deletion packages/zarith-freestanding/zarith-freestanding.1.6/opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ install: ["sh" "-eux" "./mirage-install.sh"]
remove: ["sh" "-eux" "./mirage-uninstall.sh"]
depends: [
"ocaml-freestanding"
"gmp-freestanding"
"gmp-freestanding" {> "6.0.0"}
"zarith" {= "1.6"}
"ocamlfind"
]
Expand Down
2 changes: 1 addition & 1 deletion packages/zarith-xen/zarith-xen.1.6/opam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ install: ["sh" "-eux" "./mirage-install.sh"]
remove: ["sh" "-eux" "./mirage-uninstall.sh"]
depends: [
"mirage-xen-posix"
"gmp-xen"
"gmp-xen" {> "6.0.0"}
"zarith" {= "1.6"}
"ocamlfind"
]

0 comments on commit acfe7bf

Please sign in to comment.