1{ lib, stdenv, fetchurl, zlib, gd, texinfo4, makeWrapper, readline
2, withTeXLive ? false, texLive
3, withLua ? false, lua
4, emacs ? null
5, libX11 ? null
6, libXt ? null
7, libXpm ? null
8, libXaw ? null
9, aquaterm ? false
10, withWxGTK ? false, wxGTK ? null
11, pango ? null
12, cairo ? null
13, pkgconfig ? null
14, fontconfig ? null
15, gnused ? null
16, coreutils ? null
17, withQt ? false, qt }:
18
19assert libX11 != null -> (fontconfig != null && gnused != null && coreutils != null);
20let
21 withX = libX11 != null && !aquaterm && !stdenv.isDarwin;
22in
23stdenv.mkDerivation rec {
24 name = "gnuplot-5.0.0";
25
26 src = fetchurl {
27 url = "mirror://sourceforge/gnuplot/${name}.tar.gz";
28 sha256 = "1bqg6zbsin9w9m53rbf6adzv0j2gs66z2p5pkd060jlipk2lnza1";
29 };
30
31 buildInputs =
32 [ zlib gd texinfo4 readline pango cairo pkgconfig makeWrapper ]
33 ++ lib.optional withTeXLive texLive
34 ++ lib.optional withLua lua
35 ++ lib.optionals withX [ libX11 libXpm libXt libXaw ]
36 ++ lib.optional withQt [ qt ]
37 # compiling with wxGTK causes a malloc (double free) error on darwin
38 ++ lib.optional (withWxGTK && !stdenv.isDarwin) wxGTK;
39
40 configureFlags =
41 (if withX then ["--with-x"] else ["--without-x"])
42 ++ (if withQt then ["--enable-qt"] else ["--disable-qt"])
43 ++ (if aquaterm then ["--with-aquaterm"] else ["--without-aquaterm"]);
44
45 postInstall = lib.optionalString withX ''
46 wrapProgram $out/bin/gnuplot \
47 --prefix PATH : '${gnused}/bin' \
48 --prefix PATH : '${coreutils}/bin' \
49 --prefix PATH : '${fontconfig}/bin' \
50 --run '. ${./set-gdfontpath-from-fontconfig.sh}'
51 '';
52
53 meta = with lib; {
54 homepage = http://www.gnuplot.info/;
55 description = "A portable command-line driven graphing utility for many platforms";
56 hydraPlatforms = platforms.linux ++ platforms.darwin;
57 maintainers = with maintainers; [ lovek323 ];
58 };
59}