View | Details | Raw Unified | Return to bug 252570
Collapse All | Expand All

(-)b/devel/android-tools-adb/Makefile (-2 / +5 lines)
Lines 2-9 Link Here
2
2
3
PORTNAME=	android-tools-adb
3
PORTNAME=	android-tools-adb
4
DISTVERSIONPREFIX=	platform-tools-
4
DISTVERSIONPREFIX=	platform-tools-
5
DISTVERSION?=	29.0.6
5
DISTVERSION?=	30.0.0
6
PORTREVISION?=	1
6
PORTREVISION?=	0
7
CATEGORIES=	devel comms
7
CATEGORIES=	devel comms
8
8
9
MAINTAINER=	jbeich@FreeBSD.org
9
MAINTAINER=	jbeich@FreeBSD.org
Lines 11-16 COMMENT= Android debug bridge command line tool Link Here
11
11
12
LICENSE=	APACHE20
12
LICENSE=	APACHE20
13
13
14
LIB_DEPENDS=	libbrotlienc.so:archivers/brotli \
15
		libprotobuf-lite.so:devel/protobuf
16
14
USE_GITHUB=	yes
17
USE_GITHUB=	yes
15
GH_TUPLE=	aosp-mirror:platform_system_core:${DISTVERSIONFULL}
18
GH_TUPLE=	aosp-mirror:platform_system_core:${DISTVERSIONFULL}
16
19
(-)b/devel/android-tools-adb/distinfo (-5 / +5 lines)
Lines 1-7 Link Here
1
TIMESTAMP = 1581453885
1
TIMESTAMP = 1587159609
2
SHA256 (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 3d1898c1ad19f63641090576c60588ab761132b42b306ff4979d30723187d562
2
SHA256 (aosp-mirror-platform_system_core-platform-tools-30.0.0_GH0.tar.gz) = b51992bbdcd3fce29b1fdd46eb623fcf75177d74c2d421c43d0fdde95d12df69
3
SIZE (aosp-mirror-platform_system_core-platform-tools-29.0.6_GH0.tar.gz) = 72302409
3
SIZE (aosp-mirror-platform_system_core-platform-tools-30.0.0_GH0.tar.gz) = 76689104
4
SHA256 (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = ca3311ba47a5edd56c929ac9aae57c02c2c3f1636519c5f67abb00b6e3ecd75c
4
SHA256 (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = ca3311ba47a5edd56c929ac9aae57c02c2c3f1636519c5f67abb00b6e3ecd75c
5
SIZE (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = 5967
5
SIZE (mbrubeck-android-completion-c1b0656_GH0.tar.gz) = 5967
6
SHA256 (aosp-mirror-platform_development-platform-tools-29.0.6_GH0.tar.gz) = 5560f767082834183e31af0fca9e121996e5e16aac67ce10f9321c4146809a0a
6
SHA256 (aosp-mirror-platform_development-platform-tools-30.0.0_GH0.tar.gz) = d3fef9f8170352e2a2729206c7d3dbc54ac3f8dfafe3cffdca9d33a5071de8eb
7
SIZE (aosp-mirror-platform_development-platform-tools-29.0.6_GH0.tar.gz) = 63959966
7
SIZE (aosp-mirror-platform_development-platform-tools-30.0.0_GH0.tar.gz) = 63963575
(-)b/devel/android-tools-adb/files/Makefile (-1 / +18 lines)
Lines 20-26 SRCS+= ../adb/sockets.cpp Link Here
20
SRCS+= sysdeps_unix.cpp
20
SRCS+= sysdeps_unix.cpp
21
SRCS+= transport.cpp
21
SRCS+= transport.cpp
22
SRCS+= transport_local.cpp
22
SRCS+= transport_local.cpp
23
SRCS+= transport_usb.cpp
24
SRCS+= types.cpp
23
SRCS+= types.cpp
25
24
26
TEST_SRCS+= adb_io_test.cpp
25
TEST_SRCS+= adb_io_test.cpp
Lines 37-42 TEST_SRCS+= types_test.cpp Link Here
37
.PATH: ${.CURDIR}/client
36
.PATH: ${.CURDIR}/client
38
SRCS+= adb_client.cpp
37
SRCS+= adb_client.cpp
39
SRCS+= adb_install.cpp
38
SRCS+= adb_install.cpp
39
SRCS+= adb_wifi.cpp
40
SRCS+= auth.cpp
40
SRCS+= auth.cpp
41
SRCS+= bugreport.cpp
41
SRCS+= bugreport.cpp
42
SRCS+= commandline.cpp
42
SRCS+= commandline.cpp
Lines 45-52 SRCS+= file_sync_client.cpp Link Here
45
SRCS+= line_printer.cpp
45
SRCS+= line_printer.cpp
46
SRCS+= main.cpp
46
SRCS+= main.cpp
47
SRCS+= transport_mdns${MDNSEXT}.cpp
47
SRCS+= transport_mdns${MDNSEXT}.cpp
48
SRCS+= transport_usb.cpp
48
SRCS+= usb_libusb.cpp
49
SRCS+= usb_libusb.cpp
49
50
51
.PATH: ${.CURDIR}/crypto
52
SRCS+= key.cpp
53
SRCS+= x509_generator.cpp
54
50
.PATH: ${.CURDIR}/fdevent
55
.PATH: ${.CURDIR}/fdevent
51
SRCS+= fdevent.cpp
56
SRCS+= fdevent.cpp
52
SRCS+= fdevent_poll.cpp
57
SRCS+= fdevent_poll.cpp
Lines 59-64 TEST_SRCS+= stat_test.cpp Link Here
59
.PATH: ${.CURDIR}/sysdeps/posix
64
.PATH: ${.CURDIR}/sysdeps/posix
60
SRCS+= network.cpp
65
SRCS+= network.cpp
61
66
67
.PATH: ${.CURDIR}/tls
68
SRCS+= tls_connection.cpp
69
62
.PATH: ${.CURDIR}/../base
70
.PATH: ${.CURDIR}/../base
63
SRCS+= chrono_utils.cpp
71
SRCS+= chrono_utils.cpp
64
SRCS+= file.cpp
72
SRCS+= file.cpp
Lines 107-112 CPPFLAGS+= -Dpread64=pread Link Here
107
CPPFLAGS+= -Dpwrite64=pwrite
115
CPPFLAGS+= -Dpwrite64=pwrite
108
CPPFLAGS+= -I${.CURDIR}
116
CPPFLAGS+= -I${.CURDIR}
109
CPPFLAGS+= -I${.CURDIR}/client
117
CPPFLAGS+= -I${.CURDIR}/client
118
CPPFLAGS+= -I${.CURDIR}/crypto/include
119
CPPFLAGS+= -I${.CURDIR}/pairing_connection/include
120
CPPFLAGS+= -I${.CURDIR}/proto
121
CPPFLAGS+= -I${.CURDIR}/tls/include
110
CPPFLAGS+= -I${.CURDIR}/../include
122
CPPFLAGS+= -I${.CURDIR}/../include
111
CPPFLAGS+= -I${.CURDIR}/../base/include
123
CPPFLAGS+= -I${.CURDIR}/../base/include
112
CPPFLAGS+= -I${.CURDIR}/../diagnose_usb/include
124
CPPFLAGS+= -I${.CURDIR}/../diagnose_usb/include
Lines 114-119 CPPFLAGS+= -I${.CURDIR}/../libcrypto_utils/include Link Here
114
CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
126
CPPFLAGS+= ${CPPFLAGS.${.IMPSRC:T}}
115
CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
127
CPPFLAGS+= $$(${PKG_CONFIG} libcrypto --cflags 2>/dev/null)
116
CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
128
CPPFLAGS+= $$(${PKG_CONFIG} libusb-1.0 --cflags 2>/dev/null)
129
CPPFLAGS+= $$(${PKG_CONFIG} protobuf-lite --cflags 2>/dev/null)
130
CPPFLAGS+= $$(${PKG_CONFIG} libbrotlidec libbrotlienc --cflags 2>/dev/null)
117
CXXFLAGS+= -std=gnu++2a
131
CXXFLAGS+= -std=gnu++2a
118
132
119
.ifndef COMPILE.c
133
.ifndef COMPILE.c
Lines 139-144 CLEANFILES+= ${PROG}_test ${TEST_OBJS} Link Here
139
153
140
PKG_CONFIG?= pkg-config
154
PKG_CONFIG?= pkg-config
141
155
156
beforebuild:
157
	protoc --cpp_out=. proto/*.proto
158
142
beforeinstall:
159
beforeinstall:
143
	${INSTALL} -d ${DESTDIR}${FILESDIR}
160
	${INSTALL} -d ${DESTDIR}${FILESDIR}
144
161
(-)b/devel/android-tools-adb/files/patch-adb_adb__auth.h (+12 lines)
Added Link Here
1
--- adb/adb_auth.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/adb_auth.h
3
@@ -23,6 +23,9 @@
4
 #include <memory>
5
 
6
 #include <openssl/rsa.h>
7
+#if !defined(OPENSSL_IS_BORINGSSL)
8
+#include <adb/crypto/key.h>
9
+#endif
10
 
11
 /* AUTH packets first argument */
12
 /* Request */
(-)b/devel/android-tools-adb/files/patch-adb_client_adb__install.cpp (-26 / +31 lines)
Lines 1-18 Link Here
1
--- adb/client/adb_install.cpp.orig	2019-10-18 00:22:21 UTC
1
--- adb/client/adb_install.cpp.orig	2020-04-17 21:40:09 UTC
2
+++ adb/client/adb_install.cpp
2
+++ adb/client/adb_install.cpp
3
@@ -35,9 +35,11 @@
3
@@ -37,12 +37,16 @@
4
 #include "adb_utils.h"
4
 #include "adb_utils.h"
5
 #include "client/file_sync_client.h"
5
 #include "client/file_sync_client.h"
6
 #include "commandline.h"
6
 #include "commandline.h"
7
+#if defined(ENABLE_FASTDEPLOY)
7
+#if defined(ENABLE_FASTDEPLOY)
8
 #include "fastdeploy.h"
8
 #include "fastdeploy.h"
9
+#endif
10
 #include "incremental.h"
11
 
12
 using namespace std::literals;
9
 
13
 
14
+#if defined(ENABLE_FASTDEPLOY)
10
 static constexpr int kFastDeployMinApi = 24;
15
 static constexpr int kFastDeployMinApi = 24;
11
+#endif
16
+#endif
12
 
17
 
13
 namespace {
18
 namespace {
14
 
19
 
15
@@ -167,6 +169,7 @@ static int install_app_streamed(int argc, const char**
20
@@ -177,6 +181,7 @@ static int install_app_streamed(int argc, const char**
16
     }
21
     }
17
 
22
 
18
     if (use_fastdeploy) {
23
     if (use_fastdeploy) {
Lines 20-26 Link Here
20
         auto metadata = extract_metadata(file);
25
         auto metadata = extract_metadata(file);
21
         if (metadata.has_value()) {
26
         if (metadata.has_value()) {
22
             // pass all but 1st (command) and last (apk path) parameters through to pm for
27
             // pass all but 1st (command) and last (apk path) parameters through to pm for
23
@@ -175,6 +178,9 @@ static int install_app_streamed(int argc, const char**
28
@@ -185,6 +190,9 @@ static int install_app_streamed(int argc, const char**
24
             auto patchFd = install_patch(pm_args.size(), pm_args.data());
29
             auto patchFd = install_patch(pm_args.size(), pm_args.data());
25
             return stream_patch(file, std::move(metadata.value()), std::move(patchFd));
30
             return stream_patch(file, std::move(metadata.value()), std::move(patchFd));
26
         }
31
         }
Lines 30-36 Link Here
30
     }
35
     }
31
 
36
 
32
     struct stat sb;
37
     struct stat sb;
33
@@ -189,7 +195,7 @@ static int install_app_streamed(int argc, const char**
38
@@ -199,7 +207,7 @@ static int install_app_streamed(int argc, const char**
34
         return 1;
39
         return 1;
35
     }
40
     }
36
 
41
 
Lines 39-45 Link Here
39
     posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
44
     posix_fadvise(local_fd.get(), 0, 0, POSIX_FADV_SEQUENTIAL | POSIX_FADV_NOREUSE);
40
 #endif
45
 #endif
41
 
46
 
42
@@ -263,6 +269,7 @@ static int install_app_legacy(int argc, const char** a
47
@@ -277,6 +285,7 @@ static int install_app_legacy(int argc, const char** a
43
     argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */
48
     argv[last_apk] = apk_dest.c_str(); /* destination name, not source location */
44
 
49
 
45
     if (use_fastdeploy) {
50
     if (use_fastdeploy) {
Lines 47-53 Link Here
47
         auto metadata = extract_metadata(apk_file[0]);
52
         auto metadata = extract_metadata(apk_file[0]);
48
         if (metadata.has_value()) {
53
         if (metadata.has_value()) {
49
             auto patchFd = apply_patch_on_device(apk_dest.c_str());
54
             auto patchFd = apply_patch_on_device(apk_dest.c_str());
50
@@ -273,6 +280,9 @@ static int install_app_legacy(int argc, const char** a
55
@@ -287,6 +296,9 @@ static int install_app_legacy(int argc, const char** a
51
 
56
 
52
             return status;
57
             return status;
53
         }
58
         }
Lines 56-101 Link Here
56
+#endif
61
+#endif
57
     }
62
     }
58
 
63
 
59
     if (do_sync_push(apk_file, apk_dest.c_str(), false)) {
64
     if (do_sync_push(apk_file, apk_dest.c_str(), false, CompressionType::Any, false)) {
60
@@ -288,7 +298,9 @@ int install_app(int argc, const char** argv) {
65
@@ -431,7 +443,9 @@ int install_app(int argc, const char** argv) {
61
     InstallMode installMode = INSTALL_DEFAULT;
62
     bool use_fastdeploy = false;
63
     bool is_reinstall = false;
66
     bool is_reinstall = false;
67
     bool wait = false;
68
     auto incremental_request = CmdlineOption::None;
64
+#if defined(ENABLE_FASTDEPLOY)
69
+#if defined(ENABLE_FASTDEPLOY)
65
     FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
70
     FastDeploy_AgentUpdateStrategy agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
66
+#endif
71
+#endif
67
 
72
 
68
     for (int i = 1; i < argc; i++) {
73
     for (int i = 1; i < argc; i++) {
69
         if (!strcmp(argv[i], "--streaming")) {
74
         if (argv[i] == "--streaming"sv) {
70
@@ -309,13 +321,19 @@ int install_app(int argc, const char** argv) {
75
@@ -452,13 +466,19 @@ int install_app(int argc, const char** argv) {
71
             use_fastdeploy = false;
76
             use_fastdeploy = false;
72
         } else if (!strcmp(argv[i], "--force-agent")) {
77
         } else if (argv[i] == "--force-agent"sv) {
73
             processedArgIndicies.push_back(i);
78
             processedArgIndices.push_back(i);
74
+#if defined(ENABLE_FASTDEPLOY)
79
+#if defined(ENABLE_FASTDEPLOY)
75
             agent_update_strategy = FastDeploy_AgentUpdateAlways;
80
             agent_update_strategy = FastDeploy_AgentUpdateAlways;
76
+#endif
81
+#endif
77
         } else if (!strcmp(argv[i], "--date-check-agent")) {
82
         } else if (argv[i] == "--date-check-agent"sv) {
78
             processedArgIndicies.push_back(i);
83
             processedArgIndices.push_back(i);
79
+#if defined(ENABLE_FASTDEPLOY)
84
+#if defined(ENABLE_FASTDEPLOY)
80
             agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp;
85
             agent_update_strategy = FastDeploy_AgentUpdateNewerTimeStamp;
81
+#endif
86
+#endif
82
         } else if (!strcmp(argv[i], "--version-check-agent")) {
87
         } else if (argv[i] == "--version-check-agent"sv) {
83
             processedArgIndicies.push_back(i);
88
             processedArgIndices.push_back(i);
84
+#if defined(ENABLE_FASTDEPLOY)
89
+#if defined(ENABLE_FASTDEPLOY)
85
             agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
90
             agent_update_strategy = FastDeploy_AgentUpdateDifferentVersion;
86
+#endif
91
+#endif
87
         }
92
         } else if (strlen(argv[i]) >= "--incr"sv.size() && "--incremental"sv.starts_with(argv[i])) {
88
     }
93
             processedArgIndices.push_back(i);
89
 
94
             incremental_request = CmdlineOption::Enable;
90
@@ -327,6 +345,7 @@ int install_app(int argc, const char** argv) {
95
@@ -479,6 +499,7 @@ int install_app(int argc, const char** argv) {
91
         error_exit("Attempting to use streaming install on unsupported device");
96
         error_exit("Attempting to use streaming install on unsupported device");
92
     }
97
     }
93
 
98
 
94
+#if defined(ENABLE_FASTDEPLOY)
99
+#if defined(ENABLE_FASTDEPLOY)
95
     if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) {
100
     if (use_fastdeploy && get_device_api_level() < kFastDeployMinApi) {
96
         printf("Fast Deploy is only compatible with devices of API version %d or higher, "
101
         fprintf(stderr,
97
                "ignoring.\n",
102
                 "Fast Deploy is only compatible with devices of API version %d or higher, "
98
@@ -334,6 +353,7 @@ int install_app(int argc, const char** argv) {
103
@@ -487,6 +508,7 @@ int install_app(int argc, const char** argv) {
99
         use_fastdeploy = false;
104
         use_fastdeploy = false;
100
     }
105
     }
101
     fastdeploy_set_agent_update_strategy(agent_update_strategy);
106
     fastdeploy_set_agent_update_strategy(agent_update_strategy);
(-)b/devel/android-tools-adb/files/patch-adb_client_commandline.cpp (-5 / +5 lines)
Lines 1-16 Link Here
1
--- adb/client/commandline.cpp.orig	2019-10-18 00:22:21 UTC
1
--- adb/client/commandline.cpp.orig	2020-04-17 21:40:09 UTC
2
+++ adb/client/commandline.cpp
2
+++ adb/client/commandline.cpp
3
@@ -59,7 +59,9 @@
3
@@ -63,7 +63,9 @@
4
 #include "bugreport.h"
4
 #include "bugreport.h"
5
 #include "client/file_sync_client.h"
5
 #include "client/file_sync_client.h"
6
 #include "commandline.h"
6
 #include "commandline.h"
7
+#if defined(ENABLE_FASTDEPLOY)
7
+#if defined(ENABLE_FASTDEPLOY)
8
 #include "fastdeploy.h"
8
 #include "fastdeploy.h"
9
+#endif
9
+#endif
10
 #include "incremental_server.h"
10
 #include "services.h"
11
 #include "services.h"
11
 #include "shell_protocol.h"
12
 #include "shell_protocol.h"
12
 #include "sysdeps/chrono.h"
13
@@ -1038,7 +1040,11 @@ static int ppp(int argc, const char** argv) {
13
@@ -1012,7 +1014,11 @@ static int ppp(int argc, const char** argv) {
14
 
14
 
15
         // copy args
15
         // copy args
16
         const char** ppp_args = (const char**)alloca(sizeof(char*) * argc + 1);
16
         const char** ppp_args = (const char**)alloca(sizeof(char*) * argc + 1);
Lines 22-28 Link Here
22
         for (i = 2 ; i < argc ; i++) {
22
         for (i = 2 ; i < argc ; i++) {
23
             //argv[2] and beyond become ppp_args[1] and beyond
23
             //argv[2] and beyond become ppp_args[1] and beyond
24
             ppp_args[i - 1] = argv[i];
24
             ppp_args[i - 1] = argv[i];
25
@@ -1024,8 +1030,13 @@ static int ppp(int argc, const char** argv) {
25
@@ -1050,8 +1056,13 @@ static int ppp(int argc, const char** argv) {
26
         adb_close(STDERR_FILENO);
26
         adb_close(STDERR_FILENO);
27
         adb_close(fd);
27
         adb_close(fd);
28
 
28
 
(-)b/devel/android-tools-adb/files/patch-adb_client_transport__usb.cpp (-3 / +3 lines)
Lines 1-6 Link Here
1
--- adb/transport_usb.cpp.orig	2018-06-21 00:58:42 UTC
1
--- adb/client/transport_usb.cpp.orig	2020-04-17 21:40:09 UTC
2
+++ adb/transport_usb.cpp
2
+++ adb/client/transport_usb.cpp
3
@@ -186,6 +186,8 @@ int is_adb_interface(int usb_class, int usb_subclass, 
3
@@ -205,6 +205,8 @@ int is_adb_interface(int usb_class, int usb_subclass, 
4
 bool should_use_libusb() {
4
 bool should_use_libusb() {
5
 #if !ADB_HOST
5
 #if !ADB_HOST
6
     return false;
6
     return false;
(-)b/devel/android-tools-adb/files/patch-adb_client_usb.h (+15 lines)
Added Link Here
1
--- adb/client/usb.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/client/usb.h
3
@@ -41,8 +41,12 @@ ADB_USB_INTERFACE(libusb::usb_handle*);
4
 }  // namespace libusb
5
 
6
 namespace native {
7
+#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
8
 struct usb_handle;
9
 ADB_USB_INTERFACE(native::usb_handle*);
10
+#else
11
+using namespace libusb;
12
+#endif
13
 }  // namespace native
14
 
15
 // Empty base that both implementations' opaque handles inherit from.
(-)b/devel/android-tools-adb/files/patch-adb_client_usb__libusb.cpp (-24 / +15 lines)
Lines 1-15 Link Here
1
--- adb/client/usb_libusb.cpp.orig	2017-06-20 10:50:27 UTC
1
--- adb/client/usb_libusb.cpp.orig	2020-04-17 21:40:09 UTC
2
+++ adb/client/usb_libusb.cpp
2
+++ adb/client/usb_libusb.cpp
3
@@ -30,7 +30,7 @@
3
@@ -30,7 +30,11 @@
4
 #include <thread>
4
 #include <thread>
5
 #include <unordered_map>
5
 #include <unordered_map>
6
 
6
 
7
-#include <libusb/libusb.h>
7
+#if __has_include(<libusb/libusb.h>)
8
 #include <libusb/libusb.h>
9
+#else
8
+#include <libusb.h>
10
+#include <libusb.h>
11
+#endif
9
 
12
 
10
 #include <android-base/file.h>
13
 #include <android-base/file.h>
11
 #include <android-base/logging.h>
14
 #include <android-base/logging.h>
12
@@ -39,6 +39,9 @@
15
@@ -39,6 +43,9 @@
13
 
16
 
14
 #include "adb.h"
17
 #include "adb.h"
15
 #include "adb_utils.h"
18
 #include "adb_utils.h"
Lines 17-37 Link Here
17
+#include "sysdeps/chrono.h"
20
+#include "sysdeps/chrono.h"
18
+#endif
21
+#endif
19
 #include "transport.h"
22
 #include "transport.h"
20
 #include "usb.h"
21
 
22
@@ -89,7 +89,11 @@ struct transfer_info {
23
 };
24
 
23
 
25
 namespace libusb {
24
 using android::base::StringPrintf;
26
+#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
25
@@ -150,7 +157,14 @@ struct usb_handle : public ::usb_handle {
27
 struct usb_handle : public ::usb_handle {
28
+#else
29
+struct usb_handle {
30
+#endif
31
     usb_handle(const std::string& device_address, const std::string& serial,
32
                unique_device_handle&& device_handle, uint8_t interface, uint8_t bulk_in,
33
                uint8_t bulk_out, size_t zero_mask, size_t max_packet_size)
34
@@ -152,7 +156,14 @@ struct usb_handle : public ::usb_handle {
35
 static auto& usb_handles = *new std::unordered_map<std::string, std::unique_ptr<usb_handle>>();
26
 static auto& usb_handles = *new std::unordered_map<std::string, std::unique_ptr<usb_handle>>();
36
 static auto& usb_handles_mutex = *new std::mutex();
27
 static auto& usb_handles_mutex = *new std::mutex();
37
 
28
 
Lines 46-52 Link Here
46
 
37
 
47
 static std::string get_device_address(libusb_device* device) {
38
 static std::string get_device_address(libusb_device* device) {
48
     return StringPrintf("usb:%d:%d", libusb_get_bus_number(device),
39
     return StringPrintf("usb:%d:%d", libusb_get_bus_number(device),
49
@@ -380,6 +391,7 @@ static void process_device(libusb_device* device) {
40
@@ -378,6 +392,7 @@ static void process_device(libusb_device* device) {
50
     LOG(INFO) << "registered new usb device '" << device_serial << "'";
41
     LOG(INFO) << "registered new usb device '" << device_serial << "'";
51
 }
42
 }
52
 
43
 
Lines 54-60 Link Here
54
 static std::atomic<int> connecting_devices(0);
45
 static std::atomic<int> connecting_devices(0);
55
 
46
 
56
 static void device_connected(libusb_device* device) {
47
 static void device_connected(libusb_device* device) {
57
@@ -449,7 +461,31 @@ static int hotplug_callback(libusb_context*, libusb_de
48
@@ -452,7 +467,31 @@ static LIBUSB_CALL int hotplug_callback(libusb_context
58
     hotplug_queue.Push({event, device});
49
     hotplug_queue.Push({event, device});
59
     return 0;
50
     return 0;
60
 }
51
 }
Lines 86-92 Link Here
86
 void usb_init() {
77
 void usb_init() {
87
     LOG(DEBUG) << "initializing libusb...";
78
     LOG(DEBUG) << "initializing libusb...";
88
     int rc = libusb_init(nullptr);
79
     int rc = libusb_init(nullptr);
89
@@ -457,6 +493,7 @@ void usb_init() {
80
@@ -460,6 +499,7 @@ void usb_init() {
90
         LOG(FATAL) << "failed to initialize libusb: " << libusb_error_name(rc);
81
         LOG(FATAL) << "failed to initialize libusb: " << libusb_error_name(rc);
91
     }
82
     }
92
 
83
 
Lines 94-100 Link Here
94
     // Register the hotplug callback.
85
     // Register the hotplug callback.
95
     rc = libusb_hotplug_register_callback(
86
     rc = libusb_hotplug_register_callback(
96
         nullptr, static_cast<libusb_hotplug_event>(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
87
         nullptr, static_cast<libusb_hotplug_event>(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED |
97
@@ -467,6 +504,7 @@ void usb_init() {
88
@@ -470,6 +510,7 @@ void usb_init() {
98
     if (rc != LIBUSB_SUCCESS) {
89
     if (rc != LIBUSB_SUCCESS) {
99
         LOG(FATAL) << "failed to register libusb hotplug callback";
90
         LOG(FATAL) << "failed to register libusb hotplug callback";
100
     }
91
     }
Lines 102-108 Link Here
102
 
93
 
103
     // Spawn a thread for libusb_handle_events.
94
     // Spawn a thread for libusb_handle_events.
104
     std::thread([]() {
95
     std::thread([]() {
105
@@ -475,10 +513,28 @@ void usb_init() {
96
@@ -478,10 +519,28 @@ void usb_init() {
106
             libusb_handle_events(nullptr);
97
             libusb_handle_events(nullptr);
107
         }
98
         }
108
     }).detach();
99
     }).detach();
Lines 130-133 Link Here
130
+#endif
121
+#endif
131
 }
122
 }
132
 
123
 
133
 // Dispatch a libusb transfer, unlock |device_lock|, and then wait for the result.
124
 static LIBUSB_CALL void transfer_callback(libusb_transfer* transfer) {
(-)b/devel/android-tools-adb/files/patch-adb_crypto_include_adb_crypto_key.h (+52 lines)
Added Link Here
1
--- adb/crypto/include/adb/crypto/key.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/crypto/include/adb/crypto/key.h
3
@@ -19,6 +19,49 @@
4
 #include <string>
5
 
6
 #include <openssl/evp.h>
7
+#if !defined(OPENSSL_IS_BORINGSSL)
8
+#include <openssl/x509.h>
9
+// https://boringssl.googlesource.com/boringssl/+/d17d74d73f8a%5E!/
10
+namespace bssl {
11
+namespace internal {
12
+// The Enable parameter is ignored and only exists so specializations can use
13
+// SFINAE.
14
+template <typename T, typename Enable = void>
15
+struct DeleterImpl {};
16
+
17
+template <typename T>
18
+struct Deleter {
19
+  void operator()(T *ptr) {
20
+    // Rather than specialize Deleter for each type, we specialize
21
+    // DeleterImpl. This allows bssl::UniquePtr<T> to be used while only
22
+    // including base.h as long as the destructor is not emitted. This matches
23
+    // std::unique_ptr's behavior on forward-declared types.
24
+    //
25
+    // DeleterImpl itself is specialized in the corresponding module's header
26
+    // and must be included to release an object. If not included, the compiler
27
+    // will error that DeleterImpl<T> does not have a method Free.
28
+    DeleterImpl<T>::Free(ptr);
29
+  }
30
+};
31
+
32
+#define BORINGSSL_MAKE_DELETER(type, deleter)     \
33
+  template <>                                     \
34
+  struct DeleterImpl<type> {                      \
35
+    static void Free(type *ptr) { deleter(ptr); } \
36
+  };                                              \
37
+
38
+BORINGSSL_MAKE_DELETER(EVP_PKEY, EVP_PKEY_free)
39
+BORINGSSL_MAKE_DELETER(X509, X509_free)
40
+BORINGSSL_MAKE_DELETER(BIO, BIO_free)
41
+} // namespace internal
42
+
43
+// Holds ownership of heap-allocated BoringSSL structures. Sample usage:
44
+//   bssl::UniquePtr<RSA> rsa(RSA_new());
45
+//   bssl::UniquePtr<BIO> bio(BIO_new(BIO_s_mem()));
46
+template <typename T>
47
+using UniquePtr = std::unique_ptr<T, internal::Deleter<T>>;
48
+} // namespace bssl
49
+#endif
50
 
51
 #include "key_type.pb.h"
52
 
(-)b/devel/android-tools-adb/files/patch-adb_crypto_include_adb_crypto_x509__generator.h (+12 lines)
Added Link Here
1
--- adb/crypto/include/adb/crypto/x509_generator.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/crypto/include/adb/crypto/x509_generator.h
3
@@ -17,6 +17,9 @@
4
 #pragma once
5
 
6
 #include <openssl/x509v3.h>
7
+#if !defined(OPENSSL_IS_BORINGSSL)
8
+#include <adb/crypto/key.h>
9
+#endif
10
 
11
 namespace adb {
12
 namespace crypto {
(-)b/devel/android-tools-adb/files/patch-adb_sysdeps.h (-4 / +13 lines)
Lines 1-6 Link Here
1
--- adb/sysdeps.h.orig	2019-07-17 19:54:09 UTC
1
--- adb/sysdeps.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/sysdeps.h
2
+++ adb/sysdeps.h
3
@@ -330,6 +330,11 @@ size_t ParseCompleteUTF8(const char* first, const char
3
@@ -42,7 +42,7 @@
4
 #include "sysdeps/network.h"
5
 #include "sysdeps/stat.h"
6
 
7
-#if defined(__APPLE__)
8
+#ifndef mempcpy
9
 static inline void* mempcpy(void* dst, const void* src, size_t n) {
10
     return static_cast<char*>(memcpy(dst, src, n)) + n;
11
 }
12
@@ -387,6 +387,11 @@ size_t ParseCompleteUTF8(const char* first, const char
4
 
13
 
5
 #include <cutils/sockets.h>
14
 #include <cutils/sockets.h>
6
 
15
 
Lines 12-19 Link Here
12
 #define OS_PATH_SEPARATORS "/"
21
 #define OS_PATH_SEPARATORS "/"
13
 #define OS_PATH_SEPARATOR '/'
22
 #define OS_PATH_SEPARATOR '/'
14
 #define OS_PATH_SEPARATOR_STR "/"
23
 #define OS_PATH_SEPARATOR_STR "/"
15
@@ -516,6 +521,12 @@ inline int adb_socket_get_local_port(borrowed_fd fd) {
24
@@ -609,6 +614,12 @@ inline int adb_socket_get_local_port(borrowed_fd fd) {
16
 static __inline__ int adb_thread_setname(const std::string& name) {
25
 static inline int adb_thread_setname(const std::string& name) {
17
 #ifdef __APPLE__
26
 #ifdef __APPLE__
18
     return pthread_setname_np(name.c_str());
27
     return pthread_setname_np(name.c_str());
19
+#elif defined(__Bitrig__) || defined(__DragonFly__) || \
28
+#elif defined(__Bitrig__) || defined(__DragonFly__) || \
(-)b/devel/android-tools-adb/files/patch-adb_tls_include_adb_tls_adb__ca__list.h (+12 lines)
Added Link Here
1
--- adb/tls/include/adb/tls/adb_ca_list.h.orig	2020-04-17 21:40:09 UTC
2
+++ adb/tls/include/adb/tls/adb_ca_list.h
3
@@ -16,7 +16,9 @@
4
 
5
 #pragma once
6
 
7
+#if defined(OPENSSL_IS_BORINGSSL)
8
 #include <openssl/base.h>
9
+#endif
10
 #include <optional>
11
 #include <string>
12
 
(-)b/devel/android-tools-adb/files/patch-adb_tls_tls__connection.cpp (+12 lines)
Added Link Here
1
--- adb/tls/tls_connection.cpp.orig	2020-04-17 21:40:09 UTC
2
+++ adb/tls/tls_connection.cpp
3
@@ -23,6 +23,9 @@
4
 #include <android-base/strings.h>
5
 #include <openssl/err.h>
6
 #include <openssl/ssl.h>
7
+#if !defined(OPENSSL_IS_BORINGSSL)
8
+#include <adb/crypto/key.h>
9
+#endif
10
 
11
 using android::base::borrowed_fd;
12
 
(-)a/devel/android-tools-adb/files/patch-adb_usb.h (-20 lines)
Removed Link Here
1
--- adb/usb.h.orig	2017-06-20 10:50:27 UTC
2
+++ adb/usb.h
3
@@ -43,6 +43,7 @@ namespace libusb {
4
     ADB_USB_INTERFACE(libusb::usb_handle*);
5
 }
6
 
7
+#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
8
 namespace native {
9
     struct usb_handle;
10
     ADB_USB_INTERFACE(native::usb_handle*);
11
@@ -53,6 +54,9 @@ struct usb_handle {
12
 };
13
 
14
 ADB_USB_INTERFACE(::usb_handle*);
15
+#else
16
+using namespace libusb;
17
+#endif
18
 
19
 #endif // linux host || darwin
20
 

Return to bug 252570