working statically linked binaries
This commit is contained in:
parent
4f7ed7a94c
commit
64b1e56e21
@ -3,6 +3,8 @@ STATIC_VFS=vfs/static.go
|
||||
OUT_DIR=output
|
||||
ENV=GO111MODULE=on
|
||||
|
||||
GO_LDFLAGS=-ldflags "-linkmode external -extldflags -static"
|
||||
|
||||
all: build
|
||||
|
||||
$(OUT_DIR):
|
||||
@ -20,10 +22,12 @@ $(STATIC_VFS):
|
||||
${HOME}/go/bin/esc -o $@ -prefix="static/" -pkg vfs static
|
||||
|
||||
build: $(STATIC_VFS) $(OUT_DIR)
|
||||
#CGO_ENABLED=1 GOOS=linux GOARCH=386 go build -o $(OUT_DIR)/mapserver-linux-x86
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o $(OUT_DIR)/mapserver-linux-x86_64
|
||||
# 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
|
||||
# apt install gcc-8-i686-linux-gnu
|
||||
CGO_ENABLED=1 GOOS=linux GOARCH=386 CC=i686-linux-gnu-gcc-8 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, TODO: container
|
||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 CGO_ENABLED=1 go build -ldflags "-linkmode external -extldflags -static" -o $(OUT_DIR)/mapserver-linux-arm
|
||||
GOARCH=arm GOARM=7 CC=arm-linux-gnueabihf-gcc-5 CGO_ENABLED=1 go build $(GO_LDFLAGS) -o $(OUT_DIR)/mapserver-linux-arm
|
||||
|
Loading…
Reference in New Issue
Block a user