wit-debian-gui/Makefile

109 lines
2.5 KiB
Makefile
Raw Normal View History

2021-11-02 23:44:28 -05:00
GITCOMMIT = $(shell git rev-list -1 HEAD)
GOVERSION = $(shell go version | cut -d' ' -f 3)
BUILDTIME = $(shell date -u --iso-8601=seconds)
VERSION = $(shell cat resources/VERSION)
# PATH=/usr/bin:$PATH go version
run: build
./wit-debian-gui
2021-11-02 23:44:28 -05:00
redomod:
rm -f go.*
go mod init
go mod tidy
new-build:
# go mod edit -replace go.wit.com/wit/gui=/home/jcarr/go/src/git.wit.org/wit/gui
# go mod edit -replace go.wit.com/wit/shell=/home/jcarr/go/src/git.wit.org/wit/shell
# to update go.mod to master:
# go get go.wit.com/gui/gui@master
go install -ldflags " \
-X main.GITCOMMIT=${GITCOMMIT} \
-X main.GOVERSION='${GOVERSION}' \
-X main.BUILDTIME='${BUILDTIME}' \
-X main.VERSION=${VERSION}"
# to build the old way
2021-11-02 23:44:28 -05:00
build:
GO111MODULE="off" go build -v -ldflags " \
2021-11-02 23:44:28 -05:00
-X main.GITCOMMIT=${GITCOMMIT} \
-X main.GOVERSION='${GOVERSION}' \
-X main.BUILDTIME='${BUILDTIME}' \
-X main.VERSION=${VERSION}"
goreleaser:
# go install github.com/goreleaser/goreleaser@latest
goreleaser release
2021-11-02 23:44:28 -05:00
godoc:
godoc -http=:6060
gomod-update:
wit go update
gomod-init:
go mod init
go mod tidy
gomod-clean:
rm -f go.*
sudo: new-build
sudo ~/go/bin/debian-gui
2021-11-02 23:44:28 -05:00
# https://golang.cafe/blog/golang-debugging-with-delve.html
# debug using 'delve'
debug:
dlv debug
push:
wit git push
prep:
apt install -y libgtk-3-dev
apt install -y libappindicator3-dev
apt install -y xterm
tag-version:
# git push --delete origin v0.6.15 # to delete a tag upstream
git diff --quiet
# go build # just an extra check to make sure the damn thing builds
git tag v${VERSION}
git push --tags
icon:
# go get -v github.com/cratonica/2goarray
# go install github.com/cratonica/2goarray
2021-11-02 23:44:28 -05:00
echo "//+build linux darwin" > icon.go
echo >> icon.go
cat resources/wit-logo4.png | 2goarray myIcon main >> icon.go
2021-11-02 23:44:28 -05:00
# a custom go target name
generate:
go generate
build-all:
GOOS=linux GOARCH=386 go build -o bin/linux.x32.bin
GOOS=freebsd GOARCH=386 go build -o bin/freebsd.x32.bin
GOOS=darwin GOARCH=386 go build -o bin/darwin.x32.bin
# https://www.digitalocean.com/community/tutorials/how-to-build-go-executables-for-multiple-platforms-on-ubuntu-16-04
build-darwin:
env GOOS=darwin GOARCH=amd64 go build
build-windows:
env GOOS=windows GOARCH=amd64 go build
gaper:
# 'gaper' is a simple and smart golang tool that just rebuilds every time you change a file
# go get -u github.com/maxcnunes/gaper
gaper
node002: new-build
strip ~/go/bin/debian-gui
-ssh root@node002 rm /root/debian-gui
scp ~/go/bin/debian-gui root@node002:
ssh -X root@node002 /root/debian-gui