ocamlPackages.ocamlgraph: make GTK support optional
When `gtkSupport` is true, additional components are built: - a module to render a graph on a GTK2 canvas - two GTK-based programs: a graph viewer and a graph editor. The default is to have `gtkSupport` as it is used in e.g., Frama-C.
This commit is contained in:
committed by
Vincent Laporte
parent
5be356a9cc
commit
e3c2934213
@@ -1,4 +1,7 @@
|
||||
{stdenv, fetchurl, ocaml, findlib, lablgtk ? null}:
|
||||
{ stdenv, fetchurl, ocaml, findlib
|
||||
, gtkSupport ? true
|
||||
, lablgtk
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation rec {
|
||||
pname = "ocamlgraph";
|
||||
@@ -9,22 +12,19 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "0m9g16wrrr86gw4fz2fazrh8nkqms0n863w7ndcvrmyafgxvxsnr";
|
||||
};
|
||||
|
||||
buildInputs = [ ocaml findlib lablgtk ];
|
||||
|
||||
patches = ./destdir.patch;
|
||||
|
||||
postPatch = ''
|
||||
sed -i 's@$(DESTDIR)$(OCAMLLIB)/ocamlgraph@$(DESTDIR)/lib/ocaml/${ocaml.version}/site-lib/ocamlgraph@' Makefile.in
|
||||
sed -i 's@OCAMLFINDDEST := -destdir $(DESTDIR)@@' Makefile.in
|
||||
${stdenv.lib.optionalString (lablgtk != null)
|
||||
"sed -i 's@+lablgtk2@${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/lablgtk2 -I ${lablgtk}/lib/ocaml/${ocaml.version}/site-lib/stublibs@' configure Makefile.in editor/Makefile"}
|
||||
'';
|
||||
buildInputs = [ ocaml findlib ]
|
||||
++ stdenv.lib.optional gtkSupport lablgtk
|
||||
;
|
||||
|
||||
createFindlibDestdir = true;
|
||||
|
||||
buildPhase = ''
|
||||
make all
|
||||
make install-findlib
|
||||
buildFlags = [ "all" ];
|
||||
installTargets = [ "install-findlib" ];
|
||||
|
||||
postInstall = stdenv.lib.optionalString gtkSupport ''
|
||||
mkdir -p $out/bin
|
||||
cp dgraph/dgraph.opt $out/bin/graph-viewer
|
||||
cp editor/editor.opt $out/bin/graph-editor
|
||||
'';
|
||||
|
||||
meta = {
|
||||
|
||||
Reference in New Issue
Block a user