k2pdfopt: Patch openjpeg version into mupdf as in #31852.
This commit is contained in:
parent
5c5223d46b
commit
bbb5cee20c
@ -1,5 +1,5 @@
|
||||
{ stdenv, fetchzip, fetchurl, fetchpatch, cmake, pkgconfig
|
||||
, zlib, libpng
|
||||
, zlib, libpng, openjpeg
|
||||
, enableGSL ? true, gsl
|
||||
, enableGhostScript ? true, ghostscript
|
||||
, enableMuPDF ? true, mupdf
|
||||
@ -40,11 +40,7 @@ stdenv.mkDerivation rec {
|
||||
# Patches from previous 1.10a version in nixpkgs
|
||||
patches = [
|
||||
# Compatibility with new openjpeg
|
||||
(fetchpatch {
|
||||
name = "mupdf-1.9a-openjpeg-2.1.1.patch";
|
||||
url = "https://git.archlinux.org/svntogit/community.git/plain/mupdf/trunk/0001-mupdf-openjpeg.patch?id=5a28ad0a8999a9234aa7848096041992cc988099";
|
||||
sha256 = "1i24qr4xagyapx4bijjfksj4g3bxz8vs5c2mn61nkm29c63knp75";
|
||||
})
|
||||
./load-jpx.patch
|
||||
|
||||
(fetchurl {
|
||||
name = "CVE-2017-5896.patch";
|
||||
@ -64,6 +60,14 @@ stdenv.mkDerivation rec {
|
||||
# Don't remove mujs because upstream version is incompatible
|
||||
rm -rf thirdparty/{curl,freetype,glfw,harfbuzz,jbig2dec,jpeg,openjpeg,zlib}
|
||||
'';
|
||||
postPatch = let
|
||||
# OpenJPEG version is hardcoded in package source
|
||||
openJpegVersion = with stdenv;
|
||||
lib.concatStringsSep "." (lib.lists.take 2
|
||||
(lib.splitString "." (lib.getVersion openjpeg)));
|
||||
in ''
|
||||
sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c
|
||||
'';
|
||||
});
|
||||
leptonica_modded = leptonica.overrideAttrs (attrs: {
|
||||
prePatch = ''
|
||||
|
29
pkgs/applications/misc/k2pdfopt/load-jpx.patch
Normal file
29
pkgs/applications/misc/k2pdfopt/load-jpx.patch
Normal file
@ -0,0 +1,29 @@
|
||||
--- a/source/fitz/load-jpx.c
|
||||
+++ b/source/fitz/load-jpx.c
|
||||
@@ -484,12 +484,16 @@
|
||||
/* Without the definition of OPJ_STATIC, compilation fails on windows
|
||||
* due to the use of __stdcall. We believe it is required on some
|
||||
* linux toolchains too. */
|
||||
+#ifdef __cplusplus
|
||||
+extern "C"
|
||||
+{
|
||||
#define OPJ_STATIC
|
||||
#ifndef _MSC_VER
|
||||
#define OPJ_HAVE_STDINT_H
|
||||
#endif
|
||||
+#endif
|
||||
|
||||
-#include <openjpeg.h>
|
||||
+#include <openjpeg-__OPENJPEG__VERSION__/openjpeg.h>
|
||||
|
||||
/* OpenJPEG does not provide a safe mechanism to intercept
|
||||
* allocations. In the latest version all allocations go
|
||||
@@ -971,4 +975,8 @@
|
||||
fz_drop_pixmap(ctx, img);
|
||||
}
|
||||
|
||||
+#ifdef __cplusplus
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
#endif /* HAVE_LURATECH */
|
Loading…
Reference in New Issue
Block a user