Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ lib 2, stdenv 3, fetchurl 4, zlib 5, libX11 6, libpng 7, libjpeg 8, gd 9, freetype 10, runCommand 11}: 12 13stdenv.mkDerivation (finalAttrs: { 14 pname = "ploticus"; 15 version = "2.42"; 16 17 src = fetchurl { 18 url = "mirror://sourceforge/ploticus/ploticus/${finalAttrs.version}/ploticus${lib.replaceStrings [ "." ] [ "" ] finalAttrs.version}_src.tar.gz"; 19 sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; 20 }; 21 22 patches = [ 23 # Replace hardcoded FHS path with $out. 24 ./ploticus-install.patch 25 26 # Set the location of the PREFABS directory. 27 ./set-prefabs-dir.patch 28 29 # Use gd from Nixpkgs instead of the vendored one. 30 # This is required for non-ASCII fonts to work: 31 # https://ploticus.sourceforge.net/doc/fonts.html 32 ./use-gd-package.patch 33 ]; 34 35 buildInputs = [ 36 zlib 37 libX11 38 libpng 39 gd 40 freetype 41 libjpeg 42 ]; 43 44 hardeningDisable = [ "format" ]; 45 46 postPatch = '' 47 substituteInPlace src/pl.h --subst-var out 48 ''; 49 50 preBuild = '' 51 cd src 52 ''; 53 makeFlags = [ "CC=cc" ]; 54 55 preInstall = '' 56 mkdir -p "$out/bin" 57 ''; 58 59 postInstall = '' 60 cd .. 61 62 # Install the prefabs. 63 mkdir -p "$out/share/ploticus/prefabs" 64 cp -rv prefabs/* "$out/share/ploticus/prefabs" 65 66 # Add aliases for backwards compatibility. 67 ln -s "pl" "$out/bin/ploticus" 68 ''; 69 70 passthru.tests = { 71 prefab = runCommand "ploticus-prefab-test" { 72 buildInputs = [ finalAttrs.finalPackage ]; 73 } '' 74 # trivial test to see if the prefab path munging works 75 mkdir $out/ 76 pl -prefab scat inlinedata="A 1 2" x=2 y=3 -png -o $out/out.png 77 ''; 78 }; 79 80 meta = with lib; { 81 description = "A non-interactive software package for producing plots and charts"; 82 longDescription = '' 83 Ploticus is a free, GPL'd, non-interactive 84 software package for producing plots, charts, and graphics from 85 data. Ploticus is good for automated or just-in-time graph 86 generation, handles date and time data nicely, and has basic 87 statistical capabilities. It allows significant user control 88 over colors, styles, options and details. 89 ''; 90 license = licenses.gpl2Plus; 91 maintainers = with maintainers; [ pSub ]; 92 homepage = "https://ploticus.sourceforge.net/"; 93 platforms = with platforms; linux ++ darwin; 94 }; 95})