nixpkgs/pkgs/by-name/ps/ps2eps/package.nix
aleksana 571c71e6f7 treewide: migrate packages to pkgs/by-name, take 1
We are migrating packages that meet below requirements:

1. using `callPackage`
2. called path is a directory
3. overriding set is empty (`{ }`)
4. not containing path expressions other than relative path (to
makenixpkgs-vet happy)
5. not referenced by nix files outside of the directory, other
than`pkgs/top-level/all-packages.nix`
6. not referencing nix files outside of the directory
7. not referencing `default.nix` (since it's changed to `package.nix`)
8. `outPath` doesn't change after migration

The tool is here: https://github.com/Aleksanaa/by-name-migrate.
2024-11-09 20:04:51 +08:00

69 lines
1.4 KiB
Nix

{ 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 ];
};
}