From e97ce1bb090bf16cfc24bdfed6b23f5cc550d2f3 Mon Sep 17 00:00:00 2001 From: Tee KOBAYASHI Date: Tue, 18 Jan 2022 13:17:22 +0900 Subject: [PATCH] new package: btfs2 --- packages/btfs2/build.sh | 29 +++++++++++++++++++ .../karalabe-usb-pthread_barrier.patch.diff | 24 +++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 packages/btfs2/build.sh create mode 100644 packages/btfs2/karalabe-usb-pthread_barrier.patch.diff diff --git a/packages/btfs2/build.sh b/packages/btfs2/build.sh new file mode 100644 index 000000000..274d84d31 --- /dev/null +++ b/packages/btfs2/build.sh @@ -0,0 +1,29 @@ +TERMUX_PKG_HOMEPAGE=https://www.bittorrent.com/btfs/ +TERMUX_PKG_DESCRIPTION="Decentralized file system integrating with TRON network and Bittorrent network" +TERMUX_PKG_LICENSE="Apache-2.0, MIT" +TERMUX_PKG_LICENSE_FILE="LICENSE-APACHE, LICENSE-MIT" +TERMUX_PKG_MAINTAINER="Simbad Marino " +TERMUX_PKG_VERSION=2.0.1 +TERMUX_PKG_SRCURL=https://github.com/bittorrent/go-btfs/archive/refs/tags/btfs-v${TERMUX_PKG_VERSION}.tar.gz +TERMUX_PKG_SHA256=85a12f42339b41de4b0cd3096df93f654053836b164a4f92f482d315a4a353b2 +TERMUX_PKG_AUTO_UPDATE=true +TERMUX_PKG_AUTO_UPDATE_TAG_REGEXP="\d+\.\d+\.\d+" +TERMUX_PKG_BUILD_IN_SRC=true + +termux_step_make() { + termux_setup_golang + make build || : + local _GOPATH=$(go env GOPATH) + pushd $_GOPATH/pkg/mod/github.com/karalabe/usb@* + local target=hidapi/libusb/hid.c + chmod 0755 $(dirname $target) + chmod 0644 $target + patch -p1 < $TERMUX_PKG_BUILDER_DIR/karalabe-usb-pthread_barrier.patch.diff + popd + make build + mv $TERMUX_PKG_SRCDIR/cmd/btfs/btfs $TERMUX_PKG_SRCDIR/cmd/btfs/btfs2 +} + +termux_step_make_install() { + install -Dm700 -t $TERMUX_PREFIX/bin $TERMUX_PKG_SRCDIR/cmd/btfs/btfs2 +} diff --git a/packages/btfs2/karalabe-usb-pthread_barrier.patch.diff b/packages/btfs2/karalabe-usb-pthread_barrier.patch.diff new file mode 100644 index 000000000..683cefff8 --- /dev/null +++ b/packages/btfs2/karalabe-usb-pthread_barrier.patch.diff @@ -0,0 +1,24 @@ +From e188e2d7eefa1a057a20921236f22a6008b29c93 Mon Sep 17 00:00:00 2001 +From: Fredrik Fornwall +Date: Thu, 12 Dec 2019 01:07:20 +0100 +Subject: [PATCH] Fix build when targetting Android 7 or later + +Support for pthread_barrier was introduced in Android 7, so trying to +build a custom implementation of that clashes with the system headers. +--- + hidapi/libusb/hid.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/hidapi/libusb/hid.c b/hidapi/libusb/hid.c +index 474dff4..dd6fd8c 100644 +--- a/hidapi/libusb/hid.c ++++ b/hidapi/libusb/hid.c +@@ -49,7 +49,7 @@ + + #include "hidapi.h" + +-#ifdef __ANDROID__ ++#if defined(__ANDROID__) && __ANDROID_API__ < __ANDROID_API_N__ + + /* Barrier implementation because Android/Bionic don't have pthread_barrier. + This implementation came from Brent Priddy and was posted on