From 21db6f6af1e006e29a582ca234786a8027c319a1 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 31 Dec 2017 14:27:37 -0500 Subject: mupdf: enable on darwin --- pkgs/applications/misc/mupdf/darwin.patch | 35 +++++++++++++++++++++++++++++++ pkgs/applications/misc/mupdf/default.nix | 20 ++++++++++++------ 2 files changed, 49 insertions(+), 6 deletions(-) create mode 100644 pkgs/applications/misc/mupdf/darwin.patch diff --git a/pkgs/applications/misc/mupdf/darwin.patch b/pkgs/applications/misc/mupdf/darwin.patch new file mode 100644 index 000000000000..e0c7d6a7a676 --- /dev/null +++ b/pkgs/applications/misc/mupdf/darwin.patch @@ -0,0 +1,35 @@ +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 $@ +- +-# Linux uses pkg-config for system libraries. +-else ifeq "$(OS)" "Linux" +- + 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.0.1t' && 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/pkgs/applications/misc/mupdf/default.nix b/pkgs/applications/misc/mupdf/default.nix index c1bc55b77c3c..75d8463cf7f8 100644 --- a/pkgs/applications/misc/mupdf/default.nix +++ b/pkgs/applications/misc/mupdf/default.nix @@ -1,5 +1,5 @@ -{ stdenv, lib, fetchurl, fetchpatch, pkgconfig -, freetype, harfbuzz, openjpeg, jbig2dec, libjpeg +{ stdenv, lib, fetchurl, fetchpatch, pkgconfig, freetype, harfbuzz, openjpeg +, jbig2dec, libjpeg , darwin , enableX11 ? true, libX11, libXext, libXi, libXrandr , enableCurl ? true, curl, openssl , enableGL ? true, freeglut, mesa_glu @@ -29,10 +29,13 @@ in stdenv.mkDerivation rec { url = "https://git.archlinux.org/svntogit/community.git/plain/trunk/0001-mupdf-openjpeg.patch?h=packages/mupdf&id=a910cd33a2b311712f83710dc042fbe80c104306"; sha256 = "05i9v2ia586jyjqdb7g68ss4vkfwgp6cwhagc8zzggsba83azyqk"; }) + ] - ./mupdf-1.12-shared_libs-1.patch + # Use shared libraries to decrease size + ++ stdenv.lib.optional (!stdenv.isDarwin) ./mupdf-1.12-shared_libs-1.patch - ]; + ++ stdenv.lib.optional stdenv.isDarwin ./darwin.patch + ; postPatch = '' sed -i "s/__OPENJPEG__VERSION__/${openJpegVersion}/" source/fitz/load-jpx.c @@ -43,7 +46,12 @@ in stdenv.mkDerivation rec { buildInputs = [ freetype harfbuzz openjpeg jbig2dec libjpeg freeglut mesa_glu ] ++ lib.optionals enableX11 [ libX11 libXext libXi libXrandr ] ++ lib.optionals enableCurl [ curl openssl ] - ++ lib.optionals enableGL [ freeglut mesa_glu ]; + ++ lib.optionals enableGL ( + if stdenv.isDarwin then + with darwin.apple_sdk.frameworks; [ GLUT OpenGL ] + else + [ freeglut mesa_glu ]) + ; outputs = [ "bin" "dev" "out" "man" "doc" ]; preConfigure = '' @@ -86,6 +94,6 @@ in stdenv.mkDerivation rec { description = "Lightweight PDF, XPS, and E-book viewer and toolkit written in portable C"; license = licenses.agpl3Plus; maintainers = with maintainers; [ viric vrthra fpletz ]; - platforms = platforms.linux; + platforms = platforms.unix; }; } -- cgit 1.4.1