From: Ben Gamari <bgamari.foss@gmail.com>
To: notmuch <notmuch@notmuchmail.org>
Subject: [PATCH] Build and link against notmuch shared library
Date: Thu, 11 Mar 2010 17:37:52 -0500 [thread overview]
Message-ID: <1268347072-2050-2-git-send-email-bgamari.foss@gmail.com> (raw)
In-Reply-To: <1268347072-2050-1-git-send-email-bgamari.foss@gmail.com>
---
.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
next prev parent reply other threads:[~2010-03-11 22:38 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-11 22:37 Notmuch shared library Ben Gamari
2010-03-11 22:37 ` Ben Gamari [this message]
2010-03-12 13:41 ` (no subject) Ingmar Vanhassel
2010-03-15 17:58 ` Ben Gamari
2010-03-12 13:47 ` Ingmar Vanhassel
2010-03-12 15:02 ` Sebastian Spaeth
2010-03-15 16:20 ` Sebastian Spaeth
2010-04-01 7:54 ` Notmuch shared library Carl Worth
2010-04-01 9:10 ` Sebastian Spaeth
2010-04-01 11:10 ` Michal Sojka
2010-04-01 11:24 ` martin f krafft
2010-04-01 11:41 ` martin f krafft
2010-04-01 12:12 ` Carl Worth
2010-04-01 12:44 ` Michal Sojka
2010-04-01 22:09 ` Carl Worth
2010-04-01 11:47 ` [PATCH] Makefile: Create include directory when installing headers Michal Sojka
2010-04-01 12:13 ` Carl Worth
2010-03-12 13:47 ` [PATCH 1/3] Build and link against notmuch shared library, install notmuch.h Ingmar Vanhassel
2010-03-28 2:44 ` Ben Gamari
2010-03-12 13:47 ` [PATCH 2/3] Fix target dependencies for multiple jobs Ingmar Vanhassel
2010-03-12 13:47 ` [PATCH 3/3] Add a --libdir option to ./configure Ingmar Vanhassel
-- strict thread matches above, loose matches on Subject: below --
2010-01-26 5:38 [PATCH] Add SWIG interface file Ben Gamari
2010-01-26 6:15 ` [PATCH] Build and link against notmuch shared library Ben Gamari
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-25 1:00 ` Scott Robinson
2010-01-23 18:35 ` Ben Gamari
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
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=1268347072-2050-2-git-send-email-bgamari.foss@gmail.com \
--to=bgamari.foss@gmail.com \
--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).