Open joeblew99 opened 7 years ago
No, but I have found this. Do you have OS X host?
Building and deploying to iOS
Run gomobile build to build the package as an iOS application.
Note: target=ios requires the host machine running OS X. You need to obtain a signing identity and download provisioning profiles in order to continue.
hey - yep i am on osx. Its not as easy as the message on the gomobile wiki says. Heaps of others have hit this problem. I am stuck on it at the moment. Others have had to edit the actual golang teams code and replace the BUNDLE_ID.
Your on linux or windows ?
Can you try this Makefile ?
Drop it in the demo/invader folder.
then "make windows", or "make linux"
BINARY = invader
VET_REPORT = vet.report
TEST_REPORT = tests.xml
GOARCH = amd64
VERSION=$(shell git describe --always --tags --abbrev=0)
COMMIT=$(shell git rev-parse HEAD)
BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
# Symlink into GOPATH
GITHUB_USERNAME=gedw99
GO_PATH=github.com/udhos/fugo/demo/${BINARY}
BUILD_DIR=${GOPATH}/src/${GO_PATH}
CURRENT_DIR=$(shell pwd)
BUILD_DIR_LINK=$(shell readlink ${BUILD_DIR})
# Setup the -ldflags option for go build here, interpolate the variable values
LDFLAGS = -ldflags "-X ${GO_PATH}/cmd.VERSION=${VERSION} -X ${GO_PATH}/cmd.COMMIT=${COMMIT} -X ${GO_PATH}/cmd.BRANCH=${BRANCH}"
install:
## Source: https://github.com/udhos/fugo/demo/invader
dep init
#all: link clean test vet linux darwin windows
link:
BUILD_DIR=${BUILD_DIR}; \
BUILD_DIR_LINK=${BUILD_DIR_LINK}; \
CURRENT_DIR=${CURRENT_DIR}; \
if [ "$${BUILD_DIR_LINK}" != "$${CURRENT_DIR}" ]; then \
echo "Fixing symlinks for build"; \
rm -f $${BUILD_DIR}; \
ln -s $${CURRENT_DIR} $${BUILD_DIR}; \
fi
linux:
# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
cd ${BUILD_DIR}; \
GOOS=linux GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-linux-${GOARCH} . ; \
cd - >/dev/null
darwin:
# Works
cd ${BUILD_DIR}; \
GOOS=darwin GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-darwin-${GOARCH} . ; \
cd - >/dev/null
darwin-run:
# Works
./${BINARY}-darwin-${GOARCH}
windows:
# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
cd ${BUILD_DIR}; \
GOOS=windows GOARCH=${GOARCH} go build ${LDFLAGS} -o ${BINARY}-windows-${GOARCH}.exe . ; \
cd - >/dev/null
android:
# Works
cd ${BUILD_DIR}; \
gomobile build -target=android . ; \
cd - >/dev/null
android-run:
# Works
cd ${BUILD_DIR}; \
gomobile install .
cd - >/dev/null
ios:
# Fails due to gomobile code signing error
cd ${BUILD_DIR}; \
gomobile build -target=ios . ; \
test:
if ! hash go2xunit 2>/dev/null; then go install github.com/tebeka/go2xunit; fi
cd ${BUILD_DIR}; \
godep go test -v ./... 2>&1 | go2xunit -output ${TEST_REPORT} ; \
cd - >/dev/null
vet:
-cd ${BUILD_DIR}; \
godep go vet ./... > ${VET_REPORT} 2>&1 ; \
cd - >/dev/null
fmt:
cd ${BUILD_DIR}; \
go fmt $$(go list ./... | grep -v /vendor/) ; \
cd - >/dev/null
clean:
-rm -f ${TEST_REPORT}
-rm -f ${VET_REPORT}
-rm -f ${BINARY}-*
-rm -f *.png
.PHONY: install link linux darwin windows test vet fmt clean
In general i have noticed others bypass the gomobile building command and do what it does under the hood.
try
gomobile -x build .
you will see everything its doing under the hood. I am still learning.
I am on Linux. The Makefile issues this:
udhos@RickDeckard:~/go/src/github.com/udhos/fugo/demo/invader$ make linux
# Fails due to dependency on golang.org/x/mobile/app/app.go:13:2: no buildable Go source files in /Users/apple/workspace/go/src/golang.org/x/mobile/internal/mobileinit
cd /src/github.com/udhos/fugo/demo/invader; \
GOOS=linux GOARCH=amd64 go build -ldflags "-X github.com/udhos/fugo/demo/invader/cmd.VERSION=c0c297ad072b3d305f72c730b5c13aedd710e663 -X github.com/udhos/fugo/demo/invader/cmd.COMMIT=c0c297ad072b3d305f72c730b5c13aedd710e663 -X github.com/udhos/fugo/demo/invader/cmd.BRANCH=master" -o invader-linux-amd64 . ; \
cd - >/dev/null
/bin/sh: 1: cd: can't cd to /src/github.com/udhos/fugo/demo/invader
udhos@RickDeckard:~/go/src/github.com/udhos/fugo/demo/invader$
I guess you meant 'gomobile build -x .'
gomobile -x build . ;# fail
gomobile build -x . ;# ok
Nice!
Are you still looking at this issue?
@udhos thanks :) sloppy typing.
The reason i brought up this issue was to do with how to sign the app for a Google or Apple store. As far as i know you cant sign anything that is gomobile build. You can sign a gomobile bind, because you actually signing it up at the android or xcode level if you know what i mean. From the build.sh does not have any signing capacity from what i see.
So thats why i started to dig into the "gomobile build -x" to see whats happening under the hood.
Any ideas here ?
@joeblew99 This doc gives hints on signing Google Play app with gomobile: https://pt.slideshare.net/takuyaueda967/go-for-mobile-games
@udhos The slide is really well done. thanks !!! Seems that slide 58 is the way to go ? https://docs.google.com/presentation/d/1PvlfcO5OU0Zlv3eISdIgUsRLpXsVaMvxX0C0c7iCvHg/edit#slide=id.g1530211a36_0_245
What about IOS though ?
Btw have you seen ebiten ? https://github.com/hajimehoshi/ebiten Its pretty well advanced golang 2d game system.
ebiten looks promising!! Thanks for the tip!
@joeblew99 Btw, are you aware of a any gomobile specific community to share experiences? I am fighting some issues I would like help with. For instance, I am unable to hide the Android status bar from a pure Go native app.
@odhos
its mostly a few devs doing gomobile. xlabs dskinner ebiten
As far as turning off the status bar. Never done it myself. Since its window related i reckon that you going to have to made JNI call to the java sdk level. Your using gomobile build, rather than gomobile bind ?
There is another way to do IOs and Android development with go, and not be restricted by the gomobile tool chain. https://github.com/xlab/android-go Its a direct c <--> golang setup without all the heavy CGO that gomobile uses. There is good JNI support. See https://github.com/xlab/android-go/blob/master/android/jni_util.go
Not sure if any of this really helps.... But its some of the things i have used. At the moment i use gomobile because i mostly write GUI in Web or native, rather than opengl. I have been using pure opengl one too but thats not what i am employed to work on right now
have you managed to do an IOS build ?