dev-util/android-tools dependency fix
This commit is contained in:
parent
8f8f5e76d9
commit
1a60816e35
110 changed files with 419 additions and 107 deletions
2
dev-util/android-tools/Manifest
Normal file
2
dev-util/android-tools/Manifest
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
DIST android-tools-31.0.3-no-gtest.patch 3152 BLAKE2B da71e3cba87b21ffcb144602a06d7e269faabd173233363b757cd2191c051f8d3281f591117d4551d7acc029d6e2d421f702f9f836dfe0dec6c676aa39a2d9fe SHA512 a28d2264bf40c420a279acf1f4c3b4588d96ce2d6e2d6d322abbde62d773804bef10dc33f13dd52c7de80ace6c58f91ae28f5d4e8e97dfae4d2a8473d8537423
|
||||
DIST android-tools-35.0.2.tar.xz 18847376 BLAKE2B 5db4d32e4d9acca5f98f0fa76d02f2cbb9c8ad23f7138deb57aa78bcfb02e8e1998dd5649e2a7f77df99f4f4c0b47440c8f6b84d2a001ae8ec2f4840e01535a8 SHA512 391ce4d638b274d7bbae24a3df8de8b5812a982570f29b2aef37d12a3ba7ed6f66b5c0b7f908759e0b0da30d152b5319af0fef16c54bdc3b9f4074fb22f80d10
|
||||
116
dev-util/android-tools/android-tools-35.0.2-r1.ebuild
Normal file
116
dev-util/android-tools/android-tools-35.0.2-r1.ebuild
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
# Copyright 1999-2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
PYTHON_COMPAT=( python3_{10..13} )
|
||||
|
||||
inherit cmake flag-o-matic python-r1
|
||||
|
||||
DESCRIPTION="Android platform tools (adb, fastboot, and mkbootimg)"
|
||||
HOMEPAGE="https://github.com/nmeum/android-tools/ https://developer.android.com/"
|
||||
|
||||
MY_PV="${PV//_/}"
|
||||
SRC_URI="https://github.com/nmeum/android-tools/releases/download/${MY_PV}/${PN}-${MY_PV}.tar.xz
|
||||
https://dev.gentoo.org/~zmedico/dist/${PN}-31.0.3-no-gtest.patch
|
||||
"
|
||||
S="${WORKDIR}/${PN}-${MY_PV}"
|
||||
|
||||
# The entire source code is Apache-2.0, except for fastboot which is BSD-2.
|
||||
LICENSE="Apache-2.0 BSD-2"
|
||||
SLOT="0"
|
||||
KEYWORDS="~amd64 ~arm ~arm64 ~x86"
|
||||
IUSE="python udev"
|
||||
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
|
||||
|
||||
# dev-libs/libpcre only required for e2fsdroid
|
||||
DEPEND="
|
||||
app-arch/brotli:=
|
||||
app-arch/lz4:=
|
||||
app-arch/zstd:=
|
||||
<dev-cpp/abseil-cpp-20250127.0
|
||||
dev-libs/libpcre2:=
|
||||
<dev-libs/protobuf-30:=
|
||||
sys-libs/zlib:=
|
||||
>=dev-libs/libusb-1.0.28
|
||||
dev-libs/libfmt:=
|
||||
"
|
||||
RDEPEND="${DEPEND}
|
||||
udev? ( dev-util/android-udev-rules )
|
||||
python? ( ${PYTHON_DEPS} )
|
||||
"
|
||||
BDEPEND="
|
||||
dev-lang/go
|
||||
dev-lang/perl
|
||||
dev-libs/protobuf[protoc(+)]
|
||||
"
|
||||
|
||||
DOCS=()
|
||||
|
||||
src_prepare() {
|
||||
eapply "${DISTDIR}/${PN}-31.0.3-no-gtest.patch"
|
||||
|
||||
cd "${S}/vendor/core" || die
|
||||
eapply "${S}/patches/core/0011-Remove-the-useless-dependency-on-gtest.patch"
|
||||
|
||||
cd "${S}/vendor/libziparchive" || die
|
||||
eapply "${S}/patches/libziparchive/0004-Remove-the-useless-dependency-on-gtest.patch"
|
||||
|
||||
cd "${S}" || die
|
||||
|
||||
# why do we depend on libandroidfw? It is never linked to or used.
|
||||
# https://github.com/nmeum/android-tools/issues/148
|
||||
sed -i '/libandroidfw/d' vendor/CMakeLists.txt || die
|
||||
|
||||
rm -r patches || die
|
||||
cmake_src_prepare
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
# -Werror=odr, -Werror=lto-type-mismatch
|
||||
#
|
||||
# https://bugs.gentoo.org/858311
|
||||
# https://issuetracker.google.com/issues/347247969
|
||||
#
|
||||
# and in vendored f2fs-tools copy:
|
||||
# https://bugs.gentoo.org/863896
|
||||
filter-lto
|
||||
|
||||
local mycmakeargs=(
|
||||
# Statically link the bundled boringssl
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
|
||||
-DCMAKE_C_FLAGS="$CFLAGS" \
|
||||
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON \
|
||||
-Dprotobuf_MODULE_COMPATIBLE=ON
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
)
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
export GOCACHE="${T}/go-build"
|
||||
export GOFLAGS="-mod=vendor"
|
||||
cmake_src_compile
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
rm "${ED}/usr/bin/mkbootimg" || die
|
||||
rm "${ED}/usr/bin/unpack_bootimg" || die
|
||||
rm "${ED}/usr/bin/repack_bootimg" || die
|
||||
rm "${ED}/usr/bin/mkdtboimg" || die
|
||||
rm "${ED}/usr/bin/avbtool" || die
|
||||
|
||||
if use python; then
|
||||
python_foreach_impl python_newexe vendor/mkbootimg/mkbootimg.py mkbootimg
|
||||
python_foreach_impl python_newexe vendor/mkbootimg/unpack_bootimg.py unpack_bootimg
|
||||
python_foreach_impl python_newexe vendor/mkbootimg/repack_bootimg.py repack_bootimg
|
||||
python_foreach_impl python_newexe vendor/libufdt/utils/src/mkdtboimg.py mkdtboimg
|
||||
python_foreach_impl python_newexe vendor/avb/avbtool.py avbtool
|
||||
fi
|
||||
docinto adb
|
||||
doman vendor/adb/docs/user/adb.1
|
||||
docinto fastboot
|
||||
dodoc vendor/core/fastboot/README.md
|
||||
}
|
||||
|
|
@ -0,0 +1,120 @@
|
|||
https://github.com/anatol/android-tools/blob/2f8405a47909861c9359fe4797e7b4a0fba4dc12/patches/adb/0023-Update-usage-of-usbdevfs_urb-to-match-new-kernel-UAP.patch
|
||||
https://github.com/nmeum/android-tools/issues/74
|
||||
https://bugs.gentoo.org/876328
|
||||
|
||||
From c830c90995fc0877348e2ed9cdeccf9b739138d2 Mon Sep 17 00:00:00 2001
|
||||
From: Anatol Pomozov <anatol.pomozov@gmail.com>
|
||||
Date: Mon, 10 Oct 2022 10:47:57 -0700
|
||||
Subject: [PATCH] Update usage of usbdevfs_urb to match new kernel UAPI
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Linux kernel API has been changed by commit 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members")
|
||||
where zero-length array iso_frame_desc in struct usbdevfs_urb was replaced with a proper flexible-array member.
|
||||
|
||||
Current USB API usage causes a compilation error at Linux 6.0:
|
||||
|
||||
In file included from /home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:28:
|
||||
/usr/include/linux/usbdevice_fs.h:134:41: error: flexible array member ‘usbdevfs_urb::iso_frame_desc’ not at end of ‘struct usb_handle’
|
||||
134 | struct usbdevfs_iso_packet_desc iso_frame_desc[];
|
||||
| ^~~~~~~~~~~~~~
|
||||
/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:76:18: note: next member ‘usbdevfs_urb usb_handle::urb_out’ declared here
|
||||
76 | usbdevfs_urb urb_out;
|
||||
| ^~~~~~~
|
||||
/home/mae/.cache/kiss/proc/121205/build/android-tools/vendor/adb/client/usb_linux.cpp:61:8: note: in the definition of ‘struct usb_handle’
|
||||
61 | struct usb_handle {
|
||||
| ^~~~~~~~~~
|
||||
|
||||
Fix it by using pointers to a struct with flexible-array members.
|
||||
Current fix works both with the old and the new API.
|
||||
|
||||
See https://github.com/nmeum/android-tools/issues/74 for more context.
|
||||
|
||||
Tested: built on Linux against kernel 5.19 and 6.0; 'adb shell' over USB
|
||||
cable
|
||||
Acked-by: Gustavo A. R. Silva gustavoars@kernel.org
|
||||
Change-Id: I7f0f7b35d9a3ab980d3520b541b60c7857a6b101
|
||||
Signed-off-by: Anatol Pomozov <anatol.pomozov@gmail.com>
|
||||
--- a/client/usb_linux.cpp
|
||||
+++ b/client/usb_linux.cpp
|
||||
@@ -71,8 +71,8 @@ struct usb_handle {
|
||||
unsigned zero_mask;
|
||||
unsigned writeable = 1;
|
||||
|
||||
- usbdevfs_urb urb_in;
|
||||
- usbdevfs_urb urb_out;
|
||||
+ usbdevfs_urb *urb_in;
|
||||
+ usbdevfs_urb *urb_out;
|
||||
|
||||
bool urb_in_busy = false;
|
||||
bool urb_out_busy = false;
|
||||
@@ -303,7 +303,7 @@ static int usb_bulk_write(usb_handle* h, const void* data, int len) {
|
||||
std::unique_lock<std::mutex> lock(h->mutex);
|
||||
D("++ usb_bulk_write ++");
|
||||
|
||||
- usbdevfs_urb* urb = &h->urb_out;
|
||||
+ usbdevfs_urb* urb = h->urb_out;
|
||||
memset(urb, 0, sizeof(*urb));
|
||||
urb->type = USBDEVFS_URB_TYPE_BULK;
|
||||
urb->endpoint = h->ep_out;
|
||||
@@ -342,7 +342,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
|
||||
std::unique_lock<std::mutex> lock(h->mutex);
|
||||
D("++ usb_bulk_read ++");
|
||||
|
||||
- usbdevfs_urb* urb = &h->urb_in;
|
||||
+ usbdevfs_urb* urb = h->urb_in;
|
||||
memset(urb, 0, sizeof(*urb));
|
||||
urb->type = USBDEVFS_URB_TYPE_BULK;
|
||||
urb->endpoint = h->ep_in;
|
||||
@@ -387,7 +387,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
|
||||
}
|
||||
D("[ urb @%p status = %d, actual = %d ]", out, out->status, out->actual_length);
|
||||
|
||||
- if (out == &h->urb_in) {
|
||||
+ if (out == h->urb_in) {
|
||||
D("[ reap urb - IN complete ]");
|
||||
h->urb_in_busy = false;
|
||||
if (urb->status != 0) {
|
||||
@@ -396,7 +396,7 @@ static int usb_bulk_read(usb_handle* h, void* data, int len) {
|
||||
}
|
||||
return urb->actual_length;
|
||||
}
|
||||
- if (out == &h->urb_out) {
|
||||
+ if (out == h->urb_out) {
|
||||
D("[ reap urb - OUT compelete ]");
|
||||
h->urb_out_busy = false;
|
||||
h->cv.notify_all();
|
||||
@@ -500,10 +500,10 @@ void usb_kick(usb_handle* h) {
|
||||
** but this ensures that a reader blocked on REAPURB
|
||||
** will get unblocked
|
||||
*/
|
||||
- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_in);
|
||||
- ioctl(h->fd, USBDEVFS_DISCARDURB, &h->urb_out);
|
||||
- h->urb_in.status = -ENODEV;
|
||||
- h->urb_out.status = -ENODEV;
|
||||
+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_in);
|
||||
+ ioctl(h->fd, USBDEVFS_DISCARDURB, h->urb_out);
|
||||
+ h->urb_in->status = -ENODEV;
|
||||
+ h->urb_out->status = -ENODEV;
|
||||
h->urb_in_busy = false;
|
||||
h->urb_out_busy = false;
|
||||
h->cv.notify_all();
|
||||
@@ -519,6 +519,8 @@ int usb_close(usb_handle* h) {
|
||||
|
||||
D("-- usb close %p (fd = %d) --", h, h->fd);
|
||||
|
||||
+ delete h->urb_in;
|
||||
+ delete h->urb_out;
|
||||
delete h;
|
||||
|
||||
return 0;
|
||||
@@ -572,6 +574,8 @@ static void register_device(const char* dev_name, const char* dev_path, unsigned
|
||||
usb->ep_out = ep_out;
|
||||
usb->zero_mask = zero_mask;
|
||||
usb->max_packet_size = max_packet_size;
|
||||
+ usb->urb_in = new usbdevfs_urb;
|
||||
+ usb->urb_out = new usbdevfs_urb;
|
||||
|
||||
// Initialize mark so we don't get garbage collected after the device scan.
|
||||
usb->mark = true;
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
https://bugs.gentoo.org/875575
|
||||
https://android-review.googlesource.com/c/platform/packages/modules/adb/+/2399311
|
||||
|
||||
From ddffab649b12dce1502d63711836b58d007f6a28 Mon Sep 17 00:00:00 2001
|
||||
From: Heiko Becker <heirecka@exherbo.org>
|
||||
Date: Mon, 23 Jan 2023 23:09:52 +0100
|
||||
Subject: [PATCH] Fix build with gcc 13 by including <cstdint>
|
||||
|
||||
Like other versions before, gcc 13 moved some includes around and as a
|
||||
result <cstdint> is no longer transitively included. Explicitly include
|
||||
it for uint{32,64}_t.
|
||||
|
||||
Test: local build
|
||||
Change-Id: I05a27726b05427c486fd01b013dba4d698abac97
|
||||
--- a/file_sync_protocol.h
|
||||
+++ b/file_sync_protocol.h
|
||||
@@ -16,6 +16,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
+#include <cstdint>
|
||||
+
|
||||
#define MKID(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24))
|
||||
|
||||
#define ID_LSTAT_V1 MKID('S', 'T', 'A', 'T')
|
||||
15
dev-util/android-tools/metadata.xml
Normal file
15
dev-util/android-tools/metadata.xml
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<upstream>
|
||||
<bugs-to>https://source.android.com/setup/contribute/report-bugs</bugs-to>
|
||||
<changelog>https://android.googlesource.com/platform/packages/modules/adb/+log</changelog>
|
||||
<doc>https://android.googlesource.com/platform/packages/modules/adb/+/HEAD/OVERVIEW.TXT</doc>
|
||||
<remote-id type="cpe">cpe:/a:google:android_debug_bridge</remote-id>
|
||||
<remote-id type="github">nmeum/android-tools</remote-id>
|
||||
</upstream>
|
||||
<maintainer type="person">
|
||||
<email>zmedico@gentoo.org</email>
|
||||
<name>Zac Medico</name>
|
||||
</maintainer>
|
||||
</pkgmetadata>
|
||||
Loading…
Add table
Add a link
Reference in a new issue