Skip to content

Commit

Permalink
Makefile: introduce version handling
Browse files Browse the repository at this point in the history
  • Loading branch information
apprehensions committed Nov 11, 2023
1 parent 2df963a commit cae2d31
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
VERSION = v1.5.8

PREFIX = /usr
BINPREFIX = $(PREFIX)/libexec/vinegar
APPPREFIX = $(PREFIX)/share/applications
Expand All @@ -9,7 +11,7 @@ GO = go
GO_LDFLAGS = -s -w

VINEGAR_ICONPATH = $(ICONPREFIX)/64x64/apps/$(FLATPAK).png
VINEGAR_LDFLAGS = $(GO_LDFLAGS) -X main.BinPrefix=$(BINPREFIX)
VINEGAR_LDFLAGS = $(GO_LDFLAGS) -X main.BinPrefix=$(BINPREFIX) -X main.Version=$(VERSION)
VINEGAR_GOFLAGS = --tags nowayland,novulkan

all: vinegar robloxmutexer.exe
Expand Down
17 changes: 12 additions & 5 deletions cmd/vinegar/vinegar.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@ import (
"github.com/vinegarhq/vinegar/wine"
)

var BinPrefix string
var (
BinPrefix string
Version string
)

func usage() {
fmt.Fprintln(os.Stderr, "usage: vinegar [-config filepath] player|studio [args...]")
fmt.Fprintln(os.Stderr, "usage: vinegar [-config filepath] exec prog [args...]")
fmt.Fprintln(os.Stderr, " vinegar [-config filepath] edit|kill|uninstall|delete|install-webview2|winetricks|sysinfo")
fmt.Fprintln(os.Stderr, " vinegar [-config filepath] exec prog [args...]")
fmt.Fprintln(os.Stderr, " vinegar [-config filepath] delete|edit|uninstall|version")
fmt.Fprintln(os.Stderr, " vinegar [-config filepath] kill|install-webview2|winetricks|sysinfo")
os.Exit(1)
}

Expand All @@ -38,7 +42,7 @@ func main() {

switch cmd {
// These commands don't require a configuration
case "delete", "edit", "uninstall":
case "delete", "edit", "uninstall", "version":
switch cmd {
case "delete":
Delete()
Expand All @@ -48,6 +52,8 @@ func main() {
}
case "uninstall":
Uninstall()
case "version":
fmt.Println("Vinegar", Version)
}
// These commands (except player & studio) don't require a configuration,
// but they require a wineprefix, hence wineroot of configuration is required.
Expand Down Expand Up @@ -132,13 +138,14 @@ func Sysinfo(pfx *wine.Prefix) {
}

info := `## System information
* Vinegar: %s
* Distro: %s
* Processor: %s
* Supports AVX: %t
* Kernel: %s
* Wine: %s`

fmt.Printf(info, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.Kernel, ver)
fmt.Printf(info, Version, sysinfo.Distro, sysinfo.CPU, sysinfo.HasAVX, sysinfo.Kernel, ver)
if sysinfo.InFlatpak {
fmt.Println("* Flatpak: [x]")
}
Expand Down

0 comments on commit cae2d31

Please sign in to comment.