syncthing: fix crash on Android 8 (#2391)
[termux-packages] / packages / syncthing / build.sh
1 TERMUX_PKG_HOMEPAGE=https://syncthing.net/
2 TERMUX_PKG_DESCRIPTION="Decentralized file synchronization"
3 TERMUX_PKG_VERSION=0.14.45
4 TERMUX_PKG_REVISION=1
5 TERMUX_PKG_SHA256=3236a12b3698f6eaef785348a26fea59f87398b2753c414d18844e5f7d7a655b
6 TERMUX_PKG_SRCURL=https://github.com/syncthing/syncthing/releases/download/v${TERMUX_PKG_VERSION}/syncthing-source-v${TERMUX_PKG_VERSION}.tar.gz
7
8 termux_step_make(){
9 termux_setup_golang
10
11 # The build.sh script doesn't with our compiler
12 # so small adjustments to file locations are needed
13 # so the build.go is fine.
14 mkdir -p go/src/github.com/syncthing/syncthing
15 cp $TERMUX_PKG_SRCDIR/vendor/* ./go/src/ -r
16 cp $TERMUX_PKG_SRCDIR/* go/src/github.com/syncthing/syncthing -r
17
18 # Set gopath so dependencies are built as in go get etc.
19 export GOPATH=$(pwd)/go
20
21 cd go/src/github.com/syncthing/syncthing
22
23 # Unset GOARCH so building build.go is works.
24 export GO_ARCH=$GOARCH
25 export _CC=$CC
26 unset GOOS GOARCH CC
27
28 # Now file structure is same as go get etc.
29 go build build.go
30 export CC=$_CC
31 ./build -goos android \
32 -goarch $GO_ARCH \
33 -no-upgrade \
34 -version v$TERMUX_PKG_VERSION \
35 build
36 }
37
38 termux_step_make_install() {
39 cp go/src/github.com/syncthing/syncthing/syncthing $TERMUX_PREFIX/bin/
40
41 for section in 1 5 7; do
42 local MANDIR=$PREFIX/share/man/man$section
43 mkdir -p $MANDIR
44 cp $TERMUX_PKG_SRCDIR/man/*.$section $MANDIR
45 done
46 }