unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
From: Ben Gamari <bgamari.foss@gmail.com>
To: notmuch@notmuchmail.org, cworth@cworth.org
Subject: [PATCH 2/2] Build and link against notmuch shared library
Date: Sun, 24 Jan 2010 16:23:35 -0500	[thread overview]
Message-ID: <1264368215-7101-3-git-send-email-bgamari.foss@gmail.com> (raw)
In-Reply-To: <1264368215-7101-2-git-send-email-bgamari.foss@gmail.com>

---
 Makefile           |    1 +
 Makefile.local     |    6 ++++--
 lib/Makefile.local |   10 ++++++----
 3 files changed, 11 insertions(+), 6 deletions(-)

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 d579242..a61eb67 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)) -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..cfefc9b 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,10 @@ 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)/$(SONAME): $(libnotmuch_modules)
+	$(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -Wl,-soname=$(SONAME) -shared -o $@
+$(dir)/libnotmuch.so: $(dir)/$(SONAME)
+	ln -sf $(dir)/$(SONAME) $(dir)/libnotmuch.so
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/libnotmuch.so $(dir)/$(SONAME)
-- 
1.6.3.3

  reply	other threads:[~2010-01-24 21:23 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-20 20:07 libtool-less shared library building Ben Gamari
2010-01-20 20:07 ` [PATCH] Build and link against notmuch shared library Ben Gamari
2010-01-20 20:20   ` Mike Hommey
2010-01-20 20:18 ` libtool-less shared library building David Bremner
2010-01-20 20:35   ` [PATCH] Build and link against notmuch shared library Ben Gamari
2010-01-23  0:58     ` Felipe Contreras
2010-01-23  2:06       ` Ingmar Vanhassel
2010-01-23 18:58         ` bgamari.foss
2010-01-24 21:23           ` [PATCH] Notmuch " Ben Gamari
2010-01-24 21:23             ` [PATCH 1/2] Fix typo in message Ben Gamari
2010-01-24 21:23               ` Ben Gamari [this message]
2010-03-04  8:25                 ` [PATCH 2/2] Build and link against notmuch shared library Sebastian Spaeth
2010-03-11 22:41                   ` Ben Gamari
2010-03-12 15:04                     ` Sebastian Spaeth
2010-01-25  1:00           ` [PATCH] " Scott Robinson
2010-01-23 18:35       ` Ben Gamari

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://notmuchmail.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1264368215-7101-3-git-send-email-bgamari.foss@gmail.com \
    --to=bgamari.foss@gmail.com \
    --cc=cworth@cworth.org \
    --cc=notmuch@notmuchmail.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).