diff options
Diffstat (limited to 'nixpkgs/pkgs/applications/science/misc/megam')
3 files changed, 98 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/applications/science/misc/megam/default.nix b/nixpkgs/pkgs/applications/science/misc/megam/default.nix new file mode 100644 index 000000000000..cae0fe9b26fd --- /dev/null +++ b/nixpkgs/pkgs/applications/science/misc/megam/default.nix @@ -0,0 +1,65 @@ +{ lib +, stdenv +, fetchurl +, ocaml +, ncurses +}: + +stdenv.mkDerivation { + pname = "megam"; + version = "0.92"; + + src = fetchurl { + url = "http://hal3.name/megam/megam_src.tgz"; + sha256 = "dc0e9f59ff8513449fe3bd40b260141f89c88a4edf6ddc8b8a394c758e49724e"; + }; + + patches = [ ./ocaml-includes.patch ./ocaml-3.12.patch ]; + + postPatch = '' + # Deprecated in ocaml 3.10 https://github.com/ocaml/ocaml/commit/f6190f3d0c49c5220d443ee8d03ca5072d68aa87 + # Deprecated in ocaml 3.08 https://github.com/ocaml/ocaml/commit/0c7aecb88dc696f66f49f3bed54a037361a26b8d + substituteInPlace fastdot_c.c --replace copy_double caml_copy_double --replace Bigarray_val Caml_ba_array_val --replace caml_bigarray caml_ba_array + # They were already deprecated in 3.12 https://v2.ocaml.org/releases/3.12/htmlman/libref/Array.html + substituteInPlace abffs.ml main.ml --replace create_matrix make_matrix + substituteInPlace intHashtbl.ml --replace Array.create Array.make + ''; + strictDeps = true; + + nativeBuildInputs = [ ocaml ]; + + buildInputs = [ ncurses ]; + + makeFlags = [ + "CAML_INCLUDES=${ocaml}/lib/ocaml/caml" + ("WITHBIGARRAY=" + lib.optionalString (lib.versionOlder ocaml.version "4.08.0") "bigarray.cma") + "all" + "opt" + ]; + + # see https://bugzilla.redhat.com/show_bug.cgi?id=435559 + dontStrip = true; + + installPhase = '' + runHook preInstall + + install -Dm755 megam $out/bin/megam + install -Dm755 megam.opt $out/bin/megam.opt + + runHook postInstall + ''; + + meta = with lib; { + description = "MEGA Model Optimization Package"; + longDescription = '' + The software here is an implementation of maximum likelihood and maximum a + posterior optimization of the parameters of these models. The algorithms + used are much more efficient than the iterative scaling techniques used in + almost every other maxent package out there. + ''; + homepage = "http://www.umiacs.umd.edu/~hal/megam"; + license = "non-commercial"; + maintainers = with maintainers; [ leixb ]; + platforms = platforms.unix; + }; +} diff --git a/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch new file mode 100644 index 000000000000..8265acf6e4a7 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-3.12.patch @@ -0,0 +1,12 @@ +diff -ru megam_0.92/Makefile megam_0.92-b/Makefile +--- megam_0.92/Makefile 2007-10-08 18:06:04.000000000 +0100 ++++ megam_0.92-b/Makefile 2013-11-25 10:14:20.000000000 +0000 +@@ -59,7 +59,7 @@ + + WITHUNIX =unix.cma -cclib -lunix + +-WITHSTR =str.cma -cclib -lstr ++WITHSTR =str.cma -cclib -lcamlstr + + WITHBIGARRAY =bigarray.cma -cclib -lbigarray + diff --git a/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch new file mode 100644 index 000000000000..d4f38949b4d3 --- /dev/null +++ b/nixpkgs/pkgs/applications/science/misc/megam/ocaml-includes.patch @@ -0,0 +1,21 @@ +diff -ru megam_0.92/Makefile megam_0.92-b/Makefile +--- megam_0.92/Makefile 2007-10-08 18:06:04.000000000 +0100 ++++ megam_0.92-b/Makefile 2013-11-25 10:14:20.000000000 +0000 +@@ -41,7 +41,7 @@ + # + # The Caml compilers. # + # You may fix here the path to access the Caml compiler on your machine +-CAMLC = ocamlc -g ++CAMLC = ocamlc -g $(WITHCLIBS) + CAMLOPT = ocamlopt -unsafe -ccopt -O4 -ccopt -ffast-math -inline 99999 + CAMLDEP = ocamldep + CAMLLEX = ocamllex +@@ -70,7 +70,7 @@ + WITHDBM =dbm.cma -cclib -lmldbm -cclib -lndbm + + #WITHCLIBS =-I /usr/lib/ocaml/3.09.2/caml +-WITHCLIBS =-I /usr/lib/ocaml/caml ++WITHCLIBS =-I $(CAML_INCLUDES) -I +unix -I +str + + ################ End of user's variables ##################### + |