[notmuch] [PATCH] Build and link against notmuch shared library
authorBen Gamari <bgamari.foss@gmail.com>
Tue, 26 Jan 2010 06:15:50 +0000 (01:15 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:02 +0000 (09:36 -0800)
d9/27848bc4699c9c0f162656a013ee4013a470ee [new file with mode: 0644]

diff --git a/d9/27848bc4699c9c0f162656a013ee4013a470ee b/d9/27848bc4699c9c0f162656a013ee4013a470ee
new file mode 100644 (file)
index 0000000..71f3c56
--- /dev/null
@@ -0,0 +1,145 @@
+Return-Path: <bgamari.foss@gmail.com>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 354EA431FBC\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jan 2010 22:16:02 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.716\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.716 tagged_above=-999 required=5\r
+       tests=[AWL=-0.117, BAYES_00=-2.599] autolearn=ham\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id aLhV80SFRCGz for <notmuch@notmuchmail.org>;\r
+       Mon, 25 Jan 2010 22:15:59 -0800 (PST)\r
+Received: from mail-qy0-f202.google.com (mail-qy0-f202.google.com\r
+       [209.85.221.202])\r
+       by olra.theworths.org (Postfix) with ESMTP id 02FBE431FAE\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jan 2010 22:15:58 -0800 (PST)\r
+Received: by qyk40 with SMTP id 40so2316897qyk.22\r
+       for <notmuch@notmuchmail.org>; Mon, 25 Jan 2010 22:15:58 -0800 (PST)\r
+DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;\r
+       h=domainkey-signature:received:received:from:to:cc:subject:date\r
+       :message-id:x-mailer:in-reply-to:references;\r
+       bh=79DiVqXq8uJM2Ueo242GdREH4M/GKkpILr1eDGatOEY=;\r
+       b=ZuGwi/AJPZ6XjyeEfPUvGdH2kQLGeCMUAzEZsv7RAt4AwbPr/5+INCO5R9nv8OIhCQ\r
+       YG0PlJG5j3wzyHzr+H87cvfoJvIGrtYQfaBJ8jsqMkn48kBOUcji/2k31jhQkUHHOOie\r
+       HPu0zNldz3eYSWgKmGVtEW3kloTs5NwgrN8Yc=\r
+DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;\r
+       h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references;\r
+       b=pFI12Tdlj4uX3yypKqgiq5Ol4uWDnSYp+i4QTttrnwIuw3xj4rTrX6QhEh+S07TZlj\r
+       Rz+nirYEgYKmvTbWQNSyFk+OcAHLVRmdXhFYxSGQ7tJ8KlRgk3shuRgBHEQU4jRsg/MI\r
+       rn3YmI5rRfmftWioOCDkrnH6Mz/OiybRgz3bw=\r
+Received: by 10.229.71.66 with SMTP id g2mr1138924qcj.16.1264486558488;\r
+       Mon, 25 Jan 2010 22:15:58 -0800 (PST)\r
+Received: from localhost.localdomain (umass-959-100.wireless.umass.edu\r
+       [128.119.77.100])\r
+       by mx.google.com with ESMTPS id 20sm3653724qyk.1.2010.01.25.22.15.56\r
+       (version=SSLv3 cipher=RC4-MD5); Mon, 25 Jan 2010 22:15:57 -0800 (PST)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org\r
+Date: Tue, 26 Jan 2010 01:15:50 -0500\r
+Message-Id: <1264486550-1479-1-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.6.3.3\r
+In-Reply-To: <1264484247-sup-7128@ben-laptop>\r
+References: <1264484247-sup-7128@ben-laptop>\r
+Subject: [notmuch] [PATCH] Build and link against notmuch shared library\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Tue, 26 Jan 2010 06:16:02 -0000\r
+\r
+Inger in #notmuch brought to light some build issues that will occur when the\r
+notmuch binary is being built before libnotmuch is installed. Here is an\r
+updated patch that resolves these issues.\r
+\r
+---\r
+ .gitignore         |    1 +\r
+ Makefile           |    1 +\r
+ Makefile.local     |    6 ++++--\r
+ lib/Makefile.local |    9 +++++----\r
+ 4 files changed, 11 insertions(+), 6 deletions(-)\r
+\r
+diff --git a/.gitignore b/.gitignore\r
+index efa98fb..daf8094 100644\r
+--- a/.gitignore\r
++++ b/.gitignore\r
+@@ -5,6 +5,7 @@ tags\r
+ .deps\r
+ notmuch\r
+ notmuch.1.gz\r
++libnotmuch.so*\r
+ *.[ao]\r
+ *~\r
+ .*.swp\r
+diff --git a/Makefile b/Makefile\r
+index 64b9d4a..6f296bb 100644\r
+--- a/Makefile\r
++++ b/Makefile\r
+@@ -1,3 +1,4 @@\r
++SONAME = libnotmuch.so.1\r
+ WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum\r
+ WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations\r
\r
+diff --git a/Makefile.local b/Makefile.local\r
+index 04bac83..5b6af0a 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -21,8 +21,8 @@ notmuch_client_srcs =                \\r
+       show-message.c\r
\r
+ notmuch_client_modules = $(notmuch_client_srcs:.c=.o)\r
+-notmuch: $(notmuch_client_modules) lib/notmuch.a\r
+-      $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@\r
++notmuch: $(notmuch_client_modules) lib/libnotmuch.so\r
++      $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(filter-out lib/libnotmuch.so,$^) $(FINAL_LDFLAGS) -o $@\r
\r
+ notmuch.1.gz: notmuch.1\r
+       $(call quiet,gzip) --stdout $^ > $@\r
+@@ -33,6 +33,8 @@ install: all notmuch.1.gz\r
+               install -d $$d ; \\r
+       done ;\r
+       install notmuch $(DESTDIR)$(prefix)/bin/\r
++      install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/\r
++      ln -sf $(DESTDIR)$(prefix)/lib/$(SONAME) $(DESTDIR)$(prefix)/lib/libnotmuch.so\r
+       install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/\r
\r
+ install-emacs: install emacs\r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index 70489e1..a6462ae 100644\r
+--- a/lib/Makefile.local\r
++++ b/lib/Makefile.local\r
+@@ -1,5 +1,5 @@\r
+ dir=lib\r
+-extra_cflags += -I$(dir)\r
++extra_cflags += -I$(dir) -fPIC\r
\r
+ libnotmuch_c_srcs =           \\r
+       $(dir)/libsha1.c        \\r
+@@ -18,8 +18,9 @@ libnotmuch_cxx_srcs =                \\r
+       $(dir)/thread.cc\r
\r
+ libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)\r
+-$(dir)/notmuch.a: $(libnotmuch_modules)\r
+-      $(call quiet,AR) rcs $@ $^\r
++$(dir)/libnotmuch.so : $(libnotmuch_modules)\r
++      $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@\r
++      ln -sf $(SONAME) $@\r
\r
+ SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)\r
+-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a\r
++CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/libnotmuch.so *.so\r
+-- \r
+1.6.3.3\r
+\r