aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorJ. Lewis Muir <jlmuir@imca-cat.org>2015-03-04 16:32:49 -0600
committerDavid Bremner <david@tethera.net>2015-03-06 08:00:18 +0100
commitee2d490280a939ca91dd184bece2bd53582b8e54 (patch)
treecd5bd6ee314174f10925e23185aa04a1ba75ceb9 /lib
parent326e1885640e53b8c2851e92bcf2d8297d7329ac (diff)
lib: make notmuch shared library install_name be full path on Mac OS X
The install_name of libnotmuch.dylib on Mac OS X is what is written into a program that links against it. If it is just the name of the shared library file, as opposed to the full path, the program won't be able to find it when it runs and will abort. Instead, the install_name should be the full path to the shared library (in its final installed location). Why does Notmuch work without this patch when installed via Homebrew? The answer is twofold. One, /usr/local/lib is a special location in which the dynamic linker will look by default to find shared libraries. Homebrew highly recommends installing to /usr/local, and, assuming it has been configured this way, the Notmuch library will end up installed in /usr/local/lib, and the dynamic linker will find it. Two, Homebrew globally corrects all install names in dynamically shared libraries and binaries for each package it installs. So, even if the install names in a package's binaries and libraries are incorrect, Homebrew corrects them automatically, and no one ever knows. Why does Notmuch work without this patch when installed via MacPorts? The answer is that MacPorts applies a patch just like this patch to fix the same problem.
Diffstat (limited to 'lib')
-rw-r--r--lib/Makefile.local2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Makefile.local b/lib/Makefile.local
index 7278f468..f9ecd50e 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -27,7 +27,7 @@ LIBRARY_SUFFIX = dylib
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
-LIBRARY_LINK_FLAG = -dynamiclib -install_name $(SONAME) -compatibility_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR) -current_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
+LIBRARY_LINK_FLAG = -dynamiclib -install_name $(libdir)/$(SONAME) -compatibility_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR) -current_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
else
LIBRARY_SUFFIX = so
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)