Browse Source

support non-standard install location on macOS

Libraries on OS X are referenced by binaries using absolute paths. When
linking, the linker copies this path from the library it links into the
compiled binary. To make this work with non-default paths, the library
must contain its own installation path as so-called "install name".

This makes libwkhtmltox a well-behaved library on OS X and fixes running
wkhtmltopdf if the library isn't in /usr/lib or /usr/local/lib.

Co-authored-by: Clemens Lang <neverpanic@gmail.com>
Nick Gaya 4 years ago
parent
commit
97b8bb81a8
3 changed files with 8 additions and 0 deletions
  1. 2 0
      src/image/image.pro
  2. 4 0
      src/lib/lib.pro
  3. 2 0
      src/pdf/pdf.pro

+ 2 - 0
src/image/image.pro

@@ -32,6 +32,8 @@ unix {
 }
 
 macx {
+    man.extra=DYLD_LIBRARY_PATH=../../bin/ ../../bin/wkhtmltoimage --manpage | gzip > $(INSTALL_ROOT)$$INSTALLBASE/share/man/man1/wkhtmltoimage.1.gz
+
     CONFIG -= app_bundle
 }
 

+ 4 - 0
src/lib/lib.pro

@@ -33,6 +33,10 @@ INSTALLS += headers
 
 windows: CONFIG += skip_target_version_ext
 
+macx {
+    QMAKE_LFLAGS_SONAME = -Wl,-install_name,$$INSTALLBASE/lib/
+}
+
 TARGET=wkhtmltox
 INSTALLS += target
 

+ 2 - 0
src/pdf/pdf.pro

@@ -32,6 +32,8 @@ unix {
 }
 
 macx {
+    man.extra=DYLD_LIBRARY_PATH=../../bin ../../bin/wkhtmltopdf --manpage | gzip > $(INSTALL_ROOT)$$INSTALLBASE/share/man/man1/wkhtmltopdf.1.gz
+
     CONFIG -= app_bundle
 }