aboutsummaryrefslogtreecommitdiff
path: root/office/mupdf/shared_libs.diff
blob: 8d8204b67bb28810f382dd898533ee8f0cbf8ad8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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)