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