forked from MTSR/mapserver
refactored build pipeline
This commit is contained in:
parent
b636cda646
commit
73256aa5fb
11
Makefile
11
Makefile
@ -3,7 +3,16 @@ OUT_DIR=output
|
||||
MOD_ZIP=$(OUT_DIR)/mapserver-mod.zip
|
||||
|
||||
all: $(OUT_DIR) $(MOD_ZIP)
|
||||
$(MAKE) -C server build-all-docker
|
||||
# build the docker image with all dependencies
|
||||
$(MAKE) -C docker_builder build
|
||||
# build all with the docker image
|
||||
sudo docker run --rm -it\
|
||||
-v $(shell pwd)/server/:/app\
|
||||
-v mapserver-volume:/root/go\
|
||||
-w /app\
|
||||
mapserver-builder\
|
||||
make test all
|
||||
# copy generated files to output dir
|
||||
cp server/output/* $(OUT_DIR)/
|
||||
|
||||
$(OUT_DIR):
|
||||
|
21
doc/dev.md
21
doc/dev.md
@ -15,7 +15,7 @@ Either apt-get:
|
||||
* gcc-5-arm-linux-gnueabihf
|
||||
* gcc-i686-linux-gnu
|
||||
|
||||
Or use the docker-builder image in `server/docker`
|
||||
Or use the docker-builder image in `/docker-builder`
|
||||
|
||||
# Development setup
|
||||
|
||||
@ -61,13 +61,24 @@ pgsql_player_connection = host=localhost port=5432 user=postgres password=enter
|
||||
* Start the server with `go run .` or with debug output: `go run . -debug`
|
||||
* The web files in `static/` can now be changed on the fly without restarting the server
|
||||
|
||||
# All platform build
|
||||
|
||||
Prerequisites:
|
||||
* docker
|
||||
* make
|
||||
|
||||
Building:
|
||||
* Run `make clean all` to build for all supported targets
|
||||
|
||||
The artifacts should now be in the `output` directory
|
||||
|
||||
# Release build
|
||||
|
||||
Prerequisites:
|
||||
* docker
|
||||
* go >= 1.11
|
||||
* make
|
||||
* valid github token in `.releasetoken`
|
||||
|
||||
Building:
|
||||
* Build the docker-image in the `docker` directory with: `cd docker && make build`
|
||||
* Run `make clean build-docker` to build for all supported targets
|
||||
|
||||
The artifacts should now be in the `output` directory
|
||||
* Run `./release.sh <version>`
|
||||
|
9
docker_builder/Dockerfile
Normal file
9
docker_builder/Dockerfile
Normal file
@ -0,0 +1,9 @@
|
||||
FROM ubuntu:bionic
|
||||
|
||||
RUN apt-get update &&\
|
||||
apt-get install -y gcc-mingw-w64 gcc-5-arm-linux-gnueabihf gcc-i686-linux-gnu &&\
|
||||
apt-get install -y software-properties-common git
|
||||
|
||||
RUN add-apt-repository ppa:longsleep/golang-backports &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y golang-go
|
4
docker_builder/Makefile
Normal file
4
docker_builder/Makefile
Normal file
@ -0,0 +1,4 @@
|
||||
TAG=mapserver-builder
|
||||
|
||||
build:
|
||||
sudo docker build . -t $(TAG)
|
12
docker_builder/readme.md
Normal file
12
docker_builder/readme.md
Normal file
@ -0,0 +1,12 @@
|
||||
Docker builder container
|
||||
===============
|
||||
|
||||
Builds the mapserver with all supported architectures/platforms
|
||||
|
||||
|
||||
Building the builder:
|
||||
```
|
||||
make build
|
||||
```
|
||||
|
||||
This creates an image with the name `mapserver-builder`
|
@ -1,11 +1,14 @@
|
||||
|
||||
STATIC_VFS=vfs/static.go
|
||||
OUT_DIR=output
|
||||
ENV=GO111MODULE=on
|
||||
|
||||
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static"
|
||||
|
||||
all: build-all
|
||||
BINARIES = $(OUT_DIR)/mapserver-linux-x86_64
|
||||
BINARIES += $(OUT_DIR)/mapserver-linux-x86
|
||||
BINARIES += $(OUT_DIR)/mapserver-windows-x86.exe
|
||||
BINARIES += $(OUT_DIR)/mapserver-windows-x86-64.exe
|
||||
BINARIES += $(OUT_DIR)/mapserver-linux-arm
|
||||
|
||||
$(OUT_DIR):
|
||||
mkdir $@
|
||||
@ -22,34 +25,26 @@ clean:
|
||||
rm -rf $(STATIC_VFS)
|
||||
rm -rf $(OUT_DIR)
|
||||
|
||||
clean-all: clean
|
||||
rm -rf mapserver.sqlite*
|
||||
rm -rf mapserver.tiles
|
||||
rm -rf mapserver.json
|
||||
|
||||
build-docker:
|
||||
sudo docker run --rm -it -v $(shell pwd)/:/app -v mapserver-volume:/root/go -w /app mapserver-builder make build
|
||||
|
||||
build-all-docker:
|
||||
sudo docker run --rm -it -v $(shell pwd)/:/app -v mapserver-volume:/root/go -w /app mapserver-builder make build-all
|
||||
|
||||
build: $(OUT_DIR)
|
||||
$(STATIC_VFS):
|
||||
go generate
|
||||
# native
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc go build $(GO_LDFLAGS) -o $(OUT_DIR)/mapserver-linux-x86_64
|
||||
|
||||
build-all: $(OUT_DIR)
|
||||
go generate
|
||||
# native
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 CC=x86_64-linux-gnu-gcc go build $(GO_LDFLAGS) -o $(OUT_DIR)/mapserver-linux-x86_64
|
||||
$(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 $@
|
||||
|
||||
$(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 $(OUT_DIR)/mapserver-linux-x86
|
||||
# apt install gcc-mingw-w64
|
||||
GOARCH=386 GOOS=windows CC=i686-w64-mingw32-gcc CGO_ENABLED=1 go build -o $(OUT_DIR)/mapserver-windows-x86.exe
|
||||
GOARCH=amd64 GOOS=windows CC=x86_64-w64-mingw32-gcc CGO_ENABLED=1 go build -o $(OUT_DIR)/mapserver-windows-x86-64.exe
|
||||
# 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 $(OUT_DIR)/mapserver-linux-arm
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-7 go build $(GO_LDFLAGS) -o $@
|
||||
|
||||
#go test -cpuprofile cpu.prof -memprofile mem.prof -bench . ./mapblockrenderer/
|
||||
#go tool pprof cpu.prof
|
||||
#top
|
||||
$(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 $@
|
||||
|
||||
$(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 $@
|
||||
|
||||
$(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 $@
|
||||
|
||||
all: $(STATIC_VFS) $(BINARIES)
|
||||
|
@ -1,9 +0,0 @@
|
||||
from ubuntu
|
||||
|
||||
run apt-get update &&\
|
||||
apt-get install -y gcc-mingw-w64 gcc-5-arm-linux-gnueabihf gcc-i686-linux-gnu &&\
|
||||
apt-get install -y software-properties-common git &&\
|
||||
add-apt-repository ppa:longsleep/golang-backports &&\
|
||||
apt-get update &&\
|
||||
apt-get install -y golang-go
|
||||
|
@ -1,4 +0,0 @@
|
||||
TAG=mapserver-builder
|
||||
|
||||
build:
|
||||
docker build . -t $(TAG)
|
Loading…
Reference in New Issue
Block a user