From fc50807657bc1820e2a857f5d67c97a273523a5e Mon Sep 17 00:00:00 2001 From: GenericNerdyUsername Date: Fri, 27 Jan 2023 14:03:33 +0000 Subject: [PATCH] ocamlPackages.sail: init at 0.15 --- .../ocaml-modules/sail/default.nix | 79 +++++++++++++++++++ pkgs/top-level/ocaml-packages.nix | 2 + 2 files changed, 81 insertions(+) create mode 100644 pkgs/development/ocaml-modules/sail/default.nix diff --git a/pkgs/development/ocaml-modules/sail/default.nix b/pkgs/development/ocaml-modules/sail/default.nix new file mode 100644 index 000000000000..f66abd2bdcf1 --- /dev/null +++ b/pkgs/development/ocaml-modules/sail/default.nix @@ -0,0 +1,79 @@ +{ lib +, fetchFromGitHub +, buildDunePackage +, base64 +, omd +, menhir +, ott +, linenoise +, dune-site +, pprint +, makeWrapper +, lem +, z3 +, linksem +, num +}: + +buildDunePackage rec { + pname = "sail"; + version = "0.15"; + + src = fetchFromGitHub { + owner = "rems-project"; + repo = "sail"; + rev = version; + hash = "sha256-eNdFOSzkniNvSCZeORRJ/IYAu+9P4HSouwmhd4BQLPk="; + }; + + duneVersion = "3"; + minimalOCamlVersion = "4.08"; + + nativeBuildInputs = [ + makeWrapper + ott + menhir + lem + ]; + + propagatedBuildInputs = [ + base64 + omd + dune-site + linenoise + pprint + linksem + ]; + + 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 ''${enableParallelBuild:+-j $NIX_BUILD_CORES} + runHook postBuild + ''; + checkPhase = '' + runHook preCheck + dune runtest ''${enableParallelBuild:+-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 = "A language for describing the instruction-set architecture (ISA) semantics of processors"; + maintainers = with maintainers; [ genericnerdyusername ]; + license = licenses.bsd2; + }; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 145203e837bd..0e704ce26af8 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -1244,6 +1244,8 @@ let rusage = callPackage ../development/ocaml-modules/rusage { }; + sail = callPackage ../development/ocaml-modules/sail { }; + samplerate = callPackage ../development/ocaml-modules/samplerate { }; secp256k1 = callPackage ../development/ocaml-modules/secp256k1 {