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