From 9ed8e03a09a127e4dfdbd00524ede239b94cac78 Mon Sep 17 00:00:00 2001 From: "Markus S. Wamser" Date: Wed, 14 Oct 2020 09:39:58 +0200 Subject: mupdf: mark 1.17 as insecure but as still required as dependency --- pkgs/applications/misc/k2pdfopt/default.nix | 4 +- pkgs/applications/misc/mupdf/1.17.nix | 95 ++++++++++++++++++++++ .../misc/mupdf/mupdf-1.14-shared_libs.patch | 39 +++++++++ 3 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 pkgs/applications/misc/mupdf/1.17.nix create mode 100644 pkgs/applications/misc/mupdf/mupdf-1.14-shared_libs.patch (limited to 'pkgs/applications') diff --git a/pkgs/applications/misc/k2pdfopt/default.nix b/pkgs/applications/misc/k2pdfopt/default.nix index 75e467d4cdf8a..be61a76190a27 100644 --- a/pkgs/applications/misc/k2pdfopt/default.nix +++ b/pkgs/applications/misc/k2pdfopt/default.nix @@ -2,7 +2,7 @@ , cmake, pkgconfig, zlib, libpng, makeWrapper , enableGSL ? true, gsl , enableGhostScript ? true, ghostscript -, enableMuPDF ? true, mupdf +, enableMuPDF ? true, mupdf_1_17 , enableDJVU ? true, djvulibre , enableGOCR ? false, gocr # Disabled by default due to crashes , enableTesseract ? true, leptonica, tesseract4 @@ -89,7 +89,7 @@ in stdenv.mkDerivation rec { cp ${k2pdfopt_src}/mupdf_mod/pdf-* ./source/pdf/ ''; }; - mupdf_modded = mupdf.overrideAttrs ({ patches ? [], ... }: { + mupdf_modded = mupdf_1_17.overrideAttrs ({ patches ? [], ... }: { patches = patches ++ [ mupdf_patch ]; # This function is missing in font.c, see font-win32.c postPatch = '' diff --git a/pkgs/applications/misc/mupdf/1.17.nix b/pkgs/applications/misc/mupdf/1.17.nix new file mode 100644 index 0000000000000..c6243e5f1d6ba --- /dev/null +++ b/pkgs/applications/misc/mupdf/1.17.nix @@ -0,0 +1,95 @@ +{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, freetype, harfbuzz, openjpeg +, jbig2dec, libjpeg , darwin +, enableX11 ? true, libX11, libXext, libXi, libXrandr +, enableCurl ? true, curl, openssl +, enableGL ? true, freeglut, libGLU +}: + +let + + # OpenJPEG version is hardcoded in package source + openJpegVersion = with stdenv; + lib.versions.majorMinor (lib.getVersion openjpeg); + + +in stdenv.mkDerivation rec { + version = "1.17.0"; + pname = "mupdf"; + + src = fetchurl { + url = "https://mupdf.com/downloads/archive/${pname}-${version}-source.tar.gz"; + sha256 = "13nl9nrcx2awz9l83mlv2psi1lmn3hdnfwxvwgwiwbxlkjl3zqq0"; + }; + + patches = + # Use shared libraries to decrease size + stdenv.lib.optional (!stdenv.isDarwin) ./mupdf-1.14-shared_libs.patch + ++ stdenv.lib.optional stdenv.isDarwin ./darwin.patch + ; + + postPatch = '' + sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c + ''; + + makeFlags = [ "prefix=$(out) USE_SYSTEM_LIBS=yes" ]; + nativeBuildInputs = [ pkgconfig ]; + buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg freeglut libGLU ] + ++ lib.optionals enableX11 [ libX11 libXext libXi libXrandr ] + ++ lib.optionals enableCurl [ curl openssl ] + ++ lib.optionals enableGL ( + if stdenv.isDarwin then + with darwin.apple_sdk.frameworks; [ GLUT OpenGL ] + else + [ freeglut libGLU ]) + ; + outputs = [ "bin" "dev" "out" "man" "doc" ]; + + preConfigure = '' + # Don't remove mujs because upstream version is incompatible + rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,libjpeg,openjpeg,zlib} + ''; + + postInstall = '' + mkdir -p "$out/lib/pkgconfig" + cat >"$out/lib/pkgconfig/mupdf.pc" < $bin/share/applications/mupdf.desktop <