From fec1fd7d8c5c0ce657773e1d1d6ab0115fbe9122 Mon Sep 17 00:00:00 2001 From: Alessandro De Angelis Date: Mon, 20 May 2019 19:04:55 +0200 Subject: [PATCH] [GUI] - Include version and avoid windows to open cmd --- Makefile | 37 +++++++++++++++++++++++-------------- cmd/downloader/main.go | 1 - cmd/gui/main.go | 6 +++++- 3 files changed, 28 insertions(+), 16 deletions(-) diff --git a/Makefile b/Makefile index ed9b9cd6..cae9a87b 100644 --- a/Makefile +++ b/Makefile @@ -1,31 +1,40 @@ -#get latest git tag +# get latest git tag TAG = $$(git describe --abbrev=0 --tags) -#get current date and time +# get current date and time NOW = $$(date +'%Y-%m-%d_%T') -#use the linker to inject the informations -LDFLAGS = -ldflags="-X main.release=${TAG} -X main.buildTime=${NOW}" +# use the linker to inject the informations +LDFLAGS = "-X main.release=${TAG} -X main.buildTime=${NOW}" +LDFLAGSWINDOWS = "-H windowsgui -X main.release=${TAG} -X main.buildTime=${NOW}" help: # this command # [generating help from tasks header] @egrep '^[A-Za-z0-9_-]+:' Makefile -osx-build: # Create the executable for OSX - @GOOS=darwin GOARCH=amd64 go build ${LDFLAGS} -o build/comics-downloader-osx ./cmd/downloader +osx-build: # Creates OSX executable + @GOOS=darwin GOARCH=amd64 go build -ldflags=${LDFLAGS} -o build/comics-downloader-osx ./cmd/downloader -windows-build: # Create the executable for WINDOWS - @GOOS=windows GOARCH=amd64 go build ${LDFLAGS} -o build/comics-downloader.exe ./cmd/downloader +windows-build: # Creates Windows executable + @GOOS=windows GOARCH=amd64 go build -ldflags=${LDFLAGS} -o build/comics-downloader.exe ./cmd/downloader -linux-build: # Create the executable for LINUX - @GOOS=linux GOARCH=amd64 go build ${LDFLAGS} -o build/comics-downloader ./cmd/downloader +linux-build: # Creates Linux executable + @GOOS=linux GOARCH=amd64 go build -ldflags=${LDFLAGS} -o build/comics-downloader ./cmd/downloader -gui-builds: # Creates GUI executables for LINUX OSX WINDOWS - fyne-cross --output comics-downloader-gui --targets=linux/amd64,windows/amd64,darwin/amd64 ./cmd/gui +osx-gui-build: # Creates OSX Gui executable + @GOOS=darwin GOARCH=amd64 go build -ldflags=${LDFLAGS} -o build/comics-downloader-gui-osx ./cmd/gui -builds: # Create the executables for OSX/Windows/Linux +windows-gui-build: # Creates Window GUI executable + @CGO_ENABLED=1 GOOS=windows CC=x86_64-w64-mingw32-gcc go build -ldflags=${LDFLAGSWINDOWS} -o build/comics-downloader-gui-windows ./cmd/gui + +linux-gui-build: # Creates LINUX executable + @fyne-cross --ldflags=${LDFLAGS} --output=comics-downloader-gui --targets=linux/amd64 ./cmd/gui + +builds: # Creates executables for OSX/Windows/Linux @make osx-build @make windows-build @make linux-build - @make gui-builds + @make windows-gui-build + @make osx-gui-build + @make linux-gui-build remove-builds: # Remove executables @rm -rf build/ diff --git a/cmd/downloader/main.go b/cmd/downloader/main.go index 4a782e5c..5551dc50 100644 --- a/cmd/downloader/main.go +++ b/cmd/downloader/main.go @@ -15,7 +15,6 @@ var ( ) func main() { - url := flag.String("url", "", "Comic URL or Comic URLS by separating each site with a comma without the use of spaces") format := flag.String("format", "pdf", "Comic format output, supported formats are pdf,epub,cbr,cbz") country := flag.String("country", "", "Set the country to retrieve a manga, Used by MangaRock") diff --git a/cmd/gui/main.go b/cmd/gui/main.go index 013b06a8..a441cd93 100644 --- a/cmd/gui/main.go +++ b/cmd/gui/main.go @@ -1,6 +1,8 @@ package main import ( + "fmt" + "fyne.io/fyne" "fyne.io/fyne/app" "fyne.io/fyne/layout" @@ -15,11 +17,13 @@ func watchLogs(logSection *widget.ScrollContainer, box *widget.Box) { } } +var release string // sha1 revision used to build the program + func main() { options := []string{"pdf", "epub", "cbr", "cbz"} app := app.New() - w := app.NewWindow("Comics Downloader") + w := app.NewWindow(fmt.Sprintf("Comics Downloader %s", release)) urlEntry := widget.NewEntry() urlEntry.SetPlaceHolder("Comic URL or URLs separated by a comma")