forked from MTSR/mapserver
proper version number for builds
This commit is contained in:
parent
73256aa5fb
commit
d112bf4be7
3
Makefile
3
Makefile
@ -1,6 +1,7 @@
|
||||
|
||||
OUT_DIR=output
|
||||
MOD_ZIP=$(OUT_DIR)/mapserver-mod.zip
|
||||
VERSION=git-$(shell git rev-parse HEAD)
|
||||
|
||||
all: $(OUT_DIR) $(MOD_ZIP)
|
||||
# build the docker image with all dependencies
|
||||
@ -11,7 +12,7 @@ all: $(OUT_DIR) $(MOD_ZIP)
|
||||
-v mapserver-volume:/root/go\
|
||||
-w /app\
|
||||
mapserver-builder\
|
||||
make test all
|
||||
make test all VERSION=$(VERSION)
|
||||
# copy generated files to output dir
|
||||
cp server/output/* $(OUT_DIR)/
|
||||
|
||||
|
@ -1,8 +1,13 @@
|
||||
STATIC_VFS=vfs/static.go
|
||||
OUT_DIR=output
|
||||
ENV=GO111MODULE=on
|
||||
VERSION=git-$(shell git rev-parse HEAD)
|
||||
|
||||
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static"
|
||||
|
||||
# -ldflags="-X mapserver/app.Version=1.0"
|
||||
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static -X mapserver/app.Version=$(VERSION)"
|
||||
GO_LDFLAGS_WIN=-ldflags "-X mapserver/app.Version=$(VERSION)"
|
||||
GO_BUILD=CGO_ENABLED=1 go build
|
||||
|
||||
BINARIES = $(OUT_DIR)/mapserver-linux-x86_64
|
||||
BINARIES += $(OUT_DIR)/mapserver-linux-x86
|
||||
@ -30,21 +35,21 @@ $(STATIC_VFS):
|
||||
|
||||
$(OUT_DIR)/mapserver-linux-x86_64: $(OUT_DIR)
|
||||
# native (linux x86_64)
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc go build $(GO_LDFLAGS) -o $@
|
||||
GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc $(GO_BUILD) $(GO_LDFLAGS) -o $@
|
||||
|
||||
$(OUT_DIR)/mapserver-linux-x86: $(OUT_DIR)
|
||||
# apt install gcc-8-i686-linux-gnu
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-7 go build $(GO_LDFLAGS) -o $@
|
||||
GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-7 $(GO_BUILD) $(GO_LDFLAGS) -o $@
|
||||
|
||||
$(OUT_DIR)/mapserver-windows-x86.exe: $(OUT_DIR)
|
||||
# apt install gcc-mingw-w64
|
||||
GOARCH=386 GOOS=windows CC=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o $@
|
||||
GOARCH=386 GOOS=windows CC=i686-w64-mingw32-gcc $(GO_BUILD) $(GO_LDFLAGS_WIN) -o $@
|
||||
|
||||
$(OUT_DIR)/mapserver-windows-x86-64.exe: $(OUT_DIR)
|
||||
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 go build -o $@
|
||||
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc $(GO_BUILD) $(GO_LDFLAGS_WIN) -o $@
|
||||
|
||||
$(OUT_DIR)/mapserver-linux-arm: $(OUT_DIR)
|
||||
# apt install gcc-5-arm-linux-gnueabihf
|
||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 CGO_ENABLED=1 go build $(GO_LDFLAGS) -o $@
|
||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 $(GO_BUILD) $(GO_LDFLAGS) -o $@
|
||||
|
||||
all: $(STATIC_VFS) $(BINARIES)
|
||||
|
@ -13,10 +13,6 @@ import (
|
||||
"mapserver/tilerenderer"
|
||||
)
|
||||
|
||||
const (
|
||||
Version = "1.0.1"
|
||||
)
|
||||
|
||||
type App struct {
|
||||
Params params.ParamsType
|
||||
Config *Config
|
||||
|
3
server/app/version.go
Normal file
3
server/app/version.go
Normal file
@ -0,0 +1,3 @@
|
||||
package app
|
||||
|
||||
var Version = "dev"
|
@ -9,6 +9,7 @@ import (
|
||||
|
||||
//Public facing config
|
||||
type PublicConfig struct {
|
||||
Version string `json:"version"`
|
||||
Layers []*layer.Layer `json:"layers"`
|
||||
MapObjects *app.MapObjectConfig `json:"mapobjects"`
|
||||
}
|
||||
@ -23,6 +24,7 @@ func (h *ConfigHandler) ServeHTTP(resp http.ResponseWriter, req *http.Request) {
|
||||
webcfg := PublicConfig{}
|
||||
webcfg.Layers = h.ctx.Config.Layers
|
||||
webcfg.MapObjects = h.ctx.Config.MapObjects
|
||||
webcfg.Version = app.Version
|
||||
|
||||
json.NewEncoder(resp).Encode(webcfg)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user