diff --git a/devel/android-tools/Makefile b/devel/android-tools/Makefile index 6cbe68d69a11..d807d373bce1 100644 --- a/devel/android-tools/Makefile +++ b/devel/android-tools/Makefile @@ -1,35 +1,36 @@ PORTNAME= android-tools -PORTVERSION= 35.0.2 +PORTVERSION= 37.0.0 CATEGORIES= devel MASTER_SITES= https://github.com/nmeum/android-tools/releases/download/${PORTVERSION}/ MAINTAINER= bapt@FreeBSD.org COMMENT= Android debugging tools WWW= https://github.com/nmeum/android-tools LICENSE= APACHE20 LICENSE_FILE= ${WRKSRC}/LICENSE BUILD_DEPENDS= googletest>0:devel/googletest -LIB_DEPENDS= libbrotlicommon.so:archivers/brotli \ +LIB_DEPENDS= libabsl_base.so:devel/abseil \ + libbrotlicommon.so:archivers/brotli \ libfmt.so:devel/libfmt \ liblz4.so:archivers/liblz4 \ libpcre2-8.so:devel/pcre2 \ libprotobuf.so:devel/protobuf \ libzstd.so:archivers/zstd USES= cmake compiler:c++20-lang localbase:ldflags pkgconfig python shebangfix tar:xz SHEBANG_FILES= vendor/avb/avbtool.py \ vendor/libufdt/utils/src/mkdtboimg.py \ vendor/mkbootimg/mkbootimg.py \ vendor/mkbootimg/repack_bootimg.py \ vendor/mkbootimg/unpack_bootimg.py CMAKE_ARGS= -DANDROID_TOOLS_PATCH_VENDOR:BOOL=OFF # BoringSSL ships no PowerPC assembly, so use the portable C implementations. CFLAGS_powerpc64le= -DOPENSSL_NO_ASM CXXFLAGS_powerpc64le= -DOPENSSL_NO_ASM .include diff --git a/devel/android-tools/distinfo b/devel/android-tools/distinfo index 950654b67ca5..5752bc122541 100644 --- a/devel/android-tools/distinfo +++ b/devel/android-tools/distinfo @@ -1,3 +1,3 @@ -TIMESTAMP = 1724935617 -SHA256 (android-tools-35.0.2.tar.xz) = d2c3222280315f36d8bfa5c02d7632b47e365bfe2e77e99a3564fb6576f04097 -SIZE (android-tools-35.0.2.tar.xz) = 18847376 +TIMESTAMP = 1787143081 +SHA256 (android-tools-37.0.0.tar.xz) = 2725d09f892a3a38e534429f47a321f58ecf6a3169caa42c915fb2cb7d46be0e +SIZE (android-tools-37.0.0.tar.xz) = 19271864 diff --git a/devel/android-tools/files/patch-vendor_CMakeLists.adb.txt b/devel/android-tools/files/patch-vendor_CMakeLists.adb.txt index 4a3e402d73ad..2f02fd3ecae8 100644 --- a/devel/android-tools/files/patch-vendor_CMakeLists.adb.txt +++ b/devel/android-tools/files/patch-vendor_CMakeLists.adb.txt @@ -1,16 +1,17 @@ ---- vendor/CMakeLists.adb.txt 2024-08-29 19:46:57.000000000 +0200 -+++ vendor/CMakeLists.adb.txt 2026-03-21 19:24:21.380567000 +0100 -@@ -43,9 +43,12 @@ +--- vendor/CMakeLists.adb.txt.orig 2026-08-01 05:20:11 UTC ++++ vendor/CMakeLists.adb.txt +@@ -54,10 +54,13 @@ if(APPLE) if(APPLE) list(APPEND libadb_SOURCES adb/client/usb_osx.cpp) -else() +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") list(APPEND libadb_SOURCES - adb/client/usb_linux.cpp) + adb/client/usb_linux.cpp + adb/client/usb_linux_netlink.cpp) +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + list(APPEND libadb_SOURCES + adb/client/usb_freebsd.cpp) endif() add_library(libadb STATIC ${libadb_SOURCES}) diff --git a/devel/android-tools/files/patch-vendor_CMakeLists.f2fstools.txt b/devel/android-tools/files/patch-vendor_CMakeLists.f2fstools.txt index a003a2fa63c9..1bb4ac3a8f59 100644 --- a/devel/android-tools/files/patch-vendor_CMakeLists.f2fstools.txt +++ b/devel/android-tools/files/patch-vendor_CMakeLists.f2fstools.txt @@ -1,46 +1,45 @@ ---- vendor/CMakeLists.f2fstools.txt 2024-08-29 19:46:57.000000000 +0200 -+++ vendor/CMakeLists.f2fstools.txt 2026-03-21 18:29:02.406397000 +0100 -@@ -17,8 +17,20 @@ +--- vendor/CMakeLists.f2fstools.txt.orig 2026-08-01 05:20:11 UTC ++++ vendor/CMakeLists.f2fstools.txt +@@ -17,8 +17,20 @@ target_compile_definitions(libf2fs PUBLIC target_compile_definitions(libf2fs PUBLIC ${f2fs_tools_defaults} - -DWITH_BLKDISCARD) + -DWITH_BLKDISCARD + -DHAVE_SYS_IOCTL_H) +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_compile_definitions(libf2fs PUBLIC -DHAVE_LIMITS_H) +else() + target_compile_definitions(libf2fs PUBLIC + -DHAVE_LINUX_LOOP_H + -DHAVE_LINUX_MAJOR_H + -DHAVE_SYS_SYSMACROS_H + -DHAVE_LINUX_HDREG_H + -DHAVE_LINUX_LIMITS_H) +endif() + target_include_directories(libf2fs PUBLIC core/libsparse/include f2fs-tools/include) -@@ -59,8 +71,20 @@ +@@ -59,7 +71,19 @@ target_compile_definitions(sload_f2fs PRIVATE target_compile_definitions(sload_f2fs PRIVATE ${f2fs_tools_defaults} - -DWITH_SLOAD) + -DWITH_SLOAD + -DHAVE_SYS_IOCTL_H) - ++ +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_compile_definitions(sload_f2fs PRIVATE -DHAVE_LIMITS_H) +else() + target_compile_definitions(sload_f2fs PRIVATE + -DHAVE_LINUX_LOOP_H + -DHAVE_LINUX_MAJOR_H + -DHAVE_SYS_SYSMACROS_H + -DHAVE_LINUX_HDREG_H + -DHAVE_LINUX_LIMITS_H) +endif() -+ + target_include_directories(sload_f2fs PRIVATE f2fs-tools/include - selinux/libselinux/include diff --git a/devel/android-tools/files/patch-vendor_CMakeLists.fastboot.txt b/devel/android-tools/files/patch-vendor_CMakeLists.fastboot.txt index 3981e29e64ad..6f7eef9723d4 100644 --- a/devel/android-tools/files/patch-vendor_CMakeLists.fastboot.txt +++ b/devel/android-tools/files/patch-vendor_CMakeLists.fastboot.txt @@ -1,19 +1,19 @@ ---- vendor/CMakeLists.fastboot.txt 2024-08-29 19:46:57.000000000 +0200 -+++ vendor/CMakeLists.fastboot.txt 2026-03-21 19:24:26.243327000 +0100 -@@ -119,6 +119,9 @@ +--- vendor/CMakeLists.fastboot.txt.orig 2026-08-01 05:20:11 UTC ++++ vendor/CMakeLists.fastboot.txt +@@ -121,6 +121,9 @@ if(APPLE) if(APPLE) list(APPEND fastboot_SOURCES core/fastboot/usb_osx.cpp) +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + list(APPEND fastboot_SOURCES + core/fastboot/usb_freebsd.cpp) else() list(APPEND fastboot_SOURCES core/fastboot/usb_linux.cpp) -@@ -142,4 +145,6 @@ +@@ -144,4 +147,6 @@ if(APPLE) target_link_libraries(fastboot "-framework CoreFoundation" "-framework IOKit") +elseif(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + target_link_libraries(fastboot PkgConfig::libusb-1.0) endif() diff --git a/devel/android-tools/files/patch-vendor_CMakeLists.txt b/devel/android-tools/files/patch-vendor_CMakeLists.txt index b1c5d6898cee..7757fb8c1e9a 100644 --- a/devel/android-tools/files/patch-vendor_CMakeLists.txt +++ b/devel/android-tools/files/patch-vendor_CMakeLists.txt @@ -1,18 +1,18 @@ ---- vendor/CMakeLists.txt 2024-08-29 19:46:57.000000000 +0200 -+++ vendor/CMakeLists.txt 2026-03-21 14:09:16.768573000 +0100 -@@ -41,6 +41,15 @@ +--- vendor/CMakeLists.txt.orig 2026-08-01 05:20:11 UTC ++++ vendor/CMakeLists.txt +@@ -41,6 +41,15 @@ add_compile_definitions(_FILE_OFFSET_BITS=64 _LARGEFIL # 32-bit glibc platforms this is not the case by default. add_compile_definitions(_FILE_OFFSET_BITS=64 _LARGEFILE64_SOURCE) +# On FreeBSD, _XOPEN_SOURCE (used by some sub-targets) hides BSD extensions +# like getprogname(). Ensure BSD visibility is preserved. +# Also provide compat macros for 64-bit functions that don't exist on FreeBSD +# (off_t is always 64-bit on FreeBSD). +if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + add_compile_definitions(__BSD_VISIBLE=1) + add_compile_definitions(lseek64=lseek ftruncate64=ftruncate mmap64=mmap pread64=pread pwrite64=pwrite off64_t=off_t) +endif() + set(android-vendored avb adb diff --git a/devel/android-tools/files/patch-vendor_adb_client_transport_usb.cpp b/devel/android-tools/files/patch-vendor_adb_client_transport_usb.cpp new file mode 100644 index 000000000000..420c2c52f2ec --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_transport_usb.cpp @@ -0,0 +1,11 @@ +--- vendor/adb/client/transport_usb.cpp.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/transport_usb.cpp +@@ -180,6 +180,8 @@ + bool enable = false; + #if defined(__APPLE__) + enable = true; ++#elif defined(__FreeBSD__) ++ enable = true; + #endif + char* env = getenv("ADB_LIBUSB"); + if (env) { diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp deleted file mode 100644 index 004d7a251eba..000000000000 --- a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb.cpp +++ /dev/null @@ -1,89 +0,0 @@ ---- vendor/adb/client/usb_libusb.cpp.orig 2024-08-29 17:46:57 UTC -+++ vendor/adb/client/usb_libusb.cpp -@@ -38,6 +38,8 @@ - - #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB - #include -+#elif defined(__FreeBSD__) -+#include - #else - #include - #endif -@@ -505,10 +507,14 @@ struct LibusbConnection : public Connection { - return 480; - case LIBUSB_SPEED_SUPER: - return 5000; -+#ifdef LIBUSB_SPEED_SUPER_PLUS - case LIBUSB_SPEED_SUPER_PLUS: - return 10000; -+#endif -+#ifdef LIBUSB_SPEED_SUPER_PLUS_X2 - case LIBUSB_SPEED_SUPER_PLUS_X2: - return 20000; -+#endif - case LIBUSB_SPEED_UNKNOWN: - default: - return 0; -@@ -526,20 +532,23 @@ struct LibusbConnection : public Connection { - msb++; - } - -+ // Use literal values from 'enum libusb_supported_speed' (USB spec defined bits) -+ // to remain portable across libusb implementations that may not expose the enum. - switch (1 << msb) { -- case LIBUSB_LOW_SPEED_OPERATION: -+ case (1 << 0): // LIBUSB_LOW_SPEED_OPERATION - return 1; -- case LIBUSB_FULL_SPEED_OPERATION: -+ case (1 << 1): // LIBUSB_FULL_SPEED_OPERATION - return 12; -- case LIBUSB_HIGH_SPEED_OPERATION: -+ case (1 << 2): // LIBUSB_HIGH_SPEED_OPERATION - return 480; -- case LIBUSB_SUPER_SPEED_OPERATION: -+ case (1 << 3): // LIBUSB_SUPER_SPEED_OPERATION - return 5000; - default: - return 0; - } - } - -+#ifdef LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY - static uint64_t ExtractMaxSuperSpeedPlus(libusb_ssplus_usb_device_capability_descriptor* cap) { - // The exponents is one of {bytes, kB, MB, or GB}. We express speed in MB so we use a 0 - // multiplier for value which would result in 0MB anyway. -@@ -552,6 +561,7 @@ struct LibusbConnection : public Connection { - } - return max_speed; - } -+#endif - - void RetrieveSpeeds() { - negotiated_speed_ = ToConnectionSpeed(libusb_get_device_speed(device_.get())); -@@ -563,7 +573,9 @@ struct LibusbConnection : public Connection { - return; - } - -- for (int i = 0; i < bos->bNumDeviceCaps; i++) { -+ // Use bNumDeviceCapabilities for portability: on FreeBSD < 15 the field has -+ // this name; on FreeBSD >= 15 and upstream libusb it is a macro alias. -+ for (int i = 0; i < bos->bNumDeviceCapabilities; i++) { - switch (bos->dev_capability[i]->bDevCapabilityType) { - case LIBUSB_BT_SS_USB_DEVICE_CAPABILITY: { - libusb_ss_usb_device_capability_descriptor* cap = nullptr; -@@ -574,6 +586,7 @@ struct LibusbConnection : public Connection { - libusb_free_ss_usb_device_capability_descriptor(cap); - } - } break; -+#ifdef LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY - case LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY: { - libusb_ssplus_usb_device_capability_descriptor* cap = nullptr; - if (!libusb_get_ssplus_usb_device_capability_descriptor( -@@ -582,6 +595,7 @@ struct LibusbConnection : public Connection { - libusb_free_ssplus_usb_device_capability_descriptor(cap); - } - } break; -+#endif - default: - break; - } diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.cpp b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.cpp new file mode 100644 index 000000000000..84aed1c23343 --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.cpp @@ -0,0 +1,85 @@ +--- vendor/adb/client/usb_libusb_device.cpp.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/usb_libusb_device.cpp +@@ -30,6 +30,8 @@ + + #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB + #include ++#elif defined(__FreeBSD__) ++#include + #else + #include + #endif +@@ -368,10 +370,14 @@ + return 480; + case LIBUSB_SPEED_SUPER: + return 5000; ++#ifdef LIBUSB_SPEED_SUPER_PLUS + case LIBUSB_SPEED_SUPER_PLUS: + return 10000; ++#endif ++#ifdef LIBUSB_SPEED_SUPER_PLUS_X2 + case LIBUSB_SPEED_SUPER_PLUS_X2: + return 20000; ++#endif + case LIBUSB_SPEED_UNKNOWN: + default: + return 0; +@@ -390,19 +396,20 @@ + } + + switch (1 << msb) { +- case LIBUSB_LOW_SPEED_OPERATION: ++ case (1 << 0): // LIBUSB_LOW_SPEED_OPERATION + return 1; +- case LIBUSB_FULL_SPEED_OPERATION: +- return 12; +- case LIBUSB_HIGH_SPEED_OPERATION: ++ case (1 << 1): // LIBUSB_FULL_SPEED_OPERATION ++ return 12; ++ case (1 << 2): // LIBUSB_HIGH_SPEED_OPERATION + return 480; +- case LIBUSB_SUPER_SPEED_OPERATION: ++ case (1 << 3): // LIBUSB_SUPER_SPEED_OPERATION + return 5000; + default: + return 0; + } + } + ++#ifdef LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY + static uint64_t ExtractMaxSuperSpeedPlus(libusb_ssplus_usb_device_capability_descriptor* cap) { + // The exponents is one of {bytes, kB, MB, or GB}. We express speed in MB so we use a 0 + // multiplier for value which would result in 0MB anyway. +@@ -415,6 +422,7 @@ + } + return max_speed; + } ++#endif + + void LibUsbDevice::RetrieveSpeeds() { + negotiated_speed_ = ToConnectionSpeed(libusb_get_device_speed(device_)); +@@ -426,7 +434,7 @@ + return; + } + +- for (int i = 0; i < bos->bNumDeviceCaps; i++) { ++ for (int i = 0; i < bos->bNumDeviceCapabilities; i++) { + switch (bos->dev_capability[i]->bDevCapabilityType) { + case LIBUSB_BT_SS_USB_DEVICE_CAPABILITY: { + libusb_ss_usb_device_capability_descriptor* cap = nullptr; +@@ -436,6 +444,7 @@ + libusb_free_ss_usb_device_capability_descriptor(cap); + } + } break; ++#ifdef LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY + case LIBUSB_BT_SUPERSPEED_PLUS_CAPABILITY: { + libusb_ssplus_usb_device_capability_descriptor* cap = nullptr; + if (!libusb_get_ssplus_usb_device_capability_descriptor( +@@ -444,6 +453,7 @@ + libusb_free_ssplus_usb_device_capability_descriptor(cap); + } + } break; ++#endif + default: + break; + } diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.h b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.h new file mode 100644 index 000000000000..3969ed9ee679 --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_device.h @@ -0,0 +1,11 @@ +--- vendor/adb/client/usb_libusb_device.h.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/usb_libusb_device.h +@@ -26,6 +26,8 @@ + + #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB + #include "libusb/libusb.h" ++#elif defined(__FreeBSD__) ++#include + #else + #include + #endif diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.cpp b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.cpp new file mode 100644 index 000000000000..1a9e9106be13 --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.cpp @@ -0,0 +1,20 @@ +--- vendor/adb/client/usb_libusb_hotplug.cpp.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/usb_libusb_hotplug.cpp +@@ -37,6 +37,8 @@ + + #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB + #include "libusb/libusb.h" ++#elif defined(__FreeBSD__) ++#include + #else + #include + #endif +@@ -228,7 +230,7 @@ + static_cast(LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED | + LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT), + LIBUSB_HOTPLUG_ENUMERATE, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_MATCH_ANY, +- LIBUSB_HOTPLUG_MATCH_ANY, hotplug_callback, nullptr, nullptr); ++ LIBUSB_CLASS_PER_INTERFACE, hotplug_callback, nullptr, nullptr); + + if (rc != LIBUSB_SUCCESS) { + LOG(FATAL) << "failed to register libusb hotplug callback"; diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.h b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.h new file mode 100644 index 000000000000..5f0a83fca7ce --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_hotplug.h @@ -0,0 +1,11 @@ +--- vendor/adb/client/usb_libusb_hotplug.h.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/usb_libusb_hotplug.h +@@ -20,6 +20,8 @@ + + #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB + #include ++#elif defined(__FreeBSD__) ++#include + #else + #include + #endif diff --git a/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_inhouse_hotplug.cpp b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_inhouse_hotplug.cpp new file mode 100644 index 000000000000..9c02736b247b --- /dev/null +++ b/devel/android-tools/files/patch-vendor_adb_client_usb_libusb_inhouse_hotplug.cpp @@ -0,0 +1,11 @@ +--- vendor/adb/client/usb_libusb_inhouse_hotplug.cpp.orig 2026-08-01 07:20:11.000000000 +0200 ++++ vendor/adb/client/usb_libusb_inhouse_hotplug.cpp +@@ -25,6 +25,8 @@ + + #ifdef ANDROID_TOOLS_USE_BUNDLED_LIBUSB + #include "libusb/libusb.h" ++#elif defined(__FreeBSD__) ++#include + #else + #include + #endif diff --git a/devel/android-tools/pkg-plist b/devel/android-tools/pkg-plist index 7972e3a0d3a4..ce832e5ef154 100644 --- a/devel/android-tools/pkg-plist +++ b/devel/android-tools/pkg-plist @@ -1,27 +1,29 @@ bin/adb bin/append2simg bin/avbtool bin/e2fsdroid bin/ext2simg bin/fastboot bin/img2simg bin/lpadd bin/lpdump bin/lpflash bin/lpmake bin/lpunpack bin/make_f2fs bin/mkbootimg bin/mkdtboimg bin/mke2fs.android bin/repack_bootimg bin/simg2img bin/sload_f2fs bin/unpack_bootimg share/bash-completion/completions/adb share/bash-completion/completions/fastboot +share/zsh/site-functions/_adb +share/zsh/site-functions/_fastboot share/man/man1/adb.1.gz %%DATADIR%%/completions/adb %%DATADIR%%/completions/fastboot %%DATADIR%%/mkbootimg/gki/generate_gki_certificate.py %%DATADIR%%/mkbootimg/mkbootimg.py