1{ lib, fetchFromGitHub, makeWrapper, gawk
2, makeFontsConf, freefont_ttf, gnuplot, perl, perlPackages
3, stdenv, shortenPerlShebang
4}:
5
6let
7
8 fontsConf = makeFontsConf { fontDirectories = [ freefont_ttf ]; };
9
10in
11
12perlPackages.buildPerlPackage rec {
13 pname = "feedgnuplot";
14 version = "1.58";
15
16 src = fetchFromGitHub {
17 owner = "dkogan";
18 repo = "feedgnuplot";
19 rev = "v${version}";
20 sha256 = "1qix4lwwyhqibz0a6q2rrb497rmk00v1fvmdyinj0dqmgjw155zr";
21 };
22
23 outputs = [ "out" ];
24
25 nativeBuildInputs = [ makeWrapper gawk ] ++ lib.optional stdenv.isDarwin shortenPerlShebang;
26
27 buildInputs = [ gnuplot perl ]
28 ++ (with perlPackages; [ ListMoreUtils IPCRun StringShellQuote ]);
29
30 # Fontconfig error: Cannot load default config file
31 FONTCONFIG_FILE = fontsConf;
32
33 postPatch = ''
34 patchShebangs .
35 '';
36
37 # Tests require gnuplot 4.6.4 and are completely skipped with gnuplot 5.
38 doCheck = false;
39
40 postInstall = lib.optionalString stdenv.isDarwin ''
41 shortenPerlShebang $out/bin/feedgnuplot
42 '' + ''
43 wrapProgram $out/bin/feedgnuplot \
44 --prefix "PATH" ":" "$PATH" \
45 --prefix "PERL5LIB" ":" "$PERL5LIB"
46 install -D -m 444 -t $out/share/bash-completion/completions \
47 completions/bash/feedgnuplot
48 install -D -m 444 -t $out/share/zsh/site-functions \
49 completions/zsh/_feedgnuplot
50 '';
51
52 meta = with lib; {
53 description = "General purpose pipe-oriented plotting tool";
54 homepage = "https://github.com/dkogan/feedgnuplot/";
55 license = with licenses; [ artistic1 gpl1Plus ];
56 platforms = platforms.unix;
57 maintainers = with maintainers; [ mnacamura ];
58 };
59}