Skip to content

Instantly share code, notes, and snippets.

@benbjohnson
Created January 9, 2014 18:03
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benbjohnson/8338908 to your computer and use it in GitHub Desktop.
Save benbjohnson/8338908 to your computer and use it in GitHub Desktop.
Cross Compile w/ drone.io
# This is what I have so far. The Go 1.2 installation doesn't seem to be correct so it's still breaking.
rm -rf /usr/local/go/src/pkg/appengine
rm -rf /usr/local/go/src/pkg/appengine_internal
rm /usr/local/go/src/pkg/os/error_posix.go
wget -O golang-crosscompile-master.zip https://github.com/davecheney/golang-crosscompile/archive/master.zip
unzip golang-crosscompile-master.zip
source golang-crosscompile-master/crosscompile.bash
go-crosscompile-build darwin/amd64
go-crosscompile-build windows/amd64
go-linux-amd64 build -o megajson
gzip megajson > megajson-linux-amd64.gz
go-darwin-amd64 build
gzip megajson > megajson-darwin-amd64.gz
go-windows-amd64 build
zip megajson > megajson-windows-amd64.zip
@BenPhegan
Copy link

Thanks for the start. Got this working, not very elegant but:

go get github.com/elazarl/goproxy
go build
go test

pushd ~
wget -q -O go1.3.linux-amd64.tar.gz http://golang.org/dl/go1.3.linux-amd64.tar.gz
tar -xzf go1.3.linux-amd64.tar.gz
export GOROOT=~/go
export PATH=$GOROOT/bin:$PATH
rm -rf ~/go/src/pkg/appengine
rm -rf ~/go/src/pkg/appengine_internal

popd

which go

wget -q -O golang-crosscompile-master.zip https://github.com/davecheney/golang-crosscompile/archive/master.zip
unzip golang-crosscompile-master.zip
source golang-crosscompile-master/crosscompile.bash
go-crosscompile-build darwin/amd64 2>&1 /dev/null
go-crosscompile-build windows/amd64 2>&1 /dev/null

cd $BUILD_DIR
go-linux-amd64 build
gzip -c fauxpi > fauxpi-linux-amd64.gz

go-darwin-amd64 build
gzip -c fauxpi > fauxpi-darwin-amd64.gz

go-windows-amd64 build
gzip -c fauxpi > fauxpi-windows-amd64.gz

@xogeny
Copy link

xogeny commented Dec 12, 2014

Thanks for this. The drone.io docs just don't cut it. This worked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment