Submitted By: Pierre Labastie <pierre dot labastie at neuf dot fr>
Date: 2016-11-27
Initial Package Version: 1.10
Upstream Status: N/A
Origin: Armin K and Gentoo
Description: Generate shared libraries for mupdf, instead of static ones. This
             allows to have the font information (around 35 MB) at one place
             only, instead of in all the executables.
diff -Naur a/Makefile b/Makefile
--- a/Makefile	2016-11-21 11:21:11.000000000 +0100
+++ b/Makefile	2016-11-27 10:26:11.411353082 +0100
@@ -15,7 +15,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 -I$(GEN)
+CFLAGS += $(XCFLAGS) -Iinclude -I$(GEN) -fPIC
 LIBS += $(XLIBS) -lm
 
 LIBS += $(FREETYPE_LIBS)
@@ -152,14 +152,16 @@
 
 # --- Library ---
 
-MUPDF_LIB = $(OUT)/libmupdf.a
-THIRD_LIB = $(OUT)/libmupdfthird.a
+MUPDF_LIB = $(OUT)/libmupdf.so
+THIRD_LIB = $(OUT)/libmupdfthird.so
 
 MUPDF_OBJ := $(FITZ_OBJ) $(FONT_OBJ) $(PDF_OBJ) $(XPS_OBJ) $(SVG_OBJ) $(CBZ_OBJ) $(HTML_OBJ) $(GPRF_OBJ)
 THIRD_OBJ := $(FREETYPE_OBJ) $(HARFBUZZ_OBJ) $(JBIG2DEC_OBJ) $(JPEG_OBJ) $(JPEGXR_OBJ) $(LURATECH_OBJ) $(MUJS_OBJ) $(OPENJPEG_OBJ) $(ZLIB_OBJ)
 
-$(MUPDF_LIB) : $(MUPDF_OBJ)
+$(MUPDF_LIB) : $(MUPDF_OBJ) $(THIRD_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
 
 INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
 
