From: Scott Robinson <scott@quadhome.com>
To: Jeffrey Ollie <jeff@ocjtech.us>
Cc: notmuch <notmuch@notmuchmail.org>
Subject: Re: Using notmuch from Ruby, Python, et al.
Date: Wed, 25 Nov 2009 09:40:56 -0800 [thread overview]
Message-ID: <1259170137-sup-8249@lisa> (raw)
In-Reply-To: <935ead450911250833j16359db3ob9c1d625c667ecc9@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1567 bytes --]
Excerpts from Jeffrey Ollie's message of Wed Nov 25 08:33:39 -0800 2009:
> On Wed, Nov 25, 2009 at 10:16 AM, Scott Robinson <scott@quadhome.com> wrote:
> >
> > == Shared Library
> >
> > I have modified the build to output a shared library. It's a small change
> > relying on libtool.
> >
> > However, the archives indicate Carl dislikes libtool?
>
> Ugh, please, let's not go down the autoconf/automake/libtool route.
I didn't use autoconf and friends. Just put in libtool where $(CXX) and $(CC)
are. Going with the system defaults.
See the attached patch.
> > == JSON output
> >
> > I added a --output=(text|json) option to "search" and "show." Then, emit json
> > results appropriately.
> >
> > To accomplish this, I used the cJSON library sans parsing logic.
> >
> > However, I saw discussion about providing a --format option?
>
> Awesome, I was just looking at using json-glib but I haven't gotten
> very far yet, mainly because I've never used it before (nor done much
> of anything with JSON). I was going to call the option
> '--output-format=(standard|json)' but I'm not going to worry about the
> color of that bikeshed.
>
> IMHO, I think both approaches would be valuable, that way people
> writing front ends could choose the methods that worked best for them.
> Do you have patches that you are ready to share?
>
Yes!
As the json work is a bit more substantial, is it preferable to start a [PATCH]
thread or link to a git repo?
--
Scott Robinson | http://quadhome.com/
Q: Why are my replies five sentences or less?
A: http://five.sentenc.es/
[-- Attachment #2: libtoolize-notmuch.diff --]
[-- Type: application/octet-stream, Size: 3996 bytes --]
diff --git a/Makefile b/Makefile
index 2cd1b1b..b065006 100644
--- a/Makefile
+++ b/Makefile
@@ -4,6 +4,10 @@ CFLAGS=-O2
# Additional programs that are used during the compilation process.
EMACS ?= emacs
+libtool = libtool
+# Needed so libtool replaces parameters in a modern fashion.
+CC = gcc
+CXX = g++
# Lowercase to avoid clash with GZIP environment variable for passing
# arguments to gzip.
gzip = gzip
@@ -41,20 +45,21 @@ include Makefile.config
# user how to enable verbose compiles.
ifeq ($(V),)
quiet_DOC := "Use \"$(MAKE) V=1\" to see the verbose compile lines.\n"
-quiet = @echo $(quiet_DOC)$(eval quiet_DOC:=)" $1 $@"; $($1)
+V = 0
endif
# The user has explicitly enabled quiet compilation.
ifeq ($(V),0)
-quiet = @echo " $1 $@"; $($1)
+quiet = @echo $(quiet_DOC)$(eval quiet_DOC:=)" $1 $@"; $($1)
+libtool += --silent
endif
# Otherwise, print the full command line.
quiet ?= $($1)
-%.o: %.cc $(all_deps)
- $(call quiet,CXX) -c $(CXXFLAGS) $< -o $@
+%.lo: %.cc $(all_deps)
+ $(call quiet,libtool) --mode=compile $(CXX) -c $(CXXFLAGS) $< -o $@
-%.o: %.c $(all_deps)
- $(call quiet,CC) -c $(CFLAGS) $< -o $@
+%.lo: %.c $(all_deps)
+ $(call quiet,libtool) --mode=compile $(CC) -c $(CFLAGS) $< -o $@
%.elc: %.el
$(call quiet,EMACS) -batch -f batch-byte-compile $<
@@ -62,13 +67,13 @@ quiet ?= $($1)
.deps/%.d: %.c $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
$(CC) -M $(CPPFLAGS) $(CFLAGS) $< > $@.$$$$; \
- sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,'$$(basename $*)'\.lo[ :]*,$*.lo $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
.deps/%.d: %.cc $(all_deps)
@set -e; rm -f $@; mkdir -p $$(dirname $@) ; \
$(CXX) -M $(CPPFLAGS) $(CXXFLAGS) $< > $@.$$$$; \
- sed 's,'$$(basename $*)'\.o[ :]*,$*.o $@ : ,g' < $@.$$$$ > $@; \
+ sed 's,'$$(basename $*)'\.lo[ :]*,$*.lo $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$
DEPS := $(SRCS:%.c=.deps/%.d)
@@ -77,4 +82,4 @@ DEPS := $(DEPS:%.cc=.deps/%.d)
.PHONY : clean
clean:
- rm -f $(CLEAN); rm -rf .deps
+ $(libtool) --mode=clean rm -f $(CLEAN); rm -rf .deps
diff --git a/Makefile.local b/Makefile.local
index a3a19de..0a3a201 100644
--- a/Makefile.local
+++ b/Makefile.local
@@ -20,9 +20,9 @@ notmuch_client_srcs = \
query-string.c \
show-message.c
-notmuch_client_modules = $(notmuch_client_srcs:.c=.o)
-notmuch: $(notmuch_client_modules) lib/notmuch.a
- $(call quiet,CXX) $^ $(LDFLAGS) -o $@
+notmuch_client_modules = $(notmuch_client_srcs:.c=.lo)
+notmuch: $(notmuch_client_modules) lib/libnotmuch.la
+ $(call quiet,libtool) --mode=link $(CXX) $^ $(LDFLAGS) -o $@
notmuch.1.gz: notmuch.1
$(call quiet,gzip) --stdout $^ > $@
@@ -33,10 +33,12 @@ install: all notmuch.1.gz
do \
install -d $$d ; \
done ;
- install notmuch $(DESTDIR)$(prefix)/bin/
+ $(libtool) --mode=install install -c lib/libnotmuch.la $(DESTDIR)$(prefix)/lib/
+ $(libtool) --mode=install install -c notmuch $(DESTDIR)$(prefix)/bin/
install -m0644 notmuch.1.gz $(DESTDIR)$(prefix)/share/man/man1/
install contrib/notmuch-completion.bash \
$(DESTDIR)$(bash_completion_dir)/notmuch
+ $(libtool) --mode=finish $(DESTDIR)$(prefix)/lib/
install-emacs: install emacs
for d in $(DESTDIR)/$(emacs_lispdir) ; \
diff --git a/lib/Makefile.local b/lib/Makefile.local
index a7562c9..1bc0991 100644
--- a/lib/Makefile.local
+++ b/lib/Makefile.local
@@ -16,9 +16,9 @@ libnotmuch_cxx_srcs = \
$(dir)/query.cc \
$(dir)/thread.cc
-libnotmuch_modules = $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
-$(dir)/notmuch.a: $(libnotmuch_modules)
- $(call quiet,AR) rcs $@ $^
+libnotmuch_modules = $(libnotmuch_c_srcs:.c=.lo) $(libnotmuch_cxx_srcs:.cc=.lo)
+$(dir)/libnotmuch.la: $(libnotmuch_modules)
+ $(call quiet,libtool) --mode=link $(CXX) -rpath $(DESTDIR)$(prefix)/lib -o $@ $^
SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
-CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/notmuch.a
+CLEAN := $(CLEAN) $(libnotmuch_modules) $(dir)/libnotmuch.la
next prev parent reply other threads:[~2009-11-25 17:41 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-11-25 16:16 Using notmuch from Ruby, Python, et al Scott Robinson
2009-11-25 16:33 ` Jeffrey Ollie
2009-11-25 17:40 ` Scott Robinson [this message]
2009-11-25 17:57 ` Jeffrey Ollie
2009-11-25 17:46 ` Jeffrey Ollie
2009-11-25 17:58 ` Scott Robinson
2009-11-25 18:03 ` Jeffrey Ollie
2009-11-25 18:10 ` Scott Robinson
2009-11-28 2:55 ` Carl Worth
2009-11-28 2:58 ` Mikhail Gusarov
2009-11-28 2:47 ` Carl Worth
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=1259170137-sup-8249@lisa \
--to=scott@quadhome.com \
--cc=jeff@ocjtech.us \
--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).