-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/container/builder/gmp-freestanding/gmp-freestanding.opam
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
opam-version: "2.0" | ||
synopsis: "The GNU Multiple Precision Arithmetic Library" | ||
description: "Freestanding build of GNU GMP." | ||
maintainer: "Martin Lucina <[email protected]>" | ||
authors: "Torbjörn Granlund and contributors" | ||
license: ["LGPL-3.0-only" "LGPL-2.0-only"] | ||
homepage: "https://gmplib.org/" | ||
bug-reports: "[email protected]" | ||
depends: [ | ||
"ocaml" | ||
"ocaml-freestanding" {>= "0.4.1" & < "0.7.0"} | ||
"conf-m4" {build} | ||
] | ||
flags: light-uninstall | ||
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" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.3.0 | ||
URL: https://gmplib.org | ||
Description: The GNU Multiple Precision Arithmetic Library | ||
Cflags: -I${includedir} | ||
Libs: -L${libdir} -lgmp-freestanding |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- a/mpn/x86_64/fat/fat.c | ||
+++ b/mpn/x86_64/fat/fat.c | ||
@@ -375,6 +375,7 @@ __gmpn_cpuvec_init (void) | ||
CPUVEC_SETUP_core2; | ||
CPUVEC_SETUP_coreinhm; | ||
CPUVEC_SETUP_coreisbr; | ||
+ __gmpn_cpuid (dummy_string, 7); | ||
if ((dummy_string[0 + BMI2_BIT / 8] & (1 << (BMI2_BIT % 8))) == 0) | ||
break; | ||
CPUVEC_SETUP_coreihwl; | ||
@@ -388,6 +389,7 @@ __gmpn_cpuvec_init (void) | ||
CPUVEC_SETUP_core2; | ||
CPUVEC_SETUP_coreinhm; | ||
CPUVEC_SETUP_coreisbr; | ||
+ __gmpn_cpuid (dummy_string, 7); | ||
if ((dummy_string[0 + BMI2_BIT / 8] & (1 << (BMI2_BIT % 8))) == 0) | ||
break; | ||
if (gmp_workaround_skylake_cpuid_bug ()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#!/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 | ||
# | ||
# Further, with the introduction of -fstack-protector-strong in Solo5, override | ||
# this during './configure' to prevent it complaining that the compiler does not | ||
# work, and reinstate it again during 'make'. | ||
# | ||
FREESTANDING_CFLAGS="$(pkg-config --cflags ${PKG_CONFIG_DEPS})" | ||
ac_cv_func_obstack_vprintf=no \ | ||
ac_cv_func_localeconv=no \ | ||
./configure \ | ||
--host=$(uname -m)-unknown-none --enable-fat --disable-shared --with-pic=no \ | ||
CC=cc "CPPFLAGS=${FREESTANDING_CFLAGS} -fno-stack-protector" | ||
|
||
make SUBDIRS="mpn mpz mpq mpf" \ | ||
PRINTF_OBJECTS= SCANF_OBJECTS= \ | ||
CPPFLAGS="${FREESTANDING_CFLAGS}" \ | ||
CFLAGS+=-Werror=implicit-function-declaration |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters