main: run the compiler from any path

This commit is contained in:
Ayke van Laethem
2018-09-24 12:25:33 +02:00
parent 453450f40d
commit fd6dda5e4f
3 changed files with 15 additions and 5 deletions
+2 -2
View File
@@ -134,7 +134,7 @@ func (c *Compiler) Module() llvm.Module {
return c.mod
}
func (c *Compiler) Parse(mainPath string, buildTags []string) error {
func (c *Compiler) Parse(mainPath, sourceDir string, buildTags []string) error {
tripleSplit := strings.Split(c.triple, "-")
config := loader.Config{
@@ -148,7 +148,7 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error {
Build: &build.Context{
GOARCH: tripleSplit[0],
GOOS: tripleSplit[2],
GOROOT: ".",
GOROOT: sourceDir,
GOPATH: runtime.GOROOT(),
CgoEnabled: true,
UseAllFiles: false,