criticic / llpp

llpp original source code before it turned to protestware. NOTE: changes are made on the "latest" branch, master is locked and remains as it was.
Other
28 stars 6 forks source link

Allow to build with static libmupdf #12

Open fstecker opened 4 months ago

fstecker commented 4 months ago

@Sfinx reported in https://github.com/criticic/llpp/issues/6#issuecomment-2041320200 that llpp doesn't build with the newest version of mupdf in its default configuration and suggested the following patch

diff --git a/build.bash b/build.bash
index 7830f6c..efdb9d0 100755
--- a/build.bash
+++ b/build.bash
@@ -275,7 +275,7 @@ for m in ml_gl ml_glarray ml_raw; do
 done

 libs="str.cma unix.cma"
-clibs="-ljbig2dec $(pkg-config --libs "${mudeps[@]}") -lmupdf -lpthread"
+clibs="-ljbig2dec $(pkg-config --libs "${mudeps[@]}") -lmupdf -lz -lmupdf-third -lpthread"
 if $darwin; then
     mcomp=$ccomp
     clibs+=" -framework Cocoa -framework OpenGL"

However, on my system building works without the patch, and breaks with it, as I have no libmupdf-third. It seems to me that the difference is whether libmupdf is compiled as a static library (which is the default for libmupdf, and then libmupdf-third is needed) or as a dynamic library (which seems to be the case eg. in Arch Linux, and then there is no libmupdf-third)

The build script should probably detect whether libmupdf is a static or dynamic library (or just whether libmupdf-third is present on the system) and accordingly add -lmupdf-third or not. I'm also still not sure what libmupdf-third actually contains.

Sfinx commented 4 months ago

mupdf-third from mupdf git contains extract_* functions that are used in libmupdf.a(output-docx.o) file so you will have link errors