about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--pkgs/development/ocaml-modules/afl-persistent/default.nix39
-rw-r--r--pkgs/top-level/ocaml-packages.nix2
2 files changed, 41 insertions, 0 deletions
diff --git a/pkgs/development/ocaml-modules/afl-persistent/default.nix b/pkgs/development/ocaml-modules/afl-persistent/default.nix
new file mode 100644
index 000000000000..5ac352e0762c
--- /dev/null
+++ b/pkgs/development/ocaml-modules/afl-persistent/default.nix
@@ -0,0 +1,39 @@
+{ stdenv, fetchFromGitHub, ocaml, findlib, opaline }:
+
+stdenv.mkDerivation rec {
+  pname = "afl-persistent";
+  version = "1.3";
+  name = "ocaml${ocaml.version}-${pname}-${version}";
+
+  src = fetchFromGitHub {
+    owner  = "stedolan";
+    repo   = "ocaml-${pname}";
+    rev    = "v${version}";
+    sha256 = "06yyds2vcwlfr2nd3gvyrazlijjcrd1abnvkfpkaadgwdw3qam1i";
+  };
+
+  buildInputs = [ ocaml findlib ];
+
+  # don't run tests in buildPhase
+  # don't overwrite test binary
+  postPatch = ''
+    sed -i 's/ && \.\/test$//' build.sh
+    sed -i '/^ocamlopt.*test.ml -o test$/ s/$/2/' build.sh
+    patchShebangs build.sh
+  '';
+
+  buildPhase = "./build.sh";
+  installPhase = ''
+    ${opaline}/bin/opaline -prefix $out -libdir $out/lib/ocaml/${ocaml.version}/site-lib/ ${pname}.install
+  '';
+
+  doCheck = true;
+  checkPhase = "./_build/test && ./_build/test2";
+
+  meta = with stdenv.lib; {
+    homepage = "https://github.com/stedolan/ocaml-afl-persistent";
+    description = "persistent-mode afl-fuzz for ocaml";
+    license = licenses.mit;
+    maintainers = [ maintainers.sternenseemann ];
+  };
+}
diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix
index 76082efda8f5..6c45b77abb77 100644
--- a/pkgs/top-level/ocaml-packages.nix
+++ b/pkgs/top-level/ocaml-packages.nix
@@ -16,6 +16,8 @@ let
 
     buildDunePackage = callPackage ../build-support/ocaml/dune.nix {};
 
+    afl-persistent = callPackage ../development/ocaml-modules/afl-persistent { };
+
     alcotest = callPackage ../development/ocaml-modules/alcotest {};
 
     alcotest-lwt = callPackage ../development/ocaml-modules/alcotest/lwt.nix {};