Skip to content

Commit

Permalink
Nocrypto patches for compatibility with sexplib/ppx_sexp_conv > v0.11.0
Browse files Browse the repository at this point in the history
ppx_sexp_conv v0.11.0 compiles successfully, but contains an undesired
dependency on base, and is thus still marked as conflicting. This is
fixed in ppx_sexp_conv v0.11.1.

This commit submits @gasche's fixes from
mirleft/ocaml-nocrypto#144
  • Loading branch information
copy committed May 26, 2018
1 parent 0ffd4a8 commit 4161244
Show file tree
Hide file tree
Showing 4 changed files with 128 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
From cad7cfe15ae8eca95c4e284f3a679c35842659f2 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <[email protected]>
Date: Mon, 26 Mar 2018 16:09:16 +0200
Subject: [PATCH 1/4] add missing runtime dependencies in _tags

Binaries in <bench/*>, <tests/*> depend on ppx_sexp_conv's runtime
library within ppx_sexp_conv.

The packed modules <src/nocrypto.cm{x,o}> also depend on the package
ppx_sexp_conv: its presence at pack-creation time influences the
generated .cmi interface, see

https://github.com/ocaml/opam-repository/pull/11628#issuecomment-375697444

Note: the package ppx_sexp_conv.runtime-lib would suffice, but it is
only available as such under recent ppx_sexp_conv versions, so its
explicit use would make the build description (needlessly)
incompatible with older ppx_sexp_conv versions.
---
_tags | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/_tags b/_tags
index 6d4e7de..c2a6610 100644
--- a/_tags
+++ b/_tags
@@ -7,6 +7,7 @@ true: package(bytes), package(cstruct)
<src/*.ml{,i}>: package(zarith), package(sexplib), package(ppx_sexp_conv)
<src/*.cm{x,o}> and not <src/nocrypto.cmx>: for-pack(Nocrypto)
<src/*.cm{,x}a>: link_stubs(src/libnocrypto_stubs)
+<src/nocrypto.cm{x,o}>: package(ppx_sexp_conv)

<unix>: include
<unix/*.ml{,i}>: package(unix), package(bytes)
@@ -19,7 +20,7 @@ true: package(bytes), package(cstruct)

<**/*.c>: ccopt(--std=c99 -Wall -Wextra -O3)

-<bench/*>: use_nocrypto, package(zarith), package(cstruct.unix)
-<tests/*>: use_nocrypto, package(zarith), package(oUnit)
+<bench/*>: use_nocrypto, package(zarith), package(ppx_sexp_conv)
+<tests/*>: use_nocrypto, package(zarith), package(ppx_sexp_conv), package(oUnit)

<rondom>: -traverse
--
2.17.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
From 55fbc3531afde59ba34cde1c14d99704439756e6 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <[email protected]>
Date: Tue, 27 Mar 2018 12:00:23 +0200
Subject: [PATCH 3/4] add ppx_sexp_conv as a runtime dependency in the
packaging metadata

---
opam | 2 +-
pkg/META | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/opam b/opam
index ad1dbc7..c35570b 100644
--- a/opam
+++ b/opam
@@ -20,7 +20,7 @@ depends: [
"topkg" {build}
"cpuid" {build}
"ocb-stubblr" {build}
- "ppx_sexp_conv" {build}
+ "ppx_sexp_conv"
"oUnit" {test}
"cstruct"
"zarith"
diff --git a/pkg/META b/pkg/META
index 242b2bb..a7929c7 100644
--- a/pkg/META
+++ b/pkg/META
@@ -1,6 +1,6 @@
version = "%%VERSION_NUM%%"
description = "Simple crypto for the modern age"
-requires = "cstruct zarith sexplib"
+requires = "cstruct zarith sexplib ppx_sexp_conv"
archive(byte) = "nocrypto.cma"
archive(native) = "nocrypto.cmxa"
plugin(byte) = "nocrypto.cma"
--
2.17.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
From 9e773027e0a590121896e5021d252f07ce9516c0 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <[email protected]>
Date: Mon, 26 Mar 2018 16:07:45 +0200
Subject: [PATCH 4/4] pack+package: workaround ocamlbuild#272

ocamlbuild should pass -package(...) flags to ocamlfind when building
a -pack-ed file, see

https://github.com/ocaml/opam-repository/pull/11628#issuecomment-375697444
---
myocamlbuild.ml | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 2752315..03b9efb 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -1,5 +1,13 @@
open Ocamlbuild_plugin

+let ocamlfind_and_pack = function
+ | After_rules ->
+ if !Options.use_ocamlfind then
+ pflag ["ocaml"; "pack"] "package"
+ (fun pkg -> S [A "-package"; A pkg]);
+ | _ -> ()
+
let () = dispatch Ocb_stubblr.(
init & ccopt ~tags:["accelerate"] "-DACCELERATE -msse2 -maes"
+ & ocamlfind_and_pack
)
--
2.17.0

10 changes: 8 additions & 2 deletions packages/nocrypto/nocrypto.0.5.4/opam
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@ depends: [
"cpuid" {build}
"ocb-stubblr" {build}
"ppx_deriving" {build}
"ppx_sexp_conv" {build & >= "113.33.01" & < "v0.11.0"}
"ppx_sexp_conv" {>= "113.33.01" & != "v0.11.0"}
"ounit" {test}
"cstruct" {>="2.4.0"}
"cstruct-lwt"
"zarith"
"lwt"
"sexplib" {< "v0.11.0"}
"sexplib"
("mirage-no-xen" | ("mirage-xen" & "mirage-entropy" & "zarith-xen"))
("mirage-no-solo5" | ("mirage-solo5" & "mirage-entropy" & "zarith-freestanding"))
]
Expand All @@ -39,3 +39,9 @@ conflicts: [
"mirage-xen" {<"2.2.0"}
"sexplib" {="v0.9.0"}
]

patches: [
"0001-add-missing-runtime-dependencies-in-_tags.patch"
"0003-add-ppx_sexp_conv-as-a-runtime-dependency-in-the-pac.patch"
"0004-pack-package-workaround-ocamlbuild-272.patch"
]

0 comments on commit 4161244

Please sign in to comment.