From 3e5a3d6bcc4e63e9df8f6b0023fada1caee750f9 Mon Sep 17 00:00:00 2001 From: Leonid Pliushch Date: Thu, 2 May 2019 02:03:35 +0300 Subject: [PATCH] restic: fix build error --- packages/restic/build.sh | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/restic/build.sh b/packages/restic/build.sh index b2519cd49..ffb70fdff 100644 --- a/packages/restic/build.sh +++ b/packages/restic/build.sh @@ -6,22 +6,30 @@ TERMUX_PKG_VERSION=0.9.5 TERMUX_PKG_SRCURL=https://github.com/restic/restic/archive/v$TERMUX_PKG_VERSION.tar.gz TERMUX_PKG_SHA256=e22208e946ede07f56ef60c1c89de817b453967663ce4867628dff77761bd429 TERMUX_PKG_SUGGESTS="openssh, rclone" -TERMUX_PKG_BUILD_IN_SRC=true termux_step_make() { termux_setup_golang - _GOARCH=${GOARCH} - unset GOOS GOARCH - ## build for host and regenerate manpages - go run build.go --goos linux --goarch "amd64" - ./restic generate --man doc/man && rm -f ./restic + export GOPATH=$TERMUX_PKG_BUILDDIR + mkdir -p "$GOPATH"/src/github.com/restic - ## finally build for target - go run build.go --enable-cgo --goos android --goarch "${_GOARCH}" + ln -sf "$TERMUX_PKG_SRCDIR" "$GOPATH"/src/github.com/restic/restic + cd "$GOPATH"/src/github.com/restic/restic + + ( + # Separately building for host so we can generate manpages. + unset GOOS GOARCH CGO_LDFLAGS + unset CC CXX CFLAGS CXXFLAGS LDFLAGS + go build -ldflags "-X 'main.version=${TERMUX_PKG_VERSION}'" ./cmd/... + ./restic generate --man doc/man + rm -f ./restic + ) + + go build -ldflags "-X 'main.version=${TERMUX_PKG_VERSION}'" ./cmd/... } termux_step_make_install() { + cd "$GOPATH"/src/github.com/restic/restic install -Dm700 restic "$TERMUX_PREFIX"/bin/restic install -Dm600 -t "$TERMUX_PREFIX/share/man/man1/" doc/man/*.1 }