fix build

This commit is contained in:
Jeff Carr 2024-11-16 00:06:21 -06:00
parent 1082f0b7f9
commit 9c6a232bb6
3 changed files with 33 additions and 16 deletions

View File

@ -1,14 +1,28 @@
.PHONY: debian
run: build
reset
cp -f control-panel-dns ~/
sudo ./control-panel-dns
VERSION = $(shell git describe --tags)
BUILDTIME = $(shell date +%Y.%m.%d)
all: build
./control-panel-dns
build:
-mkdir -p resources/
-cp ~/go/src/go.wit.com/toolkits/*.so resources/
GO111MODULE="off" go build -v
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}"
# embed the toolkit plugins in the binary
embed:
-rm resources/*.so
touch resources/blank.so
cp -a ~/go/src/go.wit.com/toolkits/*.so resources/
goimports:
goimports -w *.go
@ -41,9 +55,6 @@ nocui: reset build
check-git-clean:
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1)
install:
go install -v go.wit.com/control-panel-dns@latest
build-release:
reset
go get -v -u -x .
@ -71,10 +82,6 @@ clean:
-rm -f resources/*.so
-rm *.deb
debian:
cd debian && make
-wit mirrors
netlink:
GO111MODULE="off" go get -v -u github.com/vishvananda/netlink

10
argv.go
View File

@ -10,12 +10,14 @@ import (
"go.wit.com/log"
)
var args struct {
var argv args
type args struct {
Daemon bool `arg:"--daemon" help:"run without a gui"`
}
func init() {
arg.MustParse(&args)
arg.MustParse(&argv)
if debugger.ArgDebug() {
log.Info("cmd line --debugger == true")
@ -25,3 +27,7 @@ func init() {
}()
}
}
func (args) Version() string {
return "go-clone " + VERSION + " Built on " + BUILDTIME
}

View File

@ -17,6 +17,10 @@ import (
"go.wit.com/lib/gui/linuxstatus"
)
// sent via -ldflags
var VERSION string
var BUILDTIME string
//go:embed resources/*
var resToolkit embed.FS