Commit graph

193 commits

Author SHA1 Message Date
Daniel Kahn Gillmor
197d67959b crypto: move into libnotmuch_util
This prepares us for using the crypto object in both libnotmuch and
the client.
2017-10-20 07:58:10 -03:00
David Bremner
af64530d3f build: add target to run cppcheck
The advantage of having a target as opposed to running cppcheck by
hand

  - reuse list of source files
  - output errors in a format parsable, e.g. by emacs
  - returns exit code 1 on any error, for possibly use in other
    targets.

For the moment, leave this as an optional target. If desired, it can
be added to e.g. the release targets in the same way as the test
target.

Using two levels of directory for the stamps is arguably
overengineering, but it doesn't really cost anything, and leaves open
the possibility of putting other kinds of stamp files there.

This only checks "new" source files (w.r.t. their last check). A future target
(cppcheck-all ?) could blow away the stamp files first.
2017-08-29 22:05:37 -03:00
Jani Nikula
8c7d979f5d build: add .deps to CLEAN instead of listing in clean target
Seems, uh, cleaner this way.
2017-08-29 22:05:37 -03:00
Jani Nikula
ab3ac525a0 build: add optional target parameter to quiet variable function
Sometimes using $@ as the target in the quiet build lines can be
confusing. Accept an optional second parameter in the quiet variable
function to specify the target.
2017-08-29 22:05:37 -03:00
Jani Nikula
e027711148 build: avoid an extra shell out in quiet variable function
$(word 1, $1) yields the same result as the more complicated
$(shell echo $1 | sed -e s'/ .*//')
2017-08-29 22:05:37 -03:00
Daniel Kahn Gillmor
e5beec39d6 add "notmuch reindex" subcommand
This new subcommand takes a set of search terms, and re-indexes the
list of matching messages.
2017-08-01 21:17:47 -04:00
Jani Nikula
d5ed9af0e4 build: do not export compat functions from lib
Commits 9db2145272 ("lib/gen-version-script.h: add getline and
getdelim to notmuch.sym if needed") and 3242e29e57 ("build: add
canonicalize_file_name to symbols exported from libnotmuch.so")
started exporting compat functions from libnotmuch so that the cli
could use them. But we shouldn't export such functions from the
library. They are not part of our ABI. Instead, the cli should include
its own copies of the compat functions.
2017-05-11 20:41:10 -03:00
Tomi Ollila
18ee87e7ce Makefile.local: have all files in release tarball be owned by root
The tar content `git archive` creates (reproducibly) have owner and
group set to 'root'. (GNU) tar writes user ids to the added file
`version` by default. The contents of tar archive looks better and
more consistent when owner and group in all files are the same.

While at it, split this long command line to multiple lines.
2017-04-14 16:17:46 -03:00
David Bremner
c39f6361d0 rename libutil.a to libnotmuch_util.a
Apparently some systems (MacOS?) have a system library called libutil
and the name conflict causes problems. Since this library is quite
notmuch specific, rename it to something less generic.
2017-03-18 21:37:43 -03:00
David Bremner
e60b44ecf8 build: replace remaining uses of SHA1_FILE
oops. If only there was some editor facility that allowed replacing
all instances of a string.
2017-03-12 22:31:16 -03:00
David Bremner
914c4db1f2 build: use sha256sum instead of sha1sum to sign releases 2017-03-02 17:31:15 -04:00
Jani Nikula
66c1bff416 notmuch.desktop: move under emacs as notmuch-emacs-mua.desktop
The notmuch.desktop file is part of notmuch-emacs. Move it under
emacs, and rename as notmuch-emacs-mua.desktop to reflect this.
2016-11-26 08:16:39 -04:00
David Bremner
46a47f06a6 build: Move variable definitions to Makefile.global
I noticed when trying to use VERSION (and derived variables) in a
subdirectory that the top level Makefile.local needed to be included
first. But according to c10085c77b it
actually needs to be last. To break this conflict, move the variables
definitions into a new Makefile.global.
2016-11-26 07:46:42 -04:00
David Bremner
297d27e9f9 emacs: generate notmuch-pkg.el
This file contains metadata for the built in (as of emacs 24) packaging
system.
2016-11-16 21:45:56 -04:00
David Bremner
50a1032f87 build system: choose gnu99 as a C standard
Apparently pre 5.1 gcc defaulted to gnu89, but we decided it was ok to
use some c99 features.

'-std=c99' by itself is not enough for notmuch to compile.

'-std=gnu99' seems to work with clang and gcc, so I'm not convinced
configuration support is needed.
2016-09-21 20:09:14 -03:00
Tomi Ollila
e0e6a17675 Makefile.local: use $(wildcard) to check existence of ${srcdir}/.git
With this GNU Make construct one shell invocation can be skipped
and code looks shorter (narrower). This would now match to .git
being other file type than regular file or directory (or symlink
to those), but that is not a use case anyone should expect users
to do.
2016-09-04 08:14:55 -03:00
Tomi Ollila
17341ec798 Makefile.local: make IS_GIT simply expanded
By using ':=' while setting IS_GIT it is expanded to 'yes' or 'no' at
that point (and not every time when $(IS_GIT) is referenced).
2016-09-04 08:14:46 -03:00
Tomi Ollila
57bd4cf322 Makefile.local: set IS_GIT = yes when regular file $srcdir/.git exists
$srcdir/.git may also be file. E.g. `git worktree` creates .git file
while new working tree is populated.
2016-06-11 13:13:48 -03:00
Daniel Kahn Gillmor
6a833a6e83 Use https instead of http where possible
Many of the external links found in the notmuch source can be resolved
using https instead of http.  This changeset addresses as many as i
could find, without touching the e-mail corpus or expected outputs
found in tests.
2016-06-05 08:32:17 -03:00
David Bremner
bf511cb697 release: disable wget certificate check
this is a minor security hole, but no worse than what we had before. In
particular the worst that happens is someone prevents us from making a
release. Which is hardly worth the trouble of jacking the URL.
2015-10-30 07:14:41 -03:00
David Bremner
39c54df26d cli: add utility routine to print error status.
No attention to formatting here, initially just focus on getting the
relevant strings out of the library.
2015-09-20 08:04:31 -03:00
David Bremner
d038b93209 build: integrate building ruby bindings into notmuch build process
Because ruby generates a Makefile, we have to use recursive make.
Because mkmf.rb hardcodes the name Makefile, put our Makefile{.local}
in the parent directory.
2015-06-12 09:12:28 +02:00
David Bremner
aed5ec4350 python: replace hardcoding of SONAME version
Failing to update this string in globals.py causes failures when the
SONAME changes.  In order to hopefully reduce the number of such
errors, automate the process of setting the SONAME in the python
bindings.
2015-03-08 08:30:36 +01:00
Jani Nikula
57540a1952 build: generate sh.config for feeding configure results to shell scripts
Only include the relevant information.

Amended by David Bremner:

	Use a prefix NOTMUCH_ to minimize collisions with other
	variables.
2014-07-13 12:15:47 -03:00
Tomi Ollila
6721222ea8 build: check .git directory existence in srcdir (for out-of-tree builds)
So that $(VERSION) and version.stamp uses the git-describe -based
version data instead of the content of `version' file.

For consistency also the git commands in Makefile[.local] target
`verify-no-dirty-code' uses the git --git-dir=$srcdir/.git ...
commands (inside ifeq($(IS_GIT),yes)). Attempting to make this
target outside of the tree will fail in any case.
2014-07-09 20:24:28 -03:00
David Bremner
fe8cd90f97 build: add dataclean
It turns out to be inconvenient to delete the downloaded datafiles with
distclean, so I propose a new target which does that instead.

The closest conventional target is 'maintainer-clean'; the difference
here is that having the original source tarball is not enough to
reconstruct these files.
2014-05-28 09:52:10 -03:00
David Bremner
1856574394 build: remove .tar.gz.tmp files in clean
Most people won't see these, but they annoy anyone running release
or pre-release targets.
2014-05-28 09:51:51 -03:00
David Bremner
94064a6ba2 Merge branch 'release'
A point release is slowly being built on branch release. Merge those
changes into master.
2014-05-28 09:50:32 -03:00
Felipe Contreras
90f9a5e65e build: fix order of rpath
In my system `pkg-config --libs talloc` returns
'Wl,-rpath,/usr/lib -ltalloc' (probably wrongly) which causes the final
LDFLAGS to be something like '-Wl,-rpath,/usr/lib
-Wl,-rpath,/opt/notmuch/lib', which causes the RUNPATH to be
'/usr/lib:/opt/notmuch/lib', so basically defeating the whole purpose of
RUNPATH.

I noticed this when my /opt/notmuch/bin/notmuch (0.17) started updating
the database after I updated the system (which updated the system's
notmuch). This shouldn't happen.

Let's move the RUNPATH flags before other external flags have a chance of
screwing the build.

Signed-off-by: Felipe Contreras <felipe.contreras@gmail.com>
2014-05-28 09:50:04 -03:00
David Bremner
21cb851a22 notmuch 0.18~rc1 release
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v1
 
 iQGcBAABCAAGBQJTZXg2AAoJEPIClx2kp54shMEL/jimQji1GYwhBMfQKldBkl52
 FVbxOS4YiOc6zOcz7n8wjkjnHPEvTS/Q6mrZQTjJxtGDYkzaY27JKczXWB/ueqCJ
 /G9kEiXRbkVBLp2AQH7zHnKWRvqAQsaw9o+jyjzmW1UbJXX7dmZNmMQkWyN3bzy6
 taCDiKPxNTlwePRJUbC6O51GC6m7fZOQHSvrmrqFZiNdeT1Gs7g/Adj8Mho6x9A+
 q98Jtftk30Cyx0hXQKNXcJyTukdvVi69HZcmP+Rr9rCRZ4/L7WRbkX+iFQhvOm19
 c6ldgiwBV6+3DW4sNDHcpwZm5ZFh4I+0xUZ/r8V9F8f4yaY0SzMYtvA2xeIqXSG6
 FwkmPSGoW8A8cF8YqKkHOEZrM4ybd2XGvkDkibUncaAeAHQp4DCVG6etLG9kEtzr
 I4yqGhYTIjmjTuLXDOLEZ2mbhgayS5oAEnVqghapTNDYzzOK8h9Gr3Jvq6Kb2ckQ
 /VnEAOOvSv4bomil4NdgXaPrLZrTiq8lS6/pe2DZEg==
 =0A2e
 -----END PGP SIGNATURE-----

Merge tag '0.18_rc1'

notmuch 0.18~rc1 release
2014-05-04 08:32:05 +09:00
David Bremner
5535453495 build: use UPSTREAM_TAG and not VERSION to generate tarball
The latter can have "~" in it, which is not legal for a git tag.
2014-05-04 08:11:35 +09:00
Tomi Ollila
bc64cdce28 building from git: use --abbrev=7 for version string
Users may have set core.abbrev=n, where n != 7 in their git config
file(s) which would give them different than expected version strings
when building notmuch from git. This fixes the commit hash part of
version string to 7 hexadecimal values.
2014-04-24 14:01:05 +09:00
David Bremner
3c13bc0321 dump: support gzipped and atomic output
The main goal is to support gzipped output for future internal
calls (e.g. from notmuch-new) to notmuch_database_dump.

The additional dependency is not very heavy since xapian already pulls
in zlib.

We want the dump to be "atomic", in the sense that after running the
dump file is either present and complete, or not present.  This avoids
certain classes of mishaps involving overwriting a good backup with a
bad or partial one.
2014-04-12 07:59:44 -03:00
Tomi Ollila
feb3ce9572 build: write version.stamp file containing $(VERSION) string
This version file will be as prerequisite to the target files
that use the version info for some purpose, like printing
it for the user to examine. The contents of the version.stamp
file is seldom read by the build system itself as the $(VERSION)
variable has the same information.

Thanks to Trevor, David and Mark for their contributions.
2014-04-10 23:24:10 -03:00
David Bremner
9d9a700f1d doc: build man pages at build time; introduce HAVE_SPHINX, HAVE_RST2MAN
This helps avoid build artifacts (namely, nroff and gzipped-nroff man
pages) owned by root.

The variables allow choosing which generator to use for the man page.
These will be hooked to configure in a following commit.
2014-03-18 07:38:57 -03:00
David Bremner
6f8daa3989 doc: install sphinx version of man pages
The python script mkdocdeps.py is used to import the list of man pages
from the sphinx configuration to make.

This will delete the (release only) target update-man-versions. This
will be replaced in a followup commit.
2014-03-09 10:41:09 -03:00
Tomi Ollila
b54e2f4fb1 build: delete the default .SUFFIXES
All implicit rules in notmuch Makefiles are "pattern rules"; Deleting the
default suffixes (to support obsolete, old-fashioned "suffix rules") from
make reduces the output of 'make -d' by 40 to 90 percent, helping e.g.
debugging make problems.
2014-01-25 13:09:45 -04:00
Tomi Ollila
a7e072f277 build: remove trailing '/.' when doing mkdir -p .deps/.
When make variable $@ does not contain directory part, $(@D)
resolves as '.'. In this case .deps/$(@D) is '.deps/.'
In some systems `mkdir [-p] directory/.` fails.
To make this compatible with more system substitute trailing
'/.' (slashdot) with '' (empty string) whenever it occurs there.
2014-01-13 14:12:15 -04:00
Moritz Wilhelmy
bafe650f5d Place extra_cflags before CONFIGURE_CFLAGS
This ensures that the build will not attempt to use an existing notmuch.h when
an older version of notmuch is already installed elsewhere (e.g. in /usr/local)
and /usr/local/include is added to CONFIGURE_CFLAGS by one of the libraries
(talloc, in my case)
2013-10-25 21:20:11 -03:00
Ben Gamari
241a88ce2f notmuch-compact: Initial commit of CLI
Introduce the user command exposing the new compaction facility.

Signed-off-by: Ben Gamari <bgamari.foss@gmail.com>
2013-10-09 21:47:13 -03:00
Austin Clements
dc51bf0ad4 reply: Use RFC 2822/MIME wholly for text format template
Previously, reply's default text format used an odd mix of RFC 2045
MIME encoding for the reply template's body and some made-up RFC
2822-like UTF-8 format for the headers.  The intent was to present the
headers to the user in a nice, un-encoded format, but this assumed
that whatever ultimately sent the email would RFC 2047-encode the
headers, while at the same time the body was already RFC 2045 encoded,
so it assumed that whatever sent the email would *not* re-encode the
body.

This can be fixed by either producing a fully decoded UTF-8 reply
template, or a fully encoded MIME-compliant RFC 2822 message.  This
patch does the latter because it is

a) Well-defined by RFC 2822 and MIME (while any UTF-8 format would be
   ad hoc).

b) Ready to be piped to sendmail.  The point of the text format is to
   be minimal, so a user should be able to pop up the template in
   whatever editor they want, edit it, and push it to sendmail.

c) Consistent with frontend capabilities.  If a frontend has the
   smarts to RFC 2047 encode the headers before sending the mail, it
   probably has the smarts to RFC 2047 decode them before presenting
   the template to a user for editing.

Also, as far as I know, nothing automated consumes the reply text
format, so changing this should not cause serious problems.  (And if
anything does still consume this format, it probably gets these
encoding issues wrong anyway.)
2013-08-17 09:06:08 +02:00
Peter Wang
9439a1ec0c cli: add insert command
The notmuch insert command reads a message from standard input,
writes it to a Maildir folder, and then incorporates the message into
the notmuch database.  Essentially it moves the functionality of
notmuch-deliver into notmuch.

Though it could be used as an alternative to notmuch new, the reason
I want this is to allow my notmuch frontend to add postponed or sent
messages to the mail store and notmuch database, without resorting to
another tool (e.g. notmuch-deliver) nor directly modifying the maildir.
2013-06-29 14:42:20 -03:00
David Bremner
be96004b7d build: pass CPPFLAGS to C and C++ compilers
This is used in particular by hardening flags.
2013-06-02 20:49:19 -03:00
David Bremner
fb50cc41fe tag-util.[ch]: New files for common tagging routines
These are meant to be shared between notmuch-tag and notmuch-restore.

The bulk of the routines implement a "tag operation list" abstract
data type act as a structured representation of a set of tag
operations (typically coming from a single tag command or line of
input).
2012-12-09 13:33:34 -04:00
Peter Feigl
fd3ffe35a2 Adding an S-expression structured output printer.
This commit adds a structured output printer for Lisp
S-Expressions. Later commits will use this printer in notmuch search,
show and reply.

The structure is the same as json, but:
- arrays are written as lists: ("foo" "bar" "baaz" 1 2 3)
- maps are written as p-lists: (:key "value" :other-key "other-value")
- true is written as t
- false is written as nil
- null is written as nil

[ whitespace changes by db ]
2012-12-08 09:26:29 -04:00
Jani Nikula
af6b4b29f9 build: build parse-time-string as part of the notmuch lib and static cli 2012-10-31 16:53:01 -03:00
Tomi Ollila
69843dd628 {., man}/Makefile.local: edit/remove release-checks.sh related targets
Use new target release-checks in place of verify-version-debian,
verify-version-python verify-version-manpage. This target executes
devel/release-checks.sh which does all the verifications the three
dropped targets did, and some more.
2012-09-05 08:34:01 -03:00
Austin Clements
d41946ea78 cli: Remove now-unused json.c
The string buffer quoting functions in json.c have been superseded by
the new sprinter interface and are no longer used.  Remove them.
2012-08-12 21:28:08 +02:00
David Bremner
719897cdc3 build system: remove configure output in Make distclean.
Create a variable DISTCLEAN which contains a list of things to
clean in the distclean target (in addition to running the clean
target).

The deleted comment seems to be false these days, since we do
create files during configuration.

Use "rm -rf" here as well in case we want to add directories to
DISTCLEAN.
2012-08-02 21:10:15 -03:00
David Bremner
8a745d310f build system: remove directories created by tests in "make clean"
These extra directories cause problems for building on Debian
twice in a row.

In order to remove directories, we need to us "rm -rf" instead of
"rm -f". So now we should be extra careful what we add to the
variable CLEAN.
2012-08-02 21:09:45 -03:00