mirror of
https://github.com/nkanaev/yarr.git
synced 2025-05-24 00:33:14 +00:00
show version info
This commit is contained in:
parent
dc0d8bb50b
commit
751ccd2cd4
11
main.go
11
main.go
@ -2,6 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"github.com/nkanaev/yarr/server"
|
||||
"github.com/nkanaev/yarr/storage"
|
||||
"github.com/nkanaev/yarr/platform"
|
||||
@ -10,12 +11,22 @@ import (
|
||||
"path/filepath"
|
||||
)
|
||||
|
||||
var Version string = "v0.0"
|
||||
var GitHash string = "unknown"
|
||||
|
||||
func main() {
|
||||
var addr, storageFile string
|
||||
var ver bool
|
||||
flag.StringVar(&addr, "addr", "127.0.0.1:7070", "address to run server on")
|
||||
flag.StringVar(&storageFile, "db", "", "storage file path")
|
||||
flag.BoolVar(&ver, "version", false, "print application version")
|
||||
flag.Parse()
|
||||
|
||||
if ver {
|
||||
fmt.Printf("%s (%s)\n", Version, GitHash)
|
||||
return
|
||||
}
|
||||
|
||||
logger := log.New(os.Stdout, "", log.Ldate|log.Ltime|log.Lshortfile)
|
||||
|
||||
configPath, err := os.UserConfigDir()
|
||||
|
12
makefile
12
makefile
@ -1,6 +1,12 @@
|
||||
VERSION=v1.0
|
||||
GITHASH=$(shell git rev-parse --short=8 HEAD)
|
||||
|
||||
ASSETS = assets/javascripts/* assets/stylesheets/* assets/graphicarts/* assets/index.html
|
||||
CGO_ENABLED=1
|
||||
|
||||
GO_LDFLAGS = -s -w
|
||||
GO_LDFLAGS := $(GO_LDFLAGS) -X 'main.Version=$(VERSION)' -X 'main.GitHash=$(GITHASH)'
|
||||
|
||||
default: bundle
|
||||
|
||||
server/assets_bundle.go: $(ASSETS)
|
||||
@ -12,7 +18,7 @@ build_macos: bundle
|
||||
set GOOS=darwin
|
||||
set GOARCH=amd64
|
||||
mkdir -p _output/macos
|
||||
go build -tags "sqlite_foreign_keys release macos" -ldflags="-s -w" -o _output/macos/yarr main.go
|
||||
go build -tags "sqlite_foreign_keys release macos" -ldflags="$(GO_LDFLAGS)" -o _output/macos/yarr main.go
|
||||
cp artwork/icon.png _output/macos/icon.png
|
||||
go run scripts/package_macos.go _output/macos
|
||||
|
||||
@ -20,11 +26,11 @@ build_linux: bundle
|
||||
set GOOS=linux
|
||||
set GOARCH=386
|
||||
mkdir -p _output/linux
|
||||
go build -tags "sqlite_foreign_keys release linux" -ldflags="-s -w" -o _output/linux/yarr main.go
|
||||
go build -tags "sqlite_foreign_keys release linux" -ldflags="$(GO_LDFLAGS)" -o _output/linux/yarr main.go
|
||||
|
||||
build_windows: bundle
|
||||
set GOOS=windows
|
||||
set GOARCH=386
|
||||
mkdir -p _output/windows
|
||||
windres -i artwork/versioninfo.rc -O coff -o platform/versioninfo.syso
|
||||
go build -tags "sqlite_foreign_keys release windows" -ldflags="-s -w -H windowsgui" -o _output/windows/yarr.exe main.go
|
||||
go build -tags "sqlite_foreign_keys release windows" -ldflags="$(GO_LDFLAGS) -H windowsgui" -o _output/windows/yarr.exe main.go
|
||||
|
Loading…
x
Reference in New Issue
Block a user