1{ lib, stdenv, fetchurl, autoreconfHook }:
2
3stdenv.mkDerivation rec {
4 version = "1.1.28";
5 pname = "libpaper";
6
7 src = fetchurl {
8 url = "mirror://debian/pool/main/libp/libpaper/libpaper_${version}.tar.gz";
9 sha256 = "sha256-yLuUbsk9PCxyu7HXJX6QFyoipEoHoH+2uAKluyyV/dw=";
10 };
11
12 nativeBuildInputs = [ autoreconfHook ];
13
14 # The configure script of libpaper is buggy: it uses AC_SUBST on a headerfile
15 # to compile sysconfdir into the library. Autoconf however defines sysconfdir
16 # as "${prefix}/etc", which is not expanded by AC_SUBST so libpaper will look
17 # for config files in (literally, without expansion) '${prefix}/etc'. Manually
18 # setting sysconfdir fixes this issue.
19 preConfigure = ''
20 configureFlagsArray+=(
21 "--sysconfdir=$out/etc"
22 )
23 '';
24
25 # Set the default paper to letter (this is what libpaper uses as default as well,
26 # if you call getdefaultpapername()).
27 # The user can still override this with the PAPERCONF environment variable.
28 postInstall = ''
29 mkdir -p $out/etc
30 echo letter > $out/etc/papersize
31 '';
32
33 meta = {
34 description = "Library for handling paper characteristics";
35 homepage = "http://packages.debian.org/unstable/source/libpaper";
36 license = lib.licenses.gpl2;
37 platforms = lib.platforms.unix;
38 };
39}