about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting/ps2eps
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
committerAlyssa Ross <hi@alyssa.is>2023-06-16 06:56:35 +0000
commit99fcaeccb89621dd492203ce1f2d551c06f228ed (patch)
tree41cb730ae07383004789779b0f6e11cb3f4642a3 /nixpkgs/pkgs/tools/typesetting/ps2eps
parent59c5f5ac8682acc13bb22bc29c7cf02f7d75f01f (diff)
parent75a5ebf473cd60148ba9aec0d219f72e5cf52519 (diff)
downloadnixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.gz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.bz2
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.lz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.xz
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.tar.zst
nixlib-99fcaeccb89621dd492203ce1f2d551c06f228ed.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Conflicts:
	nixpkgs/nixos/modules/config/console.nix
	nixpkgs/nixos/modules/services/mail/mailman.nix
	nixpkgs/nixos/modules/services/mail/public-inbox.nix
	nixpkgs/nixos/modules/services/mail/rss2email.nix
	nixpkgs/nixos/modules/services/networking/ssh/sshd.nix
	nixpkgs/pkgs/applications/networking/instant-messengers/dino/default.nix
	nixpkgs/pkgs/applications/networking/irc/weechat/default.nix
	nixpkgs/pkgs/applications/window-managers/sway/default.nix
	nixpkgs/pkgs/build-support/go/module.nix
	nixpkgs/pkgs/build-support/rust/build-rust-package/default.nix
	nixpkgs/pkgs/development/interpreters/python/default.nix
	nixpkgs/pkgs/development/node-packages/overrides.nix
	nixpkgs/pkgs/development/tools/b4/default.nix
	nixpkgs/pkgs/servers/dict/dictd-db.nix
	nixpkgs/pkgs/servers/mail/public-inbox/default.nix
	nixpkgs/pkgs/tools/security/pinentry/default.nix
	nixpkgs/pkgs/tools/text/unoconv/default.nix
	nixpkgs/pkgs/top-level/all-packages.nix
Diffstat (limited to 'nixpkgs/pkgs/tools/typesetting/ps2eps')
-rw-r--r--nixpkgs/pkgs/tools/typesetting/ps2eps/default.nix68
-rw-r--r--nixpkgs/pkgs/tools/typesetting/ps2eps/hardcode-deps.patch26
2 files changed, 94 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/tools/typesetting/ps2eps/default.nix b/nixpkgs/pkgs/tools/typesetting/ps2eps/default.nix
new file mode 100644
index 000000000000..c8f558889c60
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/ps2eps/default.nix
@@ -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 ];
+  };
+}
diff --git a/nixpkgs/pkgs/tools/typesetting/ps2eps/hardcode-deps.patch b/nixpkgs/pkgs/tools/typesetting/ps2eps/hardcode-deps.patch
new file mode 100644
index 000000000000..b8846ab61d07
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/ps2eps/hardcode-deps.patch
@@ -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