Skip to content

Commit

Permalink
Merge pull request #13 from hannesm/freestanding
Browse files Browse the repository at this point in the history
Freestanding support (on top of #12)
  • Loading branch information
seliopou authored Jul 4, 2018
2 parents 682db3e + 8a15115 commit baa74cd
Show file tree
Hide file tree
Showing 7 changed files with 48 additions and 11 deletions.
1 change: 0 additions & 1 deletion META.bigstring.template

This file was deleted.

4 changes: 4 additions & 0 deletions META.bigstringaf.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# JBUILDER_GEN

xen_linkopts = "-l:xen/libbigstringaf_xen_stubs.a"
freestanding_linkopts = "-l:freestanding/libbigstringaf_freestanding_stubs.a"
4 changes: 4 additions & 0 deletions lib/freestanding/cflags.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
export PKG_CONFIG_PATH="$(opam config var lib)/pkgconfig"
flags="$(pkg-config --static ocaml-freestanding --cflags)"
echo "($flags)"
18 changes: 18 additions & 0 deletions lib/freestanding/jbuild
Original file line number Diff line number Diff line change
@@ -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 "./${<} > ${@}"))))
10 changes: 0 additions & 10 deletions lib/jbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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 ")")
)))
4 changes: 4 additions & 0 deletions lib/xen/cflags.sh
Original file line number Diff line number Diff line change
@@ -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)"
18 changes: 18 additions & 0 deletions lib/xen/jbuild
Original file line number Diff line number Diff line change
@@ -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 "./${<} > ${@}"))))

0 comments on commit baa74cd

Please sign in to comment.