about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/graphics/ploticus/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/tools/graphics/ploticus/default.nix')
-rw-r--r--nixpkgs/pkgs/tools/graphics/ploticus/default.nix25
1 files changed, 20 insertions, 5 deletions
diff --git a/nixpkgs/pkgs/tools/graphics/ploticus/default.nix b/nixpkgs/pkgs/tools/graphics/ploticus/default.nix
index f315dc9a63c0..ac5855304f4a 100644
--- a/nixpkgs/pkgs/tools/graphics/ploticus/default.nix
+++ b/nixpkgs/pkgs/tools/graphics/ploticus/default.nix
@@ -7,14 +7,15 @@
 , libjpeg
 , gd
 , freetype
+, runCommand
 }:
 
-stdenv.mkDerivation rec {
+stdenv.mkDerivation (finalAttrs: {
   pname = "ploticus";
   version = "2.42";
 
   src = fetchurl {
-    url = "mirror://sourceforge/ploticus/ploticus/${version}/ploticus${lib.replaceStrings [ "." ] [ "" ] version}_src.tar.gz";
+    url = "mirror://sourceforge/ploticus/ploticus/${finalAttrs.version}/ploticus${lib.replaceStrings [ "." ] [ "" ] finalAttrs.version}_src.tar.gz";
     sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA=";
   };
 
@@ -27,7 +28,7 @@ stdenv.mkDerivation rec {
 
     # 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
+    # https://ploticus.sourceforge.net/doc/fonts.html
     ./use-gd-package.patch
   ];
 
@@ -42,6 +43,10 @@ stdenv.mkDerivation rec {
 
   hardeningDisable = [ "format" ];
 
+  postPatch = ''
+    substituteInPlace src/pl.h --subst-var out
+  '';
+
   preBuild = ''
     cd src
   '';
@@ -62,6 +67,16 @@ stdenv.mkDerivation rec {
     ln -s "pl" "$out/bin/ploticus"
   '';
 
+  passthru.tests = {
+    prefab = runCommand "ploticus-prefab-test" {
+      buildInputs = [ finalAttrs.finalPackage ];
+    } ''
+      # trivial test to see if the prefab path munging works
+      mkdir $out/
+      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 = ''
@@ -74,7 +89,7 @@ stdenv.mkDerivation rec {
     '';
     license = licenses.gpl2Plus;
     maintainers = with maintainers; [ pSub ];
-    homepage = "http://ploticus.sourceforge.net/";
+    homepage = "https://ploticus.sourceforge.net/";
     platforms = with platforms; linux ++ darwin;
   };
-}
+})