forked from syncthing/syncthing-android
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-syncthing.bash
executable file
·69 lines (55 loc) · 1.35 KB
/
make-syncthing.bash
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#!/usr/bin/env bash
set -e
MYDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
JNIDIR="/src/main/jniLibs"
case "$1" in
arm)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm
export GOARM=5
export TARGETDIR=$MYDIR$JNIDIR/armeabi
;;
arm64)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=arm64
unset GOARM
export TARGETDIR=$MYDIR$JNIDIR/arm64-v8a
;;
386)
export CGO_ENABLED=0
export GOOS=linux
export GOARCH=386
export GO386=387
export TARGETDIR=$MYDIR$JNIDIR/x86
;;
*)
echo "Invalid architecture"
exit 1
esac
unset GOPATH #Set by build.go
export GOROOT=${MYDIR}/ext/golang/dist/go-${GOOS}-${GOARCH}
export PATH=${GOROOT}/bin:${PATH}
case "$(uname)" in
*CYGWIN*)
export GOROOT=`cygpath -w $GOROOT`
;;
esac
pushd ext/syncthing/src/github.com/syncthing/syncthing
_GOOS=$GOOS
unset GOOS
_GOARCH=$GOARCH
unset GOARCH
go run build.go -goos=${_GOOS} -goarch=${_GOARCH} clean
go run build.go -goos=${_GOOS} -goarch=${_GOARCH} -no-upgrade build
export GOOS=$_GOOS
export GOARCH=$_GOARCH
mkdir -p ${TARGETDIR}
mv syncthing ${TARGETDIR}/libsyncthing.so
chmod 644 ${TARGETDIR}/libsyncthing.so
if [[ -e ./build.go ]]; then
git clean -f
fi
popd
echo "Build Complete"