From c6be09a8490a4c8fc220a1e684bb5c62ed8b6083 Mon Sep 17 00:00:00 2001 From: Biswapriyo Nath Date: Mon, 4 Sep 2023 05:02:05 +0000 Subject: [PATCH] android-tools: update to 34.0.4 * Changes: - 0001: Enable building liblp for fastboot. - 0002: Remove some upstream hunks and fix libziparchive. --- .../0001-android-tools-cmake.patch | 60 ++++++++++--------- .../0002-android-tools-vendor.patch | 45 ++++---------- mingw-w64-android-tools/PKGBUILD | 16 ++--- 3 files changed, 51 insertions(+), 70 deletions(-) diff --git a/mingw-w64-android-tools/0001-android-tools-cmake.patch b/mingw-w64-android-tools/0001-android-tools-cmake.patch index 9fafecd13f..dd2f6e3341 100644 --- a/mingw-w64-android-tools/0001-android-tools-cmake.patch +++ b/mingw-w64-android-tools/0001-android-tools-cmake.patch @@ -1,14 +1,3 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -8,7 +8,7 @@ include(GNUInstallDirs) - # Option to enable or disable patching vendor projects using patches directory. - # This helps to build vendor projects with or without any patching. Also if any - # files are changed in vendor projects those can be retained with this option. --option(ANDROID_TOOLS_PATCH_VENDOR "Patch vendor projects using patches directory" ON) -+option(ANDROID_TOOLS_PATCH_VENDOR "Patch vendor projects using patches directory" OFF) - - # Install bash/zsh completion files. - set(COMPLETION_COMMON_DIR "${CMAKE_INSTALL_FULL_DATADIR}/android-tools/completions") --- a/vendor/CMakeLists.adb.txt +++ b/vendor/CMakeLists.adb.txt @@ -29,23 +29,37 @@ @@ -94,7 +83,7 @@ - core/libcutils/threads.cpp) + core/libcutils/threads.cpp + core/libcutils/trace-host.cpp) - ++ +if(WIN32) + list(APPEND libcutils_SOURCES + core/libcutils/socket_inaddr_any_server_windows.cpp @@ -116,7 +105,7 @@ + core/libcutils/sockets_unix.cpp + core/libcutils/str_parms.cpp) +endif() -+ + +add_library(libcutils STATIC ${libcutils_SOURCES}) target_compile_definitions(libcutils PRIVATE -D_GNU_SOURCE) target_include_directories(libcutils PRIVATE @@ -171,7 +160,7 @@ target_link_libraries(adb --- a/vendor/CMakeLists.fastboot.txt +++ b/vendor/CMakeLists.fastboot.txt -@@ -50,6 +50,7 @@ +@@ -38,6 +38,7 @@ # Only add common sources from libselinux_defaults and libselinux # See the file list in selinux/libselinux/Android.bp @@ -179,15 +168,15 @@ add_library(libselinux STATIC selinux/libselinux/src/booleans.c selinux/libselinux/src/callbacks.c -@@ -102,6 +103,7 @@ - target_compile_definitions(libsepol PRIVATE - -DHAVE_REALLOCARRAY) - endif() +@@ -94,6 +95,7 @@ + + target_include_directories(libsepol PUBLIC + selinux/libsepol/include) +endif(NOT WIN32) set(fastboot_SOURCES core/fastboot/bootimg_utils.cpp -@@ -115,7 +117,10 @@ +@@ -111,7 +113,10 @@ core/fastboot/vendor_boot_img_utils.cpp core/fastboot/util.cpp) @@ -199,7 +188,7 @@ list(APPEND fastboot_SOURCES core/fastboot/usb_osx.cpp) else() -@@ -129,14 +134,24 @@ +@@ -125,13 +130,24 @@ extras/ext4_utils/include extras/f2fs_utils core/libziparchive/include mkbootimg/include/bootimg core/fs_mgr/liblp/include core/fs_mgr/libstorage_literals avb) @@ -211,10 +200,9 @@ -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -DANDROID_MKE2FS_NAME="${ANDROID_MKE2FS_NAME}") target_link_libraries(fastboot - libsparse libzip libcutils liblog libfsmgr libutil + libsparse libzip libcutils liblog liblp libutil - libbase libext4 libselinux libsepol libdiagnoseusb crypto - z PkgConfig::libpcre2-8 Threads::Threads dl) -- + libbase libext4 libdiagnoseusb crypto + z PkgConfig::libpcre2-8 Threads::Threads) +if(WIN32) @@ -224,9 +212,9 @@ + target_link_libraries(fastboot + libselinux libsepol dl) +endif() + if(APPLE) target_link_libraries(fastboot - "-framework CoreFoundation" --- a/vendor/CMakeLists.libbase.txt +++ b/vendor/CMakeLists.libbase.txt @@ -1,7 +1,6 @@ @@ -239,7 +227,7 @@ libbase/file.cpp libbase/hex.cpp libbase/logging.cpp -@@ -14,9 +13,19 @@ add_library(libbase STATIC +@@ -14,9 +13,19 @@ libbase/stringprintf.cpp libbase/strings.cpp libbase/threads.cpp @@ -273,6 +261,21 @@ ${CMAKE_CURRENT_BINARY_DIR}/mkbootimg) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/mkbootimg DESTINATION bin) install(FILES mkbootimg/gki/generate_gki_certificate.py DESTINATION ${MKBOOTIMG_SCRIPTS_DIR}/gki) +--- a/vendor/CMakeLists.partition.txt ++++ b/vendor/CMakeLists.partition.txt +@@ -15,6 +15,7 @@ + target_include_directories(liblp PUBLIC + core/fs_mgr/liblp/include) + ++if(NOT WIN32) + protobuf_generate_cpp(DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_SRCS DYNAMIC_PARTITIONS_DEVICE_INFO_PROTO_HDRS + extras/partition_tools/dynamic_partitions_device_info.proto) + +@@ -54,3 +55,4 @@ + extras/partition_tools/lpunpack.cc) + target_link_libraries(lpunpack + libbase liblog liblp libsparse) ++endif(NOT WIN32) --- a/vendor/CMakeLists.sparse.txt +++ b/vendor/CMakeLists.sparse.txt @@ -24,3 +24,6 @@ @@ -284,14 +287,16 @@ +endif() --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt -@@ -73,39 +73,54 @@ pkg_check_modules(libusb-1.0 REQUIRED IMPORTED_TARGET libusb-1.0) - pkg_check_modules(libzstd REQUIRED IMPORTED_TARGET libzstd) +@@ -75,7 +75,7 @@ + find_package(Protobuf CONFIG) find_package(Protobuf REQUIRED) -set(THREADS_PREFER_PTHREAD_FLAG ON) +#set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) + check_symbol_exists(strlcpy "string.h" HAVE_STRLCPY) +@@ -84,33 +84,48 @@ include_directories(${PROTOBUF_INCLUDE_DIRS}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) @@ -310,13 +315,12 @@ include(CMakeLists.sparse.txt) include(CMakeLists.fastboot.txt) -include(CMakeLists.mke2fs.txt) --include(CMakeLists.partition.txt) + include(CMakeLists.partition.txt) include(CMakeLists.mkbootimg.txt) include(CMakeLists.libufdt.txt) include(CMakeLists.avb.txt) +if(NOT WIN32) + include(CMakeLists.mke2fs.txt) -+ include(CMakeLists.partition.txt) +endif() # Targets which should be installed by `make install`. diff --git a/mingw-w64-android-tools/0002-android-tools-vendor.patch b/mingw-w64-android-tools/0002-android-tools-vendor.patch index 6a2c29e886..aee5d89169 100644 --- a/mingw-w64-android-tools/0002-android-tools-vendor.patch +++ b/mingw-w64-android-tools/0002-android-tools-vendor.patch @@ -1,28 +1,6 @@ ---- a/vendor/adb/file_sync_protocol.h -+++ b/vendor/adb/file_sync_protocol.h -@@ -16,6 +16,8 @@ - - #pragma once - -+#include -+ - #define MKID(a, b, c, d) ((a) | ((b) << 8) | ((c) << 16) | ((d) << 24)) - - #define ID_LSTAT_V1 MKID('S', 'T', 'A', 'T') ---- a/vendor/adb/sysdeps/uio.h -+++ b/vendor/adb/sysdeps/uio.h -@@ -24,7 +24,7 @@ - - // Layout of this struct must match struct WSABUF (verified via static assert in sysdeps_win32.cpp) - struct adb_iovec { -- size_t iov_len; -+ int iov_len; - void* iov_base; - }; - --- a/vendor/boringssl/include/openssl/base.h +++ b/vendor/boringssl/include/openssl/base.h -@@ -138,8 +138,13 @@ +@@ -136,8 +136,13 @@ #endif #endif @@ -36,15 +14,14 @@ #endif // Trusty isn't Linux but currently defines __linux__. As a workaround, we ---- a/vendor/boringssl/crypto/CMakeLists.txt -+++ b/vendor/boringssl/crypto/CMakeLists.txt -@@ -466,6 +466,9 @@ +--- a/vendor/libziparchive/zip_cd_entry_map.h ++++ b/vendor/libziparchive/zip_cd_entry_map.h +@@ -90,7 +90,7 @@ + static constexpr size_t offset_max = (1u << 20) - 1; + static constexpr size_t length_max = (1u << 12) - 1; + uint32_t name_offset : 20; +- uint16_t name_length : 12; ++ uint32_t name_length : 12; + }; - SET_TARGET_PROPERTIES(crypto PROPERTIES LINKER_LANGUAGE C) - -+if(WIN32) -+ target_link_libraries(crypto ws2_32) -+endif() - if(NOT WIN32 AND NOT ANDROID) - target_link_libraries(crypto pthread) - endif() + static_assert(sizeof(struct ZipStringOffset20) == 4); diff --git a/mingw-w64-android-tools/PKGBUILD b/mingw-w64-android-tools/PKGBUILD index 8280caa0d7..df22a98dc3 100644 --- a/mingw-w64-android-tools/PKGBUILD +++ b/mingw-w64-android-tools/PKGBUILD @@ -3,9 +3,9 @@ _realname=android-tools pkgbase=mingw-w64-${_realname} pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}") -pkgver=33.0.3 -_tag=${pkgver}p2 -pkgrel=2 +pkgver=34.0.4 +_tag=${pkgver} +pkgrel=1 pkgdesc='Android platform tools (mingw-w64)' arch=('any') mingw_arch=('mingw32' 'mingw64' 'ucrt64' 'clang64' 'clang32' 'clangarm64') @@ -30,12 +30,12 @@ source=("https://github.com/nmeum/android-tools/releases/download/${_tag}/${_rea "0001-android-tools-cmake.patch" "0002-android-tools-vendor.patch") noextract=("${_realname}-${_tag}.tar.xz") -sha256sums=('6bf6b52d7389e79fc92b63cc206451ee42fc4f7da769d76922193e98d75f5604' - '34edca31f99e744bd396b09639955b68f234a0ebea88bd3d22b721c35dd056b1' - '465a8cce0e93f79e5b9b44eeb0eb7239e8de3a09bc8cc3f7dce46d0a61699a92' +sha256sums=('7a22ff9cea81ff4f38f560687858e8f8fb733624412597e3cc1ab0262f8da3a1' + 'd8856c8d3e4315393c4c47cffa491e973932d39efbe8bfdd2a0456d16b9c56cc' + 'e853151874c9a97697219ce3c5f3c89843f7ef4e325c127b3ec002168d30d208' 'e6fc31c148e120fc69be53e0464434c492ab0eaa0dbc8f18dd3c19eb2dd2577b' - '1130b36340f640639a040aa2514ae477b5f5f060dd7c02be4100676c78543eb8' - '1f1a0567ef6f0f895c9f18202133e344350208c1aac91384ea9b119dd75ec9d3') + '7e394b2c0d86bec01c06995a07e7bcf90ff44fe93dc38f5b58c20d7d52d96a65' + '3c66c9756272a63d4e5b8a13b2d55e6b42bf3f0a297739cf3ea78e8fd7a3881e') # Helper macros to help make tasks easier # apply_patch_with_msg() {