author | Anatol Pomozov
<anatolik@archlinux.org> 2020-08-02 01:45:30 UTC |
committer | Anatol Pomozov
<anatolik@archlinux.org> 2020-08-02 01:45:30 UTC |
parent | 70ddf1b3018dece068f063869c90b880c8b7aa78 |
PKGBUILD | +25 | -16 |
fix_build_core.patch | +92 | -16 |
fix_libziparchive.patch | +12 | -0 |
generate_build.rb | +14 | -14 |
diff --git a/PKGBUILD b/PKGBUILD index ce81773..560f88a 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -3,9 +3,9 @@ # Contributor: Alucryd <alucryd at gmail dot com> pkgname=android-tools -pkgver=30.0.0 -pkgrel=2 -tag=platform-tools-$pkgver +pkgver=30.0.3 +pkgrel=1 +_tag=platform-tools-$pkgver pkgdesc='Android platform tools' arch=(x86_64) url='http://tools.android.com/' @@ -17,17 +17,18 @@ optdepends=('python: for mkbootimg script' makedepends=(git clang gtest ruby cmake ninja go vim) provides=(fastboot adb) conflicts=(fastboot adb) -#_boringssl_commit=$(curl https://android.googlesource.com/platform/external/boringssl/+/refs/tags/$tag/BORINGSSL_REVISION?format=TEXT | base64 -d) -source=(git+https://android.googlesource.com/platform/frameworks/base#tag=$tag - git+https://android.googlesource.com/platform/frameworks/native#tag=$tag - git+https://android.googlesource.com/platform/system/core#tag=$tag - git+https://android.googlesource.com/platform/system/extras#tag=$tag - git+https://android.googlesource.com/platform/system/tools/mkbootimg#tag=$tag - git+https://android.googlesource.com/platform/external/selinux#tag=$tag - git+https://android.googlesource.com/platform/external/f2fs-tools#tag=$tag - git+https://android.googlesource.com/platform/external/e2fsprogs#tag=$tag - git+https://android.googlesource.com/platform/external/avb#tag=$tag - git+https://android.googlesource.com/platform/external/boringssl#tag=$tag +source=(git+https://android.googlesource.com/platform/frameworks/base#tag=$_tag + git+https://android.googlesource.com/platform/frameworks/native#tag=$_tag + git+https://android.googlesource.com/platform/system/core#tag=$_tag + git+https://android.googlesource.com/platform/system/extras#tag=$_tag + git+https://android.googlesource.com/platform/system/libbase#tag=$_tag + git+https://android.googlesource.com/platform/system/libziparchive#tag=$_tag + git+https://android.googlesource.com/platform/system/tools/mkbootimg#tag=$_tag + git+https://android.googlesource.com/platform/external/selinux#tag=$_tag + git+https://android.googlesource.com/platform/external/f2fs-tools#tag=$_tag + git+https://android.googlesource.com/platform/external/e2fsprogs#tag=$_tag + git+https://android.googlesource.com/platform/external/avb#tag=$_tag + git+https://android.googlesource.com/platform/external/boringssl#tag=$_tag #git+https://boringssl.googlesource.com/boringssl#commit=$_boringssl_commit generate_build.rb # deployagent.jar is a library built from Android sources. @@ -42,7 +43,9 @@ source=(git+https://android.googlesource.com/platform/frameworks/base#tag=$tag # mmm system/core/adb/ # cp ./target/product/generic/system/framework/deployagent.jar . deployagent.jar +# we disable mDNS functionality as it does not compile with the Arch system version of the library fix_build_core.patch + fix_libziparchive.patch boringssl-disable-thirdpartydeps.patch bash_completion.fastboot) # Bash completion file was taken from https://github.com/mbrubeck/android-completion @@ -56,9 +59,12 @@ sha1sums=('SKIP' 'SKIP' 'SKIP' 'SKIP' - '4aec96639c5a16e75fac907bc5a8ea6a7efca047' + 'SKIP' + 'SKIP' + '8c95ce0bbc39bf1fe37213497af924ad10f195b4' 'd9dfac30245faa0a96968b96f3acd9ad536f4910' - '70abd4483233ee481490b3369dbdd4977772c57f' + '61b1bcf230be39a5f9544e82d43269a20bfb9ef2' + 'ce8314d6b1e05e3f4f7ae7828d225fbb07a2a55c' '1c025855a3e7ea351685843a0df45c52a7e674dd' '7004dbd0c193668827174880de6f8434de8ceaee') @@ -66,6 +72,9 @@ prepare() { cd "$srcdir"/core patch -p1 < ../fix_build_core.patch + cd "$srcdir"/libziparchive + patch -p1 < ../fix_libziparchive.patch + cd "$srcdir"/avb sed -i 's|/usr/bin/env python$|/usr/bin/env python2|g' avbtool diff --git a/fix_build_core.patch b/fix_build_core.patch index f2c4ae7..220af41 100644 --- a/fix_build_core.patch +++ b/fix_build_core.patch @@ -1,5 +1,5 @@ diff --git a/adb/adb.cpp b/adb/adb.cpp -index 08d3904c71..a73362acec 100644 +index 08986b77e0..46b6036502 100644 --- a/adb/adb.cpp +++ b/adb/adb.cpp @@ -45,8 +45,6 @@ @@ -24,11 +24,69 @@ index 08d3904c71..a73362acec 100644 android::base::GetExecutablePath().c_str()); } +@@ -1079,21 +1077,6 @@ void adb_set_reject_kill_server(bool value) { + } + + static bool handle_mdns_request(std::string_view service, int reply_fd) { +- if (!android::base::ConsumePrefix(&service, "mdns:")) { +- return false; +- } +- +- if (service == "check") { +- std::string check = mdns_check(); +- SendOkay(reply_fd, check); +- return true; +- } +- if (service == "services") { +- std::string services_list = mdns_list_discovered_services(); +- SendOkay(reply_fd, services_list); +- return true; +- } +- + return false; + } + diff --git a/adb/client/adb_wifi.cpp b/adb/client/adb_wifi.cpp -index fa71028115..8c460f24fb 100644 +index 61a9a480c9..ded4f8f616 100644 --- a/adb/client/adb_wifi.cpp +++ b/adb/client/adb_wifi.cpp -@@ -242,5 +242,6 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password, +@@ -179,23 +179,6 @@ bool adb_wifi_is_known_host(const std::string& host) { + + void adb_wifi_pair_device(const std::string& host, const std::string& password, + std::string& response) { +- auto mdns_info = mdns_get_pairing_service_info(host); +- +- if (!mdns_info.has_value()) { +- // Check the address for a valid address and port. +- std::string parsed_host; +- std::string err; +- int port = -1; +- if (!android::base::ParseNetAddress(host, &parsed_host, &port, nullptr, &err)) { +- response = "Failed to parse address for pairing: " + err; +- return; +- } +- if (port <= 0 || port > 65535) { +- response = "Invalid port while parsing address [" + host + "]"; +- return; +- } +- } +- + auto priv_key = adb_auth_get_user_privkey(); + auto x509_cert = GenerateX509Certificate(priv_key.get()); + if (!x509_cert) { +@@ -224,10 +207,7 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password, + + PairingResultWaiter waiter; + std::unique_lock<std::mutex> lock(waiter.mutex_); +- if (!client->Start(mdns_info.has_value() +- ? android::base::StringPrintf("%s:%d", mdns_info->addr.c_str(), +- mdns_info->port) +- : host, ++ if (!client->Start(host, + waiter.OnResult, &waiter)) { + response = "Failed: Unable to start pairing client."; + return; +@@ -250,5 +230,6 @@ void adb_wifi_pair_device(const std::string& host, const std::string& password, // Write to adb_known_hosts write_known_host_to_file(device_guid); // Try to auto-connect. @@ -37,7 +95,7 @@ index fa71028115..8c460f24fb 100644 + // adb_secure_connect_by_service_name(device_guid.c_str()); } diff --git a/adb/client/main.cpp b/adb/client/main.cpp -index 05e210f607..99192831c5 100644 +index a19bd6d311..356aeb221a 100644 --- a/adb/client/main.cpp +++ b/adb/client/main.cpp @@ -126,9 +126,6 @@ int adb_server_main(int is_daemon, const std::string& socket_spec, int ack_reply @@ -100,6 +158,36 @@ index 0ac04e6913..de2aa740ea 100644 #include <iomanip> #include <sstream> #include <vector> +diff --git a/adb/socket_spec.cpp b/adb/socket_spec.cpp +index 5cad70d094..9f97307191 100644 +--- a/adb/socket_spec.cpp ++++ b/adb/socket_spec.cpp +@@ -196,24 +196,7 @@ bool socket_spec_connect(unique_fd* fd, std::string_view address, int* port, std + fd->reset(network_loopback_client(port_value, SOCK_STREAM, error)); + } else { + #if ADB_HOST +- // Check if the address is an mdns service we can connect to. +- if (auto mdns_info = mdns_get_connect_service_info(address.substr(4)); +- mdns_info != std::nullopt) { +- fd->reset(network_connect(mdns_info->addr, mdns_info->port, SOCK_STREAM, 0, error)); +- if (fd->get() != -1) { +- // TODO(joshuaduong): We still show the ip address for the serial. Change it to +- // use the mdns instance name, so we can adjust to address changes on +- // reconnects. +- port_value = mdns_info->port; +- if (serial) { +- *serial = android::base::StringPrintf("%s.%s", +- mdns_info->service_name.c_str(), +- mdns_info->service_type.c_str()); +- } +- } +- } else { +- fd->reset(network_connect(hostname, port_value, SOCK_STREAM, 0, error)); +- } ++ fd->reset(network_connect(hostname, port_value, SOCK_STREAM, 0, error)); + #else + // Disallow arbitrary connections in adbd. + *error = "adbd does not support arbitrary tcp connections"; diff --git a/adb/tls/tls_connection.cpp b/adb/tls/tls_connection.cpp index 853cdac08c..3613c3768b 100644 --- a/adb/tls/tls_connection.cpp @@ -162,15 +250,3 @@ index ba4846e33b..f3fccc4895 100644 // // Deprecated: use `_Thread_local` in C or `thread_local` in C++. // -diff --git a/libziparchive/zip_cd_entry_map.h b/libziparchive/zip_cd_entry_map.h -index 4957f754e7..1cfb74dd5b 100644 ---- a/libziparchive/zip_cd_entry_map.h -+++ b/libziparchive/zip_cd_entry_map.h -@@ -17,6 +17,7 @@ - #pragma once - - #include <stdint.h> -+#include <stdlib.h> - - #include <map> - #include <memory> diff --git a/fix_libziparchive.patch b/fix_libziparchive.patch new file mode 100644 index 0000000..78b5d20 --- /dev/null +++ b/fix_libziparchive.patch @@ -0,0 +1,12 @@ +diff --git a/zip_cd_entry_map.h b/zip_cd_entry_map.h +index 4957f75..1cfb74d 100644 +--- a/zip_cd_entry_map.h ++++ b/zip_cd_entry_map.h +@@ -17,6 +17,7 @@ + #pragma once + + #include <stdint.h> ++#include <stdlib.h> + + #include <map> + #include <memory> diff --git a/generate_build.rb b/generate_build.rb index b35518e..3228e6a 100755 --- a/generate_build.rb +++ b/generate_build.rb @@ -110,10 +110,9 @@ adbdfiles = %w( shell_service_protocol.cpp sockets.cpp transport.cpp - transport_local.cpp types.cpp ) -libadbd = compile(expand("core/adb", adbdfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/src/include -Icore/diagnose_usb/include -Icore/adb/crypto/include -Icore/adb/proto -Icore/adb/tls/include', :order_deps => [key_type_h]) +libadbd = compile(expand("core/adb", adbdfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -DADB_HOST=1 -Icore/include -Ilibbase/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/src/include -Icore/diagnose_usb/include -Icore/adb/crypto/include -Icore/adb/proto -Icore/adb/tls/include', :order_deps => [key_type_h]) apkent_h, apkent_c, apkent_o = protoc("core/adb/fastdeploy/proto/ApkEntry.proto") app_processes_h, app_processes_c, app_processes_o = protoc("core/adb/proto/app_processes.proto") @@ -143,6 +142,7 @@ adbfiles = %w( client/line_printer.cpp client/main.cpp client/pairing/pairing_client.cpp + client/transport_local.cpp client/transport_usb.cpp client/usb_dispatch.cpp client/usb_libusb.cpp @@ -164,7 +164,7 @@ adbfiles = %w( tls/adb_ca_list.cpp tls/tls_connection.cpp ) -libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/src/include -Ibase/libs/androidfw/include -Inative/include -Icore/adb/crypto/include -Icore/adb/proto -Icore/adb/tls/include -Icore/adb/pairing_connection/include -Icore/libziparchive/include -Icore/adb/pairing_auth/include", +libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Ilibbase/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/src/include -Ibase/libs/androidfw/include -Inative/include -Icore/adb/crypto/include -Icore/adb/proto -Icore/adb/tls/include -Icore/adb/pairing_connection/include -Ilibziparchive/include -Icore/adb/pairing_auth/include", :order_deps => [apkent_h, key_type_h, app_processes_h, adb_known_hosts_h, pairing_h, deployagent_inc, deployagentscript_inc]) androidfwfiles = %w( LocaleData.cpp @@ -172,7 +172,7 @@ androidfwfiles = %w( TypeWrappers.cpp ZipFileRO.cpp ) -libandroidfw = compile(expand("base/libs/androidfw", androidfwfiles), "-Icore/base/include -Ibase/libs/androidfw/include -Icore/libutils/include -Icore/liblog/include -Icore/libsystem/include -Inative/include -Icore/libcutils/include -Icore/libziparchive/include") +libandroidfw = compile(expand("base/libs/androidfw", androidfwfiles), "-Ilibbase/include -Ibase/libs/androidfw/include -Icore/libutils/include -Icore/liblog/include -Icore/libsystem/include -Inative/include -Icore/libcutils/include -Ilibziparchive/include") basefiles = %w( chrono_utils.cpp @@ -188,7 +188,7 @@ basefiles = %w( test_utils.cpp threads.cpp ) -libbase = compile(expand("core/base", basefiles), "-DADB_HOST=1 -Icore/base/include -Icore/include") +libbase = compile(expand("libbase", basefiles), "-DADB_HOST=1 -Ilibbase/include -Icore/include") logfiles = %w( log_event_list.cpp @@ -198,7 +198,7 @@ logfiles = %w( logprint.cpp properties.cpp ) -liblog = compile(expand("core/liblog", logfiles), "-DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include -Icore/base/include") +liblog = compile(expand("core/liblog", logfiles), "-DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include -Ilibbase/include") cutilsfiles = %w( android_get_control_file.cpp @@ -213,12 +213,12 @@ cutilsfiles = %w( sockets_unix.cpp threads.cpp ) -libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include -Icore/base/include") +libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include -Ilibbase/include") diagnoseusbfiles = %w( diagnose_usb.cpp ) -libdiagnoseusb = compile(expand("core/diagnose_usb", diagnoseusbfiles), "-Icore/include -Icore/base/include -Icore/diagnose_usb/include") +libdiagnoseusb = compile(expand("core/diagnose_usb", diagnoseusbfiles), "-Icore/include -Ilibbase/include -Icore/diagnose_usb/include") libcryptofiles = %w( android_pubkey.c @@ -242,7 +242,7 @@ fastbootfiles = %w( usb_linux.cpp util.cpp ) -libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Imkbootimg/include/bootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include -Icore/fs_mgr/liblp/include -Icore/diagnose_usb/include -Iavb') +libfastboot = compile(expand("core/fastboot", fastbootfiles), '-DPLATFORM_TOOLS_VERSION="\"$PLATFORM_TOOLS_VERSION\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Ilibbase/include -Icore/include -Icore/adb -Icore/libsparse/include -Imkbootimg/include/bootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Ilibziparchive/include -Icore/fs_mgr/liblp/include -Icore/diagnose_usb/include -Iavb') fsmgrfiles = %w( liblp/images.cpp @@ -251,7 +251,7 @@ fsmgrfiles = %w( liblp/utility.cpp liblp/writer.cpp ) -libfsmgr = compile(expand("core/fs_mgr", fsmgrfiles), "-Icore/fs_mgr/liblp/include -Icore/base/include -Iextras/ext4_utils/include -Icore/libsparse/include") +libfsmgr = compile(expand("core/fs_mgr", fsmgrfiles), "-Icore/fs_mgr/liblp/include -Ilibbase/include -Iextras/ext4_utils/include -Icore/libsparse/include") sparsefiles = %w( backed_block.cpp @@ -261,7 +261,7 @@ sparsefiles = %w( sparse_err.cpp sparse_read.cpp ) -libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include") +libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Ilibbase/include") f2fsfiles = %w( ) @@ -274,7 +274,7 @@ zipfiles = %w( ) # we use -std=c++17 as this lib currently does not compile with c++20 standard due to # https://stackoverflow.com/questions/37618213/when-is-a-private-constructor-not-a-private-constructor/57430419#57430419 -libzip = compile(expand("core/libziparchive", zipfiles), "-std=c++17 -Icore/base/include -Icore/include -Icore/libziparchive/include") +libzip = compile(expand("libziparchive", zipfiles), "-std=c++17 -Ilibbase/include -Icore/include -Ilibziparchive/include") utilfiles = %w( FileMap.cpp @@ -284,14 +284,14 @@ utilfiles = %w( VectorImpl.cpp Unicode.cpp ) -libutil = compile(expand("core/libutils", utilfiles), "-Icore/include -Icore/base/include") +libutil = compile(expand("core/libutils", utilfiles), "-Icore/include -Ilibbase/include") ext4files = %w( ext4_utils.cpp wipe.cpp ext4_sb.cpp ) -libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -Icore/base/include") +libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -Ilibbase/include") selinuxfiles = %w( booleans.c