Skip to content

Instantly share code, notes, and snippets.

@mato
Created July 4, 2016 13:03
Show Gist options
  • Save mato/922940d1dc7d4048c8d0b665d55caf9d to your computer and use it in GitHub Desktop.
Save mato/922940d1dc7d4048c8d0b665d55caf9d to your computer and use it in GitHub Desktop.
diff --git a/_oasis b/_oasis
index 2346deb..e079976 100644
--- a/_oasis
+++ b/_oasis
@@ -19,6 +19,10 @@ Flag xen
Description: Build Xen support
Default: false
+Flag solo5
+ Description: Build Solo5 support
+ Default: false
+
Flag lwt
Description: Build Lwt/Unix support
Default: true
@@ -121,6 +125,34 @@ Library nocrypto_xen
if flag(modernity) && architecture(amd64)
CCOpt+: -DACCELERATE -msse2 -maes
+Library nocrypto_solo5
+ Path: solo5/
+ Findlibparent: nocrypto
+ Findlibname: solo5
+ Build$: flag(solo5)
+ Modules: Nocrypto_entropy_solo5
+ CSources: native/nocrypto.h,
+ native/misc.c,
+ native/hash/stubs.c,
+ native/hash/bitfn.h,
+ native/hash/md5.c,
+ native/hash/md5.h,
+ native/hash/sha1.c,
+ native/hash/sha1.h,
+ native/hash/sha256.c,
+ native/hash/sha256.h,
+ native/hash/sha512.c,
+ native/hash/sha512.h,
+ native/aes/generic.c,
+ native/aes/aesni.c,
+ native/des/generic.c,
+ native/des/generic.h
+ BuildDepends: nocrypto, mirage-entropy-solo5
+ XMETARequires: nocrypto, lwt, mirage-entropy-solo5
+ CCOpt: --std=c99 -Wall -Wextra -Werror -O3 -DNDEBUG $FREESTANDING_CFLAGS
+ if flag(modernity) && architecture(amd64)
+ CCOpt+: -DACCELERATE -msse2 -maes
+
Library testlib
Path: tests/
Modules: Notest, Hmac_tests, Dsa_tests, Testlib
diff --git a/opam b/opam
index 2412924..604a62d 100644
--- a/opam
+++ b/opam
@@ -9,7 +9,8 @@ license: "BSD2"
build: [
[ "./configure" "--prefix" prefix
"--%{lwt:enable}%-lwt"
- "--%{mirage-xen+mirage-entropy-xen:enable}%-xen" ]
+ "--%{mirage-xen+mirage-entropy-xen:enable}%-xen"
+ "--%{mirage-solo5+mirage-entropy-solo5:enable}%-solo5" ]
[ make ]
]
install: [ make "install" ]
@@ -23,7 +24,7 @@ depends: [
"cstruct" {>= "1.6.0"}
"zarith"
"sexplib"
- ("mirage-no-xen" | ("mirage-xen" & "mirage-entropy-xen" & "zarith-xen"))
+ ("mirage-no-xen" | ("mirage-xen" & "mirage-entropy-xen" & "zarith-xen") | ("mirage-solo5" & "mirage-entropy-solo5" & "zarith-freestanding") )
"ounit" {test}
]
diff --git a/postconf b/postconf
index 4df41f3..7974b5c 100755
--- a/postconf
+++ b/postconf
@@ -8,6 +8,10 @@ XEN_CFLAGS="disabled"
grep -q '^xen="true"' setup.data && XEN_CFLAGS="$(pkg-config --static mirage-xen --cflags)"
echo "XEN_CFLAGS=\"${XEN_CFLAGS}\"" >> setup.data
+FREESTANDING_CFLAGS="disabled"
+grep -q '^solo5="true"' setup.data && FREESTANDING_CFLAGS="$(pkg-config ocaml-freestanding --cflags)"
+echo "FREESTANDING_CFLAGS=\"${FREESTANDING_CFLAGS}\"" >> setup.data
+
# Kill CPU acceleration if requested in ./configure, but:
# * unsupported by the current host CPU;
# * unsupported by the current toolchain; or
@mato
Copy link
Author

mato commented Jul 4, 2016

./configure "--prefix" "/home/mato/.opam/mirage-solo5-ukvm" "--enable-lwt" "--disable-xen" "--enable-solo5"

Fails with:

ocaml setup.ml -build
Finished, 0 targets (0 cached) in 00:00:00.
Solver failed:
Ocamlbuild knows of no rules that apply to a target named src/libnocrypto_stubs.mly. This can happen if you ask Ocamlbuild to build a target with the wrong extension (e.g. .opt instead of .native) or if the source files live in directories that have not been specified as include directories.
Compilation unsuccessful after building 7 targets (7 cached) in 00:00:00.
E: Failure("Command ''/home/mato/.opam/mirage-solo5-ukvm/bin/ocamlbuild' src/libnocrypto_stubs.a src/dllnocrypto_stubs.so src/nocrypto.cma src/nocrypto.cmxa src/nocrypto.a src/nocrypto.cmxs unix/nocrypto_unix.cma unix/nocrypto_unix.cmxa unix/nocrypto_unix.a unix/nocrypto_unix.cmxs lwt/nocrypto_lwt.cma lwt/nocrypto_lwt.cmxa lwt/nocrypto_lwt.a lwt/nocrypto_lwt.cmxs solo5/libnocrypto_solo5_stubs.a solo5/dllnocrypto_solo5_stubs.so solo5/nocrypto_solo5.cma solo5/nocrypto_solo5.cmxa solo5/nocrypto_solo5.a solo5/nocrypto_solo5.cmxs -use-ocamlfind -tag debug' terminated with error code 6")
Makefile:4: recipe for target 'build' failed
make: *** [build] Error 1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment