about summary refs log tree commit diff
path: root/nixpkgs/pkgs/tools/typesetting
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-09-16 08:50:56 +0000
committerAlyssa Ross <hi@alyssa.is>2023-09-16 08:50:56 +0000
commitc51a27c0e7727fcd2be7d2d7d275f365ab1235be (patch)
treec6f917179329e0cad02bf8b818569fe6e905ab13 /nixpkgs/pkgs/tools/typesetting
parent9d1daa60832979d5d361dfdac136fb9e5a1af2c5 (diff)
parentace5093e36ab1e95cb9463863491bee90d5a4183 (diff)
downloadnixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar.gz
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar.bz2
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar.lz
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar.xz
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.tar.zst
nixlib-c51a27c0e7727fcd2be7d2d7d275f365ab1235be.zip
Merge branch 'nixos-unstable' of https://github.com/NixOS/nixpkgs
Diffstat (limited to 'nixpkgs/pkgs/tools/typesetting')
-rw-r--r--nixpkgs/pkgs/tools/typesetting/pdfchain/default.nix33
-rw-r--r--nixpkgs/pkgs/tools/typesetting/tex/catdvi/default.nix87
2 files changed, 104 insertions, 16 deletions
diff --git a/nixpkgs/pkgs/tools/typesetting/pdfchain/default.nix b/nixpkgs/pkgs/tools/typesetting/pdfchain/default.nix
index 84ed38b3836d..256a8ebd6c53 100644
--- a/nixpkgs/pkgs/tools/typesetting/pdfchain/default.nix
+++ b/nixpkgs/pkgs/tools/typesetting/pdfchain/default.nix
@@ -1,4 +1,4 @@
-{ lib, stdenv, fetchurl, fetchpatch
+{ lib, stdenv, fetchurl, fetchDebianPatch
 , autoconf, gtkmm3, glib, pdftk, pkg-config, wrapGAppsHook
 }:
 
@@ -8,7 +8,7 @@ stdenv.mkDerivation rec {
 
   src = fetchurl {
     url = "mirror://sourceforge/${pname}/${pname}-${version}/${pname}-${version}.tar.gz";
-    sha256 = "sha256-Hu4Pk9voyc75+f5OwKEOCkXKjN5nzWzv+izmyEN1Lz0=";
+    hash = "sha256-Hu4Pk9voyc75+f5OwKEOCkXKjN5nzWzv+izmyEN1Lz0=";
   };
 
   nativeBuildInputs = [
@@ -20,23 +20,24 @@ stdenv.mkDerivation rec {
   ];
 
   patches = let
-    fetchDebianPatch = {name, sha256}: fetchpatch {
-      url = "https://salsa.debian.org/debian/pdfchain/raw/2d29107756a3194fb522bdea8e9b9e393b15a8f3/debian/patches/${name}";
-      inherit name sha256;
-    };
+    fetchDebianPatch' = args: fetchDebianPatch ({
+      inherit pname;
+      version = "1:0.4.4.2";
+      debianRevision = "2";
+    } // args);
   in
   [
-    (fetchDebianPatch {
-      name = "fix_crash_on_startup";
-      sha256 = "sha256-1UyMHHGrmUIFhY53ILdMMsyocSIbcV6CKQ7sLVNhNQw=";
+    (fetchDebianPatch' {
+      patch = "fix_crash_on_startup";
+      hash = "sha256-1UyMHHGrmUIFhY53ILdMMsyocSIbcV6CKQ7sLVNhNQw=";
     })
-    (fetchDebianPatch {
-      name = "fix_desktop_file";
-      sha256 = "sha256-L6lhUs7GqVN1XOQO6bbz6BT29n4upsJtlHCAIGzk1Bw=";
+    (fetchDebianPatch' {
+      patch = "fix_desktop_file";
+      hash = "sha256-L6lhUs7GqVN1XOQO6bbz6BT29n4upsJtlHCAIGzk1Bw=";
     })
-    (fetchDebianPatch {
-      name = "fix_spelling";
-      sha256 = "sha256-sOUUslPfcOo2K3zuaLcux+CNdgfWM0phsfe6g4GUFes=";
+    (fetchDebianPatch' {
+      patch = "fix_spelling";
+      hash = "sha256-sOUUslPfcOo2K3zuaLcux+CNdgfWM0phsfe6g4GUFes=";
     })
   ];
 
@@ -51,6 +52,6 @@ stdenv.mkDerivation rec {
     homepage = "https://pdfchain.sourceforge.io";
     license = licenses.gpl3Plus;
     maintainers = with maintainers; [ hqurve ];
-    platforms = platforms.linux;
+    platforms = platforms.unix;
   };
 }
diff --git a/nixpkgs/pkgs/tools/typesetting/tex/catdvi/default.nix b/nixpkgs/pkgs/tools/typesetting/tex/catdvi/default.nix
new file mode 100644
index 000000000000..ea2b49423f22
--- /dev/null
+++ b/nixpkgs/pkgs/tools/typesetting/tex/catdvi/default.nix
@@ -0,0 +1,87 @@
+{ stdenv
+, lib
+, fetchurl
+, fetchpatch
+, texlive
+, buildPackages
+}:
+
+let
+  buildPlatformTools = [ "pse2unic" "adobe2h" ];
+  tex = texlive.combine {
+    inherit (texlive) collection-fontsrecommended;
+  };
+in
+
+stdenv.mkDerivation (finalAttrs: {
+  pname = "catdvi";
+  version = "0.14";
+  src = fetchurl {
+    url = with finalAttrs; "http://downloads.sourceforge.net/${pname}/${pname}-${version}.tar.bz2";
+    hash = "sha256-orVQVdQuRXp//OGkA7xRidNi4+J+tkw398LPZ+HX+k8=";
+  };
+
+  patches = [
+    # fix error: conflicting types for 'kpathsea_version_string'; have 'char *'
+    (fetchpatch {
+      url = "https://sources.debian.org/data/main/c/catdvi/0.14-14/debian/patches/03_kpathsea_version_string_declaration.diff";
+      hash = "sha256-d3CPDxXdVVLNtKkN0rC2G02dh/bJrRll/nVzQNggwkk=";
+    })
+  ];
+
+  hardeningDisable = [ "format" ];
+
+  outputs = [ "out" ] ++ lib.optional (with stdenv; buildPlatform.canExecute hostPlatform) "dev";
+
+  setOutputFlags = false;
+
+  enableParallelBuilding = true;
+
+  preBuild = lib.optionalString (with stdenv; !buildPlatform.canExecute hostPlatform)
+    (lib.concatMapStringsSep "\n" (tool: ''
+      cp ${lib.getDev buildPackages.catdvi}/bin/${tool} .
+    '') buildPlatformTools);
+
+  nativeBuildInputs = [
+    texlive.bin.core
+    texlive.bin.core.dev
+  ];
+
+  buildInputs = [
+    tex
+  ];
+
+  makeFlags = [
+    "catdvi"  # to avoid running tests until checkPhase
+  ] ++ lib.optionals (with stdenv; !buildPlatform.canExecute hostPlatform)
+    (map (tool: "--assume-old=${tool}") buildPlatformTools);
+
+  nativeCheckInputs = [
+    texlive
+  ];
+
+  testFlags = [
+    "all1"
+  ];
+
+  preInstall = ''
+    mkdir -p $out/{bin,man/man1}
+  '';
+
+  postInstall = lib.optionalString (with stdenv; buildPlatform.canExecute hostPlatform) ''
+    mkdir -p $dev/bin
+    ${lib.concatMapStringsSep "\n" (tool: ''
+      cp ${tool} $dev/bin/
+    '') buildPlatformTools}
+  '' + ''
+    mkdir -p $out/share
+    ln -s ${tex}/share/texmf-var $out/share/texmf
+  '';
+
+  meta = with lib; {
+    homepage = "http://catdvi.sourceforge.net";
+    description = "A DVI to plain text translator";
+    license = licenses.gpl2;
+    maintainers = [ ];
+  };
+})