nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 fetchurl,
5 ocaml,
6 ncurses,
7}:
8
9stdenv.mkDerivation {
10 pname = "megam";
11 version = "0.92";
12
13 src = fetchurl {
14 url = "http://hal3.name/megam/megam_src.tgz";
15 sha256 = "dc0e9f59ff8513449fe3bd40b260141f89c88a4edf6ddc8b8a394c758e49724e";
16 };
17
18 patches = [
19 ./ocaml-includes.patch
20 ./ocaml-3.12.patch
21 ];
22
23 postPatch = ''
24 # Deprecated in ocaml 3.10 https://github.com/ocaml/ocaml/commit/f6190f3d0c49c5220d443ee8d03ca5072d68aa87
25 # Deprecated in ocaml 3.08 https://github.com/ocaml/ocaml/commit/0c7aecb88dc696f66f49f3bed54a037361a26b8d
26 substituteInPlace fastdot_c.c --replace copy_double caml_copy_double --replace Bigarray_val Caml_ba_array_val --replace caml_bigarray caml_ba_array
27 # They were already deprecated in 3.12 https://v2.ocaml.org/releases/3.12/htmlman/libref/Array.html
28 substituteInPlace abffs.ml main.ml --replace create_matrix make_matrix
29 substituteInPlace intHashtbl.ml --replace Array.create Array.make
30 '';
31 strictDeps = true;
32
33 nativeBuildInputs = [ ocaml ];
34
35 buildInputs = [ ncurses ];
36
37 makeFlags = [
38 "CAML_INCLUDES=${ocaml}/lib/ocaml/caml"
39 ("WITHBIGARRAY=" + lib.optionalString (lib.versionOlder ocaml.version "4.08.0") "bigarray.cma")
40 "all"
41 "opt"
42 ];
43
44 # see https://bugzilla.redhat.com/show_bug.cgi?id=435559
45 dontStrip = true;
46
47 installPhase = ''
48 runHook preInstall
49
50 install -Dm755 megam $out/bin/megam
51 install -Dm755 megam.opt $out/bin/megam.opt
52
53 runHook postInstall
54 '';
55
56 meta = with lib; {
57 description = "MEGA Model Optimization Package";
58 longDescription = ''
59 The software here is an implementation of maximum likelihood and maximum a
60 posterior optimization of the parameters of these models. The algorithms
61 used are much more efficient than the iterative scaling techniques used in
62 almost every other maxent package out there.
63 '';
64 homepage = "http://www.umiacs.umd.edu/~hal/megam";
65 license = "non-commercial";
66 maintainers = with maintainers; [ leixb ];
67 platforms = platforms.unix;
68 };
69}