mirror of
https://github.com/ilyakooo0/nixpkgs.git
synced 2024-09-24 14:18:13 +03:00
ploticus: Modernize
- Split pname & version. - Format the expression. - Do not use custom builder, the generic one is good enough. - Install the man pages to datadir instead of $out, where they would be moved anyway. – Allowing us to drop the postFixup. - Use patch instead of wrapper for pointing to prefabs. This is what Debian does and it will also apply to the pl binary, not just the ploticus alias. - Since the wrapping is no longer necessary, let’s create the alias using a symlink.
This commit is contained in:
parent
3a8d7958a6
commit
eea3344e91
@ -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,69 @@
|
||||
{lib, stdenv, fetchurl, zlib, libX11, libpng}:
|
||||
{ lib
|
||||
, stdenv
|
||||
, fetchurl
|
||||
, zlib
|
||||
, libX11
|
||||
, libpng
|
||||
}:
|
||||
|
||||
stdenv.mkDerivation {
|
||||
name = "ploticus-2.42";
|
||||
pname = "ploticus";
|
||||
version = "2.42";
|
||||
|
||||
builder = ./builder.sh;
|
||||
src = fetchurl {
|
||||
url = "mirror://sourceforge/ploticus/ploticus/2.41/pl241src.tar.gz";
|
||||
sha256 = "1065r0nizjixi9sxxfxrnwg10r458i6fgsd23nrxa200rypvdk7c";
|
||||
};
|
||||
|
||||
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
|
||||
];
|
||||
|
||||
buildInputs = [
|
||||
zlib
|
||||
libX11
|
||||
libpng
|
||||
];
|
||||
|
||||
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"
|
||||
|
||||
# Install the man pages.
|
||||
cp -rv man $out/share
|
||||
|
||||
# Add aliases for backwards compatibility.
|
||||
ln -s "pl.1" "$out/share/man/man1/ploticus.1"
|
||||
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/";
|
||||
|
10
pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
Normal file
10
pkgs/tools/graphics/ploticus/set-prefabs-dir.patch
Normal file
@ -0,0 +1,10 @@
|
||||
--- a/src/Makefile
|
||||
+++ b/src/Makefile
|
||||
@@ -133,6 +133,6 @@
|
||||
#### To set a hard-coded directory for prefabs files, uncomment & edit the following..
|
||||
#### If done, users won't be required to have PLOTICUS_PREFABS environment variable defined.
|
||||
#### This option not available for win32
|
||||
-# PREFABS_DIR = "/usr/lib/ploticus/prefabs"
|
||||
+PREFABS_DIR = "$(out)/share/ploticus/prefabs"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user