--- mupdf-1.12.0-source/Makefile.orig
+++ mupdf-1.12.0-source/Makefile
@@ -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)
@@ -75,6 +75,7 @@
 CXX_CMD = $(QUIET_CXX) $(CXX) $(CFLAGS) -o $@ -c $<
 AR_CMD = $(QUIET_AR) $(AR) cr $@ $^
 LINK_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -o $@ $^ $(LIBS)
+LINK_SHARED_CMD = $(QUIET_LINK) $(CC) $(LDFLAGS) -shared -Wl,-soname,$(notdir $@) -o $@ $^ $(LIBS)
 MKDIR_CMD = $(QUIET_MKDIR) mkdir -p $@
 RM_CMD = $(QUIET_RM) rm -f $@
 TAGS_CMD = $(QUIET_TAGS) ctags $^
@@ -90,6 +91,9 @@
 	$(AR_CMD)
 	$(RANLIB_CMD)
 
+$(OUT)/%.so.0: $(OUT)/%.a
+	$(LINK_SHARED_CMD)
+
 $(OUT)/%.exe: $(OUT)/%.o | $(ALL_DIR)
 	$(LINK_CMD)
 
@@ -312,8 +316,8 @@
 
 # --- Library ---
 
-MUPDF_LIB = $(OUT)/libmupdf.a
-THIRD_LIB = $(OUT)/libmupdfthird.a
+MUPDF_LIB = $(OUT)/libmupdf.so.0
+THIRD_LIB = $(OUT)/libmupdfthird.so.0
 THREAD_LIB = $(OUT)/libmuthreads.a
 
 MUPDF_OBJ := \
