mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2024-12-26 03:38:55 +01:00
cmd/ebitnmobile: Bug fix: using ebitenmobile with EBITENMOBILE_GOMOBILE failed
Closes #1667
This commit is contained in:
parent
9cf30d9b70
commit
cf1a91a344
@ -102,14 +102,25 @@ func prepareGomobileCommands() error {
|
||||
os.Chdir(pwd)
|
||||
}()
|
||||
|
||||
if err := runGo("mod", "init", "ebitenmobiletemporary"); err != nil {
|
||||
const modname = "ebitenmobiletemporary"
|
||||
if err := runGo("mod", "init", modname); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := os.WriteFile("tools.go", []byte(fmt.Sprintf(`// +build tools
|
||||
|
||||
package %s
|
||||
|
||||
import (
|
||||
_ "golang.org/x/mobile/cmd/gobind"
|
||||
_ "golang.org/x/mobile/cmd/gomobile"
|
||||
)
|
||||
`, modname)), 0644); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// To record gomobile to go.sum for Go 1.16 and later, go-get gomobile instaed of golang.org/x/mobile (#1487).
|
||||
// This also records gobind as gomobile depends on gobind indirectly.
|
||||
// Using `...` doesn't work on Windows since mobile/internal/mobileinit cannot be compiled on Windows w/o Cgo (#1493).
|
||||
// Note that `go mod tidy` doesn't work since this removes all the indirect imports.
|
||||
if err := runGo("get", "golang.org/x/mobile/cmd/gomobile@"+gomobileHash); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -121,6 +132,9 @@ func prepareGomobileCommands() error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
if err := runGo("mod", "tidy"); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := runGo("build", "-o", exe(filepath.Join("bin", "gomobile")), "golang.org/x/mobile/cmd/gomobile"); err != nil {
|
||||
return err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user