forked from mirrors/nixpkgs
Merge pull request #128718 from jtojnar/ploticus
ploticus: Use gd from Nixpkgs instead of the vendored one
This commit is contained in:
commit
0d1186ebfd
|
@ -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
|
|
@ -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
|
||||
'';
|
||||
|
||||
# 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
|
||||
preInstall = ''
|
||||
mkdir -p "$out/bin"
|
||||
'';
|
||||
|
||||
postInstall = ''
|
||||
cd ..
|
||||
|
||||
# Install the “prefabs”.
|
||||
mkdir -p "$out/share/ploticus/prefabs"
|
||||
cp -rv prefabs/* "$out/share/ploticus/prefabs"
|
||||
|
||||
# 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/";
|
||||
|
|
11
pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
Normal file
11
pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
Normal file
|
@ -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 */
|
||||
|
34
pkgs/tools/graphics/ploticus/use-gd-package.patch
Normal file
34
pkgs/tools/graphics/ploticus/use-gd-package.patch
Normal file
|
@ -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
|
Loading…
Reference in a new issue