mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
Move src/mobile
into main repository (#864)
* Move `src/mobile` into main repository * Update go.mod/go.sum * Move to `contrib`, separate mobile build script
This commit is contained in:
parent
a4bdf3de32
commit
6d92edd405
9 changed files with 339 additions and 30 deletions
52
contrib/mobile/build
Executable file
52
contrib/mobile/build
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/bin/sh
|
||||
|
||||
set -ef
|
||||
|
||||
[ ! -d contrib/mobile ] && (echo "Must run contrib/mobile/build.sh [-i] [-a] from the repository top level folder"; exit 1)
|
||||
|
||||
PKGSRC=${PKGSRC:-github.com/yggdrasil-network/yggdrasil-go/src/version}
|
||||
PKGNAME=${PKGNAME:-$(sh contrib/semver/name.sh)}
|
||||
PKGVER=${PKGVER:-$(sh contrib/semver/version.sh --bare)}
|
||||
|
||||
LDFLAGS="-X $PKGSRC.buildName=$PKGNAME -X $PKGSRC.buildVersion=$PKGVER"
|
||||
ARGS="-v"
|
||||
|
||||
while getopts "aitc:l:d" option
|
||||
do
|
||||
case "$option"
|
||||
in
|
||||
i) IOS=true;;
|
||||
a) ANDROID=true;;
|
||||
t) TABLES=true;;
|
||||
c) GCFLAGS="$GCFLAGS $OPTARG";;
|
||||
l) LDFLAGS="$LDFLAGS $OPTARG";;
|
||||
d) ARGS="$ARGS -tags debug" DEBUG=true;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ -z $TABLES ] && [ -z $DEBUG ]; then
|
||||
LDFLAGS="$LDFLAGS -s -w"
|
||||
fi
|
||||
|
||||
if [ ! $IOS ] && [ ! $ANDROID ]; then
|
||||
echo "Must specify -a (Android), -i (iOS) or both"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $IOS ]; then
|
||||
echo "Building framework for iOS"
|
||||
go get golang.org/x/mobile/bind
|
||||
gomobile bind \
|
||||
-target ios -tags mobile -o Yggdrasil.xcframework \
|
||||
-ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
|
||||
./contrib/mobile ./src/config;
|
||||
fi
|
||||
|
||||
if [ $ANDROID ]; then
|
||||
echo "Building aar for Android"
|
||||
go get golang.org/x/mobile/bind
|
||||
gomobile bind \
|
||||
-target android -tags mobile -o yggdrasil.aar \
|
||||
-ldflags="$LDFLAGS $STRIP" -gcflags="$GCFLAGS" \
|
||||
./contrib/mobile ./src/config;
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue