From 47d10c231f09ee5d4dcb4e4c27c7f027c1f792ae Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 16 Nov 2024 00:07:41 -0600 Subject: [PATCH] fix build --- Makefile | 20 ++++++++++++++------ argv.go | 2 +- main.go | 2 +- 3 files changed, 16 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 86fd2a0..2c7603a 100644 --- a/Makefile +++ b/Makefile @@ -1,8 +1,9 @@ .PHONY: build VERSION = $(shell git describe --tags) +BUILDTIME = $(shell date +%Y.%m.%d) -all: +all: build @echo "make build # build" @echo "make clean # clean build files" @echo "make run # build and run on port 2233" @@ -12,6 +13,18 @@ all: @echo "make enable # enable daemon on boot" @echo "make log # watch the daemon log" +build: + GO111MODULE=off go build \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + +verbose: + GO111MODULE=off go build -v -x \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + +install: + GO111MODULE=off go install \ + -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}" + log: @#systemctl status gowebd.service @journalctl -f -xeu gowebd.service @@ -29,11 +42,6 @@ start: stop: systemctl stop gowebd.service -build: - echo "build it!" - # 2024/11/06 14:41:29 path = /home/jcarr/go/src/go.wit.com/apps/gowebd cmd = go build -v -x -ldflags -X main.VERSION=0.22.2-3-g28e0f09-dirty -ldflags -X main.GUIVERSION=0.22.2-3-g28e0f09-dirty - GO111MODULE=off go build -v -x -ldflags "-X main.VERSION=${VERSION} -X gui.GUIVERSION=${VERSION}" - run: build ./gowebd --port 2233 # setcap 'cap_net_bind_service=+ep' gowebd # allow the binary to open ports below 1024 diff --git a/argv.go b/argv.go index 0963462..35bb8a8 100644 --- a/argv.go +++ b/argv.go @@ -18,7 +18,7 @@ type args struct { } func (args) Version() string { - return "gowebd " + VERSION + return "gowebd " + VERSION + " Built on " + BUILDTIME } func init() { diff --git a/main.go b/main.go index e3eec28..40a4cbc 100644 --- a/main.go +++ b/main.go @@ -13,7 +13,7 @@ import ( // are sent via -ldflags at buildtime var VERSION string -var GUIVERSION string +var BUILDTIME string //go:embed resources/* var resources embed.FS