2022-11-04 12:27:35 +00:00
|
|
|
{ lib, stdenv, fetchurl, fetchFromGitHub, ocaml, findlib, pkg-config, gtk2, libgnomecanvas, gtksourceview
|
2022-12-17 10:02:37 +00:00
|
|
|
, camlp-streams, gnumake42
|
2022-11-04 12:27:35 +00:00
|
|
|
}:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
let param =
|
2021-01-15 22:18:51 +00:00
|
|
|
let check = lib.versionAtLeast ocaml.version; in
|
2020-05-15 21:57:56 +00:00
|
|
|
if check "4.06" then rec {
|
2022-11-04 12:27:35 +00:00
|
|
|
version = "2.18.13";
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "garrigue";
|
|
|
|
repo = "lablgtk";
|
|
|
|
rev = version;
|
2022-11-04 12:27:35 +00:00
|
|
|
sha256 = "sha256-69Svno0qLaUifMscnVuPUJlCo9d8Lee+1qiYx34G3Po=";
|
2020-05-15 21:57:56 +00:00
|
|
|
};
|
2023-03-04 12:14:45 +00:00
|
|
|
env = { };
|
2022-11-04 12:27:35 +00:00
|
|
|
buildInputs = [ camlp-streams ];
|
2020-04-24 23:36:52 +00:00
|
|
|
} else if check "3.12" then {
|
|
|
|
version = "2.18.5";
|
2020-05-15 21:57:56 +00:00
|
|
|
src = fetchurl {
|
|
|
|
url = "https://forge.ocamlcore.org/frs/download.php/1627/lablgtk-2.18.5.tar.gz";
|
|
|
|
sha256 = "0cyj6sfdvzx8hw7553lhgwc0krlgvlza0ph3dk9gsxy047dm3wib";
|
|
|
|
};
|
2022-06-26 10:26:21 +00:00
|
|
|
# Workaround build failure on -fno-common toolchains like upstream
|
|
|
|
# gcc-10. Otherwise build fails as:
|
|
|
|
# ld: ml_gtktree.o:(.bss+0x0): multiple definition of
|
|
|
|
# `ml_table_extension_events'; ml_gdkpixbuf.o:(.bss+0x0): first defined here
|
2023-03-04 12:14:45 +00:00
|
|
|
env.NIX_CFLAGS_COMPILE = "-fcommon";
|
2020-04-24 23:36:52 +00:00
|
|
|
} else throw "lablgtk is not available for OCaml ${ocaml.version}";
|
|
|
|
in
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
2022-11-04 12:27:35 +00:00
|
|
|
pname = "ocaml${ocaml.version}-lablgtk";
|
2023-03-04 12:14:45 +00:00
|
|
|
inherit (param) version src env;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
# gnumake42: https://github.com/garrigue/lablgtk/issues/162
|
|
|
|
nativeBuildInputs = [ pkg-config ocaml findlib gnumake42 ];
|
2022-11-04 12:27:35 +00:00
|
|
|
buildInputs = [ gtk2 libgnomecanvas gtksourceview ]
|
|
|
|
++ param.buildInputs or [];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
configureFlags = [ "--with-libdir=$(out)/lib/ocaml/${ocaml.version}/site-lib" ];
|
|
|
|
buildFlags = [ "world" ];
|
|
|
|
|
|
|
|
preInstall = ''
|
|
|
|
mkdir -p $out/lib/ocaml/${ocaml.version}/site-lib
|
|
|
|
export OCAMLPATH=$out/lib/ocaml/${ocaml.version}/site-lib/:$OCAMLPATH
|
|
|
|
'';
|
|
|
|
|
|
|
|
dontStrip = true;
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-04-24 23:36:52 +00:00
|
|
|
description = "An OCaml interface to GTK";
|
2022-06-16 17:23:12 +00:00
|
|
|
homepage = "http://lablgtk.forge.ocamlcore.org/";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.lgpl21Plus;
|
2022-06-16 17:23:12 +00:00
|
|
|
maintainers = with maintainers; [ maggesi roconnor vbgl ];
|
|
|
|
mainProgram = "lablgtk2";
|
|
|
|
inherit (ocaml.meta) platforms;
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|