Merge pull request #225415 from doronbehar/pkg/ps2eps

ps2eps: init at 1.70
This commit is contained in:
Doron Behar 2023-04-14 09:46:01 -07:00 committed by GitHub
commit dcc87a8f7b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 96 additions and 0 deletions

View file

@ -0,0 +1,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 ];
};
}

View file

@ -0,0 +1,26 @@
diff --git i/src/perl/ps2eps w/src/perl/ps2eps
index 1122a81..31d6a9a 100755
--- i/src/perl/ps2eps
+++ w/src/perl/ps2eps
@@ -43,19 +43,13 @@ Getopt::Long::Configure("no_ignore_case");
$prgname= "ps2eps";
-if (! -d "/usr/bin")
-{ # we assume that we are running under native windows
- $ghostscriptname = "gswin32c";
- $NULLDEV = "nul";
-}
-else
{ # Unix or cygwin
- $ghostscriptname = "gs";
+ $ghostscriptname = "@gs@";
$NULLDEV = "/dev/null 2>&1";
}
$bboxver=`bbox >$NULLDEV -V`;
-$bboxname= ($?== -1) ? "" : "bbox";
+$bboxname= ($?== -1) ? "" : "@bbox@";
$version= '$Id: ps2eps,v 1.70 2018-01-09 18:00:00 bless Exp $'; #'
$insertPScode= 1; # Insert surrounding Postscript code
$infhandle = STDIN; # Standard input is the default input file

View file

@ -33099,6 +33099,8 @@ with pkgs;
ps2client = callPackage ../applications/networking/ps2client { };
ps2eps = callPackage ../tools/typesetting/ps2eps { };
psi = libsForQt5.callPackage ../applications/networking/instant-messengers/psi { };
psi-plus = libsForQt5.callPackage ../applications/networking/instant-messengers/psi-plus { };