aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--GNUmakefile3
-rw-r--r--lib/notmuch/notmuch.go11
-rw-r--r--lib/notmuch_version.go10
-rw-r--r--lib/notmuch_version_dummy.go8
-rw-r--r--main.go15
5 files changed, 38 insertions, 9 deletions
diff --git a/GNUmakefile b/GNUmakefile
index 274f2c6d..7f75c4be 100644
--- a/GNUmakefile
+++ b/GNUmakefile
@@ -1,6 +1,7 @@
# variables that can be changed by users
#
VERSION ?= $(shell git describe --long --abbrev=12 --tags --dirty 2>/dev/null || echo 0.16.0)
+DATE ?= $(shell date +%Y-%m-%d)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
SHAREDIR ?= $(PREFIX)/share/aerc
@@ -11,7 +12,7 @@ GOFLAGS ?= $(shell contrib/goflags.sh)
BUILD_OPTS ?= -trimpath
GO_LDFLAGS :=
GO_LDFLAGS += -X main.Version=$(VERSION)
-GO_LDFLAGS += -X main.Flags=$(shell echo -- $(GOFLAGS) | base64 | tr -d '\r\n')
+GO_LDFLAGS += -X main.Date=$(DATE)
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)
diff --git a/lib/notmuch/notmuch.go b/lib/notmuch/notmuch.go
index 9b13878b..27c0bdfa 100644
--- a/lib/notmuch/notmuch.go
+++ b/lib/notmuch/notmuch.go
@@ -15,6 +15,17 @@ package notmuch
*/
import "C"
+import "fmt"
+
+const (
+ MAJOR_VERSION = C.LIBNOTMUCH_MAJOR_VERSION
+ MINOR_VERSION = C.LIBNOTMUCH_MINOR_VERSION
+ MICRO_VERSION = C.LIBNOTMUCH_MICRO_VERSION
+)
+
+func Version() string {
+ return fmt.Sprintf("%d.%d.%d", MAJOR_VERSION, MINOR_VERSION, MICRO_VERSION)
+}
// NOTE: Any CGO call which passes a reference to a pointer (**object) will fail
// gocritic:dupSubExpr. All of these calls are set to be ignored by the linter
diff --git a/lib/notmuch_version.go b/lib/notmuch_version.go
new file mode 100644
index 00000000..c2025bda
--- /dev/null
+++ b/lib/notmuch_version.go
@@ -0,0 +1,10 @@
+//go:build notmuch
+// +build notmuch
+
+package lib
+
+import "git.sr.ht/~rjarry/aerc/lib/notmuch"
+
+func NotmuchVersion() (string, bool) {
+ return notmuch.Version(), true
+}
diff --git a/lib/notmuch_version_dummy.go b/lib/notmuch_version_dummy.go
new file mode 100644
index 00000000..f04905e1
--- /dev/null
+++ b/lib/notmuch_version_dummy.go
@@ -0,0 +1,8 @@
+//go:build !notmuch
+// +build !notmuch
+
+package lib
+
+func NotmuchVersion() (string, bool) {
+ return "", false
+}
diff --git a/main.go b/main.go
index 5d79428d..8f5ec2f9 100644
--- a/main.go
+++ b/main.go
@@ -3,7 +3,6 @@ package main
import (
"bytes"
"context"
- "encoding/base64"
"errors"
"fmt"
"math/rand"
@@ -21,6 +20,7 @@ import (
"git.sr.ht/~rjarry/aerc/app"
"git.sr.ht/~rjarry/aerc/commands"
"git.sr.ht/~rjarry/aerc/config"
+ "git.sr.ht/~rjarry/aerc/lib"
"git.sr.ht/~rjarry/aerc/lib/crypto"
"git.sr.ht/~rjarry/aerc/lib/hooks"
"git.sr.ht/~rjarry/aerc/lib/ipc"
@@ -85,17 +85,16 @@ func getCompletions(cmdline string) ([]string, string) {
// set at build time
var (
Version string
- Flags string
+ Date string
)
func buildInfo() string {
info := Version
- flags, _ := base64.StdEncoding.DecodeString(Flags)
- if strings.Contains(string(flags), "notmuch") {
- info += " +notmuch"
+ if soVersion, hasNotmuch := lib.NotmuchVersion(); hasNotmuch {
+ info += fmt.Sprintf(" +notmuch-%s", soVersion)
}
- info += fmt.Sprintf(" (%s %s %s)",
- runtime.Version(), runtime.GOARCH, runtime.GOOS)
+ info += fmt.Sprintf(" (%s %s %s %s)",
+ runtime.Version(), runtime.GOARCH, runtime.GOOS, Date)
return info
}
@@ -157,7 +156,7 @@ Options:
}
func (o *Opts) ShowVersion(arg string) error {
- fmt.Println(log.BuildInfo)
+ fmt.Println("aerc " + log.BuildInfo)
os.Exit(0)
return nil
}