From de6d025592be1ade67166817abf1e624d1c7e642 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20de=20Kok?= Date: Fri, 2 Nov 2018 09:20:05 +0100 Subject: [PATCH] mupdf: 1.13.0 -> 1.14.0 Changelog: https://mupdf.com/release_history.html --- pkgs/applications/misc/mupdf/darwin.patch | 73 +++++++------------ pkgs/applications/misc/mupdf/default.nix | 18 ++--- .../misc/mupdf/mupdf-1.13-shared_libs-1.patch | 45 ------------ .../misc/mupdf/mupdf-1.14-shared_libs.patch | 39 ++++++++++ 4 files changed, 73 insertions(+), 102 deletions(-) delete mode 100644 pkgs/applications/misc/mupdf/mupdf-1.13-shared_libs-1.patch create mode 100644 pkgs/applications/misc/mupdf/mupdf-1.14-shared_libs.patch diff --git a/pkgs/applications/misc/mupdf/darwin.patch b/pkgs/applications/misc/mupdf/darwin.patch index 7466fc2ca62b..be1b84b0012f 100644 --- a/pkgs/applications/misc/mupdf/darwin.patch +++ b/pkgs/applications/misc/mupdf/darwin.patch @@ -1,47 +1,30 @@ -diff --git a/Makerules b/Makerules ---- a/Makerules -+++ b/Makerules -@@ -81,22 +81,10 @@ HAVE_GLUT ?= yes - SYS_GLUT_CFLAGS := -Wno-deprecated-declarations - SYS_GLUT_LIBS := -framework GLUT -framework OpenGL - --CC = xcrun cc --AR = xcrun ar --LD = xcrun ld --RANLIB_CMD = xcrun ranlib $@ +diff -ruN mupdf-1.14.0-source.orig/Makerules mupdf-1.14.0-source/Makerules +--- mupdf-1.14.0-source.orig/Makerules 2018-11-02 06:57:12.114012496 +0100 ++++ mupdf-1.14.0-source/Makerules 2018-11-02 10:11:56.717232992 +0100 +@@ -80,13 +80,6 @@ + HAVE_GLUT := yes + SYS_GLUT_CFLAGS := -Wno-deprecated-declarations + SYS_GLUT_LIBS := -framework GLUT -framework OpenGL +- CC = xcrun cc +- AR = xcrun ar +- LD = xcrun ld +- RANLIB = xcrun ranlib - --# Linux uses pkg-config for system libraries. --else ifeq "$(OS)" "Linux" +-else ifeq ($(OS),Linux) +- HAVE_OBJCOPY := yes + + ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes) + SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2) +@@ -119,12 +112,6 @@ + SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) + endif + +- HAVE_GLUT := yes +- ifeq ($(HAVE_GLUT),yes) +- SYS_GLUT_CFLAGS := +- SYS_GLUT_LIBS := -lglut -lGL +- endif - - HAVE_PTHREAD := yes - SYS_PTHREAD_CFLAGS := - SYS_PTHREAD_LIBS := -lpthread - --HAVE_GLUT := yes --SYS_GLUT_CFLAGS := --SYS_GLUT_LIBS := -lglut -lGL -- - ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes" - HAVE_LIBCRYPTO := yes - SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto) -@@ -113,7 +101,7 @@ SYS_CURL_CFLAGS += $(shell pkg-config --cflags openssl) - SYS_CURL_DEPS += $(shell pkg-config --libs openssl) - endif - endif --SYS_CURL_DEPS += -lpthread -lrt -+SYS_CURL_DEPS += -lpthread - - ifeq "$(shell pkg-config --exists x11 xext && echo yes)" "yes" - HAVE_X11 := yes -diff --git a/platform/gl/gl-main.c b/platform/gl/gl-main.c -index d58f7ba..808af18 100644 ---- a/platform/gl/gl-main.c -+++ b/platform/gl/gl-main.c -@@ -16,6 +16,7 @@ void glutExit(void) {} - void glutMouseWheelFunc(void *fn) {} - void glutInitErrorFunc(void *fn) {} - void glutInitWarningFunc(void *fn) {} -+#define glutSetOption(X,Y) - #endif - - enum + HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes) + ifeq ($(HAVE_X11),yes) + X11_CFLAGS := $(shell pkg-config --cflags x11 xext) diff --git a/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix index bce2a79cde33..d4f59272c9c9 100644 --- a/pkgs/applications/misc/mupdf/default.nix +++ b/pkgs/applications/misc/mupdf/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, freetype, harfbuzz, openjpeg +{ stdenv, lib, fetchurl, pkgconfig, freetype, harfbuzz, openjpeg , jbig2dec, libjpeg , darwin , enableX11 ? true, libX11, libXext, libXi, libXrandr , enableCurl ? true, curl, openssl @@ -14,23 +14,17 @@ let in stdenv.mkDerivation rec { - version = "1.13.0"; + version = "1.14.0"; name = "mupdf-${version}"; src = fetchurl { url = "https://mupdf.com/downloads/archive/${name}-source.tar.gz"; - sha256 = "02faww5bnjw76k6igrjzwf0lnw4xd9ckc8d6ilc3c4gfrdi6j707"; + sha256 = "093p7lv6pgyymagn28n58fs0np928r0i5p2az9cc4gwccwx4hhy4"; }; - patches = [ - (fetchpatch { - name = "CVE-2018-10289.patch"; - url = "https://bugs.ghostscript.com/attachment.cgi?id=15230"; - sha256 = "0jmpacxd9930g6k57kda9jrcrbk75whdlv8xwmqg5jwn848qvy4q"; - }) - ] + patches = # Use shared libraries to decrease size - ++ stdenv.lib.optional (!stdenv.isDarwin) ./mupdf-1.13-shared_libs-1.patch + stdenv.lib.optional (!stdenv.isDarwin) ./mupdf-1.14-shared_libs.patch ++ stdenv.lib.optional stdenv.isDarwin ./darwin.patch ; @@ -38,7 +32,7 @@ in stdenv.mkDerivation rec { sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c ''; - makeFlags = [ "prefix=$(out)" ]; + makeFlags = [ "prefix=$(out) USE_SYSTEM_LIBS=yes" ]; nativeBuildInputs = [ pkgconfig ]; buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg freeglut libGLU ] ++ lib.optionals enableX11 [ libX11 libXext libXi libXrandr ] diff --git a/pkgs/applications/misc/mupdf/mupdf-1.13-shared_libs-1.patch b/pkgs/applications/misc/mupdf/mupdf-1.13-shared_libs-1.patch deleted file mode 100644 index e29f1f52077c..000000000000 --- a/pkgs/applications/misc/mupdf/mupdf-1.13-shared_libs-1.patch +++ /dev/null @@ -1,45 +0,0 @@ ---- mupdf-1.12.0-source.orig/Makefile 2017-12-13 15:00:30.000000000 +0100 -+++ mupdf-1.12.0-source/Makefile 2017-12-31 00:05:23.003277481 +0100 -@@ -14,7 +14,7 @@ - # Do not specify CFLAGS or LIBS on the make invocation line - specify - # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that - # set a variable that was set on the command line. --CFLAGS += $(XCFLAGS) -Iinclude -+CFLAGS += $(XCFLAGS) -Iinclude -fPIC - LIBS += $(XLIBS) -lm - - LIBS += $(FREETYPE_LIBS) -@@ -312,10 +312,10 @@ - - # --- Library --- - --MUPDF_LIB = $(OUT)/libmupdf.a --THIRD_LIB = $(OUT)/libmupdfthird.a --THREAD_LIB = $(OUT)/libmuthreads.a --PKCS7_LIB = $(OUT)/libmupkcs7.a -+MUPDF_LIB = $(OUT)/libmupdf.so -+THIRD_LIB = $(OUT)/libmupdfthird.so -+THREAD_LIB = $(OUT)/libmuthreads.so -+PKCS7_LIB = $(OUT)/libmupkcs7.so - - MUPDF_OBJ := \ - $(FITZ_OBJ) \ -@@ -343,13 +343,17 @@ - $(ZLIB_OBJ) \ - $(LCMS2_OBJ) - --$(MUPDF_LIB) : $(MUPDF_OBJ) -+$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined - $(THIRD_LIB) : $(THIRD_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdfthird.so -Wl,--no-undefined - $(THREAD_LIB) : $(THREAD_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmuthreads.so -Wl,--no-undefined -lpthread - $(PKCS7_LIB) : $(PKCS7_OBJ) -+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupkcs7.so - --INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) -+INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB) - - # --- Tools and Apps --- - diff --git a/pkgs/applications/misc/mupdf/mupdf-1.14-shared_libs.patch b/pkgs/applications/misc/mupdf/mupdf-1.14-shared_libs.patch new file mode 100644 index 000000000000..131a1bbbf6bd --- /dev/null +++ b/pkgs/applications/misc/mupdf/mupdf-1.14-shared_libs.patch @@ -0,0 +1,39 @@ +--- mupdf-1.14.0-source.orig/Makefile 2018-11-02 06:57:12.114012496 +0100 ++++ mupdf-1.14.0-source/Makefile 2018-11-02 09:57:10.067945307 +0100 +@@ -20,7 +20,7 @@ + # Do not specify CFLAGS or LIBS on the make invocation line - specify + # XCFLAGS or XLIBS instead. Make ignores any lines in the makefile that + # set a variable that was set on the command line. +-CFLAGS += $(XCFLAGS) -Iinclude ++CFLAGS += $(XCFLAGS) -Iinclude -fPIC + LIBS += $(XLIBS) -lm + + ifneq ($(threading),no) +@@ -190,17 +190,21 @@ + + # --- Library --- + +-MUPDF_LIB = $(OUT)/libmupdf.a +-THIRD_LIB = $(OUT)/libmupdf-third.a +-THREAD_LIB = $(OUT)/libmupdf-threads.a +-PKCS7_LIB = $(OUT)/libmupdf-pkcs7.a ++MUPDF_LIB = $(OUT)/libmupdf.so ++THIRD_LIB = $(OUT)/libmupdf-third.so ++THREAD_LIB = $(OUT)/libmupdf-threads.so ++PKCS7_LIB = $(OUT)/libmupdf-pkcs7.so + +-$(MUPDF_LIB) : $(MUPDF_OBJ) ++$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB) ++ $(LINK_CMD) $(THIRD_LIBS) -shared -Wl,-soname -Wl,libmupdf.so -Wl,--no-undefined + $(THIRD_LIB) : $(THIRD_OBJ) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-third.so -Wl,--no-undefined + $(THREAD_LIB) : $(THREAD_OBJ) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-threads.so -Wl,--no-undefined -lpthread + $(PKCS7_LIB) : $(PKCS7_OBJ) ++ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-pkcs7.so + +-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) ++INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB) + + # --- Main tools and viewers --- +