diff options
author | Jan Tojnar <jtojnar@gmail.com> | 2021-07-01 07:01:38 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-01 07:01:38 +0200 |
commit | 0d1186ebfda855902f461be5e33e1254346b1b5f (patch) | |
tree | 1b30bb57612472abe7f1e333a8c3623c354c5731 /pkgs/tools | |
parent | c7e7f90108ff7bb7924e6f70136dd72c0f916954 (diff) | |
parent | b236fe3d52d86143446e215bdf92121ee119a7f1 (diff) |
Merge pull request #128718 from jtojnar/ploticus
ploticus: Use gd from Nixpkgs instead of the vendored one
Diffstat (limited to 'pkgs/tools')
-rw-r--r-- | pkgs/tools/graphics/ploticus/builder.sh | 33 | ||||
-rw-r--r-- | pkgs/tools/graphics/ploticus/default.nix | 68 | ||||
-rw-r--r-- | pkgs/tools/graphics/ploticus/set-prefabs-dir.patch | 11 | ||||
-rw-r--r-- | pkgs/tools/graphics/ploticus/use-gd-package.patch | 34 |
4 files changed, 99 insertions, 47 deletions
diff --git a/pkgs/tools/graphics/ploticus/builder.sh b/pkgs/tools/graphics/ploticus/builder.sh deleted file mode 100644 index 2fb16b259bdcf..0000000000000 --- a/pkgs/tools/graphics/ploticus/builder.sh +++ /dev/null @@ -1,33 +0,0 @@ -source $stdenv/setup - -preBuild() { - cd src -} - -preInstall() { - mkdir -p $out/bin -} - -postInstall() { - # Install the "prefabs". - mkdir -p $out/share/ploticus/prefabs && \ - cd .. && \ - cp -rv prefabs/* $out/share/ploticus/prefabs - - # Create a wrapper that knows where to find them. Debian's package - # does something similar by patching directly the C file that looks - # for `$PLOTICUS_PREFABS'. - cat > $out/bin/ploticus <<EOF -#! $SHELL -e -PLOTICUS_PREFABS="$out/share/ploticus/prefabs" -export PLOTICUS_PREFABS -exec "$out/bin/pl" \$@ -EOF - chmod +x $out/bin/ploticus - - # Install the man pages. - cp -rv man $out - ln -s "$out/man/man1/pl.1" "$out/man/man1/ploticus.1" -} - -genericBuild diff --git a/pkgs/tools/graphics/ploticus/default.nix b/pkgs/tools/graphics/ploticus/default.nix index 23d6919f78e0b..50b7aad48a040 100644 --- a/pkgs/tools/graphics/ploticus/default.nix +++ b/pkgs/tools/graphics/ploticus/default.nix @@ -1,34 +1,74 @@ -{lib, stdenv, fetchurl, zlib, libX11, libpng}: +{ lib +, stdenv +, fetchurl +, zlib +, libX11 +, libpng +, gd +, freetype +}: -stdenv.mkDerivation { - name = "ploticus-2.42"; +stdenv.mkDerivation rec { + pname = "ploticus"; + version = "2.42"; - builder = ./builder.sh; src = fetchurl { - url = "mirror://sourceforge/ploticus/ploticus/2.41/pl241src.tar.gz"; - sha256 = "1065r0nizjixi9sxxfxrnwg10r458i6fgsd23nrxa200rypvdk7c"; + url = "mirror://sourceforge/ploticus/ploticus/${version}/ploticus${lib.replaceStrings [ "." ] [ "" ] version}_src.tar.gz"; + sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; }; - buildInputs = [ zlib libX11 libpng ]; + patches = [ + # 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 + ./use-gd-package.patch + ]; + + buildInputs = [ + zlib + libX11 + libpng + gd + freetype + ]; hardeningDisable = [ "format" ]; - patches = [ ./ploticus-install.patch ]; + preBuild = '' + cd src + ''; + + preInstall = '' + mkdir -p "$out/bin" + ''; + + postInstall = '' + cd .. + + # Install the “prefabs”. + mkdir -p "$out/share/ploticus/prefabs" + cp -rv prefabs/* "$out/share/ploticus/prefabs" - # Make the symlink relative instead of absolute. - # Otherwise it breaks when auto-moved to $out/share. - preFixup = '' - ln -sf pl.1 "$out"/man/man1/ploticus.1 + # Add aliases for backwards compatibility. + ln -s "pl" "$out/bin/ploticus" ''; meta = with lib; { description = "A non-interactive software package for producing plots and charts"; - longDescription = ''Ploticus is a free, GPL'd, non-interactive + longDescription = '' + Ploticus is a free, GPL'd, non-interactive software package for producing plots, charts, and graphics from data. Ploticus is good for automated or just-in-time graph generation, handles date and time data nicely, and has basic statistical capabilities. It allows significant user control - over colors, styles, options and details.''; + over colors, styles, options and details. + ''; license = licenses.gpl2Plus; maintainers = with maintainers; [ pSub ]; homepage = "http://ploticus.sourceforge.net/"; diff --git a/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch b/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch new file mode 100644 index 0000000000000..82871654fdeab --- /dev/null +++ b/pkgs/tools/graphics/ploticus/set-prefabs-dir.patch @@ -0,0 +1,11 @@ +--- 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 */ + diff --git a/pkgs/tools/graphics/ploticus/use-gd-package.patch b/pkgs/tools/graphics/ploticus/use-gd-package.patch new file mode 100644 index 0000000000000..9a72489ddaadc --- /dev/null +++ b/pkgs/tools/graphics/ploticus/use-gd-package.patch @@ -0,0 +1,34 @@ +--- a/src/Makefile ++++ b/src/Makefile +@@ -91,10 +91,10 @@ + + + ########### Option 1: use bundled GD16 (PNG only). Requires libpng and zlib. +-exetarget: plpng +-GD16LIBS = -lpng -lz +-GD16H = -I/usr/local/include +-ZFLAG = -DWZ ++# exetarget: plpng ++# GD16LIBS = -lpng -lz ++# GD16H = -I/usr/local/include ++# ZFLAG = -DWZ + ### These should remain commented unless your libs are not in usual places, then alter to suit... + ### GD16LIBS = /home/scg/lib/libpng.a /home/scg/lib/libz.a + ### GD16H = -I/home/scg/lib +@@ -111,11 +111,11 @@ + + ########### Option 4: use your own GD resource with FreeType2 (ttf) fonts enabled. + ########### Requires GD 1.84+, libpng, zlib, libjpeg and libfreetype +-# exetarget: plgd18 +-# GD18LIBS = -lgd -lpng -lz -ljpeg -lfreetype +-# GD18H = +-# GDFREETYPE = -DGDFREETYPE +-# ZFLAG = -DWZ ++exetarget: plgd18 ++GD18LIBS = -lgd -lpng -lz -ljpeg -lfreetype ++GD18H = ++GDFREETYPE = -DGDFREETYPE ++ZFLAG = -DWZ + + ########### Option 5: don't use GD at all. + # exetarget: plnogd |