Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 18 Jul 2015 16:51:09 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r392432 - in head/devel: android-tools-fastboot android-tools-fastboot-devel android-tools-fastboot-devel/files
Message-ID:  <201507181651.t6IGp9ep071083@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sat Jul 18 16:51:08 2015
New Revision: 392432
URL: https://svnweb.freebsd.org/changeset/ports/392432

Log:
  devel/android-tools-fastboot-devel: move FreeBSD code to C++
  
  Copy files in order to fix the following errors.
  
    files/usb_freebsd.cpp:132:4: error: assigning to 'usb_handle *' from incompatible type 'void *'
            h = malloc(sizeof(*h));
              ^ ~~~~~~~~~~~~~~~~~~
    files/usb_freebsd.cpp:162:6: error: no matching function for call to 'libusb_bulk_transfer'
            if (libusb_bulk_transfer(h->handle, h->ep_out, (void *)(long)_data, len, &actlen, 0) < 0)
                ^~~~~~~~~~~~~~~~~~~~
    /usr/include/libusb.h:478:5: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'uint8_t *' (aka 'unsigned char *')
    int     libusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
            ^
    files/usb_freebsd.cpp:172:6: error: no matching function for call to 'libusb_bulk_transfer'
            if (libusb_bulk_transfer(h->handle, h->ep_in, _data, len, &actlen, 0) < 0)
                ^~~~~~~~~~~~~~~~~~~~
    /usr/include/libusb.h:478:5: note: candidate function not viable: cannot convert argument of incomplete type 'void *' to 'uint8_t *' (aka 'unsigned char *')
    int     libusb_bulk_transfer(libusb_device_handle * devh, uint8_t endpoint, uint8_t *data, int length, int *transferred, uint32_t timeout);
            ^
    3 errors generated.
  
    fastboot.o: In function `find_item(char const*, char const*)':
    fastboot.cpp:(.text+0xea): undefined reference to `get_my_path'

Added:
  head/devel/android-tools-fastboot-devel/files/pkg-message.in
     - copied unchanged from r392431, head/devel/android-tools-fastboot/files/pkg-message.in
  head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp
     - copied, changed from r392431, head/devel/android-tools-fastboot/files/usb_freebsd.c
  head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp
     - copied, changed from r392431, head/devel/android-tools-fastboot/files/util_freebsd.c
Modified:
  head/devel/android-tools-fastboot-devel/Makefile
  head/devel/android-tools-fastboot-devel/files/Makefile
  head/devel/android-tools-fastboot/Makefile

Modified: head/devel/android-tools-fastboot-devel/Makefile
==============================================================================
--- head/devel/android-tools-fastboot-devel/Makefile	Sat Jul 18 16:42:27 2015	(r392431)
+++ head/devel/android-tools-fastboot-devel/Makefile	Sat Jul 18 16:51:08 2015	(r392432)
@@ -2,7 +2,7 @@
 
 DISTVERSION=	m-preview-190
 DISTVERSIONSUFFIX=	-g683790a
-PORTREVISION=	0
+PORTREVISION=	1
 PKGNAMESUFFIX=	-devel
 
 GH_TAGNAME=	m-preview-100-gdece0f9:extras \
@@ -12,7 +12,7 @@ CONFLICTS_INSTALL=	${PORTNAME}-[0-9]*
 
 MASTERDIR=	${.CURDIR}/../android-tools-fastboot
 DISTINFO_FILE=	${.CURDIR}/distinfo
-MAKEFILE=	${.CURDIR}/files/Makefile
+FILESDIR=	${.CURDIR}/files
 EXTRA_PATCHES+=	${.CURDIR}/files/patch-*
 
 USES=		compiler:c++11-lib

Modified: head/devel/android-tools-fastboot-devel/files/Makefile
==============================================================================
--- head/devel/android-tools-fastboot-devel/files/Makefile	Sat Jul 18 16:42:27 2015	(r392431)
+++ head/devel/android-tools-fastboot-devel/files/Makefile	Sat Jul 18 16:51:08 2015	(r392432)
@@ -11,8 +11,8 @@ SRCS+=	protocol.cpp
 SRCS+=	util.cpp
 
 .PATH:	${FILESDIR}
-SRCS+=	usb_freebsd.c
-SRCS+=	util_freebsd.c
+SRCS+=	usb_freebsd.cpp
+SRCS+=	util_freebsd.cpp
 
 # required by libziparchive
 .PATH: ${.CURDIR}/../base

Copied: head/devel/android-tools-fastboot-devel/files/pkg-message.in (from r392431, head/devel/android-tools-fastboot/files/pkg-message.in)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/devel/android-tools-fastboot-devel/files/pkg-message.in	Sat Jul 18 16:51:08 2015	(r392432, copy of r392431, head/devel/android-tools-fastboot/files/pkg-message.in)
@@ -0,0 +1,7 @@
+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

Copied and modified: head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp (from r392431, head/devel/android-tools-fastboot/files/usb_freebsd.c)
==============================================================================
--- head/devel/android-tools-fastboot/files/usb_freebsd.c	Sat Jul 18 16:42:27 2015	(r392431, copy source)
+++ head/devel/android-tools-fastboot-devel/files/usb_freebsd.cpp	Sat Jul 18 16:51:08 2015	(r392432)
@@ -41,11 +41,11 @@ struct usb_handle {
 };
 
 static int 
-probe(struct usb_handle *h, ifc_match_func callback)
+probe(usb_handle *h, ifc_match_func callback)
 {
-	struct usb_ifc_info info;
-	struct libusb_device_descriptor ddesc;
-	struct libusb_config_descriptor *pcfg;
+	usb_ifc_info info;
+	libusb_device_descriptor ddesc;
+	libusb_config_descriptor *pcfg;
 	int i, j;
 
 	if (libusb_open(h->dev, &h->handle) < 0)
@@ -129,7 +129,7 @@ enumerate(ifc_match_func callback)
 	ssize_t ndev;
 	ssize_t x;
 
-	h = malloc(sizeof(*h));
+	h = reinterpret_cast<usb_handle*>(malloc(sizeof(*h)));
 	if (h == NULL)
 		return (h);
 
@@ -159,7 +159,8 @@ usb_write(usb_handle * h, const void *_d
 {
 	int actlen;
 
-	if (libusb_bulk_transfer(h->handle, h->ep_out, (void *)(long)_data, len, &actlen, 0) < 0)
+	if (libusb_bulk_transfer(h->handle, h->ep_out,
+				 (unsigned char *)_data, len, &actlen, 0) < 0)
 		return (-1);
 	return (actlen);
 }
@@ -169,7 +170,8 @@ usb_read(usb_handle * h, void *_data, in
 {
 	int actlen;
 
-	if (libusb_bulk_transfer(h->handle, h->ep_in, _data, len, &actlen, 0) < 0)
+	if (libusb_bulk_transfer(h->handle, h->ep_in,
+				 (unsigned char *)_data, len, &actlen, 0) < 0)
 		return (-1);
 	return (actlen);
 }

Copied and modified: head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp (from r392431, head/devel/android-tools-fastboot/files/util_freebsd.c)
==============================================================================
--- head/devel/android-tools-fastboot/files/util_freebsd.c	Sat Jul 18 16:42:27 2015	(r392431, copy source)
+++ head/devel/android-tools-fastboot-devel/files/util_freebsd.cpp	Sat Jul 18 16:51:08 2015	(r392432)
@@ -25,6 +25,8 @@
  * SUCH DAMAGE.
  */
 
+#include "fastboot.h"
+
 #include <unistd.h>
 #include <limits.h>
 

Modified: head/devel/android-tools-fastboot/Makefile
==============================================================================
--- head/devel/android-tools-fastboot/Makefile	Sat Jul 18 16:42:27 2015	(r392431)
+++ head/devel/android-tools-fastboot/Makefile	Sat Jul 18 16:51:08 2015	(r392432)
@@ -31,7 +31,7 @@ CONFLICTS_INSTALL?=	${PORTNAME}-devel-*
 USES+=		uidfix
 BUILD_WRKSRC=	${WRKSRC}/fastboot
 INSTALL_WRKSRC=	${BUILD_WRKSRC}
-MAKEFILE=	${.CURDIR}/files/Makefile # XXX ?= when bmake-only
+MAKEFILE=	${FILESDIR}/Makefile
 MAKE_ENV=	FILESDIR="${FILESDIR}" BINDIR="${PREFIX}/bin" \
 		MANDIR="${PREFIX}/man/man" \
 		LIBPCRE="${LOCALBASE}/lib/libpcre.a"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201507181651.t6IGp9ep071083>