2019-10-06 08:37:47 +01:00
|
|
|
{ stdenv, fetchurl, fetchzip, ocaml, findlib, tcl, tk }:
|
2018-07-29 09:35:35 +01:00
|
|
|
|
2019-10-06 08:37:47 +01:00
|
|
|
let OCamlVersionAtLeast = stdenv.lib.versionAtLeast ocaml.version; in
|
|
|
|
|
|
|
|
if !OCamlVersionAtLeast "4.04"
|
2018-12-10 19:59:50 +00:00
|
|
|
then throw "labltk is not available for OCaml ${ocaml.version}"
|
|
|
|
else
|
|
|
|
|
2019-10-06 08:37:47 +01:00
|
|
|
let param =
|
|
|
|
if OCamlVersionAtLeast "4.08" then rec {
|
|
|
|
version = "8.06.7";
|
|
|
|
src = fetchzip {
|
|
|
|
url = "https://github.com/garrigue/labltk/archive/${version}.tar.gz";
|
|
|
|
sha256 = "1cqnxjv2dvw9csiz4iqqyx6rck04jgylpglk8f69kgybf7k7xk2h";
|
|
|
|
};
|
|
|
|
} else
|
|
|
|
let mkOldParam = { version, key, sha256 }: {
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://forge.ocamlcore.org/frs/download.php/${key}/labltk-${version}.tar.gz";
|
|
|
|
inherit sha256;
|
|
|
|
};
|
|
|
|
inherit version;
|
|
|
|
}; in
|
|
|
|
{
|
|
|
|
"4.04" = mkOldParam {
|
2018-07-29 09:35:35 +01:00
|
|
|
version = "8.06.2";
|
|
|
|
key = "1628";
|
|
|
|
sha256 = "1p97j9s33axkb4yyl0byhmhlyczqarb886ajpyggizy2br3a0bmk";
|
|
|
|
};
|
2019-10-06 08:37:47 +01:00
|
|
|
"4.05" = mkOldParam {
|
2018-07-29 09:35:35 +01:00
|
|
|
version = "8.06.3";
|
|
|
|
key = "1701";
|
|
|
|
sha256 = "1rka9jpg3kxqn7dmgfsa7pmsdwm16x7cn4sh15ijyyrad9phgdxn";
|
|
|
|
};
|
2019-10-06 08:37:47 +01:00
|
|
|
"4.06" = mkOldParam {
|
2018-07-29 09:35:35 +01:00
|
|
|
version = "8.06.4";
|
|
|
|
key = "1727";
|
|
|
|
sha256 = "0j3rz0zz4r993wa3ssnk5s416b1jhj58l6z2jk8238a86y7xqcii";
|
|
|
|
};
|
2019-10-06 08:37:47 +01:00
|
|
|
"4.07" = mkOldParam {
|
2018-07-29 09:35:35 +01:00
|
|
|
version = "8.06.5";
|
|
|
|
key = "1764";
|
|
|
|
sha256 = "0wgx65y1wkgf22ihpqmspqfp95fqbj3pldhp1p3b1mi8rmc37zwj";
|
|
|
|
};
|
2019-08-13 22:52:01 +01:00
|
|
|
}.${builtins.substring 0 4 ocaml.version};
|
2018-07-29 09:35:35 +01:00
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
2019-10-06 08:37:47 +01:00
|
|
|
inherit (param) version src;
|
2018-07-29 09:35:35 +01:00
|
|
|
name = "ocaml${ocaml.version}-labltk-${version}";
|
|
|
|
|
|
|
|
buildInputs = [ ocaml findlib tcl tk ];
|
|
|
|
|
|
|
|
configureFlags = [ "--use-findlib" "--installbindir" "$(out)/bin" ];
|
|
|
|
dontAddPrefix = true;
|
|
|
|
|
|
|
|
buildFlags = [ "all" "opt" ];
|
|
|
|
|
|
|
|
createFindlibDestdir = true;
|
|
|
|
|
|
|
|
postInstall = ''
|
|
|
|
mkdir -p $OCAMLFIND_DESTDIR/stublibs
|
|
|
|
mv $OCAMLFIND_DESTDIR/labltk/dlllabltk.so $OCAMLFIND_DESTDIR/stublibs/
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "OCaml interface to Tcl/Tk, including OCaml library explorer OCamlBrowser";
|
|
|
|
homepage = "http://labltk.forge.ocamlcore.org/";
|
|
|
|
license = stdenv.lib.licenses.lgpl21;
|
|
|
|
inherit (ocaml.meta) platforms;
|
|
|
|
maintainers = [ stdenv.lib.maintainers.vbgl ];
|
|
|
|
};
|
|
|
|
}
|