unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] Build and link against notmuch shared library
  2010-01-20 20:07 libtool-less shared library building Ben Gamari
@ 2010-01-20 20:07 ` Ben Gamari
  2010-01-20 20:20   ` Mike Hommey
  0 siblings, 1 reply; 30+ messages in thread
From: Ben Gamari @ 2010-01-20 20:07 UTC (permalink / raw)
  To: notmuch, cworth

---
 Makefile.local     |    5 +++--
 lib/Makefile.local |    8 ++++----
 2 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 933ff4c..6e851e4 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)
+	$(call quiet,CXX,$(LDFLAGS)) -lnotmuch $^ $(FINAL_LDFLAGS) -o $@
 
 notmuch.1.gz: notmuch.1
 	$(call quiet,gzip) --stdout $^ > $@
@@ -33,6 +33,7 @@ install: all notmuch.1.gz
 		install -d $$d ; \
 	done ;
 	install notmuch $(DESTDIR)$(prefix)/bin/
+	install lib/libnotmuch.so $(DESTDIR)$(prefix)/lib/
 	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..5e5a6e6 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,8 @@ 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 -o $@
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.so
-- 
1.6.3.3

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  2010-01-20 20:07 ` [PATCH] Build and link against notmuch shared library Ben Gamari
@ 2010-01-20 20:20   ` Mike Hommey
  0 siblings, 0 replies; 30+ messages in thread
From: Mike Hommey @ 2010-01-20 20:20 UTC (permalink / raw)
  To: Ben Gamari; +Cc: notmuch

On Wed, Jan 20, 2010 at 03:07:27PM -0500, Ben Gamari wrote:
> +	install lib/libnotmuch.so $(DESTDIR)$(prefix)/lib/

> +$(dir)/libnotmuch.so: $(libnotmuch_modules)
> +	$(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -o $@

If you're going to install that in $(prefix)/lib, you'd better make that
a library with a SONAME. -Wl,-soname,$(notdir $@) should do it, and
you'd obviously have to change the target name to add a SO version.

Mike

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] Build and link against notmuch shared library
  2010-01-20 20:18 libtool-less shared library building David Bremner
@ 2010-01-20 20:35 ` Ben Gamari
  2010-01-23  0:58   ` Felipe Contreras
  0 siblings, 1 reply; 30+ messages in thread
From: Ben Gamari @ 2010-01-20 20:35 UTC (permalink / raw)
  To: notmuch, cworth

How's this look?


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

diff --git a/Makefile b/Makefile
index 021fdb8..0f56bc6 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 933ff4c..71bd639 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,CXX,$(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

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  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:35     ` Ben Gamari
  0 siblings, 2 replies; 30+ messages in thread
From: Felipe Contreras @ 2010-01-23  0:58 UTC (permalink / raw)
  To: Ben Gamari; +Cc: notmuch

On Wed, Jan 20, 2010 at 10:35 PM, Ben Gamari <bgamari.foss@gmail.com> wrote:
>  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 $@

Does it need to be CXX? Why not CC instead?

-- 
Felipe Contreras

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  2010-01-23  0:58   ` Felipe Contreras
@ 2010-01-23  2:06     ` Ingmar Vanhassel
  2010-01-23 18:58       ` bgamari.foss
  2010-01-23 18:35     ` Ben Gamari
  1 sibling, 1 reply; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-01-23  2:06 UTC (permalink / raw)
  To: Felipe Contreras, Ben Gamari; +Cc: notmuch

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 628 bytes --]

On Sat, 23 Jan 2010 02:58:53 +0200, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> On Wed, Jan 20, 2010 at 10:35 PM, Ben Gamari <bgamari.foss@gmail.com> wrote:
> >  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 $@
> 
> Does it need to be CXX? Why not CC instead?

Xapian and the notmuch wrapper 'parts' are written in C++.

-- 
Exherbo KDE, X.org maintainer

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  2010-01-23  0:58   ` Felipe Contreras
  2010-01-23  2:06     ` Ingmar Vanhassel
@ 2010-01-23 18:35     ` Ben Gamari
  1 sibling, 0 replies; 30+ messages in thread
From: Ben Gamari @ 2010-01-23 18:35 UTC (permalink / raw)
  To: Felipe Contreras; +Cc: notmuch

Excerpts from Felipe Contreras's message of Fri Jan 22 19:58:53 -0500 2010:
> Does it need to be CXX? Why not CC instead?
> 
Nope. It's been changed to CC. Thanks!

- Ben

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  2010-01-23  2:06     ` Ingmar Vanhassel
@ 2010-01-23 18:58       ` bgamari.foss
  2010-01-25  1:00         ` Scott Robinson
  0 siblings, 1 reply; 30+ messages in thread
From: bgamari.foss @ 2010-01-23 18:58 UTC (permalink / raw)
  To: Felipe Contreras, notmuch

Excerpts from Ingmar Vanhassel's message of Fri Jan 22 21:06:00 -0500 2010:
> On Sat, 23 Jan 2010 02:58:53 +0200, Felipe Contreras <felipe.contreras@gmail.com> wrote:
> > Does it need to be CXX? Why not CC instead?
> 
> Xapian and the notmuch wrapper 'parts' are written in C++.
> 
True, but I don't think that this means that we need to link the
executable with a C++ compiler. I've tried linking with CC and it seems
to succeed, so I don't think there should be a problem changing it.

- Ben

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Build and link against notmuch shared library
  2010-01-23 18:58       ` bgamari.foss
@ 2010-01-25  1:00         ` Scott Robinson
  0 siblings, 0 replies; 30+ messages in thread
From: Scott Robinson @ 2010-01-25  1:00 UTC (permalink / raw)
  To: notmuch

Excerpts from bgamari.foss's message of Sat Jan 23 12:58:42 -0600 2010:
> True, but I don't think that this means that we need to link the
> executable with a C++ compiler. I've tried linking with CC and it seems
> to succeed, so I don't think there should be a problem changing it.
> 

Are you using "cc" or "gcc"?

Even when cc is an alias to gcc, there are different semantics. And "cc" vs.
"cpp" can be even more different on non-GCC compilers.

I wouldn't mess with it. :-)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] Build and link against notmuch shared library
  2010-01-26  5:38 [PATCH] Add SWIG interface file Ben Gamari
@ 2010-01-26  6:15 ` Ben Gamari
  0 siblings, 0 replies; 30+ messages in thread
From: Ben Gamari @ 2010-01-26  6:15 UTC (permalink / raw)
  To: notmuch

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

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Notmuch shared library
@ 2010-03-11 22:37 Ben Gamari
  2010-03-11 22:37 ` [PATCH] Build and link against notmuch " Ben Gamari
                   ` (5 more replies)
  0 siblings, 6 replies; 30+ messages in thread
From: Ben Gamari @ 2010-03-11 22:37 UTC (permalink / raw)
  To: notmuch

Hey all,

Here's a rebased version of my shared library patch. It's pretty similar to the
last version and should build against a clean tree (I'd recommend git clean -fxd).
Let me know if you have any build issues.

In the eyes of the powers that be, what is the long-term status of this patch?
It's been pretty painless to rebase, but it would be nice to merge at some
point. Then perhaps we could focus a bit on the bindings situation. Just a
thought.

Cheers,

- Ben

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] Build and link against notmuch shared library
  2010-03-11 22:37 Notmuch shared library Ben Gamari
@ 2010-03-11 22:37 ` Ben Gamari
  2010-03-12 13:41 ` (no subject) Ingmar Vanhassel
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 30+ messages in thread
From: Ben Gamari @ 2010-03-11 22:37 UTC (permalink / raw)
  To: notmuch

---
 .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

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* (no subject)
  2010-03-11 22:37 Notmuch shared library Ben Gamari
  2010-03-11 22:37 ` [PATCH] Build and link against notmuch " Ben Gamari
@ 2010-03-12 13:41 ` Ingmar Vanhassel
  2010-03-15 17:58   ` Ben Gamari
  2010-03-12 13:47 ` Ingmar Vanhassel
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-03-12 13:41 UTC (permalink / raw)
  To: notmuch

I was just going to mail an updated series for this. I'd definitely like to see
this upstream.

I amended the first patch to install the notmuch.h header.

The second patch from a friend of mine fixes a parallel make issue I ran into
when I tested one of your intiial patches. I ran this patch by you ages on
#notmuch, not sure why it isn't included, not sure why you didn't included it?

The third patch adds a way to configure where to install libraries.
On Exherbo x86_64 we install 64 bit libraries to /usr/lib64/ so I need a switch
to configure this.

Regards,
Ingmar

^ permalink raw reply	[flat|nested] 30+ messages in thread

* (no subject)
  2010-03-11 22:37 Notmuch shared library Ben Gamari
  2010-03-11 22:37 ` [PATCH] Build and link against notmuch " Ben Gamari
  2010-03-12 13:41 ` (no subject) Ingmar Vanhassel
@ 2010-03-12 13:47 ` Ingmar Vanhassel
  2010-03-12 15:02   ` Sebastian Spaeth
  2010-04-01  7:54   ` Notmuch shared library Carl Worth
  2010-03-12 13:47 ` [PATCH 1/3] Build and link against notmuch shared library, install notmuch.h Ingmar Vanhassel
                   ` (2 subsequent siblings)
  5 siblings, 2 replies; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-03-12 13:47 UTC (permalink / raw)
  To: notmuch

I'd very much like to see this upstream.

Here's my updated series for this.

I amended your first patch to make it install the notmuch.h header too.

The second patch fixed some parallel make issue I had while testing your series. We discussed this
ages ago on #notmuch, I don't remember the details at the moment, and I can't check my logs right
now. Any reason why this isn't included in your current patch?

The third patch adds a configure switch to configure where to install libraries. It has one issue
I'm aware off. Setting --prefix=/usr without setting --libdir does the wrong thing. This should
probably be fixed, but I don't have any immediate ideas how to do this.

So, series tested by me and Michael Forney, and I'm using it for my notmuch, please apply. :)

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH 1/3] Build and link against notmuch shared library, install notmuch.h
  2010-03-11 22:37 Notmuch shared library Ben Gamari
                   ` (2 preceding siblings ...)
  2010-03-12 13:47 ` Ingmar Vanhassel
@ 2010-03-12 13:47 ` 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
  5 siblings, 1 reply; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-03-12 13:47 UTC (permalink / raw)
  To: notmuch

From: Ben Gamari <bgamari.foss@gmail.com>

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
---
 .gitignore         |    1 +
 Makefile           |    1 +
 Makefile.local     |   10 +++++++---
 lib/Makefile.local |    9 +++++----
 4 files changed, 14 insertions(+), 7 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..31ab534 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -20,18 +20,22 @@ 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)/lib/ \
+		$(DESTDIR)$(prefix)/include/ $(DESTDIR)$(prefix)/share/man/man1 ; \
 	do \
 		install -d $$d ; \
 	done ;
 	install notmuch $(DESTDIR)$(prefix)/bin/
+	install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/
+	install lib/notmuch.h $(DESTDIR)$(prefix)/include/
+	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..f848946 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.7.0.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 2/3] Fix target dependencies for multiple jobs
  2010-03-11 22:37 Notmuch shared library Ben Gamari
                   ` (3 preceding siblings ...)
  2010-03-12 13:47 ` [PATCH 1/3] Build and link against notmuch shared library, install notmuch.h Ingmar Vanhassel
@ 2010-03-12 13:47 ` Ingmar Vanhassel
  2010-03-12 13:47 ` [PATCH 3/3] Add a --libdir option to ./configure Ingmar Vanhassel
  5 siblings, 0 replies; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-03-12 13:47 UTC (permalink / raw)
  To: notmuch; +Cc: Saleem Abdulrasool

From: Saleem Abdulrasool <compnerd@compnerd.org>

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
---
 lib/Makefile.local |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index f848946..7105070 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -18,9 +18,12 @@ libnotmuch_cxx_srcs =		\
 	$(dir)/thread.cc
 
 libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
-$(dir)/libnotmuch.so : $(libnotmuch_modules)
+
+$(dir)/$(SONAME) : $(libnotmuch_modules)
 	$(call quiet,CXX,$(LDFLAGS)) $^ $(FINAL_LDFLAGS) -shared -Wl,-soname=$(SONAME) -o $@
-	ln -sf $(SONAME) $@
+
+$(dir)/libnotmuch.so: $(dir)/$(SONAME)
+	ln -fs $(SONAME) $@
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/libnotmuch.so *.so
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/libnotmuch.so *.so
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* [PATCH 3/3] Add a --libdir option to ./configure
  2010-03-11 22:37 Notmuch shared library Ben Gamari
                   ` (4 preceding siblings ...)
  2010-03-12 13:47 ` [PATCH 2/3] Fix target dependencies for multiple jobs Ingmar Vanhassel
@ 2010-03-12 13:47 ` Ingmar Vanhassel
  5 siblings, 0 replies; 30+ messages in thread
From: Ingmar Vanhassel @ 2010-03-12 13:47 UTC (permalink / raw)
  To: notmuch

This allows packagers to specify to which directory libraries should be
installed.

Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
---
 Makefile.local |    6 +++---
 configure      |    7 +++++++
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/Makefile.local b/Makefile.local
index 31ab534..e139395 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -27,15 +27,15 @@ notmuch.1.gz: notmuch.1
 	$(call quiet,gzip) --stdout $^ > $@
 
 install: all notmuch.1.gz
-	for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(prefix)/lib/ \
+	for d in $(DESTDIR)$(prefix)/bin/ $(DESTDIR)$(libdir)/ \
 		$(DESTDIR)$(prefix)/include/ $(DESTDIR)$(prefix)/share/man/man1 ; \
 	do \
 		install -d $$d ; \
 	done ;
 	install notmuch $(DESTDIR)$(prefix)/bin/
-	install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/
+	install lib/$(SONAME) $(DESTDIR)$(libdir)/
 	install lib/notmuch.h $(DESTDIR)$(prefix)/include/
-	ln -sf $(SONAME) $(DESTDIR)$(prefix)/lib/libnotmuch.so
+	ln -sf $(SONAME) $(DESTDIR)$(libdir)/libnotmuch.so
 	install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
 ifeq ($(MAKECMDGOALS), install)
 	@echo ""
diff --git a/configure b/configure
index a2af672..1caff94 100755
--- a/configure
+++ b/configure
@@ -11,6 +11,7 @@ XAPIAN_CONFIG=${XAPIAN_CONFIG:-xapian-config-1.1 xapian-config}
 # Set the defaults for values the user can specify with command-line
 # options.
 PREFIX=/usr/local
+LIBDIR=${PREFIX}/lib
 
 usage ()
 {
@@ -49,6 +50,7 @@ Additionally, various options can be specified on the configure
 command line.
 
 	--prefix=PREFIX	Install files in PREFIX [$PREFIX]
+	--libdir=LIBDIR	Install libraries in LIBDIR [$LIBDIR]
 
 By default, "make install" will install the resulting program to
 $PREFIX/bin, documentation to $PREFIX/share, etc. You can
@@ -67,6 +69,8 @@ for option; do
 	exit 0
     elif [ "${option%%=*}" = '--prefix' ] ; then
 	PREFIX="${option#*=}"
+    elif [ "${option%%=*}" = '--libdir' ] ; then
+	LIBDIR="${option#*=}"
     else
 	echo "Unrecognized option: ${option}."
 	echo "See:"
@@ -271,6 +275,9 @@ CXXFLAGS = ${CXXFLAGS}
 # The prefix to which notmuch should be installed
 prefix = ${PREFIX}
 
+# The directory to which notmuch libraries should be installed
+libdir = ${LIBDIR}
+
 # The directory to which emacs lisp files should be installed
 emacs_lispdir=${emacs_lispdir}
 
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: (no subject)
  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
  1 sibling, 1 reply; 30+ messages in thread
From: Sebastian Spaeth @ 2010-03-12 15:02 UTC (permalink / raw)
  To: Ingmar Vanhassel, notmuch

On Fri, 12 Mar 2010 14:47:33 +0100, Ingmar Vanhassel <ingmar@exherbo.org> wrote:
> Here's my updated series for this.

Ben Gamaris original patch gives me an "-lnotmuch" not found failure
during compilation.
Your patchset compiles fine and installs /usr/local/bin/notmuch and
/usr/local/lib/libnotmuch.so.1. However, it doesn't find it when running
and exits saying libnotmuch.so not found.

I don't know anything about LD_LIBRARY_PATH and friends, but using the
default Makefile options (which use /usr/local as prefix) a standard
install should still work :-).

Looking eagerly forward to a shared notmuch library.

spaetz

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: (no subject)
  2010-03-12 15:02   ` Sebastian Spaeth
@ 2010-03-15 16:20     ` Sebastian Spaeth
  0 siblings, 0 replies; 30+ messages in thread
From: Sebastian Spaeth @ 2010-03-15 16:20 UTC (permalink / raw)
  To: Ingmar Vanhassel, notmuch

On Fri, 12 Mar 2010 16:02:03 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> On Fri, 12 Mar 2010 14:47:33 +0100, Ingmar Vanhassel <ingmar@exherbo.org> wrote:
> Your patchset compiles fine and installs /usr/local/bin/notmuch and
> /usr/local/lib/libnotmuch.so.1. However, it doesn't find it when running
> and exits saying libnotmuch.so not found.

DOH, a simple "sudo ldconfig" fixed the issue on a stock Ubuntu on my
box. Your patch series works fine.



I just tested the shared lib by creating a small python binding to libnotmuch
which can be found here: http://bitbucket.org/spaetz/cnotmuch
(It basically does not bind many things yet :-), but it demos that it
works in general).

This is my sample session:
>>>from cnotmuch import notmuch
>>>db = notmuch.Database()
>>>db.get_path()
'/home/spaetz/mail'
>>>tags = db.get_all_tags()
inited tags with 44762960 'Notmuch DB /home/spaetz/mail'
>>>for tag in tags: 
>>>  print tag
inbox
...
maildir::draft
Freeing the Tags now

#---------------------------------------------

>>>db = notmuch.Database("/home/spaetz/mailHAHA")
NotmuchError: Could not open the specified database

#---------------------------------------------

>>>tags = notmuch.Database("/home/spaetz/mail").get_all_tags()
>>>del(tags)
Freeing the Tags now
Freeing the database now

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: (no subject)
  2010-03-12 13:41 ` (no subject) Ingmar Vanhassel
@ 2010-03-15 17:58   ` Ben Gamari
  0 siblings, 0 replies; 30+ messages in thread
From: Ben Gamari @ 2010-03-15 17:58 UTC (permalink / raw)
  To: Ingmar Vanhassel, notmuch

On Fri, 12 Mar 2010 14:41:22 +0100, Ingmar Vanhassel <ingmar@exherbo.org> wrote:
> I was just going to mail an updated series for this. I'd definitely like to see
> this upstream.
> 
I agree. It would be quite nice to finally have to this merged.

> I amended the first patch to install the notmuch.h header.
> 
> The second patch from a friend of mine fixes a parallel make issue I ran into
> when I tested one of your intiial patches. I ran this patch by you ages on
> #notmuch, not sure why it isn't included, not sure why you didn't included it?

Oops, I guess I lost track of it. My bad, things have been pretty scattered in
my world recently. Either way, it looks like you have the shared library thing
covered with this patch set. It is definitely much more refined than mine. I'd
definitely be in favor of this going in. Thanks for your work.

- Ben

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH 1/3] Build and link against notmuch shared library, install notmuch.h
  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
  0 siblings, 0 replies; 30+ messages in thread
From: Ben Gamari @ 2010-03-28  2:44 UTC (permalink / raw)
  To: Ingmar Vanhassel, notmuch

Does anyone have this queued up to be merged upstream? I think we're beginning
to see the need for a library at this point and as far as I can see, this is an
excellent patch for it.

- Ben

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>

On Fri, 12 Mar 2010 14:47:34 +0100, Ingmar Vanhassel <ingmar@exherbo.org> wrote:
> From: Ben Gamari <bgamari.foss@gmail.com>
> 
> Signed-off-by: Ingmar Vanhassel <ingmar@exherbo.org>
> ---
>  .gitignore         |    1 +
>  Makefile           |    1 +
>  Makefile.local     |   10 +++++++---
>  lib/Makefile.local |    9 +++++----
>  4 files changed, 14 insertions(+), 7 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..31ab534 100644
> --- a/Makefile.local
> +++ b/Makefile.local
> @@ -20,18 +20,22 @@ 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)/lib/ \
> +		$(DESTDIR)$(prefix)/include/ $(DESTDIR)$(prefix)/share/man/man1 ; \
>  	do \
>  		install -d $$d ; \
>  	done ;
>  	install notmuch $(DESTDIR)$(prefix)/bin/
> +	install lib/$(SONAME) $(DESTDIR)$(prefix)/lib/
> +	install lib/notmuch.h $(DESTDIR)$(prefix)/include/
> +	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..f848946 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.7.0.2

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  2010-03-12 13:47 ` Ingmar Vanhassel
  2010-03-12 15:02   ` Sebastian Spaeth
@ 2010-04-01  7:54   ` Carl Worth
  2010-04-01  9:10     ` Sebastian Spaeth
                       ` (2 more replies)
  1 sibling, 3 replies; 30+ messages in thread
From: Carl Worth @ 2010-04-01  7:54 UTC (permalink / raw)
  To: Ingmar Vanhassel, notmuch

[-- Attachment #1: Type: text/plain, Size: 2034 bytes --]

On Fri, 12 Mar 2010 14:47:33 +0100, Ingmar Vanhassel <ingmar@exherbo.org> wrote:
> I'd very much like to see this upstream.

Me too. ;-) Sorry for the long delay.

> I amended your first patch to make it install the notmuch.h header
> too.

A very nice addition.

> The second patch fixed some parallel make issue I had while testing
> your series.

As is this. I ran into this problem immediately when testing the first
patch.

> The third patch adds a configure switch to configure where to install
> libraries. It has one issue I'm aware off. Setting --prefix=/usr
> without setting --libdir does the wrong thing. This should probably be
> fixed, but I don't have any immediate ideas how to do this.

This configure option is nice too, but the problem you pointed out was
serious, (so, thanks for noting it). I went ahead and fixed this.

I also spent some time making sure I (think I) understand how library
sonames and library versions work. I did several investigations with
libtool that convinced me it adds problems without any tangible benefit,
(at least for the target platforms I'm aware of people using with
notmuch).

I finished this by establishing a 3-part library interface version,
(initially 1.0.0), along with careful documentation in the Makefile on
how to increment it. And of course, I ended up touching up about a
half-dozen issues in the Makefiles along the way.

We'll still want to add functions/macros to the library to make the
library version available to the user. And I do want to still add some
symbol hiding and potentially some symbol versioning to the library. But
I'm not making the patch series block on that.

Finally, I'm a tiny bit annoyed that now after a fresh checkout of
notmuch and "make" that one can't easily run ./notmuch without either
installing the library (or fiddling with LD_LIBRARY_PATH). I've got some
ideas on how to simplify that, but I'm not sure if any are good or worth
it.

Anyway, this patch series is now pushed with my changes on top. Thanks,
Ben and Ingmar!

-Carl




[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  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:47     ` [PATCH] Makefile: Create include directory when installing headers Michal Sojka
  2 siblings, 0 replies; 30+ messages in thread
From: Sebastian Spaeth @ 2010-04-01  9:10 UTC (permalink / raw)
  To: notmuch

On Thu, 01 Apr 2010 00:54:16 -0700, Carl Worth <cworth@cworth.org> wrote:
> Finally, I'm a tiny bit annoyed that now after a fresh checkout of
> notmuch and "make" that one can't easily run ./notmuch without either
> installing the library (or fiddling with LD_LIBRARY_PATH). I've got some
> ideas on how to simplify that, but I'm not sure if any are good or worth
> it.

That was admittedly a very nice feature. And as I have proposed (but not
send any patch :-)). I would argue that a --shared and a --static option
(or whatever configure standard policy is for that) would make sense
that links notmuch either dynamically or statically.

But thanks for doing this work. Much appreciated
Sebastian

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  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:47     ` [PATCH] Makefile: Create include directory when installing headers Michal Sojka
  2 siblings, 1 reply; 30+ messages in thread
From: Michal Sojka @ 2010-04-01 11:10 UTC (permalink / raw)
  To: Carl Worth, Ingmar Vanhassel, notmuch

On Thu, 01 Apr 2010, Carl Worth wrote:
> Finally, I'm a tiny bit annoyed that now after a fresh checkout of
> notmuch and "make" that one can't easily run ./notmuch without either
> installing the library (or fiddling with LD_LIBRARY_PATH). I've got some
> ideas on how to simplify that, but I'm not sure if any are good or worth
> it.

Hi,

this can be solved by the following patch, but I don't know how portable
it is. You can see the efect of this by

$ objdump -x notmuch|grep RPATH

diff --git a/Makefile.local b/Makefile.local
index 32b8f4a..2a1b55d 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -20,7 +20,7 @@ extra_cxxflags :=
 # Smash together user's values with our extra values
 FINAL_CFLAGS = $(CFLAGS) $(WARN_CFLAGS) $(CONFIGURE_CFLAGS) $(extra_cflags)
 FINAL_CXXFLAGS = $(CXXFLAGS) $(WARN_CXXFLAGS) $(CONFIGURE_CXXFLAGS) $(extra_cflags) $(extra_cxxflags)
-FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS)
+FINAL_LDFLAGS = $(LDFLAGS) $(CONFIGURE_LDFLAGS) -Wl,-rpath,\$$ORIGIN/lib -z origin --enable-new-dtags
 
 all: notmuch notmuch.1.gz
 ifeq ($(MAKECMDGOALS),)

--Michal

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  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
  0 siblings, 2 replies; 30+ messages in thread
From: martin f krafft @ 2010-04-01 11:24 UTC (permalink / raw)
  To: Michal Sojka; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 485 bytes --]

also sprach Michal Sojka <sojkam1@fel.cvut.cz> [2010.04.01.1310 +0200]:
> this can be solved by the following patch, but I don't know how portable
> it is. You can see the efect of this by

Please avoid rpath. The better solution is probably to create
a wrapper for notmuch, which prepends to LD_LIBRARY_PATH.

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
when everything is coming your way, you're in the wrong lane.
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  2010-04-01 11:24       ` martin f krafft
@ 2010-04-01 11:41         ` martin f krafft
  2010-04-01 12:12         ` Carl Worth
  1 sibling, 0 replies; 30+ messages in thread
From: martin f krafft @ 2010-04-01 11:41 UTC (permalink / raw)
  To: Michal Sojka, Carl Worth, Ingmar Vanhassel, notmuch

[-- Attachment #1: Type: text/plain, Size: 564 bytes --]

also sprach martin f krafft <madduck@madduck.net> [2010.04.01.1324 +0200]:
> Please avoid rpath. The better solution is probably to create
> a wrapper for notmuch, which prepends to LD_LIBRARY_PATH.

E.g. http://wiki.debian.org/RpathIssue

-- 
martin | http://madduck.net/ | http://two.sentenc.es/
 
a common mistake that people make
when trying to design something completely foolproof
was to underestimate the ingenuity of complete fools.
                                 -- douglas adams, "mostly harmless"
 
spamtraps: madduck.bogus@madduck.net

[-- Attachment #2: Digital signature (see http://martin-krafft.net/gpg/) --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* [PATCH] Makefile: Create include directory when installing headers
  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:47     ` Michal Sojka
  2010-04-01 12:13       ` Carl Worth
  2 siblings, 1 reply; 30+ messages in thread
From: Michal Sojka @ 2010-04-01 11:47 UTC (permalink / raw)
  To: notmuch

When I wanted to create a debian package from the current master, make
install failed because of non-existent include directory. This patch
fixes this minor issue.
---
 lib/Makefile.local |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/lib/Makefile.local b/lib/Makefile.local
index 0fd843a..85b010e 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -54,6 +54,7 @@ install-$(dir):
 	$(call quiet_install_data, $(dir)/$(LIBNAME) $(DESTDIR)$(libdir)/)
 	$(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(SONAME))
 	$(call quiet_symlink, $(LIBNAME) $(DESTDIR)$(libdir)/$(LINKER_NAME))
+	$(call quiet_mkdir, $(DESTDIR)$(prefix)/include/)
 	$(call quiet_install_data, $(dir)/notmuch.h $(DESTDIR)$(prefix)/include/)
 
 SRCS  := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-- 
1.7.0.2

^ permalink raw reply related	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  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
  1 sibling, 1 reply; 30+ messages in thread
From: Carl Worth @ 2010-04-01 12:12 UTC (permalink / raw)
  To: martin f krafft, Michal Sojka; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 989 bytes --]

On Thu, 1 Apr 2010 13:24:22 +0200, martin f krafft <madduck@madduck.net> wrote:
> also sprach Michal Sojka <sojkam1@fel.cvut.cz> [2010.04.01.1310 +0200]:
> > this can be solved by the following patch, but I don't know how portable
> > it is. You can see the efect of this by
> 
> Please avoid rpath. The better solution is probably to create
> a wrapper for notmuch, which prepends to LD_LIBRARY_PATH.

So now should actually list some of the ideas I had:

1. Use rpath for the local notmuch, (and use chrpath to remove it at the
   time of "make install").

2. Create a little shell script that calls LD_LIBRARY_PATH locally, but
   then install the real program, (not very unlike what libtool does).

3. Create a static program locally, but install a shared version.

4. Create a static program by default, and make distributions pass a
   --shared option to get the shared version that they want.

I can see advantages and disadvantages to each approach.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: [PATCH] Makefile: Create include directory when installing headers
  2010-04-01 11:47     ` [PATCH] Makefile: Create include directory when installing headers Michal Sojka
@ 2010-04-01 12:13       ` Carl Worth
  0 siblings, 0 replies; 30+ messages in thread
From: Carl Worth @ 2010-04-01 12:13 UTC (permalink / raw)
  To: Michal Sojka, notmuch

[-- Attachment #1: Type: text/plain, Size: 284 bytes --]

On Thu,  1 Apr 2010 13:47:45 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> When I wanted to create a debian package from the current master, make
> install failed because of non-existent include directory. This patch
> fixes this minor issue.

Thanks. This is merged now.

-Carl

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  2010-04-01 12:12         ` Carl Worth
@ 2010-04-01 12:44           ` Michal Sojka
  2010-04-01 22:09             ` Carl Worth
  0 siblings, 1 reply; 30+ messages in thread
From: Michal Sojka @ 2010-04-01 12:44 UTC (permalink / raw)
  To: Carl Worth, martin f krafft; +Cc: notmuch

On Thu, 01 Apr 2010, Carl Worth wrote:
> On Thu, 1 Apr 2010 13:24:22 +0200, martin f krafft <madduck@madduck.net> wrote:
> > also sprach Michal Sojka <sojkam1@fel.cvut.cz> [2010.04.01.1310 +0200]:
> > > this can be solved by the following patch, but I don't know how portable
> > > it is. You can see the efect of this by
> > 
> > Please avoid rpath. The better solution is probably to create
> > a wrapper for notmuch, which prepends to LD_LIBRARY_PATH.
> 
> So now should actually list some of the ideas I had:
> 
> 1. Use rpath for the local notmuch, (and use chrpath to remove it at the
>    time of "make install").
> 
> 2. Create a little shell script that calls LD_LIBRARY_PATH locally, but
>    then install the real program, (not very unlike what libtool does).
> 
> 3. Create a static program locally, but install a shared version.
> 
> 4. Create a static program by default, and make distributions pass a
>    --shared option to get the shared version that they want.

I'd like to be able to run gdb easily on non-installed notmuch, so I'm
fine with 1, 3 and 4.

-Michal

^ permalink raw reply	[flat|nested] 30+ messages in thread

* Re: Notmuch shared library
  2010-04-01 12:44           ` Michal Sojka
@ 2010-04-01 22:09             ` Carl Worth
  0 siblings, 0 replies; 30+ messages in thread
From: Carl Worth @ 2010-04-01 22:09 UTC (permalink / raw)
  To: Michal Sojka, martin f krafft; +Cc: notmuch

[-- Attachment #1: Type: text/plain, Size: 1417 bytes --]

On Thu, 01 Apr 2010 14:44:36 +0200, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> On Thu, 01 Apr 2010, Carl Worth wrote:
> > 1. Use rpath for the local notmuch, (and use chrpath to remove it at the
> >    time of "make install").
> > 
> > 3. Create a static program locally, but install a shared version.
> > 
> > 4. Create a static program by default, and make distributions pass a
> >    --shared option to get the shared version that they want.
> 
> I'd like to be able to run gdb easily on non-installed notmuch, so I'm
> fine with 1, 3 and 4.

I really like the idea of (1) but it might cause a dependency on
chrpath, which would be obnoxious. Otherwise, it would require linking
the final application twice.

But if we're going to link twice, we might as well just do that (3).

I now don't see any advantage of (4) over (3). It's easy to compile both
static and shared, so there's not much reason to be able to disable one
or the other.

So I've now made the default "make" create a static "notmuch" binary and
a shared "notmuch-shared" binary. Then, "make install" installs
"notmuch-shared" but renames it to "notmuch".

The other reason I really wanted something like this is to be able to
ensure that the test suite tests the locally-compiled library, (and not
some installed version that the dynamic linker finds).

-Carl (happy to stay away from the pain of wrapper scripts)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2010-04-01 22:09 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-11 22:37 Notmuch shared library Ben Gamari
2010-03-11 22:37 ` [PATCH] Build and link against notmuch " Ben Gamari
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

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).