/
default.nix
68 lines (55 loc) · 1.39 KB
/
default.nix
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
{ lib
, fetchFromGitHub
, perlPackages
, substituteAll
, ghostscript
, installShellFiles
}:
perlPackages.buildPerlPackage rec {
pname = "ps2eps";
version = "1.70";
src = fetchFromGitHub {
owner = "roland-bless";
repo = pname;
rev = "v${version}";
hash = "sha256-SPLwsGKLVhANoqSQ/GJ938cYjbjMbUOXkNn9so3aJTA=";
};
patches = [
(substituteAll {
src = ./hardcode-deps.patch;
gs = "${ghostscript}/bin/gs";
# bbox cannot be substituted here because substituteAll doesn't know what
# will be the $out path of the main derivation
})
];
nativeBuildInputs = [
installShellFiles
];
configurePhase = "true";
buildPhase = ''
runHook preBuild
make -C src/C bbox
patchShebangs src/perl/ps2eps
substituteInPlace src/perl/ps2eps \
--replace @bbox@ $out/bin/bbox
runHook postBuild
'';
# Override buildPerlPackage's outputs setting
outputs = ["out" "man"];
installPhase = ''
runHook preInstall
installManPage \
doc/ps2eps.1 \
doc/bbox.1
install -D src/perl/ps2eps $out/bin/ps2eps
install -D src/C/bbox $out/bin/bbox
runHook postInstall
'';
meta = with lib; {
inherit (src.meta) homepage;
description = "Calculate correct bounding boxes for PostScript and PDF files";
license = licenses.gpl2Plus;
platforms = platforms.unix;
maintainers = [ maintainers.doronbehar ];
};
}