slackbuilds/office/mupdf/shared_libs.diff

71 lines
2.5 KiB
Diff

diff -Naur mupdf-1.16.1-source/Makefile mupdf-1.16.1-source.patched/Makefile
--- mupdf-1.16.1-source/Makefile 2019-08-02 10:49:26.000000000 -0400
+++ mupdf-1.16.1-source.patched/Makefile 2020-02-17 22:15:13.596704068 -0500
@@ -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)
@@ -189,17 +189,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) -shared -Wl,-soname -Wl,libmupdf.so.$(SOMAJOR) -Wl,--no-undefined $(THIRD_LIBS)
$(THIRD_LIB) : $(THIRD_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-third.so.$(SOMAJOR) -Wl,--no-undefined
$(THREAD_LIB) : $(THREAD_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupdf-threads.so.$(SOMAJOR) -Wl,--no-undefined -lpthread
$(PKCS7_LIB) : $(PKCS7_OBJ)
+ $(LINK_CMD) -shared -Wl,-soname -Wl,libmupfs-pkcs7.so.$(SOMAJOR)
-INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB)
+INSTALL_LIBS := $(MUPDF_LIB) $(THIRD_LIB) $(THREAD_LIB) $(PKCS7_LIB)
# --- Main tools and viewers ---
@@ -294,6 +298,14 @@
VERSION = $(shell git describe --tags)
+# 20180623 bkw: major/minor/micro versions for shared library.
+# SOMAJOR is the mupdf major/minor version jammed together (e.g. 113
+# for 1.13.0).
+# SOMINOR is the mupdf micro version (e.g. 0 for 1.13.0).
+SOMAJOR = $(shell echo $(VERSION) | cut -d. -f1-2 | sed 's,\.,,g' )
+SOMINOR = $(shell echo $(VERSION) | cut -d. -f3- | sed 's,\.,,g' )
+SOVER = $(SOMAJOR).$(SOMINOR)
+
version:
sed -i~ -e '/FZ_VERSION /s/".*"/"'$(VERSION)'"/' include/mupdf/fitz/version.h
@@ -331,7 +343,13 @@
install -m 644 include/mupdf/pdf/*.h $(DESTDIR)$(incdir)/mupdf/pdf
install -d $(DESTDIR)$(libdir)
- install -m 644 $(INSTALL_LIBS) $(DESTDIR)$(libdir)
+ install -s -m0755 $(INSTALL_LIBS) $(DESTDIR)$(libdir)
+ ( cd $(DESTDIR)$(libdir) ; \
+ for i in $(INSTALL_LIBS); do \
+ j=$$( basename $$i) ; \
+ mv $$j $$j.$(SOVER) ; \
+ ln -s $$j.$(SOVER) $$j ; \
+ done )
install -d $(DESTDIR)$(bindir)
install -m 755 $(TOOL_APPS) $(VIEW_APPS) $(DESTDIR)$(bindir)