Import android-tools-adb-5.0.2 as wip/android-tools-adb.

Adapted from the FreeBSD devel/android-tool-adb package.

Android Debug Bridge (adb) is a versatile command line tool that
lets you communicate with an emulator instance or connected
Android-powered device.
This commit is contained in:
Tobias Nygren 2015-02-28 18:09:32 +00:00 committed by Thomas Klausner
parent c74a397d53
commit 1c162b4ddd
7 changed files with 192 additions and 0 deletions

3
android-tools-adb/DESCR Normal file
View File

@ -0,0 +1,3 @@
Android Debug Bridge (adb) is a versatile command line tool that
lets you communicate with an emulator instance or connected
Android-powered device.

View File

@ -0,0 +1,27 @@
# $NetBSD: Makefile,v 1.1 2015/02/28 18:09:32 tnn2 Exp $
DISTNAME= android-5.0.2_r1
PKGNAME= android-tools-adb-5.0.2
CATEGORIES= devel
MASTER_SITES= https://github.com/android/platform_system_core/archive/
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= https://developer.android.com/tools/help/adb.html
COMMENT= Android debug bridge command line tool
LICENSE= apache-2.0
WRKSRC= ${WRKDIR}/platform_system_core-android-5.0.2_r1/adb
USE_LANGUAGES= c c++
USE_TOOLS+= gmake
MAKE_JOBS_SAFE= no
CPPFLAGS+= -I${BUILDLINK_PREFIX.libusb1}/include/libusb-1.0
INSTALLATION_DIRS+= bin
post-extract:
${CP} ${FILESDIR}/Makefile ${WRKSRC}
.include "../../devel/libusb1/buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

2
android-tools-adb/PLIST Normal file
View File

@ -0,0 +1,2 @@
@comment $NetBSD: PLIST,v 1.1 2015/02/28 18:09:32 tnn2 Exp $
bin/adb

View File

@ -0,0 +1,7 @@
$NetBSD: distinfo,v 1.1 2015/02/28 18:09:32 tnn2 Exp $
SHA1 (android-5.0.2_r1.tar.gz) = fc5626cf84cc18175be498ea3e664d7c7b188c27
RMD160 (android-5.0.2_r1.tar.gz) = e1e73c0f6ac99cd0641b8ff575fe56f3a79decfb
Size (android-5.0.2_r1.tar.gz) = 1202992 bytes
SHA1 (patch-get__my__path__freebsd.c) = 608d3d51d46519487e1494918647dfa6540bccb0
SHA1 (patch-usb__libusb.c) = d41f8a5d7639682c6d186121cd56f0a5ba87dcd7

View File

@ -0,0 +1,57 @@
# $FreeBSD: 372832 $
SRCS+= adb.c
SRCS+= adb_client.c
SRCS+= adb_auth_host.c
SRCS+= commandline.c
SRCS+= console.c
SRCS+= file_sync_client.c
SRCS+= fdevent.c
#SRCS+= get_my_path_freebsd.c
# XXX do we need NetBSD implementation or is using /proc for this OK?
SRCS+= get_my_path_linux.c
SRCS+= services.c
SRCS+= sockets.c
SRCS+= transport.c
SRCS+= transport_local.c
SRCS+= transport_usb.c
SRCS+= usb_libusb.c
SRCS+= usb_vendors.c
VPATH+= ../libcutils
SRCS+= socket_inaddr_any_server.c
SRCS+= socket_local_client.c
SRCS+= socket_local_server.c
SRCS+= socket_loopback_client.c
SRCS+= socket_loopback_server.c
SRCS+= socket_network_client.c
SRCS+= load_file.c
VPATH+= ../libzipfile
SRCS+= centraldir.c
SRCS+= zipfile.c
CPPFLAGS+= -DADB_HOST=1
CPPFLAGS+= -DHAVE_FORKEXEC=1
CPPFLAGS+= -DHAVE_SYMLINKS
CPPFLAGS+= -DHAVE_TERMIO_H
CPPFLAGS+= -DHAVE_SYS_SOCKET_H
CPPFLAGS+= -D_FILE_OFFSET_BITS=64
CPPFLAGS+= -I.
CPPFLAGS+= -I../include
LIBS+= -lc -pthread -lz -lcrypto -lusb-1.0
OBJS= $(SRCS:.c=.o)
all: adb
adb: $(OBJS)
$(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
install: adb
${BSD_INSTALL_PROGRAM} adb ${DESTDIR}${PREFIX}/bin/
clean:
rm -rf $(OBJS) adb

View File

@ -0,0 +1,32 @@
$NetBSD: patch-get__my__path__freebsd.c,v 1.1 2015/02/28 18:09:32 tnn2 Exp $
--- get_my_path_freebsd.c.orig 2014-10-22 00:46:49.000000000 +0000
+++ get_my_path_freebsd.c
@@ -18,19 +18,18 @@
*/
#include <sys/types.h>
+#include <sys/sysctl.h>
#include <unistd.h>
-#include <limits.h>
-#include <stdio.h>
void
get_my_path(char *exe, size_t maxLen)
{
- char proc[64];
+ int mib[4] = {
+ CTL_KERN,
+ KERN_PROC,
+ KERN_PROC_PATHNAME,
+ getpid()
+ };
- snprintf(proc, sizeof(proc), "/proc/%d/file", getpid());
-
- int err = readlink(proc, exe, maxLen - 1);
-
- exe[err > 0 ? err : 0] = '\0';
+ sysctl(mib, 4, exe, &maxLen, NULL, 0);
}
-

View File

@ -0,0 +1,64 @@
$NetBSD: patch-usb__libusb.c,v 1.1 2015/02/28 18:09:32 tnn2 Exp $
--- usb_libusb.c.orig 2014-10-22 00:46:49.000000000 +0000
+++ usb_libusb.c
@@ -37,7 +37,7 @@
#define TRACE_TAG TRACE_USB
#include "adb.h"
-static adb_mutex_t usb_lock = ADB_MUTEX_INITIALIZER;
+ADB_MUTEX_DEFINE( usb_lock );
static libusb_context *ctx = NULL;
struct usb_handle
@@ -246,8 +246,8 @@ void usb_kick(struct usb_handle *h)
}
int
-check_usb_interface(libusb_interface *interface,
- libusb_device_descriptor *desc,
+check_usb_interface(struct libusb_interface *interface,
+ struct libusb_device_descriptor *desc,
struct usb_handle *uh)
{
int e;
@@ -257,7 +257,7 @@ check_usb_interface(libusb_interface *in
return -1;
}
- libusb_interface_descriptor *idesc = &interface->altsetting[0];
+ const struct libusb_interface_descriptor *idesc = &interface->altsetting[0];
if (idesc->bNumEndpoints != 2) {
D("check_usb_interface(): Interface have not 2 endpoints, ignoring\n");
@@ -265,7 +265,7 @@ check_usb_interface(libusb_interface *in
}
for (e = 0; e < idesc->bNumEndpoints; e++) {
- libusb_endpoint_descriptor *edesc = &idesc->endpoint[e];
+ const struct libusb_endpoint_descriptor *edesc = &idesc->endpoint[e];
if (edesc->bmAttributes != LIBUSB_TRANSFER_TYPE_BULK) {
D("check_usb_interface(): Endpoint (%u) is not bulk (%u), ignoring\n",
@@ -304,8 +304,8 @@ check_usb_interface(libusb_interface *in
}
int
-check_usb_interfaces(libusb_config_descriptor *config,
- libusb_device_descriptor *desc, struct usb_handle *uh)
+check_usb_interfaces(struct libusb_config_descriptor *config,
+ struct libusb_device_descriptor *desc, struct usb_handle *uh)
{
int i;
@@ -382,8 +382,8 @@ check_device(libusb_device *dev)
int found = -1;
char serial[256] = {0};
- libusb_device_descriptor desc;
- libusb_config_descriptor *config = NULL;
+ struct libusb_device_descriptor desc;
+ struct libusb_config_descriptor *config = NULL;
int r = libusb_get_device_descriptor(dev, &desc);