Merge pull request #165116 from toonn/mupdf-fix-darwin

authored by

Ben Siraphob and committed by
GitHub
9ca8091c b7717b64

+88
+25
pkgs/applications/misc/mupdf/0001-Use-command-v-in-favor-of-which.patch
··· 1 + From b2935ed7e2962d73f3b493c38c0bb1e8659c0a60 Mon Sep 17 00:00:00 2001 2 + From: toonn <toonn@toonn.io> 3 + Date: Tue, 8 Mar 2022 23:59:19 +0100 4 + Subject: [PATCH 1/2] Use command -v in favor of which 5 + 6 + --- 7 + Makerules | 2 +- 8 + 1 file changed, 1 insertion(+), 1 deletion(-) 9 + 10 + diff --git a/Makerules b/Makerules 11 + index 0fdaecb..6d52cca 100644 12 + --- a/Makerules 13 + +++ b/Makerules 14 + @@ -145,7 +145,7 @@ else ifeq ($(OS),MACOS) 15 + LD = xcrun ld 16 + RANLIB = xcrun ranlib 17 + 18 + - ifeq (, $(shell which pkg-config)) 19 + + ifeq (, $(shell command -v pkg-config)) 20 + $(warning "No pkg-config found, install it for proper integration of libcrypto") 21 + else 22 + HAVE_LIBCRYPTO := $(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes) 23 + -- 24 + 2.17.2 (Apple Git-113) 25 +
+57
pkgs/applications/misc/mupdf/0002-Add-Darwin-deps.patch
··· 1 + From 0f0ccfc01cfe72d96eafee57ec6c5107f09c7238 Mon Sep 17 00:00:00 2001 2 + From: toonn <toonn@toonn.io> 3 + Date: Wed, 9 Mar 2022 00:08:28 +0100 4 + Subject: [PATCH 2/2] Add Darwin deps 5 + 6 + --- 7 + Makerules | 34 ++++++++++++++++++++++++++++++++++ 8 + 1 file changed, 34 insertions(+) 9 + 10 + diff --git a/Makerules b/Makerules 11 + index 6d52cca..a6bd0ed 100644 12 + --- a/Makerules 13 + +++ b/Makerules 14 + @@ -153,6 +153,40 @@ else ifeq ($(OS),MACOS) 15 + LIBCRYPTO_CFLAGS := $(shell pkg-config --cflags libcrypto) -DHAVE_LIBCRYPTO 16 + LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto) 17 + endif 18 + + # Required for mupdf-gl 19 + + ifeq ($(shell pkg-config --exists harfbuzz && echo yes),yes) 20 + + SYS_HARFBUZZ_CFLAGS := $(shell pkg-config --cflags harfbuzz) 21 + + SYS_HARFBUZZ_LIBS := $(shell pkg-config --libs harfbuzz) 22 + + endif 23 + + ifeq ($(shell pkg-config --exists libopenjp2 && echo yes),yes) 24 + + SYS_OPENJPEG_CFLAGS := $(shell pkg-config --cflags libopenjp2) 25 + + SYS_OPENJPEG_LIBS := $(shell pkg-config --libs libopenjp2) 26 + + endif 27 + + ifeq ($(shell pkg-config --exists freetype2 && echo yes),yes) 28 + + SYS_FREETYPE_CFLAGS := $(shell pkg-config --cflags freetype2) 29 + + SYS_FREETYPE_LIBS := $(shell pkg-config --libs freetype2) 30 + + endif 31 + + ifeq ($(shell pkg-config --exists gumbo && echo yes),yes) 32 + + SYS_GUMBO_CFLAGS := $(shell pkg-config --cflags gumbo) 33 + + SYS_GUMBO_LIBS := $(shell pkg-config --libs gumbo) 34 + + endif 35 + + # Required for mupdf-x11 36 + + HAVE_X11 := $(shell pkg-config --exists x11 xext && echo yes) 37 + + ifeq ($(HAVE_X11),yes) 38 + + X11_CFLAGS := $(shell pkg-config --cflags x11 xext) 39 + + X11_LIBS := $(shell pkg-config --libs x11 xext) 40 + + endif 41 + + # Required for mupdf-x11-curl 42 + + HAVE_SYS_CURL := $(shell pkg-config --exists libcurl && echo yes) 43 + + ifeq ($(HAVE_SYS_CURL),yes) 44 + + SYS_CURL_CFLAGS := $(shell pkg-config --cflags libcurl) 45 + + SYS_CURL_LIBS := $(shell pkg-config --libs libcurl) 46 + + endif 47 + + HAVE_PTHREAD := yes 48 + + ifeq ($(HAVE_PTHREAD),yes) 49 + + PTHREAD_CFLAGS := 50 + + PTHREAD_LIBS := -lpthread 51 + + endif 52 + endif 53 + 54 + else ifeq ($(OS),Linux) 55 + -- 56 + 2.17.2 (Apple Git-113) 57 +
+6
pkgs/applications/misc/mupdf/default.nix
··· 21 21 , enableGL ? true 22 22 , freeglut 23 23 , libGLU 24 + , xcbuild 24 25 }: 25 26 let 26 27 ··· 39 40 sha256 = "1vfyhlqq1a0k0drcggly4bgsjasmf6lmpfbdi5xcrwdbzkagrbr1"; 40 41 }; 41 42 43 + patches = [ ./0001-Use-command-v-in-favor-of-which.patch 44 + ./0002-Add-Darwin-deps.patch 45 + ]; 46 + 42 47 postPatch = '' 43 48 sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c 44 49 ''; ··· 52 57 53 58 nativeBuildInputs = [ pkg-config ]; 54 59 buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg gumbo ] 60 + ++ lib.optional stdenv.isDarwin xcbuild 55 61 ++ lib.optionals enableX11 [ libX11 libXext libXi libXrandr ] 56 62 ++ lib.optionals enableCurl [ curl openssl ] 57 63 ++ lib.optionals enableGL (