android-tools: 33.0.3 -> 33.0.3p1

+9 -104
-82
pkgs/tools/misc/android-tools/android-tools-kernel-headers-6.0.diff
··· 1 - diff --git a/vendor/adb/client/usb_linux.cpp b/vendor/adb/client/usb_linux.cpp 2 - index 25a50bd..0d09c47 100644 3 - --- a/vendor/adb/client/usb_linux.cpp 4 - +++ b/vendor/adb/client/usb_linux.cpp 5 - @@ -59,8 +59,15 @@ using namespace std::literals; 6 - #define DBGX(x...) 7 - 8 - struct usb_handle { 9 - + usb_handle() : urb_in(0), urb_out(0) { 10 - + this->urb_in = new usbdevfs_urb; 11 - + this->urb_out = new usbdevfs_urb; 12 - + } 13 - + 14 - ~usb_handle() { 15 - if (fd != -1) unix_close(fd); 16 - + delete urb_in; 17 - + delete urb_out; 18 - } 19 - 20 - std::string path; 21 - @@ -72,8 +79,8 @@ struct usb_handle { 22 - unsigned zero_mask; 23 - unsigned writeable = 1; 24 - 25 - - usbdevfs_urb urb_in; 26 - - usbdevfs_urb urb_out; 27 - + usbdevfs_urb *urb_in; 28 - + usbdevfs_urb *urb_out; 29 - 30 - bool urb_in_busy = false; 31 - bool urb_out_busy = false; 32 - @@ -304,7 +311,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) { 33 - std::unique_lock<std::mutex> lock(h->mutex); 34 - D("++ usb_bulk_write ++"); 35 - 36 - - usbdevfs_urb* urb = &h->urb_out; 37 - + usbdevfs_urb* urb = h->urb_out; 38 - memset(urb, 0, sizeof(*urb)); 39 - urb->type = USBDEVFS_URB_TYPE_BULK; 40 - urb->endpoint = h->ep_out; 41 - @@ -343,7 +350,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { 42 - std::unique_lock<std::mutex> lock(h->mutex); 43 - D("++ usb_bulk_read ++"); 44 - 45 - - usbdevfs_urb* urb = &h->urb_in; 46 - + usbdevfs_urb* urb = h->urb_in; 47 - memset(urb, 0, sizeof(*urb)); 48 - urb->type = USBDEVFS_URB_TYPE_BULK; 49 - urb->endpoint = h->ep_in; 50 - @@ -388,7 +395,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { 51 - } 52 - D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length); 53 - 54 - - if (out == &h->urb_in) { 55 - + if (out == h->urb_in) { 56 - D("[ reap urb - IN complete ]"); 57 - h->urb_in_busy = false; 58 - if (urb->status != 0) { 59 - @@ -397,7 +404,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) { 60 - } 61 - return urb->actual_length; 62 - } 63 - - if (out == &h->urb_out) { 64 - + if (out == h->urb_out) { 65 - D("[ reap urb - OUT compelete ]"); 66 - h->urb_out_busy = false; 67 - h->cv.notify_all(); 68 - @@ -501,10 +508,10 @@ void usb_kick(usb_handle* h) { 69 - ** but this ensures that a reader blocked on REAPURB 70 - ** will get unblocked 71 - */ 72 - - ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in); 73 - - ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out); 74 - - h->urb_in.status = -ENODEV; 75 - - h->urb_out.status = -ENODEV; 76 - + ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in); 77 - + ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out); 78 - + h->urb_in->status = -ENODEV; 79 - + h->urb_out->status = -ENODEV; 80 - h->urb_in_busy = false; 81 - h->urb_out_busy = false; 82 - h->cv.notify_all();
···
+9 -22
pkgs/tools/misc/android-tools/default.nix
··· 1 { lib, stdenv, fetchurl, fetchpatch 2 - , cmake, perl, go, python3 3 , protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2 4 }: 5 ··· 9 10 stdenv.mkDerivation rec { 11 pname = "android-tools"; 12 - version = "33.0.3"; 13 14 src = fetchurl { 15 url = "https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz"; 16 - hash = "sha256-jOF02reB1d69Ke0PllciMfd3vuGbjvPBZ+M9PqdnC8U="; 17 }; 18 19 patches = [ 20 - ./android-tools-kernel-headers-6.0.diff 21 ]; 22 23 - postPatch = lib.optionalString stdenv.isDarwin '' 24 - sed -i 's/usb_linux/usb_osx/g' vendor/CMakeLists.{adb,fastboot}.txt 25 - sed -i 's/libselinux libsepol/ /g;s#selinux/libselinux/include##g' vendor/CMakeLists.{fastboot,mke2fs}.txt 26 - sed -z -i 's/add_library(libselinux.*selinux\/libsepol\/include)//g' vendor/CMakeLists.fastboot.txt 27 - sed -i 's/e2fsdroid//g' vendor/CMakeLists.txt 28 - sed -z -i 's/add_executable(e2fsdroid.*e2fsprogs\/misc)//g' vendor/CMakeLists.mke2fs.txt 29 - ''; 30 - 31 - nativeBuildInputs = [ cmake perl go ]; 32 buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 ]; 33 propagatedBuildInputs = [ pythonEnv ]; 34 35 # Don't try to fetch any Go modules via the network: 36 GOFLAGS = [ "-mod=vendor" ]; 37 - 38 - NIX_CFLAGS_COMPILE = lib.optionals stdenv.isDarwin [ 39 - "-D_DARWIN_C_SOURCE" 40 - ]; 41 - 42 - NIX_LDFLAGS = lib.optionals stdenv.isDarwin [ 43 - "-framework CoreFoundation" 44 - "-framework IOKit" 45 - ]; 46 47 preConfigure = '' 48 export GOCACHE=$TMPDIR/go-cache
··· 1 { lib, stdenv, fetchurl, fetchpatch 2 + , cmake, pkg-config, perl, go, python3 3 , protobuf, zlib, gtest, brotli, lz4, zstd, libusb1, pcre2 4 }: 5 ··· 9 10 stdenv.mkDerivation rec { 11 pname = "android-tools"; 12 + version = "33.0.3p1"; 13 14 src = fetchurl { 15 url = "https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz"; 16 + hash = "sha256-viBHzyVgUWdK9a60u/7SdpiVEvgNEZHihkyRkGH5Ydg="; 17 }; 18 19 patches = [ 20 + (fetchpatch { 21 + name = "add-macos-platform.patch"; 22 + url = "https://github.com/nmeum/android-tools/commit/a1ab35b31525966e0f0770047cd82accb36d025b.patch"; 23 + hash = "sha256-6O3ekDf0qPdzcfINFF8Ae4XOYgnQWTBhvu9SCFSHkXY="; 24 + }) 25 ]; 26 27 + nativeBuildInputs = [ cmake pkg-config perl go ]; 28 buildInputs = [ protobuf zlib gtest brotli lz4 zstd libusb1 pcre2 ]; 29 propagatedBuildInputs = [ pythonEnv ]; 30 31 # Don't try to fetch any Go modules via the network: 32 GOFLAGS = [ "-mod=vendor" ]; 33 34 preConfigure = '' 35 export GOCACHE=$TMPDIR/go-cache