aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNeel Chauhan <nc@FreeBSD.org>2022-06-09 22:45:02 +0000
committerNeel Chauhan <nc@FreeBSD.org>2022-06-09 22:45:02 +0000
commit70cd49992b459b8d4bb69da5b22929205e1bfb9d (patch)
treea3823f0ede9818d5b7855975283303b0e0e00b8e
parentcdc4f394015b90c1aa11d7a9dc725e4ce0414616 (diff)
downloadports-70cd49992b459b8d4bb69da5b22929205e1bfb9d.tar.gz
ports-70cd49992b459b8d4bb69da5b22929205e1bfb9d.zip
devel/android-tools: New port: Android debugging tools
While I'm here, remove the old devel/android-tools-adb and devel/android-tools-fastboot ports. These ports are long out-of-date and the adb port especially had issues with certain devices. This port was tested from a FreeBSD 14.0 system to flash both LineageOS and GrapheneOS on a Google Pixel 3 using both `adb` and `fastboot`.
-rw-r--r--MOVED2
-rw-r--r--devel/Makefile3
-rw-r--r--devel/android-tools-adb/Makefile79
-rw-r--r--devel/android-tools-adb/distinfo7
-rw-r--r--devel/android-tools-adb/files/Makefile149
-rw-r--r--devel/android-tools-adb/files/patch-adb_adb.cpp22
-rw-r--r--devel/android-tools-adb/files/patch-adb_bugreport__test.cpp35
-rw-r--r--devel/android-tools-adb/files/patch-adb_client_adb__install.cpp105
-rw-r--r--devel/android-tools-adb/files/patch-adb_client_auth.cpp44
-rw-r--r--devel/android-tools-adb/files/patch-adb_client_commandline.cpp38
-rw-r--r--devel/android-tools-adb/files/patch-adb_client_transport__mdns__unsupported.cpp21
-rw-r--r--devel/android-tools-adb/files/patch-adb_client_usb__libusb.cpp133
-rw-r--r--devel/android-tools-adb/files/patch-adb_socket__spec__test.cpp14
-rw-r--r--devel/android-tools-adb/files/patch-adb_sysdeps.h27
-rw-r--r--devel/android-tools-adb/files/patch-adb_transport__usb.cpp11
-rw-r--r--devel/android-tools-adb/files/patch-adb_usb.h20
-rw-r--r--devel/android-tools-adb/files/patch-base_file.cpp44
-rw-r--r--devel/android-tools-adb/files/patch-base_file__test.cpp51
-rw-r--r--devel/android-tools-adb/files/patch-base_include_android-base_logging.h11
-rw-r--r--devel/android-tools-adb/files/patch-base_include_android-base_thread__annotations.h14
-rw-r--r--devel/android-tools-adb/files/patch-base_threads.cpp36
-rw-r--r--devel/android-tools-adb/files/patch-gtest-1.8.155
-rw-r--r--devel/android-tools-adb/files/patch-libcrypto__utils_android__pubkey.c204
-rw-r--r--devel/android-tools-adb/files/patch-libcutils_include_cutils_trace.h17
-rw-r--r--devel/android-tools-adb/files/patch-libcutils_threads.cpp45
-rw-r--r--devel/android-tools-adb/files/patch-liblog_logger.h16
-rw-r--r--devel/android-tools-adb/files/patch-liblog_logger__write.cpp36
-rw-r--r--devel/android-tools-adb/pkg-descr5
-rw-r--r--devel/android-tools-fastboot/Makefile59
-rw-r--r--devel/android-tools-fastboot/distinfo13
-rw-r--r--devel/android-tools-fastboot/files/Makefile113
-rw-r--r--devel/android-tools-fastboot/files/patch-base_file.cpp44
-rw-r--r--devel/android-tools-fastboot/files/patch-base_include_android-base_endian.h19
-rw-r--r--devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h11
-rw-r--r--devel/android-tools-fastboot/files/patch-base_threads.cpp36
-rw-r--r--devel/android-tools-fastboot/files/patch-extras_ext4__utils_ext4__utils.cpp47
-rw-r--r--devel/android-tools-fastboot/files/patch-fastboot_fastboot.140
-rw-r--r--devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp25
-rw-r--r--devel/android-tools-fastboot/files/patch-fastboot_socket.h14
-rw-r--r--devel/android-tools-fastboot/files/patch-liblog_logger.h16
-rw-r--r--devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp36
-rw-r--r--devel/android-tools-fastboot/files/pkg-message.in13
-rw-r--r--devel/android-tools-fastboot/files/usb_libusb.cpp223
-rw-r--r--devel/android-tools-fastboot/pkg-descr3
-rw-r--r--devel/android-tools/Makefile34
-rw-r--r--devel/android-tools/distinfo3
-rw-r--r--devel/android-tools/files/patch-vendor_adb_client_file__sync__client.cpp37
-rw-r--r--devel/android-tools/files/patch-vendor_adb_compression__utils.h28
-rw-r--r--devel/android-tools/pkg-descr10
-rw-r--r--devel/android-tools/pkg-plist18
50 files changed, 133 insertions, 1953 deletions
diff --git a/MOVED b/MOVED
index 7b6c9ae8e74e..7ac110270ffb 100644
--- a/MOVED
+++ b/MOVED
@@ -17197,3 +17197,5 @@ print/ttftot42||2022-06-08|Abdonware, depends on freetype1
print/freetype|print/freetype2|2022-06-08|Has been replaced long ago by freetype2
net/libgnetwork||2022-06-08|Gnome2 library unused anymore
x11-wm/compizconfig-backend-gconf||2022-06-08|gconf support has been removed from compiz
+devel/android-tools-adb|devel/android-tools|2022-06-09|Port has been updated, unbroken and consolidated into devel/android-tools
+devel/android-tools-fastboot|devel/android-tools|2022-06-09|Port has been updated and consolidated into devel/android-tools
diff --git a/devel/Makefile b/devel/Makefile
index ac54995c4dba..8b1fa2210f1b 100644
--- a/devel/Makefile
+++ b/devel/Makefile
@@ -151,8 +151,7 @@
SUBDIR += aml
SUBDIR += ammonite
SUBDIR += amqp-cpp
- SUBDIR += android-tools-adb
- SUBDIR += android-tools-fastboot
+ SUBDIR += android-tools
SUBDIR += android-tools-simpleperf
SUBDIR += anjuta
SUBDIR += antlr
diff --git a/devel/android-tools-adb/Makefile b/devel/android-tools-adb/Makefile
deleted file mode 100644
index aa7b8cfacfa2..000000000000
--- a/devel/android-tools-adb/Makefile
+++ /dev/null
@@ -1,79 +0,0 @@
-PORTNAME= android-tools-adb
-DISTVERSIONPREFIX= platform-tools-
-DISTVERSION?= 29.0.6
-PORTREVISION?= 1
-CATEGORIES= devel comms
-
-MAINTAINER= ports@FreeBSD.org
-COMMENT= Android debug bridge command line tool
-
-LICENSE= APACHE20
-
-USE_GITHUB= yes
-GH_TUPLE= aosp-mirror:platform_system_core:${DISTVERSIONFULL}
-
-CONFLICTS_INSTALL?= ${PORTNAME}-devel
-
-USES= compiler:c++17-lang pkgconfig ssl uidfix
-BUILD_WRKSRC= ${WRKSRC}/adb
-INSTALL_WRKSRC= ${BUILD_WRKSRC}
-TEST_WRKSRC= ${BUILD_WRKSRC}
-MAKEFILE?= ${.CURDIR}/files/Makefile
-MAKE_ENV= BINDIR="${PREFIX}/bin" FILESDIR="${DOCSDIR}" \
- VERSION="${DISTVERSION}${DISTVERSIONSUFFIX}"
-ALL_TARGET= all
-TEST_TARGET= test
-PLIST_FILES= bin/adb
-PORTDOCS= *
-
-OPTIONS_DEFINE+=MDNSRESPONDER BASH DOCS TEST TEST_PYTHON
-OPTIONS_DEFAULT=MDNSRESPONDER
-OPTIONS_SUB= yes
-
-.if make(makesum) # for optional distfiles
-.MAKEFLAGS: WITH="${OPTIONS_DEFINE}"
-.endif
-
-BASH_GH_TUPLE= mbrubeck:android-completion:c1b0656:bashcomp
-BASH_PLIST_FILES= etc/bash_completion.d/adb
-BASH_VARS= LICENSE+=MIT LICENSE_COMB=multi
-
-DOCS_MAKE_ARGS_OFF= FILES="" FILESDIR=""
-
-MDNSRESPONDER_LIB_DEPENDS= libdns_sd.so:net/mDNSResponder
-MDNSRESPONDER_USES= localbase:ldflags
-MDNSRESPONDER_LDFLAGS= -ldns_sd
-MDNSRESPONDER_MAKE_ENV_OFF= MDNSEXT=_unsupported
-
-TEST_BUILD_DEPENDS+= googletest>=1.6.0:devel/googletest
-TEST_ALL_TARGET= adb_test
-
-TEST_PYTHON_DESC= ${TEST_DESC:S/tests/python &/}
-TEST_PYTHON_GH_TUPLE= aosp-mirror:platform_development:${DISTVERSIONFULL}:development
-TEST_PYTHON_BUILD_DEPENDS=${PYTHON_PKGNAMEPREFIX}mock>0:devel/py-mock@${PY_FLAVOR}
-TEST_PYTHON_USES= python:build
-
-post-patch:
-# XXX Hidden by poudriere/tinderbox, see lindev(4) for FreeBSD < 11.0
- @if [ ! -e /dev/full ]; then \
- ${REINPLACE_CMD} -e '/TEST/s/[^ ]*ENOSPC/DISABLED_&/' \
- ${WRKSRC}/adb/adb_io_test.cpp; \
- fi
-# XXX getcwd fails and not connected upstream
- @${REINPLACE_CMD} -e '/TEST/s/, /&DISABLED_/' \
- ${WRKSRC}/adb/bugreport_test.cpp
-
-pre-install-TEST-on: do-test
-
-pre-install-TEST_PYTHON-on:
-# XXX python tests may leave behind running adb server
- ${SETENV} PATH=${BUILD_WRKSRC}:${PATH} \
- PYTHONPATH=${WRKSRC_development}/python-packages \
- ${PYTHON_CMD} -m unittest discover -vs ${BUILD_WRKSRC}
-
-post-install-BASH-on:
- ${MKDIR} ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES:H}
- ${INSTALL_DATA} ${WRKSRC_bashcomp}/android \
- ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES}
-
-.include <bsd.port.mk>
diff --git a/devel/android-tools-adb/distinfo b/devel/android-tools-adb/distinfo
deleted file mode 100644
index d34e15abf65e..000000000000
--- a/devel/android-tools-adb/distinfo
+++ /dev/null
@@ -1,7 +0,0 @@
-TIMESTAMP = 1581453885
-SHA256 (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 3d1898c1ad19f63641090576c60588ab761132b42b306ff4979d30723187d562
-SIZE (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 72302409
-SHA256 (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = ca3311ba47a5edd56c929ac9aae57c02c2c3f1636519c5f67abb00b6e3ecd75c
-SIZE (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = 5967
-SHA256 (aosp-mirror-platform_development-platform-tools-29.0.6_GH0.tar.gz) = 5560f767082834183e31af0fca9e121996e5e16aac67ce10f9321c4146809a0a
-SIZE (aosp-mirror-platform_development-platform-tools-29.0.6_GH0.tar.gz) = 63959966
diff --git a/devel/android-tools-adb/files/Makefile b/devel/android-tools-adb/files/Makefile
deleted file mode 100644
index d53b1cd36c99..000000000000
--- a/devel/android-tools-adb/files/Makefile
+++ /dev/null
@@ -1,149 +0,0 @@
-PROG_CXX=adb
-NOMAN= # DragonFly, NetBSD, OpenBSD
-MAN= # FreeBSD
-BINDIR?=/usr/bin
-FILESDIR?=${DOCDIR}/${PROG}
-
-FILES= OVERVIEW.TXT SERVICES.TXT SYNC.TXT protocol.txt
-
-SRCS+= adb.cpp
-SRCS+= adb_io.cpp
-SRCS+= adb_listeners.cpp
-SRCS+= adb_trace.cpp
-SRCS+= adb_utils.cpp
-SRCS+= services.cpp
-SRCS+= shell_service_protocol.cpp
-SRCS+= socket_spec.cpp
-SRCS+= ../adb/sockets.cpp
-SRCS+= sysdeps_unix.cpp
-SRCS+= transport.cpp
-SRCS+= transport_local.cpp
-SRCS+= transport_usb.cpp
-SRCS+= types.cpp
-
-TEST_SRCS+= adb_io_test.cpp
-TEST_SRCS+= adb_listeners_test.cpp
-TEST_SRCS+= adb_utils_test.cpp
-TEST_SRCS+= bugreport_test.cpp
-TEST_SRCS+= shell_service_protocol_test.cpp
-TEST_SRCS+= socket_spec_test.cpp
-TEST_SRCS+= socket_test.cpp
-TEST_SRCS+= sysdeps_test.cpp
-TEST_SRCS+= transport_test.cpp
-TEST_SRCS+= types_test.cpp
-
-.PATH: ${.CURDIR}/client
-SRCS+= adb_client.cpp
-SRCS+= adb_install.cpp
-SRCS+= auth.cpp
-SRCS+= bugreport.cpp
-SRCS+= commandline.cpp
-SRCS+= console.cpp
-SRCS+= file_sync_client.cpp
-SRCS+= line_printer.cpp
-SRCS+= main.cpp
-SRCS+= transport_mdns${MDNSEXT}.cpp
-SRCS+= usb_libusb.cpp
-
-.PATH: ${.CURDIR}/fdevent
-SRCS+= fdevent.cpp
-SRCS+= fdevent_poll.cpp
-TEST_SRCS+= fdevent_test.cpp
-
-.PATH: ${.CURDIR}/sysdeps
-SRCS+= errno.cpp
-TEST_SRCS+= stat_test.cpp
-
-.PATH: ${.CURDIR}/sysdeps/posix
-SRCS+= network.cpp
-
-.PATH: ${.CURDIR}/../base
-SRCS+= chrono_utils.cpp
-SRCS+= file.cpp
-SRCS+= liblog_symbols.cpp
-SRCS+= logging.cpp
-SRCS+= parsenetaddress.cpp
-SRCS+= stringprintf.cpp
-SRCS+= strings.cpp
-TEST_SRCS+= file_test.cpp
-TEST_SRCS+= logging_test.cpp
-TEST_SRCS+= parsenetaddress_test.cpp
-TEST_SRCS+= stringprintf_test.cpp
-TEST_SRCS+= strings_test.cpp
-TEST_SRCS+= test_main.cpp
-TEST_SRCS+= test_utils.cpp
-
-.PATH: ${.CURDIR}/../diagnose_usb
-SRCS+= diagnose_usb.cpp
-
-.PATH: ${.CURDIR}/../libcrypto_utils
-SRCS+= android_pubkey.c
-
-.PATH: ${.CURDIR}/../libcrypto_utils/tests
-TEST_SRCS+= android_pubkey_test.cpp
-
-.PATH: ${.CURDIR}/../libcutils
-SRCS+= socket_inaddr_any_server_unix.cpp
-SRCS+= socket_local_client_unix.cpp
-SRCS+= socket_local_server_unix.cpp
-SRCS+= socket_network_client_unix.cpp
-SRCS+= ../libcutils/sockets.cpp
-SRCS+= threads.cpp
-# DragonFly, NetBSD, OpenBSD
-CPPFLAGS.sockets.cpp+= -o ${.TARGET}
-
-# required by base
-.PATH: ${.CURDIR}/../liblog
-SRCS+= logger_write.cpp
-SRCS+= ../liblog/properties.cpp
-
-CPPFLAGS+= -DPLATFORM_TOOLS_VERSION="\"${VERSION:U0.0.0}\""
-CPPFLAGS+= -DADB_HOST=1
-CPPFLAGS+= -Doff64_t=off_t
-CPPFLAGS+= -Dlseek64=lseek
-CPPFLAGS+= -Dpread64=pread
-CPPFLAGS+= -Dpwrite64=pwrite
-CPPFLAGS+= -I${.CURDIR}
-CPPFLAGS+= -I${.CURDIR}/client
-CPPFLAGS+= -I${.CURDIR}/../include
-CPPFLAGS+= -I${.CURDIR}/../base/include
-CPPFLAGS+= -I${.CURDIR}/../diagnose_usb/include
-CPPFLAGS+= -I${.CURDIR}/../libcrypto_utils/include
-CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
-CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
-CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
-CXXFLAGS+= -std=gnu++2a
-
-.ifndef COMPILE.c
-CFLAGS+= ${CPPFLAGS}
-CXXFLAGS+= ${CPPFLAGS}
-.endif
-
-TEST_CPPFLAGS+= $$(${PKG_CONFIG} gtest --cflags)
-TEST_CPPFLAGS+= $$(${PKG_CONFIG} gmock --cflags)
-.for f in ${TEST_SRCS}
-CPPFLAGS.${f}+= ${TEST_CPPFLAGS}
-.endfor
-
-LDADD+= $$(${PKG_CONFIG} libcrypto --libs 2>/dev/null || echo -lcrypto)
-LDADD+= $$(${PKG_CONFIG} libusb-1.0 --libs 2>/dev/null || echo -lusb)
-LDADD+= \-lpthread
-DPADD+= ${LIBCRYPTO} ${LIBPTHREAD} ${LIBUSB}
-TEST_LDADD+= $$(${PKG_CONFIG} gtest --libs)
-TEST_LDADD+= $$(${PKG_CONFIG} gmock --libs)
-
-TEST_OBJS+= ${TEST_SRCS:R:S/$/.o/}
-CLEANFILES+= ${PROG}_test ${TEST_OBJS}
-
-PKG_CONFIG?= pkg-config
-
-beforeinstall:
- ${INSTALL} -d ${DESTDIR}${FILESDIR}
-
-.include <bsd.prog.mk>
-
-test: ${PROG}_test
- @for f in ${.ALLSRC}; do ./$$f; done
-
-${PROG}_test: ${OBJS:Nmain.o:Nadb_install.o:Ncommandline.o} ${TEST_OBJS}
- ${CXX} ${CPPFLAGS} ${CXXFLAGS} ${LDFLAGS} -o $@ $> ${LDADD} ${TEST_LDADD}
diff --git a/devel/android-tools-adb/files/patch-adb_adb.cpp b/devel/android-tools-adb/files/patch-adb_adb.cpp
deleted file mode 100644
index 2bea0312150b..000000000000
--- a/devel/android-tools-adb/files/patch-adb_adb.cpp
+++ /dev/null
@@ -1,22 +0,0 @@
---- adb/adb.cpp.orig 2019-07-17 19:54:09 UTC
-+++ adb/adb.cpp
-@@ -44,8 +44,19 @@
- #include <android-base/parsenetaddress.h>
- #include <android-base/stringprintf.h>
- #include <android-base/strings.h>
-+#ifdef PLATFORM_TOOLS_VERSION
-+#include <sys/utsname.h>
-+namespace android { namespace build {
-+std::string GetBuildNumber() {
-+ struct utsname uts;
-+ if (uname(&uts) == -1)
-+ return "unknown";
-+ return uts.sysname;
-+}}}
-+#else
- #include <build/version.h>
- #include <platform_tools_version.h>
-+#endif
-
- #include "adb_auth.h"
- #include "adb_io.h"
diff --git a/devel/android-tools-adb/files/patch-adb_bugreport__test.cpp b/devel/android-tools-adb/files/patch-adb_bugreport__test.cpp
deleted file mode 100644
index e9fa97dc6ed4..000000000000
--- a/devel/android-tools-adb/files/patch-adb_bugreport__test.cpp
+++ /dev/null
@@ -1,35 +0,0 @@
---- adb/bugreport_test.cpp.orig 2019-08-13 02:10:58 UTC
-+++ adb/bugreport_test.cpp
-@@ -14,8 +14,6 @@
- * limitations under the License.
- */
-
--#include "bugreport.h"
--
- #include <gmock/gmock.h>
- #include <gtest/gtest.h>
-
-@@ -24,6 +22,7 @@
-
- #include "sysdeps.h"
- #include "adb_utils.h"
-+#include "bugreport.h"
-
- using ::testing::_;
- using ::testing::Action;
-@@ -40,6 +39,7 @@ using ::testing::internal::CaptureStdout;
- using ::testing::internal::GetCapturedStderr;
- using ::testing::internal::GetCapturedStdout;
-
-+#ifdef __linux__
- // Empty function so tests don't need to be linked against file_sync_service.cpp, which requires
- // SELinux and its transitive dependencies...
- bool do_sync_pull(const std::vector<const char*>& srcs, const char* dst, bool copy_attrs,
-@@ -47,6 +47,7 @@ bool do_sync_pull(const std::vector<const char*>& srcs
- ADD_FAILURE() << "do_sync_pull() should have been mocked";
- return false;
- }
-+#endif
-
- // Empty functions so tests don't need to be linked against commandline.cpp
- DefaultStandardStreamsCallback DEFAULT_STANDARD_STREAMS_CALLBACK(nullptr, nullptr);
diff --git a/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp b/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp
deleted file mode 100644
index 5cd17d521128..000000000000
--- a/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp
+++ /dev/null
@@ -1,105 +0,0 @@
---- adb/client/adb_install.cpp.orig 2019-10-18 00:22:21 UTC
-+++ adb/client/adb_install.cpp
-@@ -35,9 +35,11 @@
- #include "adb_utils.h"
- #include "client/file_sync_client.h"
- #include "commandline.h"
-+#if defined(ENABLE_FASTDEPLOY)
- #include "fastdeploy.h"
-
- static constexpr int kFastDeployMinApi = 24;
-+#endif
-
- namespace {
-
-@@ -167,6 +169,7 @@ static int install_app_streamed(int argc, const char**
- }
-
- if (use_fastdeploy) {
-+#if defined(ENABLE_FASTDEPLOY)
- auto metadata = extract_metadata(file);
- if (metadata.has_value()) {
- // pass all but 1st (command) and last (apk path) parameters through to pm for
-@@ -175,6 +178,9 @@ static int install_app_streamed(int argc, const char**
- auto patchFd = install_patch(pm_args.size(), pm_args.data());
- return stream_patch(file, std::move(metadata.value()), std::move(patchFd));
- }
-+#else
-+ error_exit("fastdeploy is disabled");
-+#endif
- }
-
- struct stat sb;
-@@ -189,7 +195,7 @@ static int install_app_streamed(int argc, const char**
- return 1;
- }
-
--#ifdef __linux__
-+#if !defined(__APPLE__) && !defined(_WIN32)
- posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
- #endif
-
-@@ -263,6 +269,7 @@ static int install_app_legacy(int argc, const char** a
- argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */
-
- if (use_fastdeploy) {
-+#if defined(ENABLE_FASTDEPLOY)
- auto metadata = extract_metadata(apk_file[0]);
- if (metadata.has_value()) {
- auto patchFd = apply_patch_on_device(apk_dest.c_str());
-@@ -273,6 +280,9 @@ static int install_app_legacy(int argc, const char** a
-
- return status;
- }
-+#else
-+ error_exit("fastdeploy is disabled");
-+#endif
- }
-
- if (do_sync_push(apk_file, apk_dest.c_str(), false)) {
-@@ -288,7 +298,9 @@ int install_app(int argc, const char** argv) {
- InstallMode installMode = INSTALL_DEFAULT;
- bool use_fastdeploy = false;
- bool is_reinstall = false;
-+#if defined(ENABLE_FASTDEPLOY)
- FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
-+#endif
-
- for (int i = 1; i < argc; i++) {
- if (!strcmp(argv[i], "--streaming")) {
-@@ -309,13 +321,19 @@ int install_app(int argc, const char** argv) {
- use_fastdeploy = false;
- } else if (!strcmp(argv[i], "--force-agent")) {
- processedArgIndicies.push_back(i);
-+#if defined(ENABLE_FASTDEPLOY)
- agent_update_strategy = FastDeploy_AgentUpdateAlways;
-+#endif
- } else if (!strcmp(argv[i], "--date-check-agent")) {
- processedArgIndicies.push_back(i);
-+#if defined(ENABLE_FASTDEPLOY)
- agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp;
-+#endif
- } else if (!strcmp(argv[i], "--version-check-agent")) {
- processedArgIndicies.push_back(i);
-+#if defined(ENABLE_FASTDEPLOY)
- agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
-+#endif
- }
- }
-
-@@ -327,6 +345,7 @@ int install_app(int argc, const char** argv) {
- error_exit("Attempting to use streaming install on unsupported device");
- }
-
-+#if defined(ENABLE_FASTDEPLOY)
- if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) {
- printf("Fast Deploy is only compatible with devices of API version %d or higher, "
- "ignoring.\n",
-@@ -334,6 +353,7 @@ int install_app(int argc, const char** argv) {
- use_fastdeploy = false;
- }
- fastdeploy_set_agent_update_strategy(agent_update_strategy);
-+#endif
-
- std::vector<const char*> passthrough_argv;
- for (int i = 0; i < argc; i++) {
diff --git a/devel/android-tools-adb/files/patch-adb_client_auth.cpp b/devel/android-tools-adb/files/patch-adb_client_auth.cpp
deleted file mode 100644
index b4dd1e8dabbd..000000000000
--- a/devel/android-tools-adb/files/patch-adb_client_auth.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
---- adb/client/auth.cpp.orig 2019-10-18 00:22:21 UTC
-+++ adb/client/auth.cpp
-@@ -34,7 +34,10 @@
- #include <android-base/stringprintf.h>
- #include <android-base/strings.h>
- #include <crypto_utils/android_pubkey.h>
-+#if defined(OPENSSL_IS_BORINGSSL)
- #include <openssl/base64.h>
-+#endif
-+#include <openssl/err.h>
- #include <openssl/evp.h>
- #include <openssl/objects.h>
- #include <openssl/pem.h>
-@@ -52,6 +55,30 @@ static std::mutex& g_keys_mutex = *new std::mutex;
- static std::map<std::string, std::shared_ptr<RSA>>& g_keys =
- *new std::map<std::string, std::shared_ptr<RSA>>;
- static std::map<int, std::string>& g_monitored_paths = *new std::map<int, std::string>;
-+
-+#if !defined(OPENSSL_IS_BORINGSSL)
-+// https://boringssl.googlesource.com/boringssl/+/6601402%5E!/
-+static int EVP_EncodedLength(size_t *out_len, size_t len) {
-+ if (len + 2 < len) {
-+ return 0;
-+ }
-+ len += 2;
-+ len /= 3;
-+
-+ if (((len << 2) >> 2) != len) {
-+ return 0;
-+ }
-+ len <<= 2;
-+
-+ if (len + 1 < len) {
-+ return 0;
-+ }
-+ len++;
-+
-+ *out_len = len;
-+ return 1;
-+}
-+#endif
-
- static std::string get_user_info() {
- std::string hostname;
diff --git a/devel/android-tools-adb/files/patch-adb_client_commandline.cpp b/devel/android-tools-adb/files/patch-adb_client_commandline.cpp
deleted file mode 100644
index a572e6aef20a..000000000000
--- a/devel/android-tools-adb/files/patch-adb_client_commandline.cpp
+++ /dev/null
@@ -1,38 +0,0 @@
---- adb/client/commandline.cpp.orig 2019-10-18 00:22:21 UTC
-+++ adb/client/commandline.cpp
-@@ -59,7 +59,9 @@
- #include "bugreport.h"
- #include "client/file_sync_client.h"
- #include "commandline.h"
-+#if defined(ENABLE_FASTDEPLOY)
- #include "fastdeploy.h"
-+#endif
- #include "services.h"
- #include "shell_protocol.h"
- #include "sysdeps/chrono.h"
-@@ -1012,7 +1014,11 @@ static int ppp(int argc, const char** argv) {
-
- // copy args
- const char** ppp_args = (const char**)alloca(sizeof(char*) * argc + 1);
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+ ppp_args[0] = "ppp";
-+#else
- ppp_args[0] = "pppd";
-+#endif
- for (i = 2 ; i < argc ; i++) {
- //argv[2] and beyond become ppp_args[1] and beyond
- ppp_args[i - 1] = argv[i];
-@@ -1024,8 +1030,13 @@ static int ppp(int argc, const char** argv) {
- adb_close(STDERR_FILENO);
- adb_close(fd);
-
-+#if defined(__DragonFly__) || defined(__FreeBSD__)
-+ execvp("ppp", (char* const*)ppp_args);
-+ perror_exit("exec ppp failed");
-+#else
- execvp("pppd", (char* const*)ppp_args);
- perror_exit("exec pppd failed");
-+#endif
- }
-
- // parent side
diff --git a/devel/android-tools-adb/files/patch-adb_client_transport__mdns__unsupported.cpp b/devel/android-tools-adb/files/patch-adb_client_transport__mdns__unsupported.cpp
deleted file mode 100644
index fffaacf2a58e..000000000000
--- a/devel/android-tools-adb/files/patch-adb_client_transport__mdns__unsupported.cpp
+++ /dev/null
@@ -1,21 +0,0 @@
---- /dev/null 1970-01-01 00:00:00 UTC
-+++ adb/client/transport_mdns_unsupported.cpp
-@@ -0,0 +1,18 @@
-+/*
-+ * Copyright (C) 2016 The Android Open Source Project
-+ *
-+ * Licensed under the Apache License, Version 2.0 (the "License");
-+ * you may not use this file except in compliance with the License.
-+ * You may obtain a copy of the License at
-+ *
-+ * http://www.apache.org/licenses/LICENSE-2.0
-+ *
-+ * Unless required by applicable law or agreed to in writing, software
-+ * distributed under the License is distributed on an "AS IS" BASIS,
-+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+ * See the License for the specific language governing permissions and
-+ * limitations under the License.
-+ */
-+
-+/* For when mDNS discovery is unsupported */
-+void init_mdns_transport_discovery(void) {}
diff --git a/devel/android-tools-adb/files/patch-adb_client_usb__libusb.cpp b/devel/android-tools-adb/files/patch-adb_client_usb__libusb.cpp
deleted file mode 100644
index 5598261f5a52..000000000000
--- a/devel/android-tools-adb/files/patch-adb_client_usb__libusb.cpp
+++ /dev/null
@@ -1,133 +0,0 @@
---- adb/client/usb_libusb.cpp.orig 2017-06-20 10:50:27 UTC
-+++ adb/client/usb_libusb.cpp
-@@ -30,7 +30,7 @@
- #include <thread>
- #include <unordered_map>
-
--#include <libusb/libusb.h>
-+#include <libusb.h>
-
- #include <android-base/file.h>
- #include <android-base/logging.h>
-@@ -39,6 +39,9 @@
-
- #include "adb.h"
- #include "adb_utils.h"
-+#if !defined(__linux__) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__HAIKU__)
-+#include "sysdeps/chrono.h"
-+#endif
- #include "transport.h"
- #include "usb.h"
-
-@@ -89,7 +89,11 @@ struct transfer_info {
- };
-
- namespace libusb {
-+#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
- struct usb_handle : public ::usb_handle {
-+#else
-+struct usb_handle {
-+#endif
- usb_handle(const std::string& device_address, const std::string& serial,
- unique_device_handle&& device_handle, uint8_t interface, uint8_t bulk_in,
- uint8_t bulk_out, size_t zero_mask, size_t max_packet_size)
-@@ -152,7 +156,14 @@ struct usb_handle : public ::usb_handle {
- static auto& usb_handles = *new std::unordered_map<std::string, std::unique_ptr<usb_handle>>();
- static auto& usb_handles_mutex = *new std::mutex();
-
-+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
- static libusb_hotplug_callback_handle hotplug_handle;
-+#else
-+static std::thread* device_poll_thread = nullptr;
-+static bool terminate_device_poll_thread = false;
-+static auto& device_poll_mutex = *new std::mutex();
-+static auto& device_poll_cv = *new std::condition_variable();
-+#endif
-
- static std::string get_device_address(libusb_device* device) {
- return StringPrintf("usb:%d:%d", libusb_get_bus_number(device),
-@@ -380,6 +391,7 @@ static void process_device(libusb_device* device) {
- LOG(INFO) << "registered new usb device '" << device_serial << "'";
- }
-
-+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
- static std::atomic<int> connecting_devices(0);
-
- static void device_connected(libusb_device* device) {
-@@ -449,7 +461,31 @@ static int hotplug_callback(libusb_context*, libusb_de
- hotplug_queue.Push({event, device});
- return 0;
- }
-+#else
-+static void poll_for_devices() {
-+ libusb_device** list;
-+ adb_thread_setname("device poll");
-+ while (true) {
-+ const ssize_t device_count = libusb_get_device_list(nullptr, &list);
-
-+ LOG(VERBOSE) << "found " << device_count << " attached devices";
-+
-+ for (ssize_t i = 0; i < device_count; ++i) {
-+ process_device(list[i]);
-+ }
-+
-+ libusb_free_device_list(list, 1);
-+
-+ adb_notify_device_scan_complete();
-+
-+ std::unique_lock<std::mutex> lock(device_poll_mutex);
-+ if (device_poll_cv.wait_for(lock, 500ms, []() { return terminate_device_poll_thread; })) {
-+ return;
-+ }
-+ }
-+}
-+#endif
-+
- void usb_init() {
- LOG(DEBUG) << "initializing libusb...";
- int rc = libusb_init(nullptr);
-@@ -457,6 +493,7 @@ void usb_init() {
- LOG(FATAL) << "failed to initialize libusb: " << libusb_error_name(rc);
- }
-
-+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
- // Register the hotplug callback.
- rc = libusb_hotplug_register_callback(
- nullptr, static_cast<libusb_hotplug_event>(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
-@@ -467,6 +504,7 @@ void usb_init() {
- if (rc != LIBUSB_SUCCESS) {
- LOG(FATAL) << "failed to register libusb hotplug callback";
- }
-+#endif
-
- // Spawn a thread for libusb_handle_events.
- std::thread([]() {
-@@ -475,10 +513,28 @@ void usb_init() {
- libusb_handle_events(nullptr);
- }
- }).detach();
-+
-+#if !defined(__linux__) && !defined(__APPLE__) && !defined(__FreeBSD__) && !defined(__HAIKU__)
-+ std::unique_lock<std::mutex> lock(device_poll_mutex);
-+ device_poll_thread = new std::thread(poll_for_devices);
-+#endif
- }
-
- void usb_cleanup() {
-+#if defined(__linux__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__HAIKU__)
- libusb_hotplug_deregister_callback(nullptr, hotplug_handle);
-+#else
-+ {
-+ std::unique_lock<std::mutex> lock(device_poll_mutex);
-+ terminate_device_poll_thread = true;
-+
-+ if (!device_poll_thread) {
-+ return;
-+ }
-+ }
-+ device_poll_cv.notify_all();
-+ device_poll_thread->join();
-+#endif
- }
-
- // Dispatch a libusb transfer, unlock |device_lock|, and then wait for the result.
diff --git a/devel/android-tools-adb/files/patch-adb_socket__spec__test.cpp b/devel/android-tools-adb/files/patch-adb_socket__spec__test.cpp
deleted file mode 100644
index 774c9b23c357..000000000000
--- a/devel/android-tools-adb/files/patch-adb_socket__spec__test.cpp
+++ /dev/null
@@ -1,14 +0,0 @@
---- adb/socket_spec_test.cpp.orig 2020-02-11 20:44:45 UTC
-+++ adb/socket_spec_test.cpp
-@@ -98,7 +98,11 @@ TEST(socket_spec, get_host_socket_spec_port) {
- EXPECT_EQ(5555, get_host_socket_spec_port("tcp:5555", &error));
- EXPECT_EQ(5555, get_host_socket_spec_port("tcp:localhost:5555", &error));
- EXPECT_EQ(5555, get_host_socket_spec_port("tcp:[::1]:5555", &error));
-+#if ADB_LINUX
- EXPECT_EQ(5555, get_host_socket_spec_port("vsock:5555", &error));
-+#else
-+ EXPECT_EQ(-1, get_host_socket_spec_port("vsock:5555", &error));
-+#endif
- }
-
- TEST(socket_spec, get_host_socket_spec_port_no_port) {
diff --git a/devel/android-tools-adb/files/patch-adb_sysdeps.h b/devel/android-tools-adb/files/patch-adb_sysdeps.h
deleted file mode 100644
index 36f436629b00..000000000000
--- a/devel/android-tools-adb/files/patch-adb_sysdeps.h
+++ /dev/null
@@ -1,27 +0,0 @@
---- adb/sysdeps.h.orig 2019-07-17 19:54:09 UTC
-+++ adb/sysdeps.h
-@@ -330,6 +330,11 @@ size_t ParseCompleteUTF8(const char* first, const char
-
- #include <cutils/sockets.h>
-
-+#if defined(__Bitrig__) || defined(__DragonFly__) || \
-+ defined(__FreeBSD__) || defined(__OpenBSD__)
-+#include <pthread_np.h>
-+#endif
-+
- #define OS_PATH_SEPARATORS "/"
- #define OS_PATH_SEPARATOR '/'
- #define OS_PATH_SEPARATOR_STR "/"
-@@ -516,6 +521,12 @@ inline int adb_socket_get_local_port(borrowed_fd fd) {
- static __inline__ int adb_thread_setname(const std::string& name) {
- #ifdef __APPLE__
- return pthread_setname_np(name.c_str());
-+#elif defined(__Bitrig__) || defined(__DragonFly__) || \
-+ defined(__FreeBSD__) || defined(__OpenBSD__)
-+ pthread_set_name_np(pthread_self(), name.c_str());
-+ return 0;
-+#elif defined(__NetBSD__)
-+ return pthread_setname_np(pthread_self(), "%s", (void*)name.c_str());
- #else
- // Both bionic and glibc's pthread_setname_np fails rather than truncating long strings.
- // glibc doesn't have strlcpy, so we have to fake it.
diff --git a/devel/android-tools-adb/files/patch-adb_transport__usb.cpp b/devel/android-tools-adb/files/patch-adb_transport__usb.cpp
deleted file mode 100644
index a89b9bfac585..000000000000
--- a/devel/android-tools-adb/files/patch-adb_transport__usb.cpp
+++ /dev/null
@@ -1,11 +0,0 @@
---- adb/transport_usb.cpp.orig 2018-06-21 00:58:42 UTC
-+++ adb/transport_usb.cpp
-@@ -186,6 +186,8 @@ int is_adb_interface(int usb_class, int usb_subclass,
- bool should_use_libusb() {
- #if !ADB_HOST
- return false;
-+#elif !defined(__linux__) && !defined(__APPLE__) && !defined(_WIN32)
-+ return true;
- #else
- static bool enable = getenv("ADB_LIBUSB") && strcmp(getenv("ADB_LIBUSB"), "1") == 0;
- return enable;
diff --git a/devel/android-tools-adb/files/patch-adb_usb.h b/devel/android-tools-adb/files/patch-adb_usb.h
deleted file mode 100644
index ca72a7ee6a48..000000000000
--- a/devel/android-tools-adb/files/patch-adb_usb.h
+++ /dev/null
@@ -1,20 +0,0 @@
---- adb/usb.h.orig 2017-06-20 10:50:27 UTC
-+++ adb/usb.h
-@@ -43,6 +43,7 @@ namespace libusb {
- ADB_USB_INTERFACE(libusb::usb_handle*);
- }
-
-+#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
- namespace native {
- struct usb_handle;
- ADB_USB_INTERFACE(native::usb_handle*);
-@@ -53,6 +54,9 @@ struct usb_handle {
- };
-
- ADB_USB_INTERFACE(::usb_handle*);
-+#else
-+using namespace libusb;
-+#endif
-
- #endif // linux host || darwin
-
diff --git a/devel/android-tools-adb/files/patch-base_file.cpp b/devel/android-tools-adb/files/patch-base_file.cpp
deleted file mode 100644
index 9129decebfbf..000000000000
--- a/devel/android-tools-adb/files/patch-base_file.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
---- base/file.cpp.orig 2019-07-17 19:54:09 UTC
-+++ base/file.cpp
-@@ -20,6 +20,7 @@
- #include <fcntl.h>
- #include <ftw.h>
- #include <libgen.h>
-+#include <limits.h> // PATH_MAX for GCC
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -35,6 +36,9 @@
- #if defined(__APPLE__)
- #include <mach-o/dyld.h>
- #endif
-+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
-+#include <sys/sysctl.h>
-+#endif
- #if defined(_WIN32)
- #include <direct.h>
- #include <windows.h>
-@@ -421,6 +425,23 @@ std::string GetExecutablePath() {
- if (result == 0 || result == sizeof(path) - 1) return "";
- path[PATH_MAX - 1] = 0;
- return path;
-+#elif defined(KERN_PROC_PATHNAME)
-+ char path[PATH_MAX + 1];
-+ size_t path_len = sizeof(path);
-+ int mib[] = {
-+ CTL_KERN,
-+#if defined(__NetBSD__)
-+ KERN_PROC_ARGS,
-+ -1,
-+ KERN_PROC_PATHNAME,
-+#else
-+ KERN_PROC,
-+ KERN_PROC_PATHNAME,
-+ -1,
-+#endif
-+ };
-+ int rc = sysctl(mib, arraysize(mib), path, &path_len, NULL, 0);
-+ return rc ? "" : path;
- #else
- #error unknown OS
- #endif
diff --git a/devel/android-tools-adb/files/patch-base_file__test.cpp b/devel/android-tools-adb/files/patch-base_file__test.cpp
deleted file mode 100644
index f0c8bab75b77..000000000000
--- a/devel/android-tools-adb/files/patch-base_file__test.cpp
+++ /dev/null
@@ -1,51 +0,0 @@
---- base/file_test.cpp.orig 2020-02-11 20:44:45 UTC
-+++ base/file_test.cpp
-@@ -61,12 +61,20 @@ TEST(file, ReadFileToString_WriteStringToFile_symlink)
- ASSERT_EQ(0, unlink(link.path));
- ASSERT_EQ(0, symlink(target.path, link.path));
- ASSERT_FALSE(android::base::WriteStringToFile("foo", link.path, false));
-+#ifdef __linux__
- ASSERT_EQ(ELOOP, errno);
-+#else
-+ ASSERT_EQ(EMLINK, errno);
-+#endif
- ASSERT_TRUE(android::base::WriteStringToFile("foo", link.path, true));
-
- std::string s;
- ASSERT_FALSE(android::base::ReadFileToString(link.path, &s));
-+#ifdef __linux__
- ASSERT_EQ(ELOOP, errno);
-+#else
-+ ASSERT_EQ(EMLINK, errno);
-+#endif
- ASSERT_TRUE(android::base::ReadFileToString(link.path, &s, true));
- ASSERT_EQ("foo", s);
- }
-@@ -235,7 +243,7 @@ TEST(file, RemoveFileIfExists_EACCES) {
- // EACCES -- one of the directories in the path has no search permission
- // root can bypass permission restrictions, so drop root.
- if (getuid() == 0) {
-- passwd* shell = getpwnam("shell");
-+ passwd* shell = getpwnam("nobody");
- setgid(shell->pw_gid);
- setuid(shell->pw_uid);
- }
-@@ -257,6 +265,7 @@ TEST(file, RemoveFileIfExists_EACCES) {
-
- TEST(file, Readlink) {
- #if !defined(_WIN32)
-+#ifdef __linux__
- // Linux doesn't allow empty symbolic links.
- std::string min("x");
- // ext2 and ext4 both have PAGE_SIZE limits.
-@@ -265,6 +274,10 @@ TEST(file, Readlink) {
- // in current kernels (and marlin/sailfish where we're seeing this
- // failure are still on 3.18, far from current). http://b/33306057.
- std::string max(static_cast<size_t>(4096 - 2 - 1 - 1), 'x');
-+#else
-+ std::string min("");
-+ std::string max(static_cast<size_t>(1024 - 1), 'x');
-+#endif
-
- TemporaryDir td;
- std::string min_path{std::string(td.path) + "/" + "min"};
diff --git a/devel/android-tools-adb/files/patch-base_include_android-base_logging.h b/devel/android-tools-adb/files/patch-base_include_android-base_logging.h
deleted file mode 100644
index 7bdccd8bad78..000000000000
--- a/devel/android-tools-adb/files/patch-base_include_android-base_logging.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- base/include/android-base/logging.h.orig 2019-07-17 19:54:09 UTC
-+++ base/include/android-base/logging.h
-@@ -350,7 +350,7 @@ struct LogAbortAfterFullExpr {
- // DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally
- // CHECK should be used unless profiling identifies a CHECK as being in
- // performance critical code.
--#if defined(NDEBUG) && !defined(__clang_analyzer__)
-+#if defined(NDEBUG) && !defined(__clang_analyzer__) || !defined(__ANDROID__)
- static constexpr bool kEnableDChecks = false;
- #else
- static constexpr bool kEnableDChecks = true;
diff --git a/devel/android-tools-adb/files/patch-base_include_android-base_thread__annotations.h b/devel/android-tools-adb/files/patch-base_include_android-base_thread__annotations.h
deleted file mode 100644
index f2a1f8f68ba0..000000000000
--- a/devel/android-tools-adb/files/patch-base_include_android-base_thread__annotations.h
+++ /dev/null
@@ -1,14 +0,0 @@
---- base/include/android-base/thread_annotations.h.orig 2019-07-17 19:54:09 UTC
-+++ base/include/android-base/thread_annotations.h
-@@ -18,7 +18,11 @@
-
- #include <mutex>
-
-+#ifdef __clang__
- #define THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
-+#else
-+#define THREAD_ANNOTATION_ATTRIBUTE__(x)
-+#endif
-
- #define CAPABILITY(x) \
- THREAD_ANNOTATION_ATTRIBUTE__(capability(x))
diff --git a/devel/android-tools-adb/files/patch-base_threads.cpp b/devel/android-tools-adb/files/patch-base_threads.cpp
deleted file mode 100644
index df22b968c34a..000000000000
--- a/devel/android-tools-adb/files/patch-base_threads.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
---- base/threads.cpp.orig 2019-07-17 19:54:09 UTC
-+++ base/threads.cpp
-@@ -25,6 +25,16 @@
- #include <syscall.h>
- #elif defined(_WIN32)
- #include <windows.h>
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <pthread_np.h>
-+#elif defined(__NetBSD__)
-+#include <lwp.h>
-+#elif defined(__OpenBSD__)
-+#include <unistd.h>
-+#elif defined(__sun)
-+#include <thread.h>
-+#else // fallback
-+#include <stdint.h>
- #endif
-
- namespace android {
-@@ -41,6 +51,16 @@ uint64_t GetThreadId() {
- return syscall(__NR_gettid);
- #elif defined(_WIN32)
- return GetCurrentThreadId();
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+ return pthread_getthreadid_np();
-+#elif defined(__NetBSD__)
-+ return _lwp_self();
-+#elif defined(__OpenBSD__)
-+ return getthrid();
-+#elif defined(__sun)
-+ return thr_self();
-+#else // fallback
-+ return (intptr_t) pthread_self();
- #endif
- }
-
diff --git a/devel/android-tools-adb/files/patch-gtest-1.8.1 b/devel/android-tools-adb/files/patch-gtest-1.8.1
deleted file mode 100644
index 002ec7edcafd..000000000000
--- a/devel/android-tools-adb/files/patch-gtest-1.8.1
+++ /dev/null
@@ -1,55 +0,0 @@
-bugreport_test.cpp:77:20: error: no member named 'tr1' in namespace 'std'
- ::std::tr1::get<0>(args)->OnStdout(output_.c_str(), output_.size());
- ~~~~~~~^
-bugreport_test.cpp:77:37: error: member reference type 'const testing::ActionInterface<void (StandardStreamsCallbackInterface *)>::ArgumentTuple' (aka 'const tuple<StandardStreamsCallbackInterface *>') is not a pointer; did you mean to use '.'?
- ::std::tr1::get<0>(args)->OnStdout(output_.c_str(), output_.size());
- ~~~~~~^~
- .
-bugreport_test.cpp:77:39: error: no member named 'OnStdout' in 'std::__1::tuple<StandardStreamsCallbackInterface *>'
- ::std::tr1::get<0>(args)->OnStdout(output_.c_str(), output_.size());
- ~~~~~~ ^
-bugreport_test.cpp:80:20: error: no member named 'tr1' in namespace 'std'
- ::std::tr1::get<0>(args)->OnStderr(output_.c_str(), output_.size());
- ~~~~~~~^
-bugreport_test.cpp:80:37: error: member reference type 'const testing::ActionInterface<void (StandardStreamsCallbackInterface *)>::ArgumentTuple' (aka 'const tuple<StandardStreamsCallbackInterface *>') is not a pointer; did you mean to use '.'?
- ::std::tr1::get<0>(args)->OnStderr(output_.c_str(), output_.size());
- ~~~~~~^~
- .
-bugreport_test.cpp:80:39: error: no member named 'OnStderr' in 'std::__1::tuple<StandardStreamsCallbackInterface *>'
- ::std::tr1::get<0>(args)->OnStderr(output_.c_str(), output_.size());
- ~~~~~~ ^
-bugreport_test.cpp:108:29: error: no member named 'tr1' in namespace 'std'
- int status = ::std::tr1::get<0>(args)->Done(status_);
- ~~~~~~~^
-bugreport_test.cpp:108:46: error: member reference type 'const testing::ActionInterface<int (StandardStreamsCallbackInterface *)>::ArgumentTuple' (aka 'const tuple<StandardStreamsCallbackInterface *>') is not a pointer; did you mean to use '.'?
- int status = ::std::tr1::get<0>(args)->Done(status_);
- ~~~~~~^~
- .
-bugreport_test.cpp:108:48: error: no member named 'Done' in 'std::__1::tuple<StandardStreamsCallbackInterface *>'
- int status = ::std::tr1::get<0>(args)->Done(status_);
- ~~~~~~ ^
-
---- adb/bugreport_test.cpp.orig 2016-09-28 18:07:09 UTC
-+++ adb/bugreport_test.cpp
-@@ -74,10 +74,10 @@ class OnStandardStreamsCallbackAction : public ActionI
- }
- virtual Result Perform(const ArgumentTuple& args) {
- if (type_ == kStreamStdout) {
-- ::std::tr1::get<0>(args)->OnStdout(output_.c_str(), output_.size());
-+ std::get<0>(args)->OnStdout(output_.c_str(), output_.size());
- }
- if (type_ == kStreamStderr) {
-- ::std::tr1::get<0>(args)->OnStderr(output_.c_str(), output_.size());
-+ std::get<0>(args)->OnStderr(output_.c_str(), output_.size());
- }
- }
-
-@@ -105,7 +105,7 @@ class CallbackDoneAction : public ActionInterface<Call
- explicit CallbackDoneAction(int status) : status_(status) {
- }
- virtual Result Perform(const ArgumentTuple& args) {
-- int status = ::std::tr1::get<0>(args)->Done(status_);
-+ int status = std::get<0>(args)->Done(status_);
- return status;
- }
-
diff --git a/devel/android-tools-adb/files/patch-libcrypto__utils_android__pubkey.c b/devel/android-tools-adb/files/patch-libcrypto__utils_android__pubkey.c
deleted file mode 100644
index 88e0fd607201..000000000000
--- a/devel/android-tools-adb/files/patch-libcrypto__utils_android__pubkey.c
+++ /dev/null
@@ -1,204 +0,0 @@
---- libcrypto_utils/android_pubkey.c.orig 2016-04-16 00:01:39 UTC
-+++ libcrypto_utils/android_pubkey.c
-@@ -61,10 +61,49 @@ static void reverse_bytes(uint8_t* buffer, size_t size
- }
- }
-
-+#if OPENSSL_VERSION_NUMBER < 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
-+// http://github.com/google/boringssl/commit/5a91503826ad
-+static void RSA_get0_key(const RSA *rsa, const BIGNUM **out_n, const BIGNUM **out_e,
-+ const BIGNUM **out_d) {
-+ if (out_n != NULL) {
-+ *out_n = rsa->n;
-+ }
-+ if (out_e != NULL) {
-+ *out_e = rsa->e;
-+ }
-+ if (out_d != NULL) {
-+ *out_d = rsa->d;
-+ }
-+}
-+
-+static int RSA_set0_key(RSA *rsa, BIGNUM *n, BIGNUM *e, BIGNUM *d) {
-+ if ((rsa->n == NULL && n == NULL) ||
-+ (rsa->e == NULL && e == NULL)) {
-+ return 0;
-+ }
-+
-+ if (n != NULL) {
-+ BN_free(rsa->n);
-+ rsa->n = n;
-+ }
-+ if (e != NULL) {
-+ BN_free(rsa->e);
-+ rsa->e = e;
-+ }
-+ if (d != NULL) {
-+ BN_free(rsa->d);
-+ rsa->d = d;
-+ }
-+
-+ return 1;
-+}
-+#endif
-+
- bool android_pubkey_decode(const uint8_t* key_buffer, size_t size, RSA** key) {
- const RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
- bool ret = false;
- uint8_t modulus_buffer[ANDROID_PUBKEY_MODULUS_SIZE];
-+ BIGNUM *new_key_n, *new_key_e;
- RSA* new_key = RSA_new();
- if (!new_key) {
- goto cleanup;
-@@ -81,14 +120,14 @@ bool android_pubkey_decode(const uint8_t* key_buffer,
- // Convert the modulus to big-endian byte order as expected by BN_bin2bn.
- memcpy(modulus_buffer, key_struct->modulus, sizeof(modulus_buffer));
- reverse_bytes(modulus_buffer, sizeof(modulus_buffer));
-- new_key->n = BN_bin2bn(modulus_buffer, sizeof(modulus_buffer), NULL);
-- if (!new_key->n) {
-+ new_key_n = BN_bin2bn(modulus_buffer, sizeof(modulus_buffer), NULL);
-+ if (!new_key_n) {
- goto cleanup;
- }
-
- // Read the exponent.
-- new_key->e = BN_new();
-- if (!new_key->e || !BN_set_word(new_key->e, key_struct->exponent)) {
-+ new_key_e = BN_new();
-+ if (!new_key_e || !BN_set_word(new_key_e, key_struct->exponent)) {
- goto cleanup;
- }
-
-@@ -100,6 +139,7 @@ bool android_pubkey_decode(const uint8_t* key_buffer,
- // be added here if/when we want the additional speedup from using the
- // pre-computed montgomery parameters.
-
-+ RSA_set0_key(new_key, new_key_n, new_key_e, NULL);
- *key = new_key;
- ret = true;
-
-@@ -110,6 +150,83 @@ cleanup:
- return ret;
- }
-
-+#if !defined(OPENSSL_IS_BORINGSSL)
-+// https://android.googlesource.com/platform/external/chromium_org/third_party/boringssl/src/+/6887edb%5E!/
-+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
-+struct bignum_st {
-+ BN_ULONG *d; /* Pointer to an array of 'BN_BITS2' bit chunks in little-endian
-+ order. */
-+ int top; // Index of last used element in |d|, plus one.
-+ int dmax; // Size of |d|, in words.
-+ int neg; // one if the number is negative
-+ int flags; // bitmask of BN_FLG_* values
-+};
-+#endif
-+
-+// constant_time_select_ulong returns |x| if |v| is 1 and |y| if |v| is 0. Its
-+// behavior is undefined if |v| takes any other value.
-+static BN_ULONG constant_time_select_ulong(int v, BN_ULONG x, BN_ULONG y) {
-+ BN_ULONG mask = v;
-+ mask--;
-+
-+ return (~mask & x) | (mask & y);
-+}
-+
-+// constant_time_le_size_t returns 1 if |x| <= |y| and 0 otherwise. |x| and |y|
-+// must not have their MSBs set.
-+static int constant_time_le_size_t(size_t x, size_t y) {
-+ return ((x - y - 1) >> (sizeof(size_t) * 8 - 1)) & 1;
-+}
-+
-+// read_word_padded returns the |i|'th word of |in|, if it is not out of
-+// bounds. Otherwise, it returns 0. It does so without branches on the size of
-+// |in|, however it necessarily does not have the same memory access pattern. If
-+// the access would be out of bounds, it reads the last word of |in|. |in| must
-+// not be zero.
-+static BN_ULONG read_word_padded(const BIGNUM *in, size_t i) {
-+ // Read |in->d[i]| if valid. Otherwise, read the last word.
-+ BN_ULONG l = in->d[constant_time_select_ulong(
-+ constant_time_le_size_t(in->dmax, i), in->dmax - 1, i)];
-+
-+ // Clamp to zero if above |d->top|.
-+ return constant_time_select_ulong(constant_time_le_size_t(in->top, i), 0, l);
-+}
-+
-+int BN_bn2bin_padded(uint8_t *out, size_t len, const BIGNUM *in) {
-+ // Special case for |in| = 0. Just branch as the probability is negligible.
-+ if (BN_is_zero(in)) {
-+ memset(out, 0, len);
-+ return 1;
-+ }
-+
-+ // Check if the integer is too big. This case can exit early in non-constant
-+ // time.
-+ if ((size_t)in->top > (len + (BN_BYTES - 1)) / BN_BYTES) {
-+ return 0;
-+ }
-+ if ((len % BN_BYTES) != 0) {
-+ BN_ULONG l = read_word_padded(in, len / BN_BYTES);
-+ if (l >> (8 * (len % BN_BYTES)) != 0) {
-+ return 0;
-+ }
-+ }
-+
-+ // Write the bytes out one by one. Serialization is done without branching on
-+ // the bits of |in| or on |in->top|, but if the routine would otherwise read
-+ // out of bounds, the memory access pattern can't be fixed. However, for an
-+ // RSA key of size a multiple of the word size, the probability of BN_BYTES
-+ // leading zero octets is low.
-+ //
-+ // See Falko Stenzke, "Manger's Attack revisited", ICICS 2010.
-+ size_t i = len;
-+ while (i--) {
-+ BN_ULONG l = read_word_padded(in, i / BN_BYTES);
-+ *(out++) = (uint8_t)(l >> (8 * (i % BN_BYTES))) & 0xff;
-+ }
-+ return 1;
-+}
-+#endif
-+
- static bool android_pubkey_encode_bignum(const BIGNUM* num, uint8_t* buffer) {
- if (!BN_bn2bin_padded(buffer, ANDROID_PUBKEY_MODULUS_SIZE, num)) {
- return false;
-@@ -120,6 +237,7 @@ static bool android_pubkey_encode_bignum(const BIGNUM*
- }
-
- bool android_pubkey_encode(const RSA* key, uint8_t* key_buffer, size_t size) {
-+ const BIGNUM *key_n, *key_e;
- RSAPublicKey* key_struct = (RSAPublicKey*)key_buffer;
- bool ret = false;
- BN_CTX* ctx = BN_CTX_new();
-@@ -136,27 +254,28 @@ bool android_pubkey_encode(const RSA* key, uint8_t* ke
- key_struct->modulus_size_words = ANDROID_PUBKEY_MODULUS_SIZE_WORDS;
-
- // Compute and store n0inv = -1 / N[0] mod 2^32.
-+ RSA_get0_key(key, &key_n, &key_e, NULL);
- if (!ctx || !r32 || !n0inv || !BN_set_bit(r32, 32) ||
-- !BN_mod(n0inv, key->n, r32, ctx) ||
-+ !BN_mod(n0inv, key_n, r32, ctx) ||
- !BN_mod_inverse(n0inv, n0inv, r32, ctx) || !BN_sub(n0inv, r32, n0inv)) {
- goto cleanup;
- }
- key_struct->n0inv = (uint32_t)BN_get_word(n0inv);
-
- // Store the modulus.
-- if (!android_pubkey_encode_bignum(key->n, key_struct->modulus)) {
-+ if (!android_pubkey_encode_bignum(key_n, key_struct->modulus)) {
- goto cleanup;
- }
-
- // Compute and store rr = (2^(rsa_size)) ^ 2 mod N.
- if (!ctx || !rr || !BN_set_bit(rr, ANDROID_PUBKEY_MODULUS_SIZE * 8) ||
-- !BN_mod_sqr(rr, rr, key->n, ctx) ||
-+ !BN_mod_sqr(rr, rr, key_n, ctx) ||
- !android_pubkey_encode_bignum(rr, key_struct->rr)) {
- goto cleanup;
- }
-
- // Store the exponent.
-- key_struct->exponent = (uint32_t)BN_get_word(key->e);
-+ key_struct->exponent = (uint32_t)BN_get_word(key_e);
-
- ret = true;
-
diff --git a/devel/android-tools-adb/files/patch-libcutils_include_cutils_trace.h b/devel/android-tools-adb/files/patch-libcutils_include_cutils_trace.h
deleted file mode 100644
index 147cc6815cf7..000000000000
--- a/devel/android-tools-adb/files/patch-libcutils_include_cutils_trace.h
+++ /dev/null
@@ -1,17 +0,0 @@
---- libcutils/include/cutils/trace.h.orig 2019-07-17 19:54:09 UTC
-+++ libcutils/include/cutils/trace.h
-@@ -18,8 +18,14 @@
- #define _LIBS_CUTILS_TRACE_H
-
- #include <inttypes.h>
-+#ifdef __cplusplus
-+#include <atomic>
-+using std::atomic_bool;
-+using std::memory_order_acquire;
-+#else
- #include <stdatomic.h>
- #include <stdbool.h>
-+#endif
- #include <stdint.h>
- #include <stdio.h>
- #include <sys/cdefs.h>
diff --git a/devel/android-tools-adb/files/patch-libcutils_threads.cpp b/devel/android-tools-adb/files/patch-libcutils_threads.cpp
deleted file mode 100644
index 469fb8ffd69e..000000000000
--- a/devel/android-tools-adb/files/patch-libcutils_threads.cpp
+++ /dev/null
@@ -1,45 +0,0 @@
---- libcutils/threads.cpp.orig 2018-07-13 19:58:45 UTC
-+++ libcutils/threads.cpp
-@@ -24,11 +24,21 @@
- #include <sys/syscall.h>
- #include <sys/time.h>
- #include <unistd.h>
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <pthread_np.h>
-+#elif defined(__NetBSD__)
-+#include <lwp.h>
-+#elif defined(__OpenBSD__)
-+#include <unistd.h>
-+#elif defined(__sun)
-+#include <thread.h>
- #elif defined(__linux__) && !defined(__ANDROID__)
- #include <syscall.h>
- #include <unistd.h>
- #elif defined(_WIN32)
- #include <windows.h>
-+#else // fallback
-+#include <stdint.h>
- #endif
-
- // No definition needed for Android because we'll just pick up bionic's copy.
-@@ -38,10 +46,20 @@ pid_t gettid() {
- uint64_t tid;
- pthread_threadid_np(NULL, &tid);
- return tid;
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+ return pthread_getthreadid_np();
-+#elif defined(__NetBSD__)
-+ return _lwp_self();
-+#elif defined(__OpenBSD__)
-+ return getthrid();
-+#elif defined(__sun)
-+ return thr_self();
- #elif defined(__linux__)
- return syscall(__NR_gettid);
- #elif defined(_WIN32)
- return GetCurrentThreadId();
-+#else // fallback
-+ return (intptr_t) pthread_self();
- #endif
- }
- #endif // __ANDROID__
diff --git a/devel/android-tools-adb/files/patch-liblog_logger.h b/devel/android-tools-adb/files/patch-liblog_logger.h
deleted file mode 100644
index 2bf6f1fe9fa0..000000000000
--- a/devel/android-tools-adb/files/patch-liblog_logger.h
+++ /dev/null
@@ -1,16 +0,0 @@
---- liblog/logger.h.orig 2020-02-11 20:44:45 UTC
-+++ liblog/logger.h
-@@ -16,7 +16,13 @@
-
- #pragma once
-
-+#ifdef __cplusplus
-+#include <atomic>
-+using std::atomic_int;
-+using std::atomic_uintptr_t;
-+#else
- #include <stdatomic.h>
-+#endif
- #include <sys/cdefs.h>
-
- #include <log/log.h>
diff --git a/devel/android-tools-adb/files/patch-liblog_logger__write.cpp b/devel/android-tools-adb/files/patch-liblog_logger__write.cpp
deleted file mode 100644
index de32cf8fbf70..000000000000
--- a/devel/android-tools-adb/files/patch-liblog_logger__write.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
---- liblog/logger_write.cpp.orig 2020-02-11 20:44:45 UTC
-+++ liblog/logger_write.cpp
-@@ -51,6 +51,16 @@
- #include <syscall.h>
- #elif defined(_WIN32)
- #include <windows.h>
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <pthread_np.h>
-+#elif defined(__NetBSD__)
-+#include <lwp.h>
-+#elif defined(__OpenBSD__)
-+#include <unistd.h>
-+#elif defined(__sun)
-+#include <thread.h>
-+#else // fallback
-+#include <stdint.h>
- #endif
-
- using android::base::ErrnoRestorer;
-@@ -248,6 +258,16 @@ static uint64_t GetThreadId() {
- return syscall(__NR_gettid);
- #elif defined(_WIN32)
- return GetCurrentThreadId();
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+ return pthread_getthreadid_np();
-+#elif defined(__NetBSD__)
-+ return _lwp_self();
-+#elif defined(__OpenBSD__)
-+ return getthrid();
-+#elif defined(__sun)
-+ return thr_self();
-+#else // fallback
-+ return (intptr_t) pthread_self();
- #endif
- }
-
diff --git a/devel/android-tools-adb/pkg-descr b/devel/android-tools-adb/pkg-descr
deleted file mode 100644
index b49c5066081a..000000000000
--- a/devel/android-tools-adb/pkg-descr
+++ /dev/null
@@ -1,5 +0,0 @@
-Android Debug Bridge (adb) is a versatile command line tool that
-lets you communicate with an emulator instance or connected
-Android-powered device.
-
-WWW: http://developer.android.com/tools/help/adb.html
diff --git a/devel/android-tools-fastboot/Makefile b/devel/android-tools-fastboot/Makefile
deleted file mode 100644
index ec8d904ed7fc..000000000000
--- a/devel/android-tools-fastboot/Makefile
+++ /dev/null
@@ -1,59 +0,0 @@
-PORTNAME= android-tools-fastboot
-DISTVERSIONPREFIX= platform-tools-
-DISTVERSION?= 29.0.6
-PORTREVISION?= 1
-CATEGORIES= devel sysutils
-MASTER_SITES= https://salsa.debian.org/android-tools-team/android-tools/raw/706e754/debian/:manpage
-DISTFILES= fastboot.1:manpage
-EXTRACT_ONLY= ${DISTFILES:N*\:manpage:C/:.*//}
-
-MAINTAINER= ports@FreeBSD.org
-COMMENT= Android Fastboot protocol CLI tool
-
-LICENSE= APACHE20 BSD2CLAUSE
-LICENSE_COMB= multi
-
-USE_GITHUB= yes
-GH_TUPLE= aosp-mirror:platform_system_core:${DISTVERSIONFULL} \
- jbeich:platform_external_avb:${DISTVERSIONFULL}:avb/avb \
- jbeich:platform_system_extras:${DISTVERSIONFULL}:extras/extras \
- jbeich:platform_system_tools_mkbootimg:${DISTVERSIONFULL}:mkbootimg/mkbootimg
-
-CONFLICTS_INSTALL?= ${PORTNAME}-devel
-
-USES= compiler:c++17-lang pkgconfig ssl uidfix
-BUILD_WRKSRC= ${WRKSRC}/fastboot
-INSTALL_WRKSRC= ${BUILD_WRKSRC}
-MAKEFILE?= ${.CURDIR}/files/Makefile
-MAKE_ENV= BINDIR="${PREFIX}/bin" EXTRADIR="${FILESDIR}" \
- FILESDIR="${DOCSDIR}" \
- VERSION="${DISTVERSION}${DISTVERSIONSUFFIX}" \
- MANDIR="${PREFIX}/share/man/man"
-PLIST_FILES= bin/fastboot \
- share/man/man1/fastboot.1.gz
-PORTDOCS= *
-SUB_FILES= pkg-message
-
-OPTIONS_DEFINE= BASH DOCS
-OPTIONS_SUB= yes
-
-.if make(makesum) # for optional distfiles
-.MAKEFLAGS: WITH="${OPTIONS_DEFINE}"
-.endif
-
-BASH_GH_TUPLE= mbrubeck:android-completion:c1b0656:bashcomp
-BASH_PLIST_FILES= etc/bash_completion.d/fastboot
-BASH_VARS= LICENSE+=MIT
-
-DOCS_MAKE_ARGS_OFF= FILES="" FILESDIR=""
-
-post-extract:
- @${CP} ${_DISTDIR}/${DISTFILES:M*\:manpage:C/:.*//} \
- ${BUILD_WRKSRC}
-
-post-install-BASH-on:
- ${MKDIR} ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES:H}
- ${INSTALL_DATA} ${WRKSRC_bashcomp}/android \
- ${STAGEDIR}${PREFIX}/${BASH_PLIST_FILES}
-
-.include <bsd.port.mk>
diff --git a/devel/android-tools-fastboot/distinfo b/devel/android-tools-fastboot/distinfo
deleted file mode 100644
index ae39f48f6c96..000000000000
--- a/devel/android-tools-fastboot/distinfo
+++ /dev/null
@@ -1,13 +0,0 @@
-TIMESTAMP = 1581453885
-SHA256 (fastboot.1) = 2af01b064440952a82f1602691a0fecc030302722a71444946fb70d9c423d283
-SIZE (fastboot.1) = 5906
-SHA256 (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 3d1898c1ad19f63641090576c60588ab761132b42b306ff4979d30723187d562
-SIZE (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 72302409
-SHA256 (jbeich-platform_external_avb-platform-tools-29.0.6_GH0.tar.gz) = 3ea64518a9bcbb54bdc755e7558b810b47b506a1f020e600bf8f215315a329e0
-SIZE (jbeich-platform_external_avb-platform-tools-29.0.6_GH0.tar.gz) = 863119
-SHA256 (jbeich-platform_system_extras-platform-tools-29.0.6_GH0.tar.gz) = 528a9d09b342b9037153f9b11ae619c9bbc9908301755bd24687db407257f5aa
-SIZE (jbeich-platform_system_extras-platform-tools-29.0.6_GH0.tar.gz) = 280670895
-SHA256 (jbeich-platform_system_tools_mkbootimg-platform-tools-29.0.6_GH0.tar.gz) = e0671a28899351c4ea7b68f6bd8465db88926f5233824fae379bfcf4608c2bda
-SIZE (jbeich-platform_system_tools_mkbootimg-platform-tools-29.0.6_GH0.tar.gz) = 12397
-SHA256 (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = ca3311ba47a5edd56c929ac9aae57c02c2c3f1636519c5f67abb00b6e3ecd75c
-SIZE (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = 5967
diff --git a/devel/android-tools-fastboot/files/Makefile b/devel/android-tools-fastboot/files/Makefile
deleted file mode 100644
index 840ded151846..000000000000
--- a/devel/android-tools-fastboot/files/Makefile
+++ /dev/null
@@ -1,113 +0,0 @@
-PROG_CXX=fastboot
-BINDIR?=/usr/bin
-FILESDIR?=${DOCDIR}/${PROG}
-
-FILES= README.md
-
-SRCS+= bootimg_utils.cpp
-SRCS+= fastboot.cpp
-SRCS+= fastboot_driver.cpp
-SRCS+= ../fastboot/fs.cpp
-SRCS+= main.cpp
-SRCS+= socket.cpp
-SRCS+= tcp.cpp
-SRCS+= udp.cpp
-SRCS+= util.cpp
-
-.PATH: ${EXTRADIR}
-SRCS+= usb_libusb.cpp
-
-# required by fastboot, diagnose_usb and libziparchive
-.PATH: ${.CURDIR}/../base
-SRCS+= errors_unix.cpp
-SRCS+= file.cpp
-SRCS+= liblog_symbols.cpp
-SRCS+= logging.cpp
-SRCS+= mapped_file.cpp
-SRCS+= parsenetaddress.cpp
-SRCS+= stringprintf.cpp
-SRCS+= strings.cpp
-SRCS+= threads.cpp
-
-# required by fastboot
-.PATH: ${.CURDIR}/../diagnose_usb
-SRCS+= diagnose_usb.cpp
-
-# required by fs_mgr/liblp
-.PATH: ${.CURDIR}/../extras/ext4_utils
-SRCS+= ext4_sb.cpp
-SRCS+= ext4_utils.cpp
-
-# required by fastboot
-.PATH: ${.CURDIR}/../fs_mgr/liblp
-SRCS+= images.cpp
-SRCS+= partition_opener.cpp
-SRCS+= reader.cpp
-SRCS+= utility.cpp
-SRCS+= writer.cpp
-
-# required by fastboot
-.PATH: ${.CURDIR}/../libcutils
-SRCS+= android_get_control_file.cpp
-SRCS+= ../libcutils/sockets.cpp
-SRCS+= socket_inaddr_any_server_unix.cpp
-SRCS+= socket_network_client_unix.cpp
-SRCS+= sockets_unix.cpp
-# DragonFly, NetBSD, OpenBSD
-CPPFLAGS.sockets.cpp+= -o ${.TARGET}
-
-# required by base and zip_archive
-.PATH: ${.CURDIR}/../liblog
-SRCS+= logger_write.cpp
-SRCS+= ../liblog/properties.cpp
-
-# required by fastboot
-.PATH: ${.CURDIR}/../libsparse
-SRCS+= backed_block.cpp
-SRCS+= output_file.cpp
-SRCS+= sparse.cpp
-SRCS+= sparse_crc32.cpp
-SRCS+= sparse_err.cpp
-SRCS+= sparse_read.cpp
-
-# required by fastboot
-.PATH: ${.CURDIR}/../libziparchive
-SRCS+= zip_archive.cc
-
-CPPFLAGS+= -DPLATFORM_TOOLS_VERSION="\"${VERSION:U0.0.0}\""
-CPPFLAGS+= -Doff64_t=off_t
-CPPFLAGS+= -Dftruncate64=ftruncate
-CPPFLAGS+= -Dlseek64=lseek
-CPPFLAGS+= -Dmmap64=mmap
-CPPFLAGS+= -I${.CURDIR}
-CPPFLAGS+= -I${.CURDIR}/../include
-CPPFLAGS+= -I${.CURDIR}/../avb
-CPPFLAGS+= -I${.CURDIR}/../base/include
-CPPFLAGS+= -I${.CURDIR}/../diagnose_usb/include
-CPPFLAGS+= -I${.CURDIR}/../extras/ext4_utils/include
-CPPFLAGS+= -I${.CURDIR}/../fs_mgr/liblp/include
-CPPFLAGS+= -I${.CURDIR}/../libsparse/include
-CPPFLAGS+= -I${.CURDIR}/../libziparchive/include
-CPPFLAGS+= -I${.CURDIR}/../mkbootimg/include/bootimg
-CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
-CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
-CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
-CXXFLAGS+= -D__STDC_LIMIT_MACROS # DragonFly
-CXXFLAGS+= -std=gnu++17
-
-.ifndef COMPILE.c
-CFLAGS+= ${CPPFLAGS}
-CXXFLAGS+= ${CPPFLAGS}
-.endif
-
-LDADD+= $$(${PKG_CONFIG} libcrypto --libs 2>/dev/null || echo -lcrypto)
-LDADD+= $$(${PKG_CONFIG} libusb-1.0 --libs 2>/dev/null || echo -lusb)
-LDADD+= -lz \-lpthread
-DPADD+= ${LIBPTHREAD} ${LIBUSB} ${LIBZ}
-
-PKG_CONFIG?= pkg-config
-
-beforeinstall:
- ${INSTALL} -d ${DESTDIR}${FILESDIR}
-
-.include <bsd.prog.mk>
diff --git a/devel/android-tools-fastboot/files/patch-base_file.cpp b/devel/android-tools-fastboot/files/patch-base_file.cpp
deleted file mode 100644
index 9129decebfbf..000000000000
--- a/devel/android-tools-fastboot/files/patch-base_file.cpp
+++ /dev/null
@@ -1,44 +0,0 @@
---- base/file.cpp.orig 2019-07-17 19:54:09 UTC
-+++ base/file.cpp
-@@ -20,6 +20,7 @@
- #include <fcntl.h>
- #include <ftw.h>
- #include <libgen.h>
-+#include <limits.h> // PATH_MAX for GCC
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -35,6 +36,9 @@
- #if defined(__APPLE__)
- #include <mach-o/dyld.h>
- #endif
-+#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__)
-+#include <sys/sysctl.h>
-+#endif
- #if defined(_WIN32)
- #include <direct.h>
- #include <windows.h>
-@@ -421,6 +425,23 @@ std::string GetExecutablePath() {
- if (result == 0 || result == sizeof(path) - 1) return "";
- path[PATH_MAX - 1] = 0;
- return path;
-+#elif defined(KERN_PROC_PATHNAME)
-+ char path[PATH_MAX + 1];
-+ size_t path_len = sizeof(path);
-+ int mib[] = {
-+ CTL_KERN,
-+#if defined(__NetBSD__)
-+ KERN_PROC_ARGS,
-+ -1,
-+ KERN_PROC_PATHNAME,
-+#else
-+ KERN_PROC,
-+ KERN_PROC_PATHNAME,
-+ -1,
-+#endif
-+ };
-+ int rc = sysctl(mib, arraysize(mib), path, &path_len, NULL, 0);
-+ return rc ? "" : path;
- #else
- #error unknown OS
- #endif
diff --git a/devel/android-tools-fastboot/files/patch-base_include_android-base_endian.h b/devel/android-tools-fastboot/files/patch-base_include_android-base_endian.h
deleted file mode 100644
index 04bda9b2f8b0..000000000000
--- a/devel/android-tools-fastboot/files/patch-base_include_android-base_endian.h
+++ /dev/null
@@ -1,19 +0,0 @@
---- base/include/android-base/endian.h.orig 2019-10-18 00:22:21 UTC
-+++ base/include/android-base/endian.h
-@@ -25,10 +25,15 @@
-
- #include <sys/endian.h>
-
--#elif defined(__GLIBC__)
-+#elif defined(__GLIBC__) || defined(__DragonFly__) || defined(__FreeBSD__) || \
-+ defined(__NetBSD__) || defined(__OpenBSD__)
-
-+#if defined(__GLIBC__)
- /* glibc's <endian.h> is like bionic's <sys/endian.h>. */
- #include <endian.h>
-+#else
-+#include <sys/endian.h>
-+#endif
-
- /* glibc keeps htons and htonl in <netinet/in.h>. */
- #include <netinet/in.h>
diff --git a/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h b/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h
deleted file mode 100644
index 7bdccd8bad78..000000000000
--- a/devel/android-tools-fastboot/files/patch-base_include_android-base_logging.h
+++ /dev/null
@@ -1,11 +0,0 @@
---- base/include/android-base/logging.h.orig 2019-07-17 19:54:09 UTC
-+++ base/include/android-base/logging.h
-@@ -350,7 +350,7 @@ struct LogAbortAfterFullExpr {
- // DCHECKs are debug variants of CHECKs only enabled in debug builds. Generally
- // CHECK should be used unless profiling identifies a CHECK as being in
- // performance critical code.
--#if defined(NDEBUG) && !defined(__clang_analyzer__)
-+#if defined(NDEBUG) && !defined(__clang_analyzer__) || !defined(__ANDROID__)
- static constexpr bool kEnableDChecks = false;
- #else
- static constexpr bool kEnableDChecks = true;
diff --git a/devel/android-tools-fastboot/files/patch-base_threads.cpp b/devel/android-tools-fastboot/files/patch-base_threads.cpp
deleted file mode 100644
index df22b968c34a..000000000000
--- a/devel/android-tools-fastboot/files/patch-base_threads.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
---- base/threads.cpp.orig 2019-07-17 19:54:09 UTC
-+++ base/threads.cpp
-@@ -25,6 +25,16 @@
- #include <syscall.h>
- #elif defined(_WIN32)
- #include <windows.h>
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <pthread_np.h>
-+#elif defined(__NetBSD__)
-+#include <lwp.h>
-+#elif defined(__OpenBSD__)
-+#include <unistd.h>
-+#elif defined(__sun)
-+#include <thread.h>
-+#else // fallback
-+#include <stdint.h>
- #endif
-
- namespace android {
-@@ -41,6 +51,16 @@ uint64_t GetThreadId() {
- return syscall(__NR_gettid);
- #elif defined(_WIN32)
- return GetCurrentThreadId();
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+ return pthread_getthreadid_np();
-+#elif defined(__NetBSD__)
-+ return _lwp_self();
-+#elif defined(__OpenBSD__)
-+ return getthrid();
-+#elif defined(__sun)
-+ return thr_self();
-+#else // fallback
-+ return (intptr_t) pthread_self();
- #endif
- }
-
diff --git a/devel/android-tools-fastboot/files/patch-extras_ext4__utils_ext4__utils.cpp b/devel/android-tools-fastboot/files/patch-extras_ext4__utils_ext4__utils.cpp
deleted file mode 100644
index 802be5e45ca5..000000000000
--- a/devel/android-tools-fastboot/files/patch-extras_ext4__utils_ext4__utils.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
---- extras/ext4_utils/ext4_utils.cpp.orig 2019-08-13 02:10:50 UTC
-+++ extras/ext4_utils/ext4_utils.cpp
-@@ -32,8 +32,16 @@
-
- #if defined(__linux__)
- #include <linux/fs.h>
--#elif defined(__APPLE__) && defined(__MACH__)
-+#elif defined(__FreeBSD__) || defined(__FreeBSD_kernel__) \
-+ || (defined(__APPLE__) && defined(__MACH__))
- #include <sys/disk.h>
-+#elif defined(__sun)
-+#include <sys/dkio.h>
-+#elif defined(__Bitrig__) || defined(__NetBSD__) || defined(__OpenBSD__)
-+#include <sys/disklabel.h>
-+#include <sys/dkio.h>
-+#elif defined(__DragonFly__)
-+#include <sys/diskslice.h>
- #endif
-
- int force = 0;
-@@ -206,10 +214,24 @@ u64 get_block_device_size(int fd)
- u64 size = 0;
- int ret;
-
--#if defined(__linux__)
-+#if defined(BLKGETSIZE64)
- ret = ioctl(fd, BLKGETSIZE64, &size);
--#elif defined(__APPLE__) && defined(__MACH__)
-+#elif defined(DKIOCGETBLOCKCOUNT)
- ret = ioctl(fd, DKIOCGETBLOCKCOUNT, &size);
-+#elif defined(DIOCGMEDIASIZE)
-+ ret = ioctl(fd, DIOCGMEDIASIZE, &size);
-+#elif defined(DKIOCGMEDIAINFO)
-+ struct dk_minfo minfo;
-+ ret = ioctl(fd, DKIOCGMEDIAINFO, &minfo);
-+ size = minfo.dki_lbsize * minfo.dki_capacity;
-+#elif defined(DIOCGDINFO)
-+ struct disklabel dl;
-+ ret = ioctl(fd, DIOCGDINFO, &dl);
-+ size = dl.d_secsize * dl.d_nsectors * dl.d_ntracks * dl.d_ncylinders;
-+#elif defined(DIOCGPART)
-+ struct partinfo pi;
-+ ret = ioctl(fd, DIOCGPART, &pi);
-+ size = pi.media_size;
- #else
- close(fd);
- return 0;
diff --git a/devel/android-tools-fastboot/files/patch-fastboot_fastboot.1 b/devel/android-tools-fastboot/files/patch-fastboot_fastboot.1
deleted file mode 100644
index 35997d9b409e..000000000000
--- a/devel/android-tools-fastboot/files/patch-fastboot_fastboot.1
+++ /dev/null
@@ -1,40 +0,0 @@
---- fastboot/fastboot.1.orig 2015-06-11 14:34:07 UTC
-+++ fastboot/fastboot.1
-@@ -1,4 +1,4 @@
--.TH fastboot
-+.TH fastboot 1
- .SH NAME
- fastboot \- manipulate the non-volatile flash partitions
- .SH SYNOPSIS
-@@ -21,9 +21,9 @@ fastboot is primarily used for installin
- The partition should adhere to a specific layout. Fastboot was designed
- for use with phones and tablets running the Android operating system.
- .PP
--To allow non-root user access to the devices, one might needed to add
--udev rules file for the specific device and add the user to the
--appopriate group (typically the group is named \fIplugdev\fR).
-+To allow non-root user access to the devices, one might need to adjust
-+permissions via \fI/etc/devd/*.conf\fR file for a particular device or
-+via \fI/etc/devfs.rules\fR for a particular user or group.
- .PP
- If the device is not connected, certain fastboot commands display the
- output:
-@@ -176,9 +176,9 @@ Thie variable can be used to specify the
-
- .fi
- .SH DIAGNOSTICS
--Make sure that the device is connected and is visible via \fIlsusb\fR.
--If the device is detected by `\fIlsusb\fR' and `\fIadb devices\fR' output
--shows `\fI???????????? device\fR', then try reloading udev rules or
-+Make sure that the device is connected and is visible via \fIusbconfig\fR.
-+If the device is detected by `\fIusbconfig\fR' and `\fIadb devices\fR' output
-+shows `\fI???????????? device\fR', then try restarting \fBdevd\fP(8) or
- try disconnecting and connecting the cables.
- .SH BUGS
- The command name should have been chosen more carefully to reflect its
-@@ -190,4 +190,4 @@ was written by engineers at Google for t
- Ramakrishnan Muthukrishnan wrote this manual page, originally for the
- Debian Project, with a lot of suggestions from Raul Miller.
- .SH SEE ALSO
--\fBadb\fP(1), \fBudev\fP(7), \fBlsusb\fP(8)
-+\fBadb\fP(1), \fBdevd.conf\fP(5), \fBdevfs.rules\fP(5), \fBusbconfig\fP(8)
diff --git a/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp b/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp
deleted file mode 100644
index 4b8449b72656..000000000000
--- a/devel/android-tools-fastboot/files/patch-fastboot_fastboot.cpp
+++ /dev/null
@@ -1,25 +0,0 @@
---- fastboot/fastboot.cpp.orig 2019-10-18 00:22:21 UTC
-+++ fastboot/fastboot.cpp
-@@ -59,10 +59,21 @@
- #include <android-base/stringprintf.h>
- #include <android-base/strings.h>
- #include <android-base/unique_fd.h>
-+#ifdef PLATFORM_TOOLS_VERSION
-+#include <sys/utsname.h>
-+namespace android { namespace build {
-+std::string GetBuildNumber() {
-+ struct utsname uts;
-+ if (uname(&uts) == -1)
-+ return "unknown";
-+ return uts.sysname;
-+}}}
-+#else
- #include <build/version.h>
-+#include <platform_tools_version.h>
-+#endif
- #include <libavb/libavb.h>
- #include <liblp/liblp.h>
--#include <platform_tools_version.h>
- #include <sparse/sparse.h>
- #include <ziparchive/zip_archive.h>
-
diff --git a/devel/android-tools-fastboot/files/patch-fastboot_socket.h b/devel/android-tools-fastboot/files/patch-fastboot_socket.h
deleted file mode 100644
index 6b0b4bf20dd5..000000000000
--- a/devel/android-tools-fastboot/files/patch-fastboot_socket.h
+++ /dev/null
@@ -1,14 +0,0 @@
---- fastboot/socket.h.orig 2016-02-20 02:39:51 UTC
-+++ fastboot/socket.h
-@@ -41,7 +41,10 @@
-
- #include <android-base/macros.h>
- #include <cutils/sockets.h>
--#include <gtest/gtest_prod.h>
-+
-+// Copied from <gtest/gtest_prod.h>
-+#define FRIEND_TEST(test_case_name, test_name)\
-+friend class test_case_name##_##test_name##_Test
-
- // Socket interface to be implemented for each platform.
- class Socket {
diff --git a/devel/android-tools-fastboot/files/patch-liblog_logger.h b/devel/android-tools-fastboot/files/patch-liblog_logger.h
deleted file mode 100644
index 2bf6f1fe9fa0..000000000000
--- a/devel/android-tools-fastboot/files/patch-liblog_logger.h
+++ /dev/null
@@ -1,16 +0,0 @@
---- liblog/logger.h.orig 2020-02-11 20:44:45 UTC
-+++ liblog/logger.h
-@@ -16,7 +16,13 @@
-
- #pragma once
-
-+#ifdef __cplusplus
-+#include <atomic>
-+using std::atomic_int;
-+using std::atomic_uintptr_t;
-+#else
- #include <stdatomic.h>
-+#endif
- #include <sys/cdefs.h>
-
- #include <log/log.h>
diff --git a/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp b/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp
deleted file mode 100644
index de32cf8fbf70..000000000000
--- a/devel/android-tools-fastboot/files/patch-liblog_logger__write.cpp
+++ /dev/null
@@ -1,36 +0,0 @@
---- liblog/logger_write.cpp.orig 2020-02-11 20:44:45 UTC
-+++ liblog/logger_write.cpp
-@@ -51,6 +51,16 @@
- #include <syscall.h>
- #elif defined(_WIN32)
- #include <windows.h>
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+#include <pthread_np.h>
-+#elif defined(__NetBSD__)
-+#include <lwp.h>
-+#elif defined(__OpenBSD__)
-+#include <unistd.h>
-+#elif defined(__sun)
-+#include <thread.h>
-+#else // fallback
-+#include <stdint.h>
- #endif
-
- using android::base::ErrnoRestorer;
-@@ -248,6 +258,16 @@ static uint64_t GetThreadId() {
- return syscall(__NR_gettid);
- #elif defined(_WIN32)
- return GetCurrentThreadId();
-+#elif defined(__DragonFly__) || defined(__FreeBSD__)
-+ return pthread_getthreadid_np();
-+#elif defined(__NetBSD__)
-+ return _lwp_self();
-+#elif defined(__OpenBSD__)
-+ return getthrid();
-+#elif defined(__sun)
-+ return thr_self();
-+#else // fallback
-+ return (intptr_t) pthread_self();
- #endif
- }
-
diff --git a/devel/android-tools-fastboot/files/pkg-message.in b/devel/android-tools-fastboot/files/pkg-message.in
deleted file mode 100644
index 685189b9b7d0..000000000000
--- a/devel/android-tools-fastboot/files/pkg-message.in
+++ /dev/null
@@ -1,13 +0,0 @@
-[
-{ type: install
- message: <<EOM
-The port installed fastboot(1) under %%PREFIX%%/bin. However, there's
-a different fastboot(8) under /sbin. To avoid accidentally invoking
-the wrong command make sure either to
-
-- adjust PATH environment variable to have fastboot(1) found first
-- create a shell alias with absolute path to fastboot(1)
-- create a symlink with different name in PATH e.g., under ~/bin
-EOM
-}
-]
diff --git a/devel/android-tools-fastboot/files/usb_libusb.cpp b/devel/android-tools-fastboot/files/usb_libusb.cpp
deleted file mode 100644
index de2385f6a27b..000000000000
--- a/devel/android-tools-fastboot/files/usb_libusb.cpp
+++ /dev/null
@@ -1,223 +0,0 @@
-/*
- * Copyright (C) 2011 Hans Petter Selasky. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in
- * the documentation and/or other materials provided with the
- * distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
- * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
- * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
- * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <libusb.h>
-
-#include <memory>
-
-#include "usb.h"
-
-struct usb_handle {
- libusb_device_handle *handle;
- libusb_device *dev;
- unsigned char ep_in;
- unsigned char ep_out;
- unsigned char iface;
-};
-
-class LibusbUsbTransport : public UsbTransport {
-public:
- explicit LibusbUsbTransport(std::unique_ptr<usb_handle> handle, uint32_t ms_timeout):
- h(std::move(handle)), ms_timeout_(ms_timeout) {}
- ~LibusbUsbTransport() override;
-
- ssize_t Read(void *_data, size_t len) override;
- ssize_t Write(const void *_data, size_t len) override;
- int Close() override;
- int Reset() override;
-
-private:
- std::unique_ptr<usb_handle> h;
- const uint32_t ms_timeout_;
-
- DISALLOW_COPY_AND_ASSIGN(LibusbUsbTransport);
-};
-
-static int
-probe(std::unique_ptr<usb_handle> &h, ifc_match_func callback)
-{
- usb_ifc_info info;
- libusb_device_descriptor ddesc;
- libusb_config_descriptor *pcfg;
- int i, j;
-
- if (libusb_open(h->dev, &h->handle) < 0)
- return (-1);
-
- if (libusb_get_device_descriptor(h->dev, &ddesc) < 0) {
- libusb_close(h->handle);
- return (-1);
- }
- memset(&info, 0, sizeof(info));
-
- info.dev_vendor = ddesc.idVendor;
- info.dev_product = ddesc.idProduct;
- info.dev_class = ddesc.bDeviceClass;
- info.dev_subclass = ddesc.bDeviceSubClass;
- info.dev_protocol = ddesc.bDeviceProtocol;
- info.writable = 1;
-
- snprintf(info.device_path, sizeof(info.device_path), "usb:%d:%d",
- libusb_get_bus_number(h->dev), libusb_get_device_address(h->dev));
-
- if (ddesc.iSerialNumber != 0) {
- libusb_get_string_descriptor_ascii(h->handle, ddesc.iSerialNumber,
- (unsigned char *)info.serial_number, sizeof(info.serial_number));
- }
- if (libusb_get_active_config_descriptor(h->dev, &pcfg)) {
- libusb_close(h->handle);
- return (-1);
- }
-
- for (i = 0; i < pcfg->bNumInterfaces; i++) {
-
- h->ep_in = 0;
- h->ep_out = 0;
- h->iface = i;
-
- for (j = 0; j < pcfg->interface[i].altsetting[0].bNumEndpoints; j++) {
-
- unsigned char temp = pcfg->interface[i].altsetting[0].
- endpoint[j].bEndpointAddress;
- unsigned char type = pcfg->interface[i].altsetting[0].
- endpoint[j].bmAttributes & 0x03;
-
- /* check for BULK endpoint */
- if ((type & 0x03) == 0x02) {
- /* check for IN endpoint */
- if (temp & 0x80)
- h->ep_in = temp;
- else
- h->ep_out = temp;
- }
- }
-
- info.ifc_class = pcfg->interface[i].altsetting[0].bInterfaceClass;
- info.ifc_subclass = pcfg->interface[i].altsetting[0].bInterfaceSubClass;
- info.ifc_protocol = pcfg->interface[i].altsetting[0].bInterfaceProtocol;
- info.has_bulk_in = (h->ep_in != 0);
- info.has_bulk_out = (h->ep_out != 0);
-
- if (libusb_claim_interface(h->handle, h->iface) < 0)
- continue;
-
- if (callback(&info) == 0) {
- libusb_free_config_descriptor(pcfg);
- return (0);
- }
- libusb_release_interface(h->handle, h->iface);
- }
-
- libusb_free_config_descriptor(pcfg);
- libusb_close(h->handle);
- return (-1);
-}
-
-static std::unique_ptr<usb_handle>
-enumerate(ifc_match_func callback)
-{
- static libusb_context *ctx = NULL;
- std::unique_ptr<usb_handle> h;
- libusb_device **ppdev;
- ssize_t ndev;
- ssize_t x;
-
- if (ctx == NULL)
- libusb_init(&ctx);
-
- ndev = libusb_get_device_list(ctx, &ppdev);
- for (x = 0; x < ndev; x++) {
-
- h.reset(new usb_handle);
-
- h->dev = ppdev[x];
-
- if (probe(h, callback) == 0) {
- libusb_ref_device(h->dev);
- libusb_free_device_list(ppdev, 1);
- return (h);
- }
- }
- h.reset();
- libusb_free_device_list(ppdev, 1);
- return (nullptr);
-}
-
-ssize_t
-LibusbUsbTransport::Write(const void *_data, size_t len)
-{
- int actlen;
-
- if (libusb_bulk_transfer(h->handle, h->ep_out,
- (unsigned char *)_data, len, &actlen, ms_timeout_) < 0)
- return (-1);
- return (actlen);
-}
-
-ssize_t
-LibusbUsbTransport::Read(void *_data, size_t len)
-{
- int actlen;
-
- if (libusb_bulk_transfer(h->handle, h->ep_in,
- (unsigned char *)_data, len, &actlen, ms_timeout_) < 0)
- return (-1);
- return (actlen);
-}
-
-LibusbUsbTransport::~LibusbUsbTransport()
-{
- Close();
-}
-
-int
-LibusbUsbTransport::Close()
-{
- libusb_close(h->handle);
- h->handle = NULL;
- libusb_unref_device(h->dev);
- h.reset();
- return (0);
-}
-
-int
-LibusbUsbTransport::Reset()
-{
- if (libusb_reset_device(h->handle))
- return (-1);
- return (0);
-}
-
-UsbTransport *
-usb_open(ifc_match_func callback, uint32_t timeout_ms)
-{
- std::unique_ptr<usb_handle> h = enumerate(callback);
- return (h ? new LibusbUsbTransport(std::move(h), timeout_ms) : nullptr);
-}
diff --git a/devel/android-tools-fastboot/pkg-descr b/devel/android-tools-fastboot/pkg-descr
deleted file mode 100644
index 18bab0ae9bac..000000000000
--- a/devel/android-tools-fastboot/pkg-descr
+++ /dev/null
@@ -1,3 +0,0 @@
-Fastboot protocol is a mechanism for communicating with bootloaders
-over USB or Ethernet. The provided command line tool can be used
-to flash filesystems on Android-powered devices.
diff --git a/devel/android-tools/Makefile b/devel/android-tools/Makefile
new file mode 100644
index 000000000000..a94d3b780700
--- /dev/null
+++ b/devel/android-tools/Makefile
@@ -0,0 +1,34 @@
+PORTNAME= android-tools
+PORTVERSION= 31.0.3p1
+CATEGORIES= devel
+MASTER_SITES= GH
+
+MAINTAINER= nc@FreeBSD.org
+COMMENT= Android debugging tools
+
+LICENSE= APACHE20
+LICENSE_FILE= ${WRKSRC}/LICENSE
+
+LIB_DEPENDS= libbrotlicommon.so:archivers/brotli \
+ libgmock.so:devel/googletest \
+ liblz4.so:archivers/liblz4 \
+ libpcre2-8.so:devel/pcre2 \
+ libprotobuf.so:devel/protobuf \
+ libzstd.so:archivers/zstd
+
+USES= cmake go:no_targets perl5 python:3.7+ shebangfix
+
+USE_GITHUB= yes
+GH_ACCOUNT= neelchauhan
+GH_PROJECT= freebsd-${PORTNAME}
+GH_TAGNAME= 7fa3613259c9c1e4bc4f82af46dfca975e28a930
+
+SHEBANG_FILES= vendor/mkbootimg/repack_bootimg.py \
+ vendor/mkbootimg/mkbootimg.py \
+ vendor/mkbootimg/unpack_bootimg.py
+
+MAKE_ENV+= GOFLAGS=-mod=vendor \
+ GOPATH=${WRKSRC}/vendor/boringssl/vendor \
+ GOPROXY=off
+
+.include <bsd.port.mk>
diff --git a/devel/android-tools/distinfo b/devel/android-tools/distinfo
new file mode 100644
index 000000000000..6b4cf1a90b49
--- /dev/null
+++ b/devel/android-tools/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1654813422
+SHA256 (neelchauhan-freebsd-android-tools-31.0.3p1-7fa3613259c9c1e4bc4f82af46dfca975e28a930_GH0.tar.gz) = 7322c908319c42c5d83f00ff6bc805e173bce01eb4d96dd1ed4561fb2fb37ef1
+SIZE (neelchauhan-freebsd-android-tools-31.0.3p1-7fa3613259c9c1e4bc4f82af46dfca975e28a930_GH0.tar.gz) = 40958596
diff --git a/devel/android-tools/files/patch-vendor_adb_client_file__sync__client.cpp b/devel/android-tools/files/patch-vendor_adb_client_file__sync__client.cpp
new file mode 100644
index 000000000000..4883dd619897
--- /dev/null
+++ b/devel/android-tools/files/patch-vendor_adb_client_file__sync__client.cpp
@@ -0,0 +1,37 @@
+--- vendor/adb/client/file_sync_client.cpp.orig 2022-06-09 20:52:06 UTC
++++ vendor/adb/client/file_sync_client.cpp
+@@ -394,9 +394,16 @@ class SyncConnection {
+
+ void* p = buf.data();
+
++#ifdef __FreeBSD__
++ // TODO: Delete when 12.x goes EOL
++ p = (char *)memcpy(p, &req, sizeof(SyncRequest)) + sizeof(SyncRequest);
++ p = (char *)memcpy(p, path.data(), path.length()) + path.length();
++ p = (char *)memcpy(p, &msg.send_v2_setup, sizeof(msg.send_v2_setup)) + sizeof(msg.send_v2_setup);
++#else
+ p = mempcpy(p, &req, sizeof(SyncRequest));
+ p = mempcpy(p, path.data(), path.length());
+ p = mempcpy(p, &msg.send_v2_setup, sizeof(msg.send_v2_setup));
++#endif
+
+ return WriteFdExactly(fd, buf.data(), buf.size());
+ }
+@@ -441,9 +448,16 @@ class SyncConnection {
+
+ void* p = buf.data();
+
++#ifdef __FreeBSD__
++ // TODO: Delete when 12.x goes EOL
++ p = (char *)memcpy(p, &req, sizeof(SyncRequest)) + sizeof(SyncRequest);
++ p = (char *)memcpy(p, path.data(), path.length()) + path.length();
++ p = (char *)memcpy(p, &msg.send_v2_setup, sizeof(msg.send_v2_setup)) + sizeof(msg.send_v2_setup);
++#else
+ p = mempcpy(p, &req, sizeof(SyncRequest));
+ p = mempcpy(p, path.data(), path.length());
+- p = mempcpy(p, &msg.recv_v2_setup, sizeof(msg.recv_v2_setup));
++ p = mempcpy(p, &msg.send_v2_setup, sizeof(msg.send_v2_setup));
++#endif
+
+ return WriteFdExactly(fd, buf.data(), buf.size());
+ }
diff --git a/devel/android-tools/files/patch-vendor_adb_compression__utils.h b/devel/android-tools/files/patch-vendor_adb_compression__utils.h
new file mode 100644
index 000000000000..a51f7377e357
--- /dev/null
+++ b/devel/android-tools/files/patch-vendor_adb_compression__utils.h
@@ -0,0 +1,28 @@
+--- vendor/adb/compression_utils.h.orig 2022-06-09 20:52:06 UTC
++++ vendor/adb/compression_utils.h
+@@ -95,7 +95,12 @@ struct NullDecoder final : public Decoder {
+ void* p = output_buffer_.data();
+ while (available_out > 0 && !input_buffer_.empty()) {
+ size_t len = std::min(available_out, input_buffer_.front_size());
++#ifdef __FreeBSD__
++ // TODO: Delete when FreeBSD 12.x goes EOL
++ p = (char *)memcpy(p, input_buffer_.front_data(), len) + len;
++#else
+ p = mempcpy(p, input_buffer_.front_data(), len);
++#endif
+ available_out -= len;
+ input_buffer_.drop_front(len);
+ }
+@@ -119,7 +124,12 @@ struct NullEncoder final : public Encoder {
+
+ while (available_out > 0 && !input_buffer_.empty()) {
+ size_t len = std::min(available_out, input_buffer_.front_size());
++#ifdef __FreeBSD__
++ // TODO: Delete when FreeBSD 12.x goes EOL
++ p = (char *)memcpy(p, input_buffer_.front_data(), len) + len;
++#else
+ p = mempcpy(p, input_buffer_.front_data(), len);
++#endif
+ available_out -= len;
+ input_buffer_.drop_front(len);
+ }
diff --git a/devel/android-tools/pkg-descr b/devel/android-tools/pkg-descr
new file mode 100644
index 000000000000..d50ff7fb3c2f
--- /dev/null
+++ b/devel/android-tools/pkg-descr
@@ -0,0 +1,10 @@
+Android tools for FreeBSD. Tools include:
+
+ * adb
+ * fastboot
+ * mke2fs.android (required by fastboot)
+ * simg2img, img2simg, append2simg
+ * lpdump, lpmake, lpadd, lpflash, lpunpack
+ * mkbootimg, unpack_bootimg, repack_bootimg
+
+WWW: https://github.com/neelchauhan/freebsd-android-tools
diff --git a/devel/android-tools/pkg-plist b/devel/android-tools/pkg-plist
new file mode 100644
index 000000000000..34592897be55
--- /dev/null
+++ b/devel/android-tools/pkg-plist
@@ -0,0 +1,18 @@
+bin/adb
+bin/append2simg
+bin/fastboot
+bin/img2simg
+bin/lpadd
+bin/lpdump
+bin/lpflash
+bin/lpmake
+bin/lpunpack
+bin/mkbootimg
+bin/mke2fs.android
+bin/repack_bootimg
+bin/simg2img
+bin/unpack_bootimg
+%%DATADIR%%/completions/adb
+%%DATADIR%%/completions/fastboot
+share/bash-completion/completions/adb
+share/bash-completion/completions/fastboot