update build process

This commit is contained in:
Sebastian Hugentobler 2019-05-29 18:35:50 +02:00
parent 049d0ffda2
commit 9b5238af59
6 changed files with 74 additions and 23 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@
**/.idea/tasks.xml **/.idea/tasks.xml
*.pdf *.pdf
bin/ bin/
dist/

View File

@ -1,25 +1,46 @@
.PHONY: all BINARIES=ecload ecload-tui
all: bin/ecload bin/ecload.exe bin/ecload-mac bin/ecload-tui bin/ecload-tui.exe bin/ecload-tui-mac
VERSION=0.1.0
BUILD:=`git rev-parse HEAD`
PLATFORMS=linux darwin windows
ARCHITECTURES=386 amd64
LDFLAGS=-ldflags "-s -X main.Version=${VERSION} -X main.Build=${BUILD}"
define BUILDER
bin/%/$(TARGET): cmd/$(TARGET)/*.go pkg/ecload/*.go
GOOS=$$(patsubst %/,%,$$(dir $$*)) GOARCH=$$(notdir $$*) go build $(LDFLAGS) -v -o $$@ cmd/$(TARGET)/main.go
endef
$(foreach TARGET,$(BINARIES),$(eval $(BUILDER)))
dist/%.tar.gz:
@mkdir -p ./dist
$(eval TMP := $(shell mktemp -d))
$(eval SANE=$(subst -,/,$*))
$(eval INPUT=bin/$(SANE)/)
$(eval PLATFORM=$(patsubst %/,%,$(dir $(SANE))))
@cp -r $(INPUT)* $(TMP)
@if [ "$(PLATFORM)" == "windows" ]; then \
for FILE in $(TMP)/*; do mv $$FILE $$FILE.exe; done \
fi
tar -zcf $@ -C $(TMP) .
@rm -rf $(TMP)
dist: binaries $(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), dist/$(GOOS)-$(GOARCH).tar.gz))
binaries: $(foreach GOOS, $(PLATFORMS), $(foreach GOARCH, $(ARCHITECTURES), $(foreach BINARY, $(BINARIES), bin/$(GOOS)/$(GOARCH)/$(BINARY))))
all: dist
.PHONY: clean
clean: clean:
rm -r bin/ rm -rf bin/ dist/
go clean ./cmd/ecload/ ./cmd/ecload-tui/ ./pkg/ecload/ go clean ./cmd/ecload ./cmd/ecload-tui ./pkg/ecload
bin/ecload: cmd/ecload/*.go pkg/ecload/*.go .PHONY: all clean binaries dist
GOOS=linux GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload/main.go
bin/ecload.exe: cmd/ecload/*.go pkg/ecload/*.go
GOOS=windows GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload/main.go
bin/ecload-mac: cmd/ecload/*.go pkg/ecload/*.go
GOOS=darwin GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload/main.go
bin/ecload-tui: cmd/ecload-tui/*.go pkg/ecload/*.go
GOOS=linux GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload-tui/main.go
bin/ecload-tui.exe: cmd/ecload-tui/*.go pkg/ecload/*.go
GOOS=windows GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload-tui/main.go
bin/ecload-tui-mac: cmd/ecload-tui/*.go pkg/ecload/*.go
GOOS=darwin GOARCH=amd64 go build -ldflags '-s' -v -o $@ cmd/ecload-tui/main.go

View File

@ -16,6 +16,9 @@ import (
"ecload/pkg/ecload" "ecload/pkg/ecload"
) )
var Version string
var Build string
const THEME = "//----------------- Theme properties -----------------" + const THEME = "//----------------- Theme properties -----------------" +
"//----------------- Colors -----------------" + "//----------------- Colors -----------------" +
"// View colors - internal area and border" + "// View colors - internal area and border" +

View File

@ -13,11 +13,14 @@ import (
"ecload/pkg/ecload" "ecload/pkg/ecload"
) )
var Version string
var Build string
func main() { func main() {
logger := ecload.InitLogger(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr) logger := ecload.InitLogger(ioutil.Discard, os.Stdout, os.Stdout, os.Stderr)
app := cli.App("ecload", "Download books from https://www.e-codices.unifr.ch") app := cli.App("ecload", "Download books from https://www.e-codices.unifr.ch")
app.Version("v version", "0.1.0") app.Version("v version", Version)
app.Spec = "[-o=<PATH>] [-s=<SIZE>] ID" app.Spec = "[-o=<PATH>] [-s=<SIZE>] ID"

5
go.mod
View File

@ -7,11 +7,16 @@ require (
github.com/VladimirMarkelov/clui v1.2.0 github.com/VladimirMarkelov/clui v1.2.0
github.com/atotto/clipboard v0.1.2 // indirect github.com/atotto/clipboard v0.1.2 // indirect
github.com/gizak/termui/v3 v3.0.0 // indirect github.com/gizak/termui/v3 v3.0.0 // indirect
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f // indirect
github.com/huandu/xstrings v1.2.0 // indirect github.com/huandu/xstrings v1.2.0 // indirect
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 // indirect
github.com/jawher/mow.cli v1.1.0 github.com/jawher/mow.cli v1.1.0
github.com/jroimartin/gocui v0.4.0 // indirect github.com/jroimartin/gocui v0.4.0 // indirect
github.com/jung-kurt/gofpdf v1.4.2 github.com/jung-kurt/gofpdf v1.4.2
github.com/mattn/go-runewidth v0.0.4 // indirect github.com/mattn/go-runewidth v0.0.4 // indirect
github.com/nsf/termbox-go v0.0.0-20190325093121-288510b9734e // indirect github.com/nsf/termbox-go v0.0.0-20190325093121-288510b9734e // indirect
github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0 github.com/shibukawa/configdir v0.0.0-20170330084843-e180dbdc8da0
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f // indirect
golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8 // indirect
golang.org/x/tools v0.0.0-20190529010454-aa71c3f32488 // indirect
) )

18
go.sum
View File

@ -13,8 +13,12 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE= github.com/gizak/termui/v3 v3.0.0 h1:NYTUG6ig/sJK05O5FyhWemwlVPO8ilNpvS/PgRtrKAE=
github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY= github.com/gizak/termui/v3 v3.0.0/go.mod h1:uinu2dMdtMI+FTIdEFUJQT5y+KShnhQRshvPblXq3lY=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f h1:Jnx61latede7zDD3DiiP4gmNz33uK0U5HDUaF0a/HVQ=
github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc=
github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0= github.com/huandu/xstrings v1.2.0 h1:yPeWdRnmynF7p+lLYz0H2tthW9lqhMJrQV/U7yy4wX0=
github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4= github.com/huandu/xstrings v1.2.0/go.mod h1:DvyZB1rfVYsBIigL8HwpZgxHwXozlTgGqn63UyNX5k4=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/jawher/mow.cli v1.1.0 h1:NdtHXRc0CwZQ507wMvQ/IS+Q3W3x2fycn973/b8Zuk8= github.com/jawher/mow.cli v1.1.0 h1:NdtHXRc0CwZQ507wMvQ/IS+Q3W3x2fycn973/b8Zuk8=
github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg= github.com/jawher/mow.cli v1.1.0/go.mod h1:aNaQlc7ozF3vw6IJ2dHjp2ZFiA4ozMIYY6PyuRJwlUg=
github.com/jroimartin/gocui v0.4.0 h1:52jnalstgmc25FmtGcWqa0tcbMEWS6RpFLsOIO+I+E8= github.com/jroimartin/gocui v0.4.0 h1:52jnalstgmc25FmtGcWqa0tcbMEWS6RpFLsOIO+I+E8=
@ -38,9 +42,23 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045 h1:Pn8fQdvx+z1avAi7fdM2kRYWQNxGlavNDSyzrQg2SsU=
golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8= golang.org/x/arch v0.0.0-20181203225421-5a4828bb7045/go.mod h1:cYlCBUl1MsqxdiKgmc4uh7TxZfWSFLOGSRR090WDxt8=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f h1:R423Cnkcp5JABoeemiGEPlt9tHXFfw5kvc0yqlxRPWo=
golang.org/x/crypto v0.0.0-20190513172903-22d7a77e9e5f/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/image v0.0.0-20190507092727-e4e5bf290fec/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190507092727-e4e5bf290fec/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180218175443-cbe0f9307d01/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a h1:gOpx8G595UYyvj8UK4+OFyY4rx037g3fmfhe5SasG3U= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a h1:gOpx8G595UYyvj8UK4+OFyY4rx037g3fmfhe5SasG3U=
golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ=
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8 h1:2WjIC11WRITGlVWmyLXKjzIVj1ZwoWZ//tadeUUV6/o=
golang.org/x/sys v0.0.0-20190529130038-5219a1e1c5f8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/tools v0.0.0-20190529010454-aa71c3f32488 h1:vBgi/AgEje1rNScpWGJqe+RPHHZvBqrk9UH+LOXWN6Q=
golang.org/x/tools v0.0.0-20190529010454-aa71c3f32488/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q=