Skip to content

Commit

Permalink
Nocrypto: Provide patches without rename
Browse files Browse the repository at this point in the history
Fixes application of these patches on non-gnu systems
  • Loading branch information
copy committed Jun 26, 2018
1 parent 08656a1 commit 55a1684
Show file tree
Hide file tree
Showing 6 changed files with 160 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From cad7cfe15ae8eca95c4e284f3a679c35842659f2 Mon Sep 17 00:00:00 2001
From 6f97531287a3e3ee749f2277248af28bdc85b8e4 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <gabriel.scherer@gmail.com>
Date: Mon, 26 Mar 2018 16:09:16 +0200
Subject: [PATCH 2/6] add missing runtime dependencies in _tags
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.
Expand Down Expand Up @@ -43,5 +43,5 @@ index 6d4e7de..c2a6610 100644

<rondom>: -traverse
--
2.17.0
2.18.0

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 55fbc3531afde59ba34cde1c14d99704439756e6 Mon Sep 17 00:00:00 2001
From dc799fd2a66c41ca7729201a5d038cd403ca1de6 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <gabriel.scherer@gmail.com>
Date: Tue, 27 Mar 2018 12:00:23 +0200
Subject: [PATCH 4/6] add ppx_sexp_conv as a runtime dependency in the
Subject: [PATCH 2/4] add ppx_sexp_conv as a runtime dependency in the
packaging metadata

---
Expand Down Expand Up @@ -35,5 +35,5 @@ index 242b2bb..a7929c7 100644
archive(native) = "nocrypto.cmxa"
plugin(byte) = "nocrypto.cma"
--
2.17.0
2.18.0

Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
From ad9278021a65d423e30765e58110848adda4b13e Mon Sep 17 00:00:00 2001
From: Jeremie Dimino <jeremie@dimino.org>
Date: Fri, 11 May 2018 15:44:47 +0200
Subject: [PATCH 3/4] Auto-detect ppx_sexp_conv runtime library

---
myocamlbuild.ml | 25 ++++++++++++++++++++++---
pkg/META | 43 -------------------------------------------
pkg/META.in | 43 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 65 insertions(+), 46 deletions(-)
delete mode 100644 pkg/META
create mode 100644 pkg/META.in

diff --git a/myocamlbuild.ml b/myocamlbuild.ml
index 2752315..7b29635 100644
--- a/myocamlbuild.ml
+++ b/myocamlbuild.ml
@@ -1,5 +1,24 @@
open Ocamlbuild_plugin

-let () = dispatch Ocb_stubblr.(
- init & ccopt ~tags:["accelerate"] "-DACCELERATE -msse2 -maes"
-)
+let runtime_deps_of_ppx ppx =
+ (Findlib.query "ppx_sexp_conv").dependencies
+ |> List.filter_opt (fun { Findlib.name; _ } ->
+ if name = ppx || name = "ppx_deriving" then
+ None
+ else
+ Some name)
+
+let () = dispatch (fun hook ->
+ Ocb_stubblr.(
+ init & ccopt ~tags:["accelerate"] "-DACCELERATE -msse2 -maes"
+ ) hook;
+ match hook with
+ | After_rules ->
+ let meta = "pkg/META" in
+ let meta_in = meta ^ ".in" in
+ rule meta ~dep:meta_in ~prod:meta (fun _ _ ->
+ let deps = String.concat " " (runtime_deps_of_ppx "ppx_sexp_conv") in
+ Echo([String.subst "PPX_SEXP_CONV_RUNTIME" deps
+ (Pathname.read meta_in)],
+ meta))
+ | _ -> ())
diff --git a/pkg/META b/pkg/META
deleted file mode 100644
index a7929c7..0000000
--- a/pkg/META
+++ /dev/null
@@ -1,43 +0,0 @@
-version = "%%VERSION_NUM%%"
-description = "Simple crypto for the modern age"
-requires = "cstruct zarith sexplib ppx_sexp_conv"
-archive(byte) = "nocrypto.cma"
-archive(native) = "nocrypto.cmxa"
-plugin(byte) = "nocrypto.cma"
-plugin(native) = "nocrypto.cmxs"
-xen_linkopts = "-lnocrypto_stubs+mirage-xen"
-freestanding_linkopts = "-lnocrypto_stubs+mirage-freestanding"
-exists_if = "nocrypto.cma"
-
-package "unix" (
- version = "%%VERSION_NUM%%"
- description = "Simple crypto for the modern age"
- requires = "nocrypto unix bytes"
- archive(byte) = "nocrypto_unix.cma"
- archive(native) = "nocrypto_unix.cmxa"
- plugin(byte) = "nocrypto_unix.cma"
- plugin(native) = "nocrypto_unix.cmxs"
- exists_if = "nocrypto_unix.cma"
-)
-
-package "lwt" (
- version = "%%VERSION_NUM%%"
- description = "Simple crypto for the modern age"
- requires = "nocrypto nocrypto.unix lwt.unix cstruct.lwt"
- archive(byte) = "nocrypto_lwt.cma"
- archive(native) = "nocrypto_lwt.cmxa"
- plugin(byte) = "nocrypto_lwt.cma"
- plugin(native) = "nocrypto_lwt.cmxs"
- exists_if = "nocrypto_lwt.cma"
-)
-
-package "mirage" (
- version = "%%VERSION_NUM%%"
- description = "Simple crypto for the modern age"
- requires = "nocrypto lwt mirage-entropy"
- archive(byte) = "nocrypto_mirage.cma"
- archive(native) = "nocrypto_mirage.cmxa"
- plugin(byte) = "nocrypto_mirage.cma"
- plugin(native) = "nocrypto_mirage.cmxs"
- exists_if = "nocrypto_mirage.cma"
-)
diff --git a/pkg/META.in b/pkg/META.in
new file mode 100644
index 0000000..0b263d7
--- /dev/null
+++ b/pkg/META.in
@@ -0,0 +1,43 @@
+version = "%%VERSION_NUM%%"
+description = "Simple crypto for the modern age"
+requires = "cstruct zarith sexplib PPX_SEXP_CONV_RUNTIME"
+archive(byte) = "nocrypto.cma"
+archive(native) = "nocrypto.cmxa"
+plugin(byte) = "nocrypto.cma"
+plugin(native) = "nocrypto.cmxs"
+xen_linkopts = "-lnocrypto_stubs+mirage-xen"
+freestanding_linkopts = "-lnocrypto_stubs+mirage-freestanding"
+exists_if = "nocrypto.cma"
+
+package "unix" (
+ version = "%%VERSION_NUM%%"
+ description = "Simple crypto for the modern age"
+ requires = "nocrypto unix bytes"
+ archive(byte) = "nocrypto_unix.cma"
+ archive(native) = "nocrypto_unix.cmxa"
+ plugin(byte) = "nocrypto_unix.cma"
+ plugin(native) = "nocrypto_unix.cmxs"
+ exists_if = "nocrypto_unix.cma"
+)
+
+package "lwt" (
+ version = "%%VERSION_NUM%%"
+ description = "Simple crypto for the modern age"
+ requires = "nocrypto nocrypto.unix lwt.unix cstruct.lwt"
+ archive(byte) = "nocrypto_lwt.cma"
+ archive(native) = "nocrypto_lwt.cmxa"
+ plugin(byte) = "nocrypto_lwt.cma"
+ plugin(native) = "nocrypto_lwt.cmxs"
+ exists_if = "nocrypto_lwt.cma"
+)
+
+package "mirage" (
+ version = "%%VERSION_NUM%%"
+ description = "Simple crypto for the modern age"
+ requires = "nocrypto lwt mirage-entropy"
+ archive(byte) = "nocrypto_mirage.cma"
+ archive(native) = "nocrypto_mirage.cmxa"
+ plugin(byte) = "nocrypto_mirage.cma"
+ plugin(native) = "nocrypto_mirage.cmxs"
+ exists_if = "nocrypto_mirage.cma"
+)
--
2.18.0

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
From 1befe5d2ab60653d1d44fa734d2b8057cf3410db Mon Sep 17 00:00:00 2001
From 063b3496340fe4c3544b532ec0d27797b7917bb4 Mon Sep 17 00:00:00 2001
From: Gabriel Scherer <gabriel.scherer@gmail.com>
Date: Mon, 26 Mar 2018 16:07:45 +0200
Subject: [PATCH 6/6] pack+package: workaround ocamlbuild#272
Subject: [PATCH 4/4] pack+package: workaround ocamlbuild#272

ocamlbuild should pass -package(...) flags to ocamlfind when building
a -pack-ed file, see
Expand Down Expand Up @@ -34,5 +34,5 @@ index 7b29635..7a5cdb6 100644
match hook with
| After_rules ->
--
2.17.0
2.18.0

This file was deleted.

10 changes: 5 additions & 5 deletions packages/nocrypto/nocrypto.0.5.4-1/opam
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ authors: ["David Kaloper <david@numm.org>"]
maintainer: "David Kaloper <david@numm.org>"
license: "ISC"
tags: [ "org:mirage" ]
available: [ ocaml-version >= "4.02.0" & os != "freebsd" & os != "openbsd" ]
available: [ ocaml-version >= "4.02.0" ]

build: ["ocaml" "pkg/pkg.ml" "build" "--pinned" "%{pinned}%" "--tests" "false"
"--jobs" "1"
Expand Down Expand Up @@ -41,8 +41,8 @@ conflicts: [
]

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

0 comments on commit 55a1684

Please sign in to comment.