2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, which
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
, opaline
|
|
|
|
, cmake
|
|
|
|
, ocaml
|
|
|
|
, findlib
|
|
|
|
, hacl-star
|
|
|
|
, ctypes
|
|
|
|
, cppo
|
|
|
|
}:
|
2021-07-21 07:28:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ocaml${ocaml.version}-hacl-star-raw";
|
2023-05-24 13:37:59 +00:00
|
|
|
version = "0.7.0";
|
2021-07-21 07:28:18 +00:00
|
|
|
|
|
|
|
src = fetchzip {
|
2023-05-24 13:37:59 +00:00
|
|
|
url = "https://github.com/cryspen/hacl-packages/releases/download/ocaml-v${version}/hacl-star.${version}.tar.gz";
|
|
|
|
sha256 = "sha256-jJtxVYhQgP8ItfLhQ2wcF8RKNRnYhB2j0nR7/YH1NfY=";
|
2021-07-21 07:28:18 +00:00
|
|
|
stripRoot = false;
|
|
|
|
};
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
patches = [
|
|
|
|
./aligned-alloc.patch
|
|
|
|
];
|
2021-07-21 07:28:18 +00:00
|
|
|
|
2022-01-25 03:21:06 +00:00
|
|
|
minimalOCamlVersion = "4.08";
|
2021-07-21 07:28:18 +00:00
|
|
|
|
2022-04-27 09:35:20 +00:00
|
|
|
# strictoverflow is disabled because it breaks aarch64-darwin
|
|
|
|
hardeningDisable = [ "strictoverflow" ];
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
postPatch = ''
|
|
|
|
patchShebangs ./
|
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
buildPhase = ''
|
|
|
|
runHook preBuild
|
|
|
|
|
|
|
|
make -C hacl-star-raw build-c
|
|
|
|
make -C hacl-star-raw build-bindings
|
|
|
|
|
|
|
|
runHook postBuild
|
|
|
|
'';
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
preInstall = ''
|
2023-05-24 13:37:59 +00:00
|
|
|
mkdir $out
|
2021-07-21 07:28:18 +00:00
|
|
|
mkdir -p $OCAMLFIND_DESTDIR/stublibs
|
|
|
|
'';
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
installPhase = ''
|
|
|
|
runHook preInstall
|
|
|
|
|
|
|
|
make -C hacl-star-raw install
|
|
|
|
|
|
|
|
runHook postInstall
|
|
|
|
'';
|
2021-07-21 07:28:18 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
dontUseCmakeConfigure = true;
|
2021-07-21 07:28:18 +00:00
|
|
|
dontAddPrefix = true;
|
2021-09-18 10:52:07 +00:00
|
|
|
dontAddStaticConfigureFlags = true;
|
2023-05-24 13:37:59 +00:00
|
|
|
createFindlibDestdir = true;
|
2021-07-21 07:28:18 +00:00
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
nativeBuildInputs = [
|
2021-07-21 07:28:18 +00:00
|
|
|
which
|
2023-05-24 13:37:59 +00:00
|
|
|
cmake
|
2021-07-21 07:28:18 +00:00
|
|
|
ocaml
|
|
|
|
findlib
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
ctypes
|
|
|
|
];
|
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
checkInputs = [
|
2021-07-21 07:28:18 +00:00
|
|
|
cppo
|
|
|
|
];
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
strictDeps = true;
|
|
|
|
|
2021-07-21 07:28:18 +00:00
|
|
|
doCheck = true;
|
|
|
|
|
|
|
|
meta = {
|
2023-05-24 13:37:59 +00:00
|
|
|
inherit (ocaml.meta) platforms;
|
2021-07-21 07:28:18 +00:00
|
|
|
description = "Auto-generated low-level OCaml bindings for EverCrypt/HACL*";
|
|
|
|
license = lib.licenses.asl20;
|
|
|
|
maintainers = [ lib.maintainers.ulrikstrid ];
|
|
|
|
};
|
|
|
|
}
|