termux-packages/packages/android-tools/fix-ndk.patch

335 lines
13 KiB
Diff

diff -uNr android-tools-31.0.2/vendor/adb/sysdeps.h android-tools-31.0.2.mod/vendor/adb/sysdeps.h
--- android-tools-31.0.2/vendor/adb/sysdeps.h 2021-07-20 11:13:01.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/adb/sysdeps.h 2021-10-08 09:55:05.170121003 +0000
@@ -514,7 +514,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.2/vendor/base/libs/androidfw/ResourceTypes.cpp android-tools-31.0.2.mod/vendor/base/libs/androidfw/ResourceTypes.cpp
--- android-tools-31.0.2/vendor/base/libs/androidfw/ResourceTypes.cpp 2021-05-28 20:48:32.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/base/libs/androidfw/ResourceTypes.cpp 2021-10-08 09:55:05.174121003 +0000
@@ -42,7 +42,7 @@
#include <utils/String16.h>
#include <utils/String8.h>
-#ifdef __ANDROID__
+#if 0
#include <binder/TextOutput.h>
#endif
diff -uNr android-tools-31.0.2/vendor/boringssl/crypto/CMakeLists.txt android-tools-31.0.2.mod/vendor/boringssl/crypto/CMakeLists.txt
--- android-tools-31.0.2/vendor/boringssl/crypto/CMakeLists.txt 2021-06-02 15:08:20.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/boringssl/crypto/CMakeLists.txt 2021-10-08 09:55:05.175121003 +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.2/vendor/CMakeLists.adb.txt android-tools-31.0.2.mod/vendor/CMakeLists.adb.txt
--- android-tools-31.0.2/vendor/CMakeLists.adb.txt 2021-06-02 15:20:44.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/CMakeLists.adb.txt 2021-10-08 09:55:05.167121003 +0000
@@ -192,7 +192,6 @@
brotlidec
brotlienc
lz4
- pthread
usb-1.0
z
zstd)
diff -uNr android-tools-31.0.2/vendor/CMakeLists.fastboot.txt android-tools-31.0.2.mod/vendor/CMakeLists.fastboot.txt
--- android-tools-31.0.2/vendor/CMakeLists.fastboot.txt 2021-07-15 11:17:07.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/CMakeLists.fastboot.txt 2021-10-08 09:55:05.168121003 +0000
@@ -135,4 +135,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.2/vendor/CMakeLists.mke2fs.txt android-tools-31.0.2.mod/vendor/CMakeLists.mke2fs.txt
--- android-tools-31.0.2/vendor/CMakeLists.mke2fs.txt 2021-06-02 15:20:41.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/CMakeLists.mke2fs.txt 2021-10-08 09:55:05.169121003 +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.2/vendor/core/fs_mgr/liblp/utility.cpp android-tools-31.0.2.mod/vendor/core/fs_mgr/liblp/utility.cpp
--- android-tools-31.0.2/vendor/core/fs_mgr/liblp/utility.cpp 2020-12-20 20:06:59.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/core/fs_mgr/liblp/utility.cpp 2021-10-08 09:55:05.176121003 +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.2/vendor/core/init/reboot.cpp android-tools-31.0.2.mod/vendor/core/init/reboot.cpp
--- android-tools-31.0.2/vendor/core/init/reboot.cpp 2021-07-20 11:13:01.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/core/init/reboot.cpp 2021-10-08 09:55:05.177121003 +0000
@@ -246,7 +246,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.2/vendor/core/libcutils/properties.cpp android-tools-31.0.2.mod/vendor/core/libcutils/properties.cpp
--- android-tools-31.0.2/vendor/core/libcutils/properties.cpp 2020-12-20 20:06:59.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/core/libcutils/properties.cpp 2021-10-08 09:55:05.178121003 +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.2/vendor/e2fsprogs/lib/ext2fs/ismounted.c android-tools-31.0.2.mod/vendor/e2fsprogs/lib/ext2fs/ismounted.c
--- android-tools-31.0.2/vendor/e2fsprogs/lib/ext2fs/ismounted.c 2019-08-21 17:14:14.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/e2fsprogs/lib/ext2fs/ismounted.c 2021-10-08 09:55:05.178121003 +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.2/vendor/f2fs-tools/lib/libf2fs.c android-tools-31.0.2.mod/vendor/f2fs-tools/lib/libf2fs.c
--- android-tools-31.0.2/vendor/f2fs-tools/lib/libf2fs.c 2020-12-20 12:53:55.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/f2fs-tools/lib/libf2fs.c 2021-10-08 09:55:05.179121003 +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.2/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h android-tools-31.0.2.mod/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h
--- android-tools-31.0.2/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h 2021-07-20 11:13:01.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/incremental_delivery/incfs/util/include/util/map_ptr.h 2021-10-08 10:01:07.304004004 +0000
@@ -23,6 +23,7 @@
#include <android-base/logging.h>
#include <android-base/off64_t.h>
+#undef __ANDROID__
#ifdef __ANDROID__
#include <linux/incrementalfs.h>
#endif
@@ -400,4 +401,4 @@
} // namespace incfs
-} // namespace android
\ No newline at end of file
+} // namespace android
diff -uNr android-tools-31.0.2/vendor/libbase/include/android-base/unique_fd.h android-tools-31.0.2.mod/vendor/libbase/include/android-base/unique_fd.h
--- android-tools-31.0.2/vendor/libbase/include/android-base/unique_fd.h 2020-11-12 18:02:33.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/libbase/include/android-base/unique_fd.h 2021-10-08 09:55:05.180121003 +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.2/vendor/libbase/logging.cpp android-tools-31.0.2.mod/vendor/libbase/logging.cpp
--- android-tools-31.0.2/vendor/libbase/logging.cpp 2021-07-20 11:13:01.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/libbase/logging.cpp 2021-10-08 09:55:05.180121003 +0000
@@ -61,11 +61,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.2/vendor/libbase/properties.cpp android-tools-31.0.2.mod/vendor/libbase/properties.cpp
--- android-tools-31.0.2/vendor/libbase/properties.cpp 2020-11-12 18:02:33.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/libbase/properties.cpp 2021-10-08 09:55:05.181121003 +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.2/vendor/libziparchive/zip_archive.cc android-tools-31.0.2.mod/vendor/libziparchive/zip_archive.cc
--- android-tools-31.0.2/vendor/libziparchive/zip_archive.cc 2021-06-02 15:08:21.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/libziparchive/zip_archive.cc 2021-10-08 09:55:05.182121003 +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.2/vendor/logging/liblog/logger_write.cpp android-tools-31.0.2.mod/vendor/logging/liblog/logger_write.cpp
--- android-tools-31.0.2/vendor/logging/liblog/logger_write.cpp 2021-07-20 11:13:01.000000000 +0000
+++ android-tools-31.0.2.mod/vendor/logging/liblog/logger_write.cpp 2021-10-08 09:55:05.183121003 +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. We use a pointer to avoid exit time destructors.