2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, which
|
|
|
|
, stdenv
|
|
|
|
, fetchzip
|
|
|
|
, cmake
|
|
|
|
, ocaml
|
|
|
|
, findlib
|
|
|
|
, ctypes
|
|
|
|
, cppo
|
|
|
|
}:
|
2021-07-21 07:28:18 +00:00
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "ocaml${ocaml.version}-hacl-star-raw";
|
2023-11-16 04:20:00 +00:00
|
|
|
version = "0.7.1";
|
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";
|
2023-11-16 04:20:00 +00:00
|
|
|
hash = "sha256-TcAEaJou4BOVXSz5DYewzKfvIpjXmhLAlgF0hlq3ToQ=";
|
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-04-27 09:35:20 +00:00
|
|
|
# strictoverflow is disabled because it breaks aarch64-darwin
|
|
|
|
hardeningDisable = [ "strictoverflow" ];
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
# Compatibility with ctypes ≥ 0.21
|
|
|
|
# see: https://github.com/cryspen/hacl-packages/commit/81303b83a54a92d3b5f54f1b8ddbea60438cc2bf
|
2021-07-21 07:28:18 +00:00
|
|
|
postPatch = ''
|
2024-04-21 15:54:59 +00:00
|
|
|
substituteInPlace hacl-star-raw/META --replace-warn 'requires="ctypes"' 'requires="ctypes ctypes.stubs"'
|
2021-07-21 07:28:18 +00:00
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|