diff options
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | README.md | 10 | ||||
-rwxr-xr-x | contrib/check-notmuch.sh | 20 | ||||
-rwxr-xr-x | contrib/goflags.sh | 19 |
4 files changed, 28 insertions, 31 deletions
@@ -2,7 +2,7 @@ .SUFFIXES: .SUFFIXES: .1 .5 .7 .1.scd .5.scd .7.scd -VERSION!=git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.14.0 +VERSION?=`git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.14.0` VPATH=doc PREFIX?=/usr/local BINDIR?=$(PREFIX)/bin @@ -10,19 +10,17 @@ SHAREDIR?=$(PREFIX)/share/aerc LIBEXECDIR?=$(PREFIX)/libexec/aerc MANDIR?=$(PREFIX)/share/man GO?=go -default_goflags!=GO=$(GO) contrib/check-notmuch.sh 2>/dev/null && echo -tags=notmuch -GOFLAGS?=$(default_goflags) +GOFLAGS?=`contrib/goflags.sh` BUILD_OPTS?=-trimpath -flags!=echo -- $(GOFLAGS) | base64 | tr -d '\n' # ignore environment variable GO_LDFLAGS:= GO_LDFLAGS+=-X main.Version=$(VERSION) -GO_LDFLAGS+=-X main.Flags=$(flags) +GO_LDFLAGS+=-X main.Flags=$$(echo -- $(GOFLAGS) | base64 | tr -d '\n') GO_LDFLAGS+=-X git.sr.ht/~rjarry/aerc/config.shareDir=$(SHAREDIR) GO_LDFLAGS+=-X git.sr.ht/~rjarry/aerc/config.libexecDir=$(LIBEXECDIR) GO_LDFLAGS+=$(GO_EXTRA_LDFLAGS) -GOSRC!=find * -name '*.go' | grep -v filters/wrap.go +GOSRC!=find * -type f -name '*.go' GOSRC+=go.mod go.sum DOCS := \ @@ -77,12 +77,12 @@ Then compile aerc: aerc optionally supports notmuch. To enable it, you need to have a recent version of [notmuch](https://notmuchmail.org/#index7h2), including the header -files (notmuch.h). The `notmuch` build tag should be automatically added. +files (notmuch.h). The `notmuch` build tag should be automatically added. To +check if it is, run the following command: - $ make - go build -trimpath -tags=notmuch -ldflags "-X ... - ^^^^^^^^^^^^^ - ... + $ ./aerc -v + aerc 0.14.0-108-g31e1cd9af565 +notmuch (go1.19.6 amd64 linux) + ^^^^^^^^ If it is not, you can force it before building: diff --git a/contrib/check-notmuch.sh b/contrib/check-notmuch.sh deleted file mode 100755 index 6b5beb62..00000000 --- a/contrib/check-notmuch.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/sh - -set -e - -tmp=$(mktemp -d) -trap "rm -rf $tmp" EXIT - -cat > $tmp/src.go <<EOF -package main - -// #cgo LDFLAGS: -lnotmuch -// #include <notmuch.h> -import "C" - -func main() { - C.notmuch_status_to_string(C.NOTMUCH_STATUS_SUCCESS) -} -EOF - -${GO:-go} build -o $tmp/out $tmp/src.go diff --git a/contrib/goflags.sh b/contrib/goflags.sh new file mode 100755 index 00000000..90e4d9ee --- /dev/null +++ b/contrib/goflags.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +set -e + +tags= + +if ${CC:-cc} -x c - -o/dev/null -lnotmuch; then + tags="$tags,notmuch" +fi <<EOF +#include <notmuch.h> + +void main(void) { + notmuch_status_to_string(NOTMUCH_STATUS_SUCCESS); +} +EOF + +if [ -n "$tags" ]; then + printf -- '-tags=%s\n' "${tags#,}" +fi |