depot/pkgs/development/ocaml-modules/sail/default.nix
Luke Granger-Brown 57725ef3ec Squashed 'third_party/nixpkgs/' content from commit 76612b17c0ce
git-subtree-dir: third_party/nixpkgs
git-subtree-split: 76612b17c0ce71689921ca12d9ffdc9c23ce40b2
2024-11-10 23:59:47 +00:00

78 lines
1.7 KiB
Nix

{ lib
, fetchFromGitHub
, buildDunePackage
, base64
, omd
, menhir
, ott
, linenoise
, dune-site
, pprint
, makeWrapper
, lem
, linksem
, yojson
}:
buildDunePackage rec {
pname = "sail";
version = "0.16";
src = fetchFromGitHub {
owner = "rems-project";
repo = "sail";
rev = version;
hash = "sha256-HY/rgWi0S7ZiAWZF0fVIRK6fpoJ7Xp5EQcxoPRCPJ5Y=";
};
minimalOCamlVersion = "4.08";
nativeBuildInputs = [
makeWrapper
ott
menhir
lem
];
propagatedBuildInputs = [
base64
omd
dune-site
linenoise
pprint
linksem
yojson
];
preBuild = ''
rm -r aarch* # Remove code derived from non-bsd2 arm spec
rm -r snapshots # Some of this might be derived from stuff in the aarch dir, it builds fine without it
'';
# `buildDunePackage` only builds the [pname] package
# This doesnt work in this case, as sail includes multiple packages in the same source tree
buildPhase = ''
runHook preBuild
dune build --release ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postBuild
'';
checkPhase = ''
runHook preCheck
dune runtest ''${enableParallelBuilding:+-j $NIX_BUILD_CORES}
runHook postCheck
'';
installPhase = ''
runHook preInstall
dune install --prefix $out --libdir $OCAMLFIND_DESTDIR
runHook postInstall
'';
postInstall = ''
wrapProgram $out/bin/sail --set SAIL_DIR $out/share/sail
'';
meta = with lib; {
homepage = "https://github.com/rems-project/sail";
description = "Language for describing the instruction-set architecture (ISA) semantics of processors";
maintainers = with maintainers; [ genericnerdyusername ];
license = licenses.bsd2;
};
}