summary refs log tree commit diff
path: root/pkgs/tools/graphics/ploticus/builder.sh
blob: 89d4e3b98eaf076ad8c5861c0ed238868aaeedbb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
source $stdenv/setup

preBuild() {
  cd src
}

preInstall() {
  ensureDir $out/bin
}

postInstall() {
  # Install the "prefabs".
  ensureDir $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