fix build

This commit is contained in:
Jeff Carr 2024-11-16 00:07:41 -06:00
parent 1579e18f69
commit 47d10c231f
3 changed files with 16 additions and 8 deletions

View File

@ -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

View File

@ -18,7 +18,7 @@ type args struct {
}
func (args) Version() string {
return "gowebd " + VERSION
return "gowebd " + VERSION + " Built on " + BUILDTIME
}
func init() {

View File

@ -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