Skip to content

Commit

Permalink
Merge pull request #1502 from andydotxyz/fix/1497
Browse files Browse the repository at this point in the history
Remove 32bit from iOS apps, Go 1.15 does not allow it
  • Loading branch information
andydotxyz committed Nov 4, 2020
2 parents 45dfb8f + 2d9a597 commit aec4f79
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 13 deletions.
6 changes: 3 additions & 3 deletions cmd/fyne/internal/mobile/bind.go
Expand Up @@ -65,14 +65,14 @@ func writeFile(filename string, generate func(io.Writer) error) error {
return generate(f)
}

func packagesConfig(targetOS string) *packages.Config {
func packagesConfig(targetOS, targetArch string) *packages.Config {
config := &packages.Config{}
// Add CGO_ENABLED=1 explicitly since Cgo is disabled when GOOS is different from host OS.
config.Env = append(os.Environ(), "GOARCH=arm", "GOOS="+targetOS, "CGO_ENABLED=1")
config.Env = append(os.Environ(), "GOARCH="+targetArch, "GOOS="+targetOS, "CGO_ENABLED=1")
if targetOS == "android" {
// with Cgo enabled we need to ensure the C compiler is set via CC to
// avoid the error: "gcc: error: unrecognized command line option '-marm'"
config.Env = append(os.Environ(), androidEnv["arm"]...)
config.Env = append(os.Environ(), androidEnv[targetArch]...)
}
tags := buildTags
if targetOS == "darwin" {
Expand Down
12 changes: 6 additions & 6 deletions cmd/fyne/internal/mobile/build.go
Expand Up @@ -113,7 +113,7 @@ func runBuildImpl(cmd *command) (*packages.Package, error) {
cmd.usage()
os.Exit(1)
}
pkgs, err := packages.Load(packagesConfig(targetOS), buildPath)
pkgs, err := packages.Load(packagesConfig(targetOS, targetArchs[0]), buildPath)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -152,7 +152,7 @@ func runBuildImpl(cmd *command) (*packages.Package, error) {
return nil, fmt.Errorf("-os=ios requires XCode")
}
if buildRelease {
targetArchs = []string{"arm", "arm64"}
targetArchs = []string{"arm64"}
}

if pkg.Name != "main" {
Expand Down Expand Up @@ -381,8 +381,8 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
}

// verify all archs are supported one while deduping.
isSupported := func(arch string) bool {
for _, a := range allArchs {
isSupported := func(os, arch string) bool {
for _, a := range allArchs[os] {
if a == arch {
return true
}
Expand All @@ -395,7 +395,7 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
if _, ok := seen[arch]; ok {
continue
}
if !isSupported(arch) {
if !isSupported(os, arch) {
return "", nil, fmt.Errorf(`unsupported arch: %q`, arch)
}

Expand All @@ -408,7 +408,7 @@ func parseBuildTarget(buildTarget string) (os string, archs []string, _ error) {
targetOS = "darwin"
}
if all {
return targetOS, allArchs, nil
return targetOS, allArchs[os], nil
}
return targetOS, archs, nil
}
4 changes: 2 additions & 2 deletions cmd/fyne/internal/mobile/build_iosapp.go
Expand Up @@ -27,7 +27,7 @@ func goIOSBuild(pkg *packages.Package, bundleID string, archs []string,
// Detect the team ID
teamID, err := DetectIOSTeamID(cert)
if err != nil {
return nil, err
return nil, fmt.Errorf("failed to look up certificate %s: %s", cert, err.Error())
}

projPbxproj := new(bytes.Buffer)
Expand Down Expand Up @@ -306,7 +306,7 @@ var infoplistTmpl = template.Must(template.New("infoplist").Parse(`<?xml version
<string>LaunchScreen</string>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>
<string>arm64</string>
</array>
<key>UIRequiresFullScreen</key>
<true/>
Expand Down
6 changes: 4 additions & 2 deletions cmd/fyne/internal/mobile/env.go
Expand Up @@ -23,7 +23,9 @@ var (

darwinArmNM string

allArchs = []string{"arm", "arm64", "386", "amd64"}
allArchs = map[string][]string{
"android": {"arm", "arm64", "386", "amd64"},
"ios": {"arm64", "amd64"}}

bitcodeEnabled bool
)
Expand Down Expand Up @@ -136,7 +138,7 @@ func envInit() (err error) {

darwinArmNM = "nm"
darwinEnv = make(map[string][]string)
for _, arch := range allArchs {
for _, arch := range allArchs["ios"] {
var env []string
var err error
var clang, cflags string
Expand Down

0 comments on commit aec4f79

Please sign in to comment.