2018-07-05 21:40:30 +02:00
|
|
|
{ stdenv, fetchurl, fetchpatch, ocaml, findlib, ocamlbuild, topkg
|
2019-08-24 09:02:26 +02:00
|
|
|
, cpuid, ocb-stubblr, sexplib
|
2019-11-20 13:06:08 +01:00
|
|
|
, cstruct, zarith, ppx_sexp_conv, ppx_deriving, writeScriptBin
|
2017-11-27 20:08:40 +01:00
|
|
|
, cstruct-lwt ? null
|
2017-03-22 23:53:28 +01:00
|
|
|
}:
|
2015-10-09 21:23:06 +02:00
|
|
|
|
2016-11-03 01:09:54 +01:00
|
|
|
with stdenv.lib;
|
2019-10-31 11:16:15 +01:00
|
|
|
let
|
|
|
|
withLwt = cstruct-lwt != null;
|
|
|
|
# the build system will call 'cc' with no way to override
|
|
|
|
# this is wrong when we're cross-compiling, so insert a wrapper
|
|
|
|
cc-wrapper = writeScriptBin "cc" ''
|
|
|
|
set -e
|
|
|
|
$CC "$@"
|
|
|
|
'';
|
|
|
|
in
|
2015-10-09 21:23:06 +02:00
|
|
|
|
2017-03-22 23:53:28 +01:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
name = "ocaml${ocaml.version}-nocrypto-${version}";
|
|
|
|
version = "0.5.4";
|
2016-11-03 01:09:54 +01:00
|
|
|
|
2018-07-05 21:40:30 +02:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://github.com/mirleft/ocaml-nocrypto/releases/download/v${version}/nocrypto-${version}.tbz";
|
|
|
|
sha256 = "0zshi9hlhcz61n5z1k6fx6rsi0pl4xgahsyl2jp0crqkaf3hqwlg";
|
2015-10-09 21:23:06 +02:00
|
|
|
};
|
|
|
|
|
2018-07-05 21:40:30 +02:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0001-add-missing-runtime-dependencies-in-_tags.patch";
|
|
|
|
sha256 = "1asybwj3rl07b4q4cxwy80a7j17j0i5vzz77p38hymilhc2ky7xn";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0002-add-ppx_sexp_conv-as-a-runtime-dependency-in-the-pac.patch";
|
|
|
|
sha256 = "0zmp64n5fgkawpkyw0vv0bg0i2c3xbsxqy17vwy92nf5rbardi1r";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0003-Auto-detect-ppx_sexp_conv-runtime-library.patch";
|
|
|
|
sha256 = "0lngbg5gyd5gs56lbjh6g86cps1y8x1xsqzi0vi1v28al1gn5dhw";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0004-pack-package-workaround-ocamlbuild-272.patch";
|
|
|
|
sha256 = "16k0w78plvqhl17qiqq1mckxhhcdysqgs94l54a1bn0l6fx3rvb9";
|
|
|
|
})
|
2019-08-24 09:02:26 +02:00
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0005-use-modern-cstruct-findlib.patch";
|
|
|
|
sha256 = "021k38zbdidw6g7j4vjxlnbsrnzq07bnavxzdjq23nbwlifs2nq9";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
url = "https://raw.githubusercontent.com/ocaml/opam-repository/master/packages/nocrypto/nocrypto.0.5.4-1/files/0006-explicit-dependency-on-sexplib.patch";
|
|
|
|
sha256 = "15kd0qgi96yxr3qkmaqny591l0s6qmwpprxd5xdx9qwv72hq813z";
|
|
|
|
})
|
2018-07-05 21:40:30 +02:00
|
|
|
];
|
|
|
|
|
2019-10-31 11:16:15 +01:00
|
|
|
nativeBuildInputs = [ ocaml findlib ocamlbuild cc-wrapper ];
|
2019-12-05 07:38:35 +01:00
|
|
|
buildInputs = [ ocamlbuild findlib topkg cpuid ocb-stubblr ];
|
|
|
|
propagatedBuildInputs = [ cstruct ppx_deriving ppx_sexp_conv sexplib zarith ] ++ optional withLwt cstruct-lwt;
|
2016-11-03 01:09:54 +01:00
|
|
|
|
2019-11-29 22:32:18 +01:00
|
|
|
buildPhase = "${topkg.buildPhase} --accelerate false --with-lwt ${boolToString withLwt}";
|
2017-03-22 23:53:28 +01:00
|
|
|
inherit (topkg) installPhase;
|
2015-10-09 21:23:06 +02:00
|
|
|
|
|
|
|
meta = {
|
2020-04-01 03:11:51 +02:00
|
|
|
homepage = "https://github.com/mirleft/ocaml-nocrypto";
|
2015-10-09 21:23:06 +02:00
|
|
|
description = "Simplest possible crypto to support TLS";
|
|
|
|
license = stdenv.lib.licenses.bsd2;
|
|
|
|
maintainers = with stdenv.lib.maintainers; [ vbgl ];
|
|
|
|
};
|
|
|
|
}
|