diff --git a/pkgs/development/ocaml-modules/lablgtk3/default.nix b/pkgs/development/ocaml-modules/lablgtk3/default.nix index 9f2227327e49..8da00b76393a 100644 --- a/pkgs/development/ocaml-modules/lablgtk3/default.nix +++ b/pkgs/development/ocaml-modules/lablgtk3/default.nix @@ -1,27 +1,38 @@ -{ stdenv, fetchurl, pkgconfig, ocaml, findlib, gtk3, gtkspell3, gtksourceview }: +{ stdenv,lib, fetchFromGitHub, pkgconfig, ocaml, findlib, dune, gtk3, cairo2 }: -if !stdenv.lib.versionAtLeast ocaml.version "4.05" +if !lib.versionAtLeast ocaml.version "4.05" then throw "lablgtk3 is not available for OCaml ${ocaml.version}" else +# This package uses the dune.configurator library +# It thus needs said library to be compiled with this OCaml compiler +let __dune = dune; in +let dune = __dune.override { ocamlPackages = { inherit ocaml findlib; }; }; in + stdenv.mkDerivation rec { - version = "3.0.beta3"; - name = "ocaml${ocaml.version}-lablgtk3-${version}"; - src = fetchurl { - url = https://forge.ocamlcore.org/frs/download.php/1775/lablgtk-3.0.beta3.tar.gz; - sha256 = "174mwwdz1s91a6ycbas7nc0g87c2l6zqv68zi5ab33yb76l46a6w"; + version = "3.0.beta4"; + pname = "lablgtk3"; + name = "ocaml${ocaml.version}-${pname}-${version}"; + + src = fetchFromGitHub { + owner = "garrigue"; + repo = "lablgtk"; + rev = version; + sha256 = "1lppb7k4xb1a35i7klm9mz98hw8l2f8s7rivgzysi1sviqy1ds5d"; }; nativeBuildInputs = [ pkgconfig ]; - buildInputs = [ ocaml findlib gtk3 gtkspell3 gtksourceview ]; + buildInputs = [ ocaml findlib dune gtk3 ]; + propagatedBuildInputs = [ cairo2 ]; - buildFlags = "world"; + buildPhase = "dune build -p ${pname}"; + inherit (dune) installPhase; meta = { description = "OCaml interface to gtk+-3"; homepage = "http://lablgtk.forge.ocamlcore.org/"; - license = stdenv.lib.licenses.lgpl21; - maintainers = [ stdenv.lib.maintainers.vbgl ]; + license = lib.licenses.lgpl21; + maintainers = [ lib.maintainers.vbgl ]; inherit (ocaml.meta) platforms; }; } diff --git a/pkgs/development/ocaml-modules/lablgtk3/gtkspell3.nix b/pkgs/development/ocaml-modules/lablgtk3/gtkspell3.nix new file mode 100644 index 000000000000..7e898be74901 --- /dev/null +++ b/pkgs/development/ocaml-modules/lablgtk3/gtkspell3.nix @@ -0,0 +1,8 @@ +{ buildDunePackage, gtkspell3, lablgtk3 }: + +buildDunePackage rec { + pname = "lablgtk3-gtkspell3"; + buildInputs = [ gtkspell3 ] ++ lablgtk3.buildInputs; + propagatedBuildInputs = [ lablgtk3 ]; + inherit (lablgtk3) src version meta nativeBuildInputs; +} diff --git a/pkgs/development/ocaml-modules/lablgtk3/sourceview3.nix b/pkgs/development/ocaml-modules/lablgtk3/sourceview3.nix new file mode 100644 index 000000000000..7e8807576eeb --- /dev/null +++ b/pkgs/development/ocaml-modules/lablgtk3/sourceview3.nix @@ -0,0 +1,9 @@ +{ stdenv, ocaml, gtksourceview, lablgtk3 }: + +stdenv.mkDerivation rec { + name = "ocaml${ocaml.version}-lablgtk3-sourceview3-${version}"; + buildPhase = "dune build -p lablgtk3-sourceview3"; + buildInputs = lablgtk3.buildInputs ++ [ gtksourceview ]; + propagatedBuildInputs = [ lablgtk3 ]; + inherit (lablgtk3) src version meta nativeBuildInputs installPhase; +} diff --git a/pkgs/top-level/ocaml-packages.nix b/pkgs/top-level/ocaml-packages.nix index 510fd62f2405..1541bb12ee1b 100644 --- a/pkgs/top-level/ocaml-packages.nix +++ b/pkgs/top-level/ocaml-packages.nix @@ -355,7 +355,13 @@ let lablgl = callPackage ../development/ocaml-modules/lablgl { }; - lablgtk3 = callPackage ../development/ocaml-modules/lablgtk3 { }; + lablgtk3 = callPackage ../development/ocaml-modules/lablgtk3 { + cairo2 = cairo2.override { enableGtkSupport = false; }; + }; + + lablgtk3-gtkspell3 = callPackage ../development/ocaml-modules/lablgtk3/gtkspell3.nix { }; + + lablgtk3-sourceview3 = callPackage ../development/ocaml-modules/lablgtk3/sourceview3.nix { }; lablgtk_2_14 = callPackage ../development/ocaml-modules/lablgtk/2.14.0.nix { inherit (pkgs.gnome2) libgnomecanvas libglade gtksourceview;