[notmuch] [PATCH] Build and link against notmuch shared library
--- .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
[notmuch] [PATCH] Build and link against notmuch shared library
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
[notmuch] [PATCH] Build and link against notmuch shared library
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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH] Build and link against notmuch shared library
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. :-)
Re: [notmuch] [PATCH] Build and link against notmuch shared library
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. :-) ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
[notmuch] [PATCH] Build and link against notmuch shared library
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 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
[notmuch] [PATCH] Build and link against notmuch shared library
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
[notmuch] [PATCH] Build and link against notmuch shared library
On Wed, Jan 20, 2010 at 10:35 PM, Ben Gamari 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
[notmuch] [PATCH] Build and link against notmuch shared library
On Sat, 23 Jan 2010 02:58:53 +0200, Felipe Contreras wrote: > On Wed, Jan 20, 2010 at 10:35 PM, Ben Gamari > 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
[notmuch] [PATCH] Build and link against notmuch shared library
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
[notmuch] [PATCH] Build and link against notmuch shared library
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
[notmuch] [PATCH] Build and link against notmuch shared library
--- 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
[notmuch] [PATCH] Build and link against notmuch shared library
--- 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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch
Re: [notmuch] [PATCH] Build and link against notmuch shared library
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 ___ notmuch mailing list notmuch@notmuchmail.org http://notmuchmail.org/mailman/listinfo/notmuch