Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 2B2894048C8 for ; Thu, 11 Mar 2010 14:38:09 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.689 X-Spam-Level: X-Spam-Status: No, score=-2.689 tagged_above=-999 required=5 tests=[AWL=-0.090, BAYES_00=-2.599] autolearn=ham Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IUfQx3JDtlHa for ; Thu, 11 Mar 2010 14:38:07 -0800 (PST) Received: from mail-fx0-f212.google.com (mail-fx0-f212.google.com [209.85.220.212]) by olra.theworths.org (Postfix) with ESMTP id A61274048C2 for ; Thu, 11 Mar 2010 14:38:07 -0800 (PST) Received: by mail-fx0-f212.google.com with SMTP id 4so620571fxm.0 for ; Thu, 11 Mar 2010 14:38:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:from:to:cc:subject:date :message-id:x-mailer:in-reply-to:references; bh=tkNz5YTfH3snmyKnlY+Fth+cU1IFgnLKxUEgSIEARQ4=; b=BAw19LMmXnvf5DhlzAHIo0O0GeQe4/AaVXYi35AMonOA5lbp0W76T/6GB5s4bB3m/X IlmgfB3jOqoGVD6Zh5Yhp3yabRSmqWS11Xw6gRyfdiTh9ZwPjkyFDjQAYqrUPFmgpjnl p7Zu8JdSB6OdFraTHips9iBcCD+awMmtp9ykM= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; b=cMCWlgltfgnxkLdRsE/yC3QwirQUs1ydLsWhtfJ3fHv6trcA3gNi3YtRylKwxzgs9K fgMPCjXM3vP131qV1OJC3exEPhohfC2W1fNhJ8foq8X1qvC+UbfGq9b9Le3WnxG3rUNz eRYf4qFkWO7MU4x/575tF8f81hRpmUuD4ikh4= Received: by 10.87.62.39 with SMTP id p39mr2945462fgk.9.1268347085531; Thu, 11 Mar 2010 14:38:05 -0800 (PST) Received: from localhost.localdomain (physnat56.physics.umass.edu [128.119.50.56]) by mx.google.com with ESMTPS id 13sm463034fxm.10.2010.03.11.14.38.03 (version=SSLv3 cipher=RC4-MD5); Thu, 11 Mar 2010 14:38:04 -0800 (PST) From: Ben Gamari To: notmuch Date: Thu, 11 Mar 2010 17:37:52 -0500 Message-Id: <1268347072-2050-2-git-send-email-bgamari.foss@gmail.com> X-Mailer: git-send-email 1.7.0.2 In-Reply-To: <1268347072-2050-1-git-send-email-bgamari.foss@gmail.com> References: <1268347072-2050-1-git-send-email-bgamari.foss@gmail.com> Subject: [notmuch] [PATCH] Build and link against notmuch shared library X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Mar 2010 22:38:09 -0000 --- .gitignore | 1 + Makefile | 1 + Makefile.local | 9 ++++++--- lib/Makefile.local | 11 ++++++----- 4 files changed, 14 insertions(+), 8 deletions(-) diff --git a/.gitignore b/.gitignore index efa98fb..daf8094 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ tags .deps notmuch notmuch.1.gz +libnotmuch.so* *.[ao] *~ .*.swp diff --git a/Makefile b/Makefile index 46f001c..80eedd0 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,4 @@ +SONAME = libnotmuch.so.1 WARN_CXXFLAGS=-Wall -Wextra -Wwrite-strings -Wswitch-enum WARN_CFLAGS=$(WARN_CXXFLAGS) -Wmissing-declarations diff --git a/Makefile.local b/Makefile.local index 3c2a629..38cecd1 100644 --- a/Makefile.local +++ b/Makefile.local @@ -20,18 +20,21 @@ notmuch_client_srcs = \ json.c notmuch_client_modules = $(notmuch_client_srcs:.c=.o) -notmuch: $(notmuch_client_modules) lib/notmuch.a - $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -o $@ +notmuch: $(notmuch_client_modules) lib/libnotmuch.so + $(call quiet,CC,$(LDFLAGS)) -Llib -lnotmuch $(filter-out lib/libnotmuch.so,$^) $(FINAL_LDFLAGS) -o $@ notmuch.1.gz: notmuch.1 $(call quiet,gzip) --stdout $^ > $@ install: all notmuch.1.gz - for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 ; \ + for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/share/man/man1 \ + $(DESTDIR)$(prefix)/lib/ ; \ do \ install -d $$d ; \ done ; install notmuch $(DESTDIR)$(prefix)/bin/ + install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/ + ln -sf $(SONAME) $(DESTDIR)$(prefix)/lib/libnotmuch.so install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ ifeq ($(MAKECMDGOALS), install) @echo "" diff --git a/lib/Makefile.local b/lib/Makefile.local index 495b27e..a6462ae 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -1,5 +1,5 @@ -dir := lib -extra_cflags += -I$(dir) +dir=lib +extra_cflags += -I$(dir) -fPIC libnotmuch_c_srcs = \ $(dir)/libsha1.c \ @@ -18,8 +18,9 @@ libnotmuch_cxx_srcs = \ $(dir)/thread.cc libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o) -$(dir)/notmuch.a: $(libnotmuch_modules) - $(call quiet,AR) rcs $@ $^ +$(dir)/libnotmuch.so : $(libnotmuch_modules) + $(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@ + ln -sf $(SONAME) $@ SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs) -CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a +CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/libnotmuch.so *.so -- 1.7.0.2