From 75c9f34374485d535c90e45a103f1c2fbbbcc82c Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Mon, 23 Sep 2019 18:12:20 +0900 Subject: [PATCH] cmd/ebitenmobile: Bug fix: Give environment variables to search the package name --- cmd/ebitenmobile/main.go | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/cmd/ebitenmobile/main.go b/cmd/ebitenmobile/main.go index f860e104b..927febe98 100644 --- a/cmd/ebitenmobile/main.go +++ b/cmd/ebitenmobile/main.go @@ -131,7 +131,22 @@ func main() { } func doBind(args []string, flagset *flag.FlagSet) error { - pkgs, err := packages.Load(nil, flagset.Args()[0]) + tags := buildTags + cfg := &packages.Config{} + switch buildTarget { + case "android": + cfg.Env = append(os.Environ(), "GOOS=android") + case "ios": + cfg.Env = append(os.Environ(), "GOOS=darwin") + if tags != "" { + tags += " " + } + tags += "ios" + } + cfg.BuildFlags = []string{"-tags", tags} + cfg.Mode |= packages.NeedName + + pkgs, err := packages.Load(cfg, flagset.Args()[0]) if err != nil { return err }