Submitted By: Bruce Dubbs <bdubbs at linuxfromscratch dot org>
Date: 2017-12-17
Initial Package Version: 1.12.0
Upstream Status: Not submitted
Origin: Arch Linux, rolled forward for openjpeg-2.3
Description: Fixes for openjpeg-2.2
Update: 2017-10-15 Change include directory to openjpeg-2.3

Consolidated patch for installing shared libraries.
Original patch by Ken Moffat

With minor changes for Void by svenper

diff -Naur mupdf-1.12.0-source.orig/Makefile mupdf-1.12.0-source/Makefile
--- Makefile	2017-12-13 08:00:30.000000000 -0600
+++ Makefile	2017-12-17 18:07:39.809057239 -0600
@@ -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.$(VOID_VERSION)
+THIRD_LIB = $(OUT)/libmupdfthird.so.$(VOID_VERSION)
+THREAD_LIB = $(OUT)/libmuthreads.so.$(VOID_VERSION)
+PKCS7_LIB = $(OUT)/libmupkcs7.so.$(VOID_VERSION)
 
 MUPDF_OBJ := \
 	$(FITZ_OBJ) \
@@ -343,12 +343,16 @@
 
 THREAD_OBJ := $(THREAD_OBJ)
 
-$(MUPDF_LIB) : $(MUPDF_OBJ)
+$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
+	$(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf.so.$(VOID_VERSION) -Wl,--no-undefined
 $(THIRD_LIB) : $(THIRD_OBJ)
+	$(LINK_CMD) -shared -Wl,-soname -Wl,libmupdfthird.so.$(VOID_VERSION) -Wl,--no-undefined
 $(THREAD_LIB) : $(THREAD_OBJ)
+	$(LINK_CMD) -shared -Wl,-soname -Wl,libmuthreads.so.$(VOID_VERSION) -Wl,--no-undefined -lpthread
 $(PKCS7_LIB) : $(PKCS7_OBJ)
+	$(LINK_CMD) -shared -Wl,-soname -Wl,libmupkcs7.so.$(VOID_VERSION) -lssl -lcrypto
 
-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
+INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
 
 # --- Tools and Apps ---
 
diff -Naur mupdf-1.12.0-source.orig/source/fitz/load-jpx.c mupdf-1.12.0-source/source/fitz/load-jpx.c
--- source/fitz/load-jpx.c	2017-12-13 08:00:30.000000000 -0600
+++ source/fitz/load-jpx.c	2017-12-17 18:03:03.259071255 -0600
@@ -445,7 +445,7 @@
 
 #else /* HAVE_LURATECH */
 
-#include <openjpeg.h>
+#include <openjpeg-2.3/openjpeg.h>
 
 struct fz_jpxd_s
 {
--- Makerules.orig
+++ Makerules
@@ -97,7 +97,7 @@
 SYS_GLUT_CFLAGS :=
 SYS_GLUT_LIBS := -lglut -lGL
 
-ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0' && echo yes)" "yes"
+ifeq "$(shell pkg-config --exists 'libcrypto >= 1.1.0 && libcrypto <= 2.0' && echo yes)" "yes"
 HAVE_LIBCRYPTO := yes
 SYS_LIBCRYPTO_CFLAGS := -DHAVE_LIBCRYPTO $(shell pkg-config --cflags libcrypto)
 SYS_LIBCRYPTO_LIBS := $(shell pkg-config --libs libcrypto)
