summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoachim Breitner <mail@joachim-breitner.de>2023-02-18 09:40:35 +0100
committergithub-actions[bot] <github-actions[bot]@users.noreply.github.com>2023-02-18 21:49:34 +0000
commit70457fd14716915a75e40f6ffaec1fb7e07183cc (patch)
treedc5cba42598862c2ead934e93d3bb0aa3f23135a
parentlinux_{5_15,6_1}: revert patch to fix Equinix Metal bonded networking with `i... (diff)
downloadnixpkgs-70457fd14716915a75e40f6ffaec1fb7e07183cc.tar.gz
ploticus: Fix PREFAB settings, add test
previous, 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 using `sed` (with access to `$out`) instead of a patch. (cherry picked from commit 18cfd15b9e79b05d088d57ef546e5376107144c2)
-rw-r--r--pkgs/tools/graphics/ploticus/default.nix15
-rw-r--r--pkgs/tools/graphics/ploticus/set-prefabs-dir.patch11
2 files changed, 12 insertions, 14 deletions
diff --git a/pkgs/tools/graphics/ploticus/default.nix b/pkgs/tools/graphics/ploticus/default.nix
index f315dc9a63c0..085c56cd5abe 100644
--- a/pkgs/tools/graphics/ploticus/default.nix
+++ b/pkgs/tools/graphics/ploticus/default.nix
@@ -7,6 +7,8 @@
, libjpeg
, gd
, freetype
+, runCommand
+, ploticus
}:
stdenv.mkDerivation rec {
@@ -22,9 +24,6 @@ stdenv.mkDerivation rec {
# Replace hardcoded FHS path with $out.
./ploticus-install.patch
- # Set the location of the PREFABS directory.
- ./set-prefabs-dir.patch
-
# Use gd from Nixpkgs instead of the vendored one.
# This is required for non-ASCII fonts to work:
# http://ploticus.sourceforge.net/doc/fonts.html
@@ -44,6 +43,8 @@ stdenv.mkDerivation rec {
preBuild = ''
cd src
+ # Set the location of the PREFABS directory.
+ sed -i -e 's,PREFABS_DIR "",PREFABS_DIR "'$out'/share/ploticus/prefabs",' pl.h
'';
makeFlags = [ "CC=cc" ];
@@ -62,6 +63,14 @@ stdenv.mkDerivation rec {
ln -s "pl" "$out/bin/ploticus"
'';
+ passthru.tests = {
+ simple = runCommand "${pname}-test" {} ''
+ # trivial test to see if the prefab path munging works
+ mkdir $out/
+ ${ploticus}/bin/pl pl -prefab scat inlinedata="A 1 2" x=2 y=3 -png -o $out/out.png
+ '';
+ };
+
meta = with lib; {
description = "A non-interactive software package for producing plots and charts";
longDescription = ''
diff --git a/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch b/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
deleted file mode 100644
index 82871654fdea..000000000000
--- a/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- a/src/pl.h
-+++ b/src/pl.h
-@@ -8,7 +8,7 @@
- #include <stdlib.h>
- #include "plg.h"
-
--#define PREFABS_DIR "" /* INSTALLERS can set this to a valid pathname, so that users don't need to set PLOTICUS_PREFABS env var */
-+#define PREFABS_DIR "@out@/share/ploticus/prefabs" /* INSTALLERS can set this to a valid pathname, so that users don't need to set PLOTICUS_PREFABS env var */
-
- #define PLVERSION "2.42-May2013" /* see also the Copyright page, and page headers and footers */
-