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 .PHONY: debian
run: build VERSION = $(shell git describe --tags)
reset BUILDTIME = $(shell date +%Y.%m.%d)
cp -f control-panel-dns ~/
sudo ./control-panel-dns all: build
./control-panel-dns
build: build:
-mkdir -p resources/ GO111MODULE=off go build \
-cp ~/go/src/go.wit.com/toolkits/*.so resources/ -ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
GO111MODULE="off" go build -v
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:
goimports -w *.go goimports -w *.go
@ -41,9 +55,6 @@ nocui: reset build
check-git-clean: check-git-clean:
@git diff-index --quiet HEAD -- || (echo "Git repository is dirty, please commit your changes first"; exit 1) @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: build-release:
reset reset
go get -v -u -x . go get -v -u -x .
@ -71,10 +82,6 @@ clean:
-rm -f resources/*.so -rm -f resources/*.so
-rm *.deb -rm *.deb
debian:
cd debian && make
-wit mirrors
netlink: netlink:
GO111MODULE="off" go get -v -u github.com/vishvananda/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" "go.wit.com/log"
) )
var args struct { var argv args
type args struct {
Daemon bool `arg:"--daemon" help:"run without a gui"` Daemon bool `arg:"--daemon" help:"run without a gui"`
} }
func init() { func init() {
arg.MustParse(&args) arg.MustParse(&argv)
if debugger.ArgDebug() { if debugger.ArgDebug() {
log.Info("cmd line --debugger == true") 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" "go.wit.com/lib/gui/linuxstatus"
) )
// sent via -ldflags
var VERSION string
var BUILDTIME string
//go:embed resources/* //go:embed resources/*
var resToolkit embed.FS var resToolkit embed.FS