Unverified Commit 12ee5fb2 authored by Vincenzo Mantova's avatar Vincenzo Mantova Committed by GitHub
Browse files

texlive.bin.dvisvgm: 3.0.3 -> 3.1.2 (#294817)

Build dvisvgm from upstream sources to align with binaries distributed
by TeX Live.
parent ef12e2a9
Loading
Loading
Loading
Loading
+11 −30
Original line number Diff line number Diff line
@@ -322,44 +322,25 @@ context = stdenv.mkDerivation rec {
  };
};

dvisvgm = stdenv.mkDerivation {
dvisvgm = stdenv.mkDerivation rec {
  pname = "dvisvgm";
  inherit (texlive.pkgs.dvisvgm) version;
  version = "3.1.2";

  inherit (common) src;
  src = assert lib.assertMsg (version == texlive.pkgs.dvisvgm.version) "dvisvgm: TeX Live version (${texlive.pkgs.dvisvgm.version}) different from source (${version}), please update dvisvgm"; fetchurl {
    url = "https://github.com/mgieseki/dvisvgm/releases/download/${version}/dvisvgm-${version}.tar.gz";
    hash = "sha256-vqeDrf6TG3eUoMMNeQK4Kw1NmtaBbc2KCVqTHNM+rPY=";
  };

  patches = [
    # do not use deprecated NEWPDF option with Ghostscript >= 10.02.0
    # https://github.com/mgieseki/dvisvgm/issues/245
    (fetchpatch {
      name = "dont-use-NEWPDF-with-GS-10.02.0.patch";
      url = "https://github.com/mgieseki/dvisvgm/commit/f31cdf14d73f586e2b92b4b0891d097a90274a0b.patch";
      hash = "sha256-Yf/GhmJYM87M0ITZ/+7q2ZvSYnac4N2/NkTkFlJ2VII=";
      stripLen = 1;
      extraPrefix = "texk/dvisvgm/dvisvgm-src/";
    })
  configureFlags = [
    "--disable-manpage" # man pages are provided by the doc container
  ];

  # since we are running configure directly in texk/dvisvgm,
  # the option --with-system-potrace is not picked up properly
  # and dvisvgm tries to build a vendored copy of potrace
  postPatch = ''
    cat > texk/dvisvgm/dvisvgm-src/libs/potrace/Makefile <<EOF
    all:
    install:
    EOF
  '' +
  # PDF handling requires mutool (from mupdf) since Ghostscript 10.01
  ''
    substituteInPlace texk/dvisvgm/dvisvgm-src/src/PDFHandler.cpp \
      --replace 'Process("mutool"' "Process(\"$(PATH="$HOST_PATH" command -v mutool)\""
  postPatch = ''
    substituteInPlace src/PDFHandler.cpp \
      --replace-fail 'Process("mutool"' "Process(\"$(PATH="$HOST_PATH" command -v mutool)\""
  '';

  preConfigure = "cd texk/dvisvgm";

  configureFlags = common.configureFlags
    ++ [ "--with-system-kpathsea" ];

  nativeBuildInputs = [ pkg-config ];
  buildInputs = [ core brotli ghostscript zlib freetype woff2 potrace xxHash mupdf-headless ];