git: 70cd49992b45 - main - devel/android-tools: New port: Android debugging tools

From: Neel Chauhan <nc_at_FreeBSD.org>
Date: Thu, 09 Jun 2022 22:46:23 UTC
The branch main has been updated by nc:

URL: https://cgit.FreeBSD.org/ports/commit/?id=70cd49992b459b8d4bb69da5b22929205e1bfb9d

commit 70cd49992b459b8d4bb69da5b22929205e1bfb9d
Author:     Neel Chauhan <nc@FreeBSD.org>
AuthorDate: 2022-06-09 22:45:02 +0000
Commit:     Neel Chauhan <nc@FreeBSD.org>
CommitDate: 2022-06-09 22:45:02 +0000

    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`.
---
 MOVED                                              |   2 +
 devel/Makefile                                     |   3 +-
 devel/android-tools-adb/Makefile                   |  79 --------
 devel/android-tools-adb/distinfo                   |   7 -
 devel/android-tools-adb/files/Makefile             | 149 --------------
 devel/android-tools-adb/files/patch-adb_adb.cpp    |  22 --
 .../files/patch-adb_bugreport__test.cpp            |  35 ----
 .../files/patch-adb_client_adb__install.cpp        | 105 ----------
 .../files/patch-adb_client_auth.cpp                |  44 ----
 .../files/patch-adb_client_commandline.cpp         |  38 ----
 ...tch-adb_client_transport__mdns__unsupported.cpp |  21 --
 .../files/patch-adb_client_usb__libusb.cpp         | 133 ------------
 .../files/patch-adb_socket__spec__test.cpp         |  14 --
 devel/android-tools-adb/files/patch-adb_sysdeps.h  |  27 ---
 .../files/patch-adb_transport__usb.cpp             |  11 -
 devel/android-tools-adb/files/patch-adb_usb.h      |  20 --
 devel/android-tools-adb/files/patch-base_file.cpp  |  44 ----
 .../files/patch-base_file__test.cpp                |  51 -----
 .../patch-base_include_android-base_logging.h      |  11 -
 ...base_include_android-base_thread__annotations.h |  14 --
 .../android-tools-adb/files/patch-base_threads.cpp |  36 ----
 devel/android-tools-adb/files/patch-gtest-1.8.1    |  55 -----
 .../files/patch-libcrypto__utils_android__pubkey.c | 204 -------------------
 .../files/patch-libcutils_include_cutils_trace.h   |  17 --
 .../files/patch-libcutils_threads.cpp              |  45 -----
 .../android-tools-adb/files/patch-liblog_logger.h  |  16 --
 .../files/patch-liblog_logger__write.cpp           |  36 ----
 devel/android-tools-adb/pkg-descr                  |   5 -
 devel/android-tools-fastboot/Makefile              |  59 ------
 devel/android-tools-fastboot/distinfo              |  13 --
 devel/android-tools-fastboot/files/Makefile        | 113 -----------
 .../files/patch-base_file.cpp                      |  44 ----
 .../files/patch-base_include_android-base_endian.h |  19 --
 .../patch-base_include_android-base_logging.h      |  11 -
 .../files/patch-base_threads.cpp                   |  36 ----
 .../files/patch-extras_ext4__utils_ext4__utils.cpp |  47 -----
 .../files/patch-fastboot_fastboot.1                |  40 ----
 .../files/patch-fastboot_fastboot.cpp              |  25 ---
 .../files/patch-fastboot_socket.h                  |  14 --
 .../files/patch-liblog_logger.h                    |  16 --
 .../files/patch-liblog_logger__write.cpp           |  36 ----
 devel/android-tools-fastboot/files/pkg-message.in  |  13 --
 devel/android-tools-fastboot/files/usb_libusb.cpp  | 223 ---------------------
 devel/android-tools-fastboot/pkg-descr             |   3 -
 devel/android-tools/Makefile                       |  34 ++++
 devel/android-tools/distinfo                       |   3 +
 .../patch-vendor_adb_client_file__sync__client.cpp |  37 ++++
 .../files/patch-vendor_adb_compression__utils.h    |  28 +++
 devel/android-tools/pkg-descr                      |  10 +
 devel/android-tools/pkg-plist                      |  18 ++
 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("");
*** 1478 LINES SKIPPED ***