[notmuch] [PATCH 2/2] Build and link against notmuch shared library

2010-03-12 Thread Sebastian Spaeth
On Thu, 11 Mar 2010 14:41:09 -0800 (PST), Ben Gamari  wrote:
> On Thu, 04 Mar 2010 09:25:45 +0100, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > I just tried out this patch to compile notmuch as a shared library and
> > while producing lib/libnotmuch.so.1 it fails to find notmuch later:
> 
> Try the version I just posted. It will apply against master and builds on my 
> machine.

Using the updated patch and a stock cworth/master I still got that
error. Using the updated patchset that was just posted and builds on
your work, it compiled and installed fine (but failed to find
libnotmuch.so.1 in /usr/local/lib)

I don't think I have a special setup on this box, so I wonder why it did
not work for me.

spaetz


[notmuch] [PATCH 2/2] Build and link against notmuch shared library

2010-03-11 Thread Ben Gamari
On Thu, 04 Mar 2010 09:25:45 +0100, "Sebastian Spaeth"  wrote:
> I just tried out this patch to compile notmuch as a shared library and
> while producing lib/libnotmuch.so.1 it fails to find notmuch later:

Try the version I just posted. It will apply against master and builds on my 
machine.

> Is more needed than this patch? Also, *I* think it would be nice to
> support --static or --shared as options to --configure. But that is a
> minor thing, probably.

What do others think about this? Would it be useful, counter-productive, or
none of the above to allow configuration of the library type?

Cheers,

- Ben


[notmuch] [PATCH 2/2] Build and link against notmuch shared library

2010-03-04 Thread Sebastian Spaeth
>  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 $@

I just tried out this patch to compile notmuch as a shared library and
while producing lib/libnotmuch.so.1 it fails to find notmuch later:

CC  notmuch
/usr/bin/ld: cannot find -lnotmuch

Aso it creates libnotmuch.so.1 in lib but seems to try symlinking it in
the "compat" dir which fails and produces a dead symlink.

CXX lib/libnotmuch.so.1
ln -sf compat/libnotmuch.so.1 compat/libnotmuch.so

Is more needed than this patch? Also, *I* think it would be nice to
support --static or --shared as options to --configure. But that is a
minor thing, probably.

Sebastian


[notmuch] [PATCH 2/2] Build and link against notmuch shared library

2010-01-24 Thread Ben Gamari
---
 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



[notmuch] [PATCH 2/2] Build and link against notmuch shared library

2010-01-24 Thread Ben Gamari
---
 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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch