diff --git a/META.bigstring.template b/META.bigstring.template deleted file mode 100644 index fc6c18c..0000000 --- a/META.bigstring.template +++ /dev/null @@ -1 +0,0 @@ -xen_linkopts = "-lbigstringaf_stubs_xen" diff --git a/META.bigstringaf.template b/META.bigstringaf.template new file mode 100644 index 0000000..ab74057 --- /dev/null +++ b/META.bigstringaf.template @@ -0,0 +1,4 @@ +# JBUILDER_GEN + +xen_linkopts = "-l:xen/libbigstringaf_xen_stubs.a" +freestanding_linkopts = "-l:freestanding/libbigstringaf_freestanding_stubs.a" diff --git a/lib/freestanding/cflags.sh b/lib/freestanding/cflags.sh new file mode 100755 index 0000000..276e29e --- /dev/null +++ b/lib/freestanding/cflags.sh @@ -0,0 +1,4 @@ +#!/bin/sh +export PKG_CONFIG_PATH="$(opam config var lib)/pkgconfig" +flags="$(pkg-config --static ocaml-freestanding --cflags)" +echo "($flags)" diff --git a/lib/freestanding/jbuild b/lib/freestanding/jbuild new file mode 100644 index 0000000..1d9b3b4 --- /dev/null +++ b/lib/freestanding/jbuild @@ -0,0 +1,18 @@ +(jbuild_version 1) + +(library + ((name bigstringaf_freestanding) + (public_name bigstringaf.freestanding) + (optional) + (libraries (bigarray mirage-solo5)) + (c_names (bigstringaf_stubs)) + (c_flags (:include cflags.sexp)))) + +(rule (copy# ../bigstringaf_stubs.c bigstringaf_stubs.c)) +(rule (copy# ../bigstringaf.ml bigstringaf.ml)) +(rule (copy# ../bigstringaf.mli bigstringaf.mli)) + +(rule + ((targets (cflags.sexp)) + (deps (cflags.sh)) + (action (bash "./${<} > ${@}")))) diff --git a/lib/jbuild b/lib/jbuild index 909d5b1..3e3d0d9 100644 --- a/lib/jbuild +++ b/lib/jbuild @@ -11,13 +11,3 @@ (javascript_files (runtime.js)) )) )) - -(rule (copy# bigstringaf_stubs.c bigstringaf_stubs_xen.c)) - -(rule - (with-stdout-to cflags-xen.sexp - (progn - (echo "(") - (run pkg-config pkg-config --static mirage-xen --cflags) - (echo ")") - ))) diff --git a/lib/xen/cflags.sh b/lib/xen/cflags.sh new file mode 100755 index 0000000..9a246e1 --- /dev/null +++ b/lib/xen/cflags.sh @@ -0,0 +1,4 @@ +#!/bin/sh +export PKG_CONFIG_PATH="$(opam config var lib)/pkgconfig" +flags="$(pkg-config --static mirage-xen-posix --cflags)" +echo "($flags)" diff --git a/lib/xen/jbuild b/lib/xen/jbuild new file mode 100644 index 0000000..5676dde --- /dev/null +++ b/lib/xen/jbuild @@ -0,0 +1,18 @@ +(jbuild_version 1) + +(library + ((name bigstringaf_xen) + (public_name bigstringaf.xen) + (optional) + (libraries (bigarray mirage-xen)) + (c_names (bigstringaf_stubs)) + (c_flags (:include cflags.sexp)))) + +(rule (copy# ../bigstringaf_stubs.c bigstringaf_stubs.c)) +(rule (copy# ../bigstringaf.ml bigstringaf.ml)) +(rule (copy# ../bigstringaf.mli bigstringaf.mli)) + +(rule + ((targets (cflags.sexp)) + (deps (cflags.sh)) + (action (bash "./${<} > ${@}"))))