+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 09AA4431FC9\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Jan 2010 13:23:54 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -1.819\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-1.819 tagged_above=-999 required=5 tests=[AWL=0.780,\r
+ 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 PgzW+EfFAzpy for <notmuch@notmuchmail.org>;\r
+ Sun, 24 Jan 2010 13:23:52 -0800 (PST)\r
+Received: from mail-qy0-f172.google.com (mail-qy0-f172.google.com\r
+ [209.85.221.172])\r
+ by olra.theworths.org (Postfix) with ESMTP id 13ECA431FC0\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Jan 2010 13:23:52 -0800 (PST)\r
+Received: by mail-qy0-f172.google.com with SMTP id 2so1454613qyk.6\r
+ for <notmuch@notmuchmail.org>; Sun, 24 Jan 2010 13:23:51 -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=2REmTz3dNITQCO8FgMdhpWGbC8kJNZsoJmyHL7LuMNo=;\r
+ b=xtxKq51viZS47tam1cn0fczl7r4sK+6gCQ8Znrgm4481mmYEpQDXCWVNYx3IMECyTZ\r
+ gD2FyXNzhxzMhL/6L+ZralarDfFp7nH1OrDN+BxOhrQc4R9YpTvfd9zfAlWYv/qGRBuW\r
+ gosjR/w2l/SWcJ0/HeBurWza2HNCPBGbvitL8=\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=BTGbRFimTWUhUu19blljzcNLu6U3WggTiJsS2pyd/EmTxirQ3QRLkj1clGyNEsT3Ue\r
+ ApJDDjwoEvI6y4bir7B+DXZd8UjaCj1kxo9m6xnz9Nub0yyb84aID5Wvpb8NhbgR3/Va\r
+ bY+UNwKZG/h82by/GU6MMGoweJpqQwh1brSYw=\r
+Received: by 10.224.87.228 with SMTP id x36mr3589999qal.232.1264368231754;\r
+ Sun, 24 Jan 2010 13:23:51 -0800 (PST)\r
+Received: from localhost.localdomain\r
+ (pool-72-70-241-97.spfdma.east.verizon.net [72.70.241.97])\r
+ by mx.google.com with ESMTPS id 6sm10145914qwk.41.2010.01.24.13.23.49\r
+ (version=SSLv3 cipher=RC4-MD5); Sun, 24 Jan 2010 13:23:50 -0800 (PST)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch@notmuchmail.org,\r
+ cworth@cworth.org\r
+Date: Sun, 24 Jan 2010 16:23:35 -0500\r
+Message-Id: <1264368215-7101-3-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.6.3.3\r
+In-Reply-To: <1264368215-7101-2-git-send-email-bgamari.foss@gmail.com>\r
+References: <1264272821-sup-5331@ben-laptop>\r
+ <1264368215-7101-1-git-send-email-bgamari.foss@gmail.com>\r
+ <1264368215-7101-2-git-send-email-bgamari.foss@gmail.com>\r
+Subject: [notmuch] [PATCH 2/2] 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: Sun, 24 Jan 2010 21:23:54 -0000\r
+\r
+---\r
+ Makefile | 1 +\r
+ Makefile.local | 6 ++++--\r
+ lib/Makefile.local | 10 ++++++----\r
+ 3 files changed, 11 insertions(+), 6 deletions(-)\r
+\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 d579242..a61eb67 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)) -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..cfefc9b 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,10 @@ 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)/$(SONAME): $(libnotmuch_modules)\r
++ $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -Wl,-soname=$(SONAME) -shared -o $@\r
++$(dir)/libnotmuch.so: $(dir)/$(SONAME)\r
++ ln -sf $(dir)/$(SONAME) $(dir)/libnotmuch.so\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 $(dir)/$(SONAME)\r
+-- \r
+1.6.3.3\r
+\r