Commit 393343e2 authored by Doron Behar's avatar Doron Behar
Browse files

ps2eps: init at 1.70

parent 7f3f7ec3
Loading
Loading
Loading
Loading
+68 −0
Original line number Diff line number Diff line
{ 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 ];
  };
}
+26 −0
Original line number Diff line number Diff line
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
+2 −0
Original line number Diff line number Diff line
@@ -33080,6 +33080,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 { };