[notmuch] [PATCH] Build and link against notmuch shared library
authorBen Gamari <bgamari.foss@gmail.com>
Thu, 11 Mar 2010 22:37:52 +0000 (17:37 +1900)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:36:22 +0000 (09:36 -0800)
2d/8168e282b7e83f8a6f2fed4394cacd87700a49 [new file with mode: 0644]

diff --git a/2d/8168e282b7e83f8a6f2fed4394cacd87700a49 b/2d/8168e282b7e83f8a6f2fed4394cacd87700a49
new file mode 100644 (file)
index 0000000..f37111c
--- /dev/null
@@ -0,0 +1,147 @@
+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 2B2894048C8\r
+       for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 14:38:09 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -2.689\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-2.689 tagged_above=-999 required=5\r
+       tests=[AWL=-0.090, 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 IUfQx3JDtlHa for <notmuch@notmuchmail.org>;\r
+       Thu, 11 Mar 2010 14:38:07 -0800 (PST)\r
+Received: from mail-fx0-f212.google.com (mail-fx0-f212.google.com\r
+       [209.85.220.212])\r
+       by olra.theworths.org (Postfix) with ESMTP id A61274048C2\r
+       for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 14:38:07 -0800 (PST)\r
+Received: by mail-fx0-f212.google.com with SMTP id 4so620571fxm.0\r
+       for <notmuch@notmuchmail.org>; Thu, 11 Mar 2010 14:38:05 -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=tkNz5YTfH3snmyKnlY+Fth+cU1IFgnLKxUEgSIEARQ4=;\r
+       b=BAw19LMmXnvf5DhlzAHIo0O0GeQe4/AaVXYi35AMonOA5lbp0W76T/6GB5s4bB3m/X\r
+       IlmgfB3jOqoGVD6Zh5Yhp3yabRSmqWS11Xw6gRyfdiTh9ZwPjkyFDjQAYqrUPFmgpjnl\r
+       p7Zu8JdSB6OdFraTHips9iBcCD+awMmtp9ykM=\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=cMCWlgltfgnxkLdRsE/yC3QwirQUs1ydLsWhtfJ3fHv6trcA3gNi3YtRylKwxzgs9K\r
+       fgMPCjXM3vP131qV1OJC3exEPhohfC2W1fNhJ8foq8X1qvC+UbfGq9b9Le3WnxG3rUNz\r
+       eRYf4qFkWO7MU4x/575tF8f81hRpmUuD4ikh4=\r
+Received: by 10.87.62.39 with SMTP id p39mr2945462fgk.9.1268347085531;\r
+       Thu, 11 Mar 2010 14:38:05 -0800 (PST)\r
+Received: from localhost.localdomain (physnat56.physics.umass.edu\r
+       [128.119.50.56])\r
+       by mx.google.com with ESMTPS id 13sm463034fxm.10.2010.03.11.14.38.03\r
+       (version=SSLv3 cipher=RC4-MD5); Thu, 11 Mar 2010 14:38:04 -0800 (PST)\r
+From: Ben Gamari <bgamari.foss@gmail.com>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Date: Thu, 11 Mar 2010 17:37:52 -0500\r
+Message-Id: <1268347072-2050-2-git-send-email-bgamari.foss@gmail.com>\r
+X-Mailer: git-send-email 1.7.0.2\r
+In-Reply-To: <1268347072-2050-1-git-send-email-bgamari.foss@gmail.com>\r
+References: <1268347072-2050-1-git-send-email-bgamari.foss@gmail.com>\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: Thu, 11 Mar 2010 22:38:09 -0000\r
+\r
+---\r
+ .gitignore         |    1 +\r
+ Makefile           |    1 +\r
+ Makefile.local     |    9 ++++++---\r
+ lib/Makefile.local |   11 ++++++-----\r
+ 4 files changed, 14 insertions(+), 8 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 46f001c..80eedd0 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 3c2a629..38cecd1 100644\r
+--- a/Makefile.local\r
++++ b/Makefile.local\r
+@@ -20,18 +20,21 @@ notmuch_client_srcs =              \\r
+       json.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
\r
+ install: all notmuch.1.gz\r
+-      for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 ; \\r
++      for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \\r
++              $(DESTDIR)$(prefix)/lib/ ; \\r
+       do \\r
+               install -d $$d ; \\r
+       done ;\r
+       install notmuch $(DESTDIR)$(prefix)/bin/\r
++      install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/\r
++      ln -sf $(SONAME) $(DESTDIR)$(prefix)/lib/libnotmuch.so\r
+       install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/\r
+ ifeq ($(MAKECMDGOALS), install)\r
+       @echo ""\r
+diff --git a/lib/Makefile.local b/lib/Makefile.local\r
+index 495b27e..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
++dir=lib\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.7.0.2\r
+\r