2010-03-21 10:54:08 +01:00
|
|
|
# -*- makefile -*-
|
|
|
|
|
2017-05-10 21:42:11 +02:00
|
|
|
dir := lib
|
|
|
|
|
|
|
|
# The (often-reused) $dir works fine within targets/prerequisites,
|
|
|
|
# but cannot be used reliably within commands, so copy its value to a
|
|
|
|
# variable that is not reused.
|
|
|
|
lib := $(dir)
|
|
|
|
|
2010-04-30 21:00:24 +02:00
|
|
|
ifeq ($(PLATFORM),MACOSX)
|
2010-04-12 01:44:53 +02:00
|
|
|
LIBRARY_SUFFIX = dylib
|
|
|
|
# On OS X, library version numbers go before suffix.
|
|
|
|
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
|
|
|
|
SONAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBRARY_SUFFIX)
|
|
|
|
LIBNAME = libnotmuch.$(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE).$(LIBRARY_SUFFIX)
|
lib: make notmuch shared library install_name be full path on Mac OS X
The install_name of libnotmuch.dylib on Mac OS X is what is written
into a program that links against it. If it is just the name of the
shared library file, as opposed to the full path, the program won't be
able to find it when it runs and will abort. Instead, the install_name
should be the full path to the shared library (in its final installed
location).
Why does Notmuch work without this patch when installed via Homebrew?
The answer is twofold. One, /usr/local/lib is a special location in
which the dynamic linker will look by default to find shared libraries.
Homebrew highly recommends installing to /usr/local, and, assuming it
has been configured this way, the Notmuch library will end up installed
in /usr/local/lib, and the dynamic linker will find it. Two, Homebrew
globally corrects all install names in dynamically shared libraries and
binaries for each package it installs. So, even if the install names in
a package's binaries and libraries are incorrect, Homebrew corrects them
automatically, and no one ever knows.
Why does Notmuch work without this patch when installed via MacPorts?
The answer is that MacPorts applies a patch just like this patch to fix
the same problem.
2015-03-04 23:32:49 +01:00
|
|
|
LIBRARY_LINK_FLAG = -dynamiclib -install_name $(libdir)/$(SONAME) -compatibility_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR) -current_version $(LIBNOTMUCH_VERSION_MAJOR).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
|
2010-04-12 01:44:53 +02:00
|
|
|
else
|
|
|
|
LIBRARY_SUFFIX = so
|
|
|
|
LINKER_NAME = libnotmuch.$(LIBRARY_SUFFIX)
|
2010-04-01 09:41:25 +02:00
|
|
|
SONAME = $(LINKER_NAME).$(LIBNOTMUCH_VERSION_MAJOR)
|
|
|
|
LIBNAME = $(SONAME).$(LIBNOTMUCH_VERSION_MINOR).$(LIBNOTMUCH_VERSION_RELEASE)
|
2017-09-10 13:56:16 +02:00
|
|
|
LIBRARY_LINK_FLAG = -shared -Wl,--version-script=$(srcdir)/$(lib)/notmuch.sym,-soname=$(SONAME) $(NO_UNDEFINED_LDFLAGS)
|
2012-10-24 23:43:28 +02:00
|
|
|
ifeq ($(PLATFORM),OPENBSD)
|
|
|
|
LIBRARY_LINK_FLAG += -lc
|
|
|
|
endif
|
2010-06-05 01:52:56 +02:00
|
|
|
ifeq ($(LIBDIR_IN_LDCONFIG),1)
|
2010-06-16 16:14:18 +02:00
|
|
|
ifeq ($(DESTDIR),)
|
2010-06-05 01:52:56 +02:00
|
|
|
LIBRARY_INSTALL_POST_COMMAND=ldconfig
|
|
|
|
endif
|
2010-04-12 01:44:53 +02:00
|
|
|
endif
|
2010-06-16 16:14:18 +02:00
|
|
|
endif
|
2010-04-01 07:47:12 +02:00
|
|
|
|
2017-05-10 21:42:11 +02:00
|
|
|
extra_cflags += -I$(srcdir)/$(dir) -fPIC -fvisibility=hidden
|
|
|
|
extra_cxxflags += -fvisibility-inlines-hidden
|
2011-10-23 16:44:01 +02:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
libnotmuch_c_srcs = \
|
2010-04-15 01:03:18 +02:00
|
|
|
$(notmuch_compat_srcs) \
|
2010-11-11 08:26:31 +01:00
|
|
|
$(dir)/filenames.c \
|
2010-12-09 01:26:05 +01:00
|
|
|
$(dir)/string-list.c \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/message-file.c \
|
2017-06-04 14:32:26 +02:00
|
|
|
$(dir)/message-id.c \
|
2009-11-15 08:05:17 +01:00
|
|
|
$(dir)/messages.c \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/sha1.c \
|
2016-03-22 11:54:45 +01:00
|
|
|
$(dir)/built-with.c \
|
2016-06-13 03:05:49 +02:00
|
|
|
$(dir)/string-map.c \
|
reindex: drop notmuch_param_t, use notmuch_indexopts_t instead
There are at least three places in notmuch that can trigger an
indexing action:
* notmuch new
* notmuch insert
* notmuch reindex
I have plans to add some indexing options (e.g. indexing the cleartext
of encrypted parts, external filters, automated property injection)
that should properly be available in all places where indexing
happens.
I also want those indexing options to be exposed by (and constrained
by) the libnotmuch C API.
This isn't yet an API break because we've never made a release with
notmuch_param_t.
These indexing options are relevant in the listed places (and in the
libnotmuch analogues), but they aren't relevant in the other kinds of
functionality that notmuch offers (e.g. dump/restore, tagging, search,
show, reply).
So i think a generic "param" object isn't well-suited for this case.
In particular:
* a param object sounds like it could contain parameters for some
other (non-indexing) operation. This sounds confusing -- why would
i pass non-indexing parameters to a function that only does
indexing?
* bremner suggests online a generic param object would actually be
passed as a list of param objects, argv-style. In this case (at
least in the obvious argv implementation), the params might be some
sort of generic string. This introduces a problem where the API of
the library doesn't grow as new options are added, which means that
when code outside the library tries to use a feature, it first has
to test for it, and have code to handle it not being available.
The indexopts approach proposed here instead makes it clear at
compile time and at dynamic link time that there is an explicit
dependency on that feature, which allows automated tools to keep
track of what's needed and keeps the actual code simple.
My proposal adds the notmuch_indexopts_t as an opaque struct, so that
we can extend the list of options without causing ABI breakage.
The cost of this proposal appears to be that the "boilerplate" API
increases a little bit, with a generic constructor and destructor
function for the indexopts struct.
More patches will follow that make use of this indexopts approach.
2017-08-18 01:14:26 +02:00
|
|
|
$(dir)/indexopts.c \
|
2011-10-23 17:05:13 +02:00
|
|
|
$(dir)/tags.c
|
2009-11-10 16:14:49 +01:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
libnotmuch_cxx_srcs = \
|
|
|
|
$(dir)/database.cc \
|
lib: add date range query support
Add a custom value range processor to enable date and time searches of
the form date:since..until, where "since" and "until" are expressions
understood by the previously added date/time parser, to restrict the
results to messages within a particular time range (based on the Date:
header).
If "since" or "until" describes date/time at an accuracy of days or
less, the values are rounded according to the accuracy, towards past
for "since" and towards future for "until". For example,
date:november..yesterday would match from the beginning of November
until the end of yesterday. Expressions such as date:today..today
means since the beginning of today until the end of today.
Open-ended ranges are supported (since Xapian 1.2.1), i.e. you can
specify date:..until or date:since.. to not limit the start or end
date, respectively.
CAVEATS:
Xapian does not support spaces in range expressions. You can replace
the spaces with '_', or (in most cases) '-', or (in some cases) leave
the spaces out altogether.
Entering date:expr without ".." (for example date:yesterday) will not
work as you might expect. You can achieve the expected result by
duplicating the expr both sides of ".." (for example
date:yesterday..yesterday).
Open-ended ranges won't work with pre-1.2.1 Xapian, but they don't
produce an error either.
Signed-off-by: Jani Nikula <jani@nikula.org>
2012-10-30 21:32:37 +01:00
|
|
|
$(dir)/parse-time-vrp.cc \
|
2010-01-05 22:29:23 +01:00
|
|
|
$(dir)/directory.cc \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/index.cc \
|
|
|
|
$(dir)/message.cc \
|
2017-06-04 14:32:24 +02:00
|
|
|
$(dir)/add-message.cc \
|
2016-06-13 03:05:50 +02:00
|
|
|
$(dir)/message-property.cc \
|
2009-11-10 17:04:54 +01:00
|
|
|
$(dir)/query.cc \
|
2016-03-22 11:54:54 +01:00
|
|
|
$(dir)/query-fp.cc \
|
2016-03-22 11:54:47 +01:00
|
|
|
$(dir)/config.cc \
|
2017-02-27 03:34:20 +01:00
|
|
|
$(dir)/regexp-fields.cc \
|
2017-12-28 15:05:55 +01:00
|
|
|
$(dir)/thread.cc
|
2009-11-10 17:04:54 +01:00
|
|
|
|
2011-06-22 02:25:06 +02:00
|
|
|
libnotmuch_modules := $(libnotmuch_c_srcs:.c=.o) $(libnotmuch_cxx_srcs:.cc=.o)
|
2010-03-12 14:47:35 +01:00
|
|
|
|
2010-04-02 00:03:40 +02:00
|
|
|
$(dir)/libnotmuch.a: $(libnotmuch_modules)
|
|
|
|
$(call quiet,AR) rcs $@ $^
|
|
|
|
|
2017-05-10 21:42:11 +02:00
|
|
|
$(dir)/$(LIBNAME): $(libnotmuch_modules) util/libnotmuch_util.a parse-time-string/libparse-time-string.a
|
2017-03-14 12:10:07 +01:00
|
|
|
$(call quiet,CXX $(CXXFLAGS)) $(libnotmuch_modules) $(FINAL_LIBNOTMUCH_LDFLAGS) $(LIBRARY_LINK_FLAG) -o $@ util/libnotmuch_util.a parse-time-string/libparse-time-string.a
|
2011-06-22 02:25:06 +02:00
|
|
|
|
2010-04-01 09:41:25 +02:00
|
|
|
$(dir)/$(SONAME): $(dir)/$(LIBNAME)
|
2010-04-06 19:00:30 +02:00
|
|
|
ln -sf $(LIBNAME) $@
|
2010-04-01 09:41:25 +02:00
|
|
|
|
|
|
|
$(dir)/$(LINKER_NAME): $(dir)/$(SONAME)
|
2010-04-06 19:00:30 +02:00
|
|
|
ln -sf $(LIBNAME) $@
|
2009-11-10 16:14:49 +01:00
|
|
|
|
2010-04-01 07:47:12 +02:00
|
|
|
install: install-$(dir)
|
|
|
|
|
2011-03-10 00:02:42 +01:00
|
|
|
install-$(dir): $(dir)/$(LIBNAME)
|
2011-01-26 14:29:15 +01:00
|
|
|
mkdir -p "$(DESTDIR)$(libdir)/"
|
|
|
|
install -m0644 "$(lib)/$(LIBNAME)" "$(DESTDIR)$(libdir)/"
|
|
|
|
ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(SONAME)"
|
|
|
|
ln -sf $(LIBNAME) "$(DESTDIR)$(libdir)/$(LINKER_NAME)"
|
|
|
|
mkdir -p "$(DESTDIR)$(includedir)"
|
2011-03-10 00:02:42 +01:00
|
|
|
install -m0644 "$(srcdir)/$(lib)/notmuch.h" "$(DESTDIR)$(includedir)/"
|
2010-06-05 01:52:56 +02:00
|
|
|
$(LIBRARY_INSTALL_POST_COMMAND)
|
2010-04-01 07:47:12 +02:00
|
|
|
|
2009-11-10 17:04:54 +01:00
|
|
|
SRCS := $(SRCS) $(libnotmuch_c_srcs) $(libnotmuch_cxx_srcs)
|
2011-06-25 14:45:58 +02:00
|
|
|
CLEAN += $(libnotmuch_modules) $(dir)/$(SONAME) $(dir)/$(LINKER_NAME)
|
2017-05-10 21:42:11 +02:00
|
|
|
CLEAN += $(dir)/$(LIBNAME) $(dir)/libnotmuch.a
|
2011-06-25 14:45:58 +02:00
|
|
|
CLEAN += $(dir)/notmuch.h.gch
|