ploticus: Fix PREFAB settings, add test

Previously, I would get

pl: error 22: Cannot open specified scriptfile (@out@/share/ploticus/prefabs/chron.pl)

and it seems the PREFAB setting last changed in
https://github.com/NixOS/nixpkgs/commit/fbc4b41e692f04511f063d1ec2b438c4d47775eb
didn't quite work.

So this adds a test to demonstrate the issue, and fixes it by substituting the placeholder.

authored by Joachim Breitner and committed by GitHub ea4d2f7e 76f83afe

+18 -3
+18 -3
pkgs/tools/graphics/ploticus/default.nix
··· 7 , libjpeg 8 , gd 9 , freetype 10 }: 11 12 - stdenv.mkDerivation rec { 13 pname = "ploticus"; 14 version = "2.42"; 15 16 src = fetchurl { 17 - url = "mirror://sourceforge/ploticus/ploticus/${version}/ploticus${lib.replaceStrings [ "." ] [ "" ] version}_src.tar.gz"; 18 sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; 19 }; 20 ··· 42 43 hardeningDisable = [ "format" ]; 44 45 preBuild = '' 46 cd src 47 ''; ··· 62 ln -s "pl" "$out/bin/ploticus" 63 ''; 64 65 meta = with lib; { 66 description = "A non-interactive software package for producing plots and charts"; 67 longDescription = '' ··· 77 homepage = "https://ploticus.sourceforge.net/"; 78 platforms = with platforms; linux ++ darwin; 79 }; 80 - }
··· 7 , libjpeg 8 , gd 9 , freetype 10 + , runCommand 11 }: 12 13 + stdenv.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 ··· 43 44 hardeningDisable = [ "format" ]; 45 46 + postPatch = '' 47 + substituteInPlace src/pl.h --subst-var out 48 + ''; 49 + 50 preBuild = '' 51 cd src 52 ''; ··· 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 = '' ··· 92 homepage = "https://ploticus.sourceforge.net/"; 93 platforms = with platforms; linux ++ darwin; 94 }; 95 + })