add new build environment for cross compile
This commit is contained in:
parent
63b1e5497b
commit
952ebbf1fc
|
@ -0,0 +1 @@
|
||||||
|
*
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Dockerfile for cross-platform Pomo builds
|
||||||
|
FROM golang:1.12-stretch
|
||||||
|
|
||||||
|
ENV OSXCROSS_REPO="https://github.com/tpoechtrager/osxcross.git"
|
||||||
|
ENV OSX_SDK_TARBALL="https://s3.dockerproject.org/darwin/v2/MacOSX10.11.sdk.tar.xz"
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
apt-get update -yyq \
|
||||||
|
&& apt-get install -yyq \
|
||||||
|
clang \
|
||||||
|
libxml2 \
|
||||||
|
patch \
|
||||||
|
xz-utils
|
||||||
|
|
||||||
|
RUN \
|
||||||
|
mkdir /build \
|
||||||
|
&& cd /build \
|
||||||
|
&& git clone --depth=1 "$OSXCROSS_REPO" \
|
||||||
|
&& cd osxcross/tarballs \
|
||||||
|
&& wget "$OSX_SDK_TARBALL" \
|
||||||
|
&& cd .. \
|
||||||
|
&& UNATTENDED=1 ./build.sh
|
||||||
|
|
||||||
|
ENV PATH="$PATH:/build/osxcross/target/bin"
|
20
Makefile
20
Makefile
|
@ -1,25 +1,22 @@
|
||||||
|
DOCKER_CMD=docker run --rm -ti --user 1000 -w /build/pomo -v $$PWD:/build/pomo
|
||||||
|
DOCKER_IMAGE=pomo-build
|
||||||
VERSION ?= $(shell git describe --tags 2>/dev/null)
|
VERSION ?= $(shell git describe --tags 2>/dev/null)
|
||||||
ifeq "$(VERSION)" ""
|
ifeq "$(VERSION)" ""
|
||||||
VERSION := UNKNOWN
|
VERSION := UNKNOWN
|
||||||
endif
|
endif
|
||||||
|
|
||||||
.PHONY: \
|
.PHONY: \
|
||||||
all \
|
|
||||||
test \
|
test \
|
||||||
docs \
|
docs \
|
||||||
|
pomo-build \
|
||||||
readme \
|
readme \
|
||||||
release \
|
release \
|
||||||
release-linux \
|
release-linux \
|
||||||
release-darwin
|
release-darwin
|
||||||
|
|
||||||
all: bin/pomo
|
|
||||||
|
|
||||||
bin/pomo: test
|
bin/pomo: test
|
||||||
go build -o $@
|
go build -o $@
|
||||||
|
|
||||||
clean:
|
|
||||||
-rm -rfv bin/* docs/*
|
|
||||||
|
|
||||||
bindata.go: tomato-icon.png
|
bindata.go: tomato-icon.png
|
||||||
go-bindata -pkg main -o $@ $^
|
go-bindata -pkg main -o $@ $^
|
||||||
|
|
||||||
|
@ -27,8 +24,15 @@ test:
|
||||||
go test ./...
|
go test ./...
|
||||||
go vet ./...
|
go vet ./...
|
||||||
|
|
||||||
|
pomo-build:
|
||||||
|
docker build -t $(DOCKER_IMAGE) .
|
||||||
|
|
||||||
|
bin/pomo-linux: bin/pomo-$(VERSION)-linux-amd64
|
||||||
|
|
||||||
|
bin/pomo-darwin: bin/pomo-$(VERSION)-darwin-amd64
|
||||||
|
|
||||||
bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
|
bin/pomo-$(VERSION)-linux-amd64: bin bindata.go
|
||||||
go build -ldflags "-X main.Version=$(VERSION)" -o $@
|
$(DOCKER_CMD) --env GOOS=linux --env GOARCH=amd64 $(DOCKER_IMAGE) go build -ldflags "-X main.Version=$(VERSION)" -o $@
|
||||||
|
|
||||||
bin/pomo-$(VERSION)-linux-amd64.md5:
|
bin/pomo-$(VERSION)-linux-amd64.md5:
|
||||||
md5sum bin/pomo-$(VERSION)-linux-amd64 | sed -e 's/bin\///' > $@
|
md5sum bin/pomo-$(VERSION)-linux-amd64 | sed -e 's/bin\///' > $@
|
||||||
|
@ -36,7 +40,7 @@ bin/pomo-$(VERSION)-linux-amd64.md5:
|
||||||
bin/pomo-$(VERSION)-darwin-amd64: bin bindata.go
|
bin/pomo-$(VERSION)-darwin-amd64: bin bindata.go
|
||||||
# This is used to cross-compile a Darwin compatible Mach-O executable
|
# This is used to cross-compile a Darwin compatible Mach-O executable
|
||||||
# on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
|
# on Linux for OSX, you need to install https://github.com/tpoechtrager/osxcross
|
||||||
PATH="$$PATH:/usr/local/osx-ndk-x86/bin" GOOS=darwin GOARCH=amd64 CC=/usr/local/osx-ndk-x86/bin/x86_64-apple-darwin15-cc CGO_ENABLED=1 go build $(FLAGS) -o $@
|
$(DOCKER_CMD) --env GOOS=darwin --env GOARCH=amd64 --env CC=x86_64-apple-darwin15-cc --env CGO_ENABLED=1 $(DOCKER_IMAGE) go build -ldflags "-X main.Version=$(VERSION)" -o $@
|
||||||
|
|
||||||
|
|
||||||
bin/pomo-$(VERSION)-darwin-amd64.md5:
|
bin/pomo-$(VERSION)-darwin-amd64.md5:
|
||||||
|
|
Loading…
Reference in New Issue