termux-packages/packages/android-tools/fix-ndk.patch
2021-05-03 18:01:40 +00:00

353 lines
14 KiB
Diff

diff -uNr android-tools-31.0.0p1/vendor/CMakeLists.adb.txt android-tools-31.0.0p1.mod/vendor/CMakeLists.adb.txt
--- android-tools-31.0.0p1/vendor/CMakeLists.adb.txt 2021-03-22 17:48:01.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/CMakeLists.adb.txt 2021-05-03 17:56:53.036722882 +0000
@@ -192,7 +192,6 @@
brotlidec
brotlienc
lz4
- pthread
usb-1.0
z
zstd)
diff -uNr android-tools-31.0.0p1/vendor/CMakeLists.fastboot.txt android-tools-31.0.0p1.mod/vendor/CMakeLists.fastboot.txt
--- android-tools-31.0.0p1/vendor/CMakeLists.fastboot.txt 2021-03-22 17:48:01.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/CMakeLists.fastboot.txt 2021-05-03 17:56:53.036722882 +0000
@@ -133,4 +133,4 @@
target_link_libraries(fastboot
libsparse libzip libcutils liblog libfsmgr libutil
libbase libext4 libselinux libsepol libdiagnoseusb crypto
- z pcre2-8 pthread dl)
+ z pcre2-8 dl)
diff -uNr android-tools-31.0.0p1/vendor/CMakeLists.mke2fs.txt android-tools-31.0.0p1.mod/vendor/CMakeLists.mke2fs.txt
--- android-tools-31.0.0p1/vendor/CMakeLists.mke2fs.txt 2020-03-06 13:43:50.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/CMakeLists.mke2fs.txt 2021-05-03 17:56:53.036722882 +0000
@@ -112,6 +112,6 @@
e2fsprogs/misc/util.c)
target_link_libraries("${ANDROID_MKE2FS_NAME}"
- libext2fs libsparse libbase libzip liblog libutil pthread z)
+ libext2fs libsparse libbase libzip liblog libutil z)
target_include_directories("${ANDROID_MKE2FS_NAME}" PRIVATE
e2fsprogs/lib)
diff -uNr android-tools-31.0.0p1/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h android-tools-31.0.0p1.mod/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h
--- android-tools-31.0.0p1/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/adb/pairing_auth/include/adb/pairing/pairing_auth.h 2021-05-03 17:56:53.036722882 +0000
@@ -26,7 +26,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
+#if 1
/**
* PairingAuthCtx is a wrapper around the SPAKE2 protocol + cipher initialization
diff -uNr android-tools-31.0.0p1/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h android-tools-31.0.0p1.mod/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h
--- android-tools-31.0.0p1/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/adb/pairing_connection/include/adb/pairing/pairing_connection.h 2021-05-03 17:56:53.036722882 +0000
@@ -37,7 +37,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
+#if 1
const uint32_t kMaxPeerInfoSize = 8192;
struct PeerInfo {
diff -uNr android-tools-31.0.0p1/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h android-tools-31.0.0p1.mod/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h
--- android-tools-31.0.0p1/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/adb/pairing_connection/include/adb/pairing/pairing_server.h 2021-05-03 17:56:53.036722882 +0000
@@ -33,7 +33,7 @@
#ifdef __cplusplus
extern "C" {
#endif
-#if !defined(__ANDROID__) || __ANDROID_API__ >= 30
+#if 1
// PairingServerCtx is a wrapper around the #PairingConnectionCtx APIs,
// which handles multiple client connections.
diff -uNr android-tools-31.0.0p1/vendor/adb/sysdeps.h android-tools-31.0.0p1.mod/vendor/adb/sysdeps.h
--- android-tools-31.0.0p1/vendor/adb/sysdeps.h 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/adb/sysdeps.h 2021-05-03 17:56:53.036722882 +0000
@@ -482,7 +482,11 @@
}
static inline int adb_getlogin_r(char* buf, size_t bufsize) {
- return getlogin_r(buf, bufsize);
+ char* logname = getlogin();
+ if (!logname) return ENXIO;
+ if (strlen(logname) >= bufsize) return ERANGE;
+ strcpy(buf, logname);
+ return 0;
}
static inline int adb_read(borrowed_fd fd, void* buf, size_t len) {
diff -uNr android-tools-31.0.0p1/vendor/base/libs/androidfw/ResourceTypes.cpp android-tools-31.0.0p1.mod/vendor/base/libs/androidfw/ResourceTypes.cpp
--- android-tools-31.0.0p1/vendor/base/libs/androidfw/ResourceTypes.cpp 2020-11-12 18:02:26.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/base/libs/androidfw/ResourceTypes.cpp 2021-05-03 17:56:53.036722882 +0000
@@ -41,7 +41,7 @@
#include <utils/String16.h>
#include <utils/String8.h>
-#ifdef __ANDROID__
+#if 0
#include <binder/TextOutput.h>
#endif
diff -uNr android-tools-31.0.0p1/vendor/boringssl/crypto/CMakeLists.txt android-tools-31.0.0p1.mod/vendor/boringssl/crypto/CMakeLists.txt
--- android-tools-31.0.0p1/vendor/boringssl/crypto/CMakeLists.txt 2021-03-22 17:48:14.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/boringssl/crypto/CMakeLists.txt 2021-05-03 17:56:53.036722882 +0000
@@ -167,7 +167,7 @@
add_custom_command(
OUTPUT err_data.c
- COMMAND ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c
+ COMMAND GOOS=linux GOARCH=amd64 ${GO_EXECUTABLE} run err_data_generate.go > ${CMAKE_CURRENT_BINARY_DIR}/err_data.c
DEPENDS
err/err_data_generate.go
err/asn1.errordata
diff -uNr android-tools-31.0.0p1/vendor/core/fs_mgr/liblp/utility.cpp android-tools-31.0.0p1.mod/vendor/core/fs_mgr/liblp/utility.cpp
--- android-tools-31.0.0p1/vendor/core/fs_mgr/liblp/utility.cpp 2020-12-20 20:06:59.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/core/fs_mgr/liblp/utility.cpp 2021-05-03 17:56:53.040722882 +0000
@@ -34,7 +34,7 @@
#include <ext4_utils/ext4_utils.h>
#include <openssl/sha.h>
-#ifdef __ANDROID__
+#if 0
#include <cutils/android_get_control_file.h>
#endif
@@ -208,7 +208,7 @@
}
base::unique_fd GetControlFileOrOpen(std::string_view path, int flags) {
-#if defined(__ANDROID__)
+#if 0
int fd = android_get_control_file(path.data());
if (fd >= 0) {
int newfd = TEMP_FAILURE_RETRY(dup(fd));
diff -uNr android-tools-31.0.0p1/vendor/core/init/reboot.cpp android-tools-31.0.0p1.mod/vendor/core/init/reboot.cpp
--- android-tools-31.0.0p1/vendor/core/init/reboot.cpp 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/core/init/reboot.cpp 2021-05-03 17:56:53.040722882 +0000
@@ -247,7 +247,7 @@
if (dump) {
LOG(INFO) << "mount entry " << mentry->mnt_fsname << ":" << mentry->mnt_dir << " opts "
<< mentry->mnt_opts << " type " << mentry->mnt_type;
- } else if (MountEntry::IsBlockDevice(*mentry) && hasmntopt(mentry, "rw")) {
+ } else if (MountEntry::IsBlockDevice(*mentry) && 0) {
std::string mount_dir(mentry->mnt_dir);
// These are R/O partitions changed to R/W after adb remount.
// Do not umount them as shutdown critical services may rely on them.
diff -uNr android-tools-31.0.0p1/vendor/core/libcutils/properties.cpp android-tools-31.0.0p1.mod/vendor/core/libcutils/properties.cpp
--- android-tools-31.0.0p1/vendor/core/libcutils/properties.cpp 2020-12-20 20:06:59.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/core/libcutils/properties.cpp 2021-05-03 17:56:53.040722882 +0000
@@ -91,7 +91,7 @@
return len;
}
-#if __has_include(<sys/system_properties.h>)
+#if 0
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/_system_properties.h>
diff -uNr android-tools-31.0.0p1/vendor/e2fsprogs/lib/ext2fs/ismounted.c android-tools-31.0.0p1.mod/vendor/e2fsprogs/lib/ext2fs/ismounted.c
--- android-tools-31.0.0p1/vendor/e2fsprogs/lib/ext2fs/ismounted.c 2019-08-21 17:14:14.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/e2fsprogs/lib/ext2fs/ismounted.c 2021-05-03 17:56:53.044722882 +0000
@@ -196,7 +196,7 @@
#endif /* __GNU__ */
*mount_flags = EXT2_MF_MOUNTED;
-#ifdef MNTOPT_RO
+#if 0
/* Check to see if the ro option is set */
if (hasmntopt(mnt, MNTOPT_RO))
*mount_flags |= EXT2_MF_READONLY;
diff -uNr android-tools-31.0.0p1/vendor/f2fs-tools/lib/libf2fs.c android-tools-31.0.0p1.mod/vendor/f2fs-tools/lib/libf2fs.c
--- android-tools-31.0.0p1/vendor/f2fs-tools/lib/libf2fs.c 2020-12-20 12:53:55.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/f2fs-tools/lib/libf2fs.c 2021-05-03 17:56:53.044722882 +0000
@@ -714,7 +714,7 @@
while ((mnt = getmntent(file)) != NULL) {
if (!strcmp(device, mnt->mnt_fsname)) {
-#ifdef MNTOPT_RO
+#if 0
if (hasmntopt(mnt, MNTOPT_RO))
c.ro = 1;
#endif
diff -uNr android-tools-31.0.0p1/vendor/libbase/include/android-base/unique_fd.h android-tools-31.0.0p1.mod/vendor/libbase/include/android-base/unique_fd.h
--- android-tools-31.0.0p1/vendor/libbase/include/android-base/unique_fd.h 2020-11-12 18:02:33.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/libbase/include/android-base/unique_fd.h 2021-05-03 17:56:53.044722882 +0000
@@ -46,7 +46,7 @@
// unique_fd is also known as ScopedFd/ScopedFD/scoped_fd; mentioned here to help
// you find this class if you're searching for one of those names.
-#if defined(__BIONIC__)
+#if 0
#include <android/fdsan.h>
#endif
@@ -54,7 +54,7 @@
namespace base {
struct DefaultCloser {
-#if defined(__BIONIC__)
+#if 0
static void Tag(int fd, void* old_addr, void* new_addr) {
if (android_fdsan_exchange_owner_tag) {
uint64_t old_tag = android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_UNIQUE_FD,
diff -uNr android-tools-31.0.0p1/vendor/libbase/logging.cpp android-tools-31.0.0p1.mod/vendor/libbase/logging.cpp
--- android-tools-31.0.0p1/vendor/libbase/logging.cpp 2021-04-14 15:24:51.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/libbase/logging.cpp 2021-05-03 17:56:53.044722882 +0000
@@ -65,11 +65,17 @@
namespace android {
namespace base {
+#if defined(__linux__)
+extern "C" {
+extern char* __progname;
+}
+#endif
+
// BSD-based systems like Android/macOS have getprogname(). Others need us to provide one.
#if defined(__linux__) || defined(_WIN32)
static const char* getprogname() {
#if defined(__linux__)
- return program_invocation_short_name;
+ return __progname;
#elif defined(_WIN32)
static bool first = true;
static char progname[MAX_PATH] = {};
diff -uNr android-tools-31.0.0p1/vendor/libbase/properties.cpp android-tools-31.0.0p1.mod/vendor/libbase/properties.cpp
--- android-tools-31.0.0p1/vendor/libbase/properties.cpp 2020-11-12 18:02:33.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/libbase/properties.cpp 2021-05-03 17:56:53.044722882 +0000
@@ -16,7 +16,7 @@
#include "android-base/properties.h"
-#if defined(__BIONIC__)
+#if 0
#define _REALLY_INCLUDE_SYS__SYSTEM_PROPERTIES_H_
#include <sys/system_properties.h>
#include <sys/_system_properties.h>
@@ -32,8 +32,6 @@
#include <android-base/parseint.h>
#include <android-base/strings.h>
-#if !defined(__BIONIC__)
-
#define PROP_VALUE_MAX 92
static std::map<std::string, std::string>& g_properties = *new std::map<std::string, std::string>;
@@ -63,8 +61,6 @@
return strlen(value);
}
-#endif
-
namespace android {
namespace base {
@@ -108,7 +104,7 @@
std::string GetProperty(const std::string& key, const std::string& default_value) {
std::string property_value;
-#if defined(__BIONIC__)
+#if 0
const prop_info* pi = __system_property_find(key.c_str());
if (pi == nullptr) return default_value;
@@ -134,7 +130,7 @@
return (__system_property_set(key.c_str(), value.c_str()) == 0);
}
-#if defined(__BIONIC__)
+#if 0
struct WaitForPropertyData {
bool done;
diff -uNr android-tools-31.0.0p1/vendor/libziparchive/zip_archive.cc android-tools-31.0.0p1.mod/vendor/libziparchive/zip_archive.cc
--- android-tools-31.0.0p1/vendor/libziparchive/zip_archive.cc 2020-11-12 18:02:33.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/libziparchive/zip_archive.cc 2021-05-03 17:56:53.044722882 +0000
@@ -39,7 +39,9 @@
#define lseek64 lseek
#endif
-#if defined(__BIONIC__)
+#undef __ANDROID__
+
+#if 0
#include <android/fdsan.h>
#endif
@@ -88,7 +90,7 @@
* of the string length into the hash table entry.
*/
-#if defined(__BIONIC__)
+#if 0
uint64_t GetOwnerTag(const ZipArchive* archive) {
return android_fdsan_create_owner_tag(ANDROID_FDSAN_OWNER_TYPE_ZIPARCHIVE,
reinterpret_cast<uint64_t>(archive));
@@ -102,7 +104,7 @@
central_directory(),
directory_map(),
num_entries(0) {
-#if defined(__BIONIC__)
+#if 0
if (assume_ownership) {
CHECK(mapped_zip.HasFd());
android_fdsan_exchange_owner_tag(mapped_zip.GetFileDescriptor(), 0, GetOwnerTag(this));
@@ -120,7 +122,7 @@
ZipArchive::~ZipArchive() {
if (close_file && mapped_zip.GetFileDescriptor() >= 0) {
-#if defined(__BIONIC__)
+#if 0
android_fdsan_close_with_tag(mapped_zip.GetFileDescriptor(), GetOwnerTag(this));
#else
close(mapped_zip.GetFileDescriptor());
diff -uNr android-tools-31.0.0p1/vendor/logging/liblog/logger_write.cpp android-tools-31.0.0p1.mod/vendor/logging/liblog/logger_write.cpp
--- android-tools-31.0.0p1/vendor/logging/liblog/logger_write.cpp 2021-04-14 15:24:52.000000000 +0000
+++ android-tools-31.0.0p1.mod/vendor/logging/liblog/logger_write.cpp 2021-05-03 17:56:53.044722882 +0000
@@ -39,6 +39,8 @@
#include "logger.h"
#include "uio.h"
+#undef __ANDROID__
+
#ifdef __ANDROID__
#include "logd_writer.h"
#include "pmsg_writer.h"
@@ -108,31 +110,6 @@
#endif
}
-#if defined(__linux__) || defined(_WIN32)
-static const char* getprogname() {
-#if defined(__linux__)
- return program_invocation_short_name;
-#elif defined(_WIN32)
- static bool first = true;
- static char progname[MAX_PATH] = {};
-
- if (first) {
- char path[PATH_MAX + 1];
- DWORD result = GetModuleFileName(nullptr, path, sizeof(path) - 1);
- if (result == 0 || result == sizeof(path) - 1) return "";
- path[PATH_MAX - 1] = 0;
-
- char* path_basename = basename(path);
-
- snprintf(progname, sizeof(progname), "%s", path_basename);
- first = false;
- }
-
- return progname;
-#endif
-}
-#endif
-
// It's possible for logging to happen during static initialization before our globals are
// initialized, so we place this std::string in a function such that it is initialized on the first
// call.