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 354EA431FBC for ; Mon, 25 Jan 2010 22:16:02 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: -2.716 X-Spam-Level: X-Spam-Status: No, score=-2.716 tagged_above=-999 required=5 tests=[AWL=-0.117, 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 aLhV80SFRCGz for ; Mon, 25 Jan 2010 22:15:59 -0800 (PST) Received: from mail-qy0-f202.google.com (mail-qy0-f202.google.com [209.85.221.202]) by olra.theworths.org (Postfix) with ESMTP id 02FBE431FAE for ; Mon, 25 Jan 2010 22:15:58 -0800 (PST) Received: by qyk40 with SMTP id 40so2316897qyk.22 for ; Mon, 25 Jan 2010 22:15:58 -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=79DiVqXq8uJM2Ueo242GdREH4M/GKkpILr1eDGatOEY=; b=ZuGwi/AJPZ6XjyeEfPUvGdH2kQLGeCMUAzEZsv7RAt4AwbPr/5+INCO5R9nv8OIhCQ YG0PlJG5j3wzyHzr+H87cvfoJvIGrtYQfaBJ8jsqMkn48kBOUcji/2k31jhQkUHHOOie HPu0zNldz3eYSWgKmGVtEW3kloTs5NwgrN8Yc= 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=pFI12Tdlj4uX3yypKqgiq5Ol4uWDnSYp+i4QTttrnwIuw3xj4rTrX6QhEh+S07TZlj Rz+nirYEgYKmvTbWQNSyFk+OcAHLVRmdXhFYxSGQ7tJ8KlRgk3shuRgBHEQU4jRsg/MI rn3YmI5rRfmftWioOCDkrnH6Mz/OiybRgz3bw= Received: by 10.229.71.66 with SMTP id g2mr1138924qcj.16.1264486558488; Mon, 25 Jan 2010 22:15:58 -0800 (PST) Received: from localhost.localdomain (umass-959-100.wireless.umass.edu [128.119.77.100]) by mx.google.com with ESMTPS id 20sm3653724qyk.1.2010.01.25.22.15.56 (version=SSLv3 cipher=RC4-MD5); Mon, 25 Jan 2010 22:15:57 -0800 (PST) From: Ben Gamari To: notmuch@notmuchmail.org Date: Tue, 26 Jan 2010 01:15:50 -0500 Message-Id: <1264486550-1479-1-git-send-email-bgamari.foss@gmail.com> X-Mailer: git-send-email 1.6.3.3 In-Reply-To: <1264484247-sup-7128@ben-laptop> References: <1264484247-sup-7128@ben-laptop> 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: Tue, 26 Jan 2010 06:16:02 -0000 Inger in #notmuch brought to light some build issues that will occur when the notmuch binary is being built before libnotmuch is installed. Here is an updated patch that resolves these issues. --- .gitignore | 1 + Makefile | 1 + Makefile.local | 6 ++++-- lib/Makefile.local | 9 +++++---- 4 files changed, 11 insertions(+), 6 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 64b9d4a..6f296bb 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 04bac83..5b6af0a 100644 --- a/Makefile.local +++ b/Makefile.local @@ -21,8 +21,8 @@ notmuch_client_srcs = \ show-message.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 $^ > $@ @@ -33,6 +33,8 @@ install: all notmuch.1.gz install -d $$d ; \ done ; install notmuch $(DESTDIR)$(prefix)/bin/ + install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/ + ln -sf $(DESTDIR)$(prefix)/lib/$(SONAME) $(DESTDIR)$(prefix)/lib/libnotmuch.so install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/ install-emacs: install emacs diff --git a/lib/Makefile.local b/lib/Makefile.local index 70489e1..a6462ae 100644 --- a/lib/Makefile.local +++ b/lib/Makefile.local @@ -1,5 +1,5 @@ dir=lib -extra_cflags += -I$(dir) +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.6.3.3