Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib, stdenv, fetchurl, makeWrapper, pkgconfig, texinfo
2, cairo, gd, libcerf, pango, readline, zlib
3, withTeXLive ? false, texlive
4, withLua ? false, lua
5, libX11 ? null
6, libXt ? null
7, libXpm ? null
8, libXaw ? null
9, aquaterm ? false
10, withWxGTK ? false, wxGTK ? null
11, fontconfig ? null
12, gnused ? null
13, coreutils ? null
14, withQt ? false, mkDerivation, qttools, qtbase, qtsvg
15}:
16
17assert libX11 != null -> (fontconfig != null && gnused != null && coreutils != null);
18let
19 withX = libX11 != null && !aquaterm && !stdenv.isDarwin;
20in
21(if withQt then mkDerivation else stdenv.mkDerivation) rec {
22 pname = "gnuplot";
23 version = "5.2.8";
24
25 src = fetchurl {
26 url = "mirror://sourceforge/gnuplot/${pname}-${version}.tar.gz";
27 sha256 = "0dxc52d17mpyb2xm24da1nvhlacryv0irwa0q5l1cjj0rx67d9k0";
28 };
29
30 nativeBuildInputs = [ makeWrapper pkgconfig texinfo ] ++ lib.optional withQt qttools;
31
32 buildInputs =
33 [ cairo gd libcerf pango readline zlib ]
34 ++ lib.optional withTeXLive (texlive.combine { inherit (texlive) scheme-small; })
35 ++ lib.optional withLua lua
36 ++ lib.optionals withX [ libX11 libXpm libXt libXaw ]
37 ++ lib.optionals withQt [ qtbase qtsvg ]
38 ++ lib.optional withWxGTK wxGTK;
39
40 postPatch = ''
41 # lrelease is in qttools, not in qtbase.
42 sed -i configure -e 's|''${QT5LOC}/lrelease|lrelease|'
43 '';
44
45 configureFlags = [
46 (if withX then "--with-x" else "--without-x")
47 (if withQt then "--with-qt=qt5" else "--without-qt")
48 (if aquaterm then "--with-aquaterm" else "--without-aquaterm")
49 ];
50
51 postInstall = lib.optionalString withX ''
52 wrapProgram $out/bin/gnuplot \
53 --prefix PATH : '${gnused}/bin' \
54 --prefix PATH : '${coreutils}/bin' \
55 --prefix PATH : '${fontconfig.bin}/bin' \
56 --run '. ${./set-gdfontpath-from-fontconfig.sh}'
57 '';
58
59 enableParallelBuilding = true;
60
61 meta = with lib; {
62 homepage = http://www.gnuplot.info/;
63 description = "A portable command-line driven graphing utility for many platforms";
64 platforms = platforms.linux ++ platforms.darwin;
65 license = {
66 # Essentially a BSD license with one modifaction:
67 # Permission to modify the software is granted, but not the right to
68 # distribute the complete modified source code. Modifications are to
69 # be distributed as patches to the released version. Permission to
70 # distribute binaries produced by compiling modified sources is granted,
71 # provided you: ...
72 url = https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright;
73 };
74 maintainers = with maintainers; [ lovek323 ];
75 };
76}