Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{
2 lib,
3 fetchFromGitHub,
4 perlPackages,
5 replaceVars,
6 ghostscript,
7 installShellFiles,
8}:
9
10perlPackages.buildPerlPackage rec {
11 pname = "ps2eps";
12 version = "1.70";
13
14 src = fetchFromGitHub {
15 owner = "roland-bless";
16 repo = "ps2eps";
17 rev = "v${version}";
18 hash = "sha256-SPLwsGKLVhANoqSQ/GJ938cYjbjMbUOXkNn9so3aJTA=";
19 };
20 patches = [
21 (replaceVars ./hardcode-deps.patch {
22 gs = "${ghostscript}/bin/gs";
23 # bbox cannot be substituted here because replaceVars doesn't know what
24 # will be the $out path of the main derivation
25 bbox = null;
26 })
27 ];
28
29 nativeBuildInputs = [
30 installShellFiles
31 ];
32
33 configurePhase = "true";
34
35 buildPhase = ''
36 runHook preBuild
37
38 make -C src/C bbox
39 patchShebangs src/perl/ps2eps
40 substituteInPlace src/perl/ps2eps \
41 --replace @bbox@ $out/bin/bbox
42
43 runHook postBuild
44 '';
45
46 # Override buildPerlPackage's outputs setting
47 outputs = [
48 "out"
49 "man"
50 ];
51 installPhase = ''
52 runHook preInstall
53
54 installManPage \
55 doc/ps2eps.1 \
56 doc/bbox.1
57
58 install -D src/perl/ps2eps $out/bin/ps2eps
59 install -D src/C/bbox $out/bin/bbox
60
61 runHook postInstall
62 '';
63
64 meta = with lib; {
65 inherit (src.meta) homepage;
66 description = "Calculate correct bounding boxes for PostScript and PDF files";
67 license = licenses.gpl2Plus;
68 platforms = platforms.unix;
69 maintainers = [ maintainers.doronbehar ];
70 };
71}