go をクロスコンパイル対応でインストール
- http://unknownplace.org/archives/golang-cross-compiling.html
- https://github.com/davecheney/golang-crosscompile
- http://dave.cheney.net/2013/07/09/an-introduction-to-cross-compilation-with-go-1-1
- https://github.com/laher/goxc
例えば golang は linux でも mac 用のバイナリを作れるという、なんともすばらしい特徴があるらしい。
クロスコンパイル可能な状態でインストールするのが、なんとなくメンドウだったのでスクリプトにまとめてみた。
使い方
curl https://raw.githubusercontent.com/shoichikaji/golang-crosscompile-installer/master/installer.pl | perl -
を実行すれば、go1.2.1 が ~/.go に入る。
例えば centos6.5 に入れると
> find .go/bin -name go .go/bin/go .go/bin/freebsd_386/go .go/bin/linux_386/go .go/bin/freebsd_arm/go .go/bin/freebsd_amd64/go .go/bin/linux_arm/go .go/bin/darwin_386/go .go/bin/darwin_amd64/go
みたいになり、
go-darwin-amd64 build hello.go
で mac 用のバイナリがつくれる!
PS
goenv が乱立してて、どれがいいのかわかりません。