Skip to content
This repository has been archived by the owner on Oct 18, 2020. It is now read-only.

Commit

Permalink
Merge pull request #214 from kit-ty-kate/411
Browse files Browse the repository at this point in the history
OCaml 4.11 support
  • Loading branch information
hannesm authored Aug 7, 2020
2 parents 47d03cd + 2faf127 commit 8f52b6c
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 7 deletions.
5 changes: 2 additions & 3 deletions mirage-xen-ocaml.opam
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ tags: "org:mirage"
homepage: "https://github.com/mirage/mirage-platform"
bug-reports: "https://github.com/mirage/mirage-platform/issues/"
depends: [
"ocaml" {>= "4.04.2" & <= "4.11.0"}
"ocaml" {>= "4.04.2" & < "4.12.0"}
"mirage-xen-posix" {>= "2.6.0"}
"conf-pkg-config"
"ocamlfind" {build}
Expand All @@ -17,7 +17,6 @@ substs: [
"xen-ocaml/flags/libs.tmp"
]
available: os = "linux"
build: [make "xen-ocaml-build"]
build: [make "xen-ocaml-build" "PREFIX=%{prefix}%"]
install: [make "xen-ocaml-install" "PREFIX=%{prefix}%"]
remove: [make "xen-ocaml-uninstall" "PREFIX=%{prefix}%"]
dev-repo: "git+https://github.com/mirage/mirage-platform.git"
1 change: 0 additions & 1 deletion mirage-xen-posix.opam
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,4 @@ substs: [
available: os = "linux"
build: [make "xen-posix-build"]
install: [make "xen-posix-install" "PREFIX=%{prefix}%"]
remove: [make "xen-posix-uninstall" "PREFIX=%{prefix}%"]
dev-repo: "git+https://github.com/mirage/mirage-platform.git"
17 changes: 15 additions & 2 deletions xen-ocaml/build.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
#!/bin/sh -ex

PREFIX=${1:-$PREFIX}
if [ "$PREFIX" = "" ]; then
PREFIX="$(opam config var prefix)"
fi

MJOBS=${4:-NJOBS}
PKG_CONFIG_DEPS="mirage-xen-posix openlibm libminios-xen >= 0.5"
check_deps () {
Expand All @@ -8,7 +13,7 @@ check_deps () {

if ! check_deps 2>/dev/null; then
# only rely on `opam` if deps are unavailable
export PKG_CONFIG_PATH=`opam config var prefix`/lib/pkgconfig
export PKG_CONFIG_PATH="${PREFIX}/lib/pkgconfig"
fi

check_deps || exit 1
Expand Down Expand Up @@ -125,6 +130,14 @@ case $OCAMLOPT_VERSION in
CFLAGS="-D__ANDROID__ $CFLAGS"
CONFIGURE_OPTS="--disable-systhreads --disable-str-lib --disable-unix-lib --disable-ocamldoc"
;;
4.11.*)
echo Applying OCaml 4.11.0 config
cp config/version-4110.h ocaml-src/runtime/caml/version.h
S_H_LOCATION="ocaml-src/runtime/caml/"
BIGARRAY_OBJ=""
CFLAGS="-D__ANDROID__ $CFLAGS"
CONFIGURE_OPTS="--disable-systhreads --disable-str-lib --disable-unix-lib --disable-ocamldoc"
;;
*)
echo unsupported OCaml version $OCAMLOPT_VERSION
exit 1
Expand All @@ -145,7 +158,7 @@ case $OCAMLOPT_VERSION in
cd asmrun && make -j${NJOBS} UNIX_OR_WIN32=unix CPPFLAGS="-DNATIVE_CODE ${CFLAGS} -I../byterun -DTARGET_${TARGET_ARCH}" NATIVECCPROFOPTS="-DNATIVE_CODE ${CFLAGS}" libasmrun.a && cd ..
IS_408_OR_MORE=0
;;
4.08.*|4.09.*|4.10.*)
4.08.*|4.09.*|4.10.*|4.11.*)
cd runtime && make -j${NJOBS} UNIX_OR_WIN32=unix OC_NATIVE_CPPFLAGS="-DNATIVE_CODE -DXXXX=1 ${CFLAGS} -DTARGET_${TARGET_ARCH}" libasmrun.a && cd ..
IS_408_OR_MORE=1
;;
Expand Down
6 changes: 6 additions & 0 deletions xen-ocaml/config/version-4110.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#define OCAML_VERSION_MAJOR 4
#define OCAML_VERSION_MINOR 11
#define OCAML_VERSION_PATCHLEVEL 0
#undef OCAML_VERSION_ADDITIONAL
#define OCAML_VERSION 41100
#define OCAML_VERSION_STRING "4.11.0"
2 changes: 1 addition & 1 deletion xen-ocaml/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ OCAML_LIB_DIR=$(ocamlopt -config )
OCAMLOPT_VERSION=$(ocamlopt -version)
echo Detected OCaml version $OCAMLOPT_VERSION
case $OCAMLOPT_VERSION in
4.08.*|4.09.*|4.10.*)
4.08.*|4.09.*|4.10.*|4.11.*)
ASMRUN_FOLDER=runtime
BYTERUN_FOLDER=runtime
;;
Expand Down

0 comments on commit 8f52b6c

Please sign in to comment.