btfs2: Re-enable CGO

Partially reverts commit 88facc1a95.
This commit is contained in:
Tee KOBAYASHI 2022-02-21 17:27:35 +09:00 committed by xtkoba
parent 979fe45a5d
commit 5c37c5644f
2 changed files with 37 additions and 1 deletions

View File

@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="Apache-2.0, MIT"
TERMUX_PKG_LICENSE_FILE="LICENSE-APACHE, LICENSE-MIT"
TERMUX_PKG_MAINTAINER="Simbad Marino <cctechmx@gmail.com>"
TERMUX_PKG_VERSION=2.1.0
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/bittorrent/go-btfs/archive/refs/tags/btfs-v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=5960a0dbf57c7867cc76189b66a4867f7da899f222bd32c53d226f3090c600e5
TERMUX_PKG_AUTO_UPDATE=true
@ -12,7 +13,18 @@ TERMUX_PKG_BUILD_IN_SRC=true
termux_step_pre_configure() {
termux_setup_golang
export CGO_ENABLED=0
go mod init || :
go mod tidy
# Please do not ever disable CGO:
# https://github.com/termux/termux-packages/issues/9094
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
}
termux_step_make() {

View File

@ -0,0 +1,24 @@
From e188e2d7eefa1a057a20921236f22a6008b29c93 Mon Sep 17 00:00:00 2001
From: Fredrik Fornwall <fredrik@fornwall.net>
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