The Go toolchain used to require that we rebuild the compiler and
friends (the cgo command) when building a cgo-enabled cross compiler.
This meant that gomobile init used to invoke make.bash in a temporary
copy of the GOROOT. This works, but brings with it several
complications, including needing to use -toolexec when invoking the
go tool, finding a boostrap copy of Go 1.4, long initialization
times, and a variety of unusual failure modes.
Fortunately we don't need our own compiler any more. All that's
necessary is building the standard library for the cross-compilation
targets and making sure the right C compiler is used when calling
go build (as it always was). This means most of the initialization
process can be replaced with a carefully invoked 'go install std'.
While here, remove the source install instructions (most of it is
documented already, and the final step, choosing the right git
revision should be within the skills of anyone using pre-release
software.) Some other documentation is changing because it's been a
while since go generate was run.
Change-Id: I88c10fef87867536e83c7df063ae7241b2e9eea4
Reviewed-on: https://go-review.googlesource.com/11711
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Also add a very simple test for gomobile build, some
documentation cleanup, and the -o flag for bind.
Change-Id: I719b92010ba2a5813049827c99502828788611ef
Reviewed-on: https://go-review.googlesource.com/11253
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
The user may have set GOBIN, in which case the existing go command is
overwritten. I cannot think of any relevant environment variables the
user would set, so the easiest thing is not to use them at all.
While here, fix the unit test I broke in cl/10319.
Change-Id: I8cef353b5a0e4aabae97169ff553b53f7973ff8b
Reviewed-on: https://go-review.googlesource.com/10397
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Fixesgolang/go#10760 maybe, I have been unable to reproduce it.
Change-Id: Iaeec631f5a6be29b312969df12f6bd6b95bc2aa1
Reviewed-on: https://go-review.googlesource.com/9880
Reviewed-by: Burcu Dogan <jbd@google.com>
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Instead of trying to preserve the unpacked NDK, this stores the
downloaded archives in GOPATH/pkg/gomobile/dl and completely
rebuilds on reinitialization.
Also introduce checking that the version of Go we are using to do
the build matches the GOROOT we are building from.
Fixesgolang/go#10187
Change-Id: I4a861718d8a413855917a5b1f1073e2cd84c9bb1
Reviewed-on: https://go-review.googlesource.com/9685
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: I2a41cf0f16dcefe87c73ab0a8f02a251c1243157
Reviewed-on: https://go-review.googlesource.com/8121
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
filepath.Join returns a Cleaned path that went through FromSlash.
Change-Id: I23afeea32453c3eb271d4e4bf47147940061c20f
Reviewed-on: https://go-review.googlesource.com/7161
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Change-Id: I415a6c4693be340ff8236d5f56c3c00fa95ce2e0
Reviewed-on: https://go-review.googlesource.com/6822
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Also moved the full ndk fetch into a separate function.
Change-Id: Ib5c4687e98a5d92ff3aa3ca99ec0ebee85d31f86
Reviewed-on: https://go-review.googlesource.com/6662
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This change makes bind remove existing symlinks to Go.java, Seq.java in outdir
and overwrites them with new paths.
Change-Id: I2d24fbfd04a2bee94c0fa220fa0bba2ec600ae4c
Reviewed-on: https://go-review.googlesource.com/5883
Reviewed-by: David Crawshaw <crawshaw@golang.org>
This feature is necessary when the cross compilers need to be rebuilt
because the goroot has been updated but the ndk version has not changed, or
when rebuilding is required but there is no network.
Currently the test for usable ndk compilers is simply checking
the presence of a file that's created after the ndk tool chain is installed
in the $GOPATH/pkg/gomobile/androind-<ndkversion> directory.
The -u option forces update of the ndk tool chain regardless.
Change-Id: I3d4f62266d436ddc52d158877f08481f92a6a690
Reviewed-on: https://go-review.googlesource.com/5140
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Each cross compiler needs tools that are stored under
GOROOT/pkg/tool/GOHOSTOS_GOHOSTARCH: 5g, 5l, etc. This means a
single GOROOT is incompatible with multiple cross compilers for
different GOOS targets that share a GOARCH. In particular, it
means android/arm and darwin/arm cannot co-exist.
To avoid conflicting paths, this CL installs the cross-compiler
tools under GOPATH/pkg/gomobile. The Go tool is instructed to
use them using the new -toolexec flag. This means far less
meddling in the user's GOROOT.
Unfortunately, the standard library .a files (and textflag.h/funcdata.h)
must still be installed under GOROOT/pkg/GOOS_GOARCH. However this path
does not conflict across cross compiler toolchains, nor with the host
toolchain.
Change-Id: I088142281cf441365072c77f4cb73683b5ffd0ce
Reviewed-on: https://go-review.googlesource.com/5040
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Change-Id: Iaaf72a06cc64e50e62c9282c95ab28317e4c915a
Reviewed-on: https://go-review.googlesource.com/4740
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
Besides being useful for debugging, I intend to use these in a
followup CL to write some simple tests.
Change-Id: I9420c0b72111bcc86ce0330886106221aab533ba
Reviewed-on: https://go-review.googlesource.com/4690
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>
init command uses the first path in the GOPATH path list.
build command searches all path elements until it finds the one
with the compiler tool chain.
Change-Id: Ia2914243965a5ef56546ff6e75af22f49457d07d
Reviewed-on: https://go-review.googlesource.com/4560
Reviewed-by: David Crawshaw <crawshaw@golang.org>
Several standard Go tool flags are not supported yet, those will
come in followup CLs.
Change-Id: I1d98afccf3063d7a3313f66b9fd57067fcfa5297
Reviewed-on: https://go-review.googlesource.com/4450
Reviewed-by: Hyang-Ah Hana Kim <hyangah@gmail.com>