Move the majority of functions in tool.go to a lib package to allow other go
programs to use the api (like build operation) easily without duplicating the code
Merge branch 'd'

Conflicts:
	tool.go
Merge branch 'master' of https://github.com/neelance/gopherjs