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