aboutsummaryrefslogtreecommitdiffstats
path: root/testing/android-tools/musl-fixes.patch
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-02-25 10:43:22 +0100
committerSören Tempel <soeren+git@soeren-tempel.net>2018-02-27 12:29:49 +0100
commit517f35f1db49d9d9beb1eb4c3ba74092744eb3b7 (patch)
treee3eaa5e6a59921dc0ddc71e25264d5a4d8925158 /testing/android-tools/musl-fixes.patch
parent6146bc2b8f1b7cc95404b57983cf99b8cc34a729 (diff)
downloadaports-517f35f1db49d9d9beb1eb4c3ba74092744eb3b7.tar.bz2
aports-517f35f1db49d9d9beb1eb4c3ba74092744eb3b7.tar.xz
testing/android-tools: upgrade to 8.1.0_p7
This upgrade includes a ruby script for generating ninja build file instead of manually creating a Makefile. The ruby script is taken from the Arch Linux PKGBUILD. Patches have also been taken from Arch Linux but needed some modifications.
Diffstat (limited to 'testing/android-tools/musl-fixes.patch')
-rw-r--r--testing/android-tools/musl-fixes.patch327
1 files changed, 181 insertions, 146 deletions
diff --git a/testing/android-tools/musl-fixes.patch b/testing/android-tools/musl-fixes.patch
index 4c093ce918..235ef68854 100644
--- a/testing/android-tools/musl-fixes.patch
+++ b/testing/android-tools/musl-fixes.patch
@@ -1,164 +1,199 @@
-This patch has been taken from the Void Linux distribution.
+Patch has been taken from Arch Linux with some minor modifications for
+needed to build android-tools with musl libc.
-https://github.com/voidlinux/void-packages/tree/master/srcpkgs/android-tools/patches/android-tools-musl.patch
-
-diff --git core/include/ziparchive/zip_archive.h core/include/ziparchive/zip_archive.h
-index 7dc60ae..8886a35 100644
---- core/include/ziparchive/zip_archive.h
-+++ core/include/ziparchive/zip_archive.h
-@@ -22,11 +22,12 @@
-
+diff -upr core.orig/adb/client/usb_libusb.cpp core/adb/client/usb_libusb.cpp
+--- core.orig/adb/client/usb_libusb.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/adb/client/usb_libusb.cpp 2018-02-25 10:35:06.661418453 +0100
+@@ -21,6 +21,7 @@
#include <stdint.h>
- #include <string.h>
--#include <sys/cdefs.h>
+
+ #include <atomic>
++#include <condition_variable>
+ #include <chrono>
+ #include <memory>
+ #include <mutex>
+@@ -28,7 +29,7 @@
+ #include <thread>
+ #include <unordered_map>
+
+-#include <libusb/libusb.h>
++#include <libusb-1.0/libusb.h>
+
+ #include <android-base/file.h>
+ #include <android-base/logging.h>
+diff -upr core.orig/adb/diagnose_usb.cpp core/adb/diagnose_usb.cpp
+--- core.orig/adb/diagnose_usb.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/adb/diagnose_usb.cpp 2018-02-25 10:35:06.658085109 +0100
+@@ -45,9 +45,7 @@ static std::string GetUdevProblem() {
+ return "";
+ }
+
+- // getgroups(2) indicates that the GNU group_member(3) may not check the egid so we check it
+- // additionally just to be sure.
+- if (group_member(plugdev_group->gr_gid) || getegid() == plugdev_group->gr_gid) {
++ if (getegid() == plugdev_group->gr_gid) {
+ // The user is in plugdev so the problem is likely with the udev rules.
+ return "user in plugdev group; are your udev rules wrong?";
+ }
+diff -upr core.orig/adb/sysdeps/posix/network.cpp core/adb/sysdeps/posix/network.cpp
+--- core.orig/adb/sysdeps/posix/network.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/adb/sysdeps/posix/network.cpp 2018-02-25 10:35:06.661418453 +0100
+@@ -21,6 +21,7 @@
+ #include <sys/socket.h>
+
+ #include <string>
++#include <string.h>
+
+ #include "adb_unique_fd.h"
+
+diff -upr core.orig/base/errors_unix.cpp core/base/errors_unix.cpp
+--- core.orig/base/errors_unix.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/base/errors_unix.cpp 2018-02-25 10:35:06.654751766 +0100
+@@ -17,6 +17,7 @@
+ #include "android-base/errors.h"
+
+ #include <errno.h>
++#include <string.h>
+
+ namespace android {
+ namespace base {
+diff -upr core.orig/base/file.cpp core/base/file.cpp
+--- core.orig/base/file.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/base/file.cpp 2018-02-25 10:35:06.654751766 +0100
+@@ -22,6 +22,7 @@
+ #include <sys/stat.h>
#include <sys/types.h>
- #include <utils/Compat.h>
-
--__BEGIN_DECLS
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
-
- /* Zip compression methods we support */
- enum {
-@@ -215,6 +216,8 @@ int GetFileDescriptor(const ZipArchiveHandle handle);
-
- const char* ErrorCodeString(int32_t error_code);
-
--__END_DECLS
-+#ifdef __cplusplus
-+}
-+#endif
-
- #endif // LIBZIPARCHIVE_ZIPARCHIVE_H_
-diff --git core/liblog/log_portability.h core/liblog/log_portability.h
-index 3ad2060..2b859c4 100644
---- core/liblog/log_portability.h
-+++ core/liblog/log_portability.h
-@@ -17,7 +17,6 @@
- #ifndef _LIBLOG_PORTABILITY_H__
- #define _LIBLOG_PORTABILITY_H__
-
--#include <sys/cdefs.h>
#include <unistd.h>
++#include <string.h>
+
+ #include <memory>
+ #include <mutex>
+diff -upr core.orig/base/logging.cpp core/base/logging.cpp
+--- core.orig/base/logging.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/base/logging.cpp 2018-02-25 10:35:06.654751766 +0100
+@@ -23,6 +23,7 @@
+ #include <fcntl.h>
+ #include <libgen.h>
+ #include <time.h>
++#include <string.h>
+
+ // For getprogname(3) or program_invocation_short_name.
+ #if defined(__ANDROID__) || defined(__APPLE__)
+@@ -89,7 +90,7 @@ static thread_id GetThreadId() {
+ }
- /* Helpful private sys/cdefs.h like definitions */
-
-diff --git core/include/private/android_filesystem_config.h core/include/private/android_filesystem_config.h
-index c220a0c..d38f971 100644
---- core/include/private/android_filesystem_config.h
-+++ core/include/private/android_filesystem_config.h
-@@ -22,7 +22,6 @@
- #ifndef _ANDROID_FILESYSTEM_CONFIG_H_
- #define _ANDROID_FILESYSTEM_CONFIG_H_
-
--#include <sys/cdefs.h>
- #include <sys/types.h>
- #include <stdint.h>
+ namespace {
+-#if defined(__GLIBC__)
++#if defined(__linux__)
+ const char* getprogname() {
+ return program_invocation_short_name;
+ }
+diff -upr core.orig/fastboot/fs.cpp core/fastboot/fs.cpp
+--- core.orig/fastboot/fs.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/fastboot/fs.cpp 2018-02-25 10:35:06.651418422 +0100
+@@ -108,7 +108,7 @@ static int generate_ext4_image(const cha
+ static constexpr int block_size = 4096;
+ const std::string exec_dir = android::base::GetExecutableDirectory();
-@@ -230,7 +229,10 @@ struct fs_path_config {
+- const std::string mke2fs_path = exec_dir + "/mke2fs";
++ const std::string mke2fs_path = exec_dir + "/mke2fs.android";
+ std::vector<const char*> mke2fs_args = {mke2fs_path.c_str(), "-t", "ext4", "-b"};
- /* Rules for directories and files has moved to system/code/libcutils/fs_config.c */
+ std::string block_size_str = std::to_string(block_size);
+diff -upr core.orig/fastboot/socket.cpp core/fastboot/socket.cpp
+--- core.orig/fastboot/socket.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/fastboot/socket.cpp 2018-02-25 10:35:06.651418422 +0100
+@@ -28,6 +28,8 @@
--__BEGIN_DECLS
-+#ifdef __cplusplus
-+extern "C" {
-+#endif
+ #include "socket.h"
+
++#include <sys/select.h>
+
+ #include <android-base/errors.h>
+ #include <android-base/stringprintf.h>
- /*
- * Used in:
-@@ -247,7 +249,9 @@ void fs_config(const char *path, int dir, const char *target_out_path,
+diff -upr core.orig/libsparse/sparse_read.cpp core/libsparse/sparse_read.cpp
+--- core.orig/libsparse/sparse_read.cpp 2017-11-29 19:11:44.000000000 +0100
++++ core/libsparse/sparse_read.cpp 2018-02-25 10:35:06.621418331 +0100
+@@ -26,6 +26,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string>
++#include <string.h>
+ #include <unistd.h>
- ssize_t fs_config_generate(char *buffer, size_t length, const struct fs_path_config *pc);
+ #include <sparse/sparse.h>
+diff -upr selinux.orig/libsepol/src/private.h selinux/libsepol/src/private.h
+--- selinux.orig/libsepol/src/private.h 2017-08-13 09:34:17.000000000 +0200
++++ selinux/libsepol/src/private.h 2018-02-25 10:36:31.765008355 +0100
+@@ -14,7 +14,7 @@
+ #endif
--__END_DECLS
-+#ifdef __cplusplus
-+}
-+#endif
+ #include <errno.h>
+-#include <dso.h>
++#include "dso.h"
- #endif
- #endif
-diff --git core/base/file.cpp core/base/file.cpp
-index da1adba..7ba6d23 100644
---- core/base/file.cpp
-+++ core/base/file.cpp
-@@ -111,7 +111,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path,
-
- bool WriteStringToFile(const std::string& content, const std::string& path) {
- int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
-- int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, DEFFILEMODE));
-+ int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)));
- if (fd == -1) {
- return false;
- }
-diff --git core/adb/sysdeps.h core/adb/sysdeps.h
-index 75dcc86..2dba172 100644
---- core/adb/sysdeps.h
-+++ core/adb/sysdeps.h
-@@ -757,18 +757,7 @@ static __inline__ int adb_thread_setname(const std::string& name) {
#ifdef __APPLE__
- return pthread_setname_np(name.c_str());
+ #define __BYTE_ORDER BYTE_ORDER
+diff -upr selinux.orig/libsepol/src/util.c selinux/libsepol/src/util.c
+--- selinux.orig/libsepol/src/util.c 2017-08-13 09:34:17.000000000 +0200
++++ selinux/libsepol/src/util.c 2018-02-25 10:36:31.765008355 +0100
+@@ -27,7 +27,7 @@
+ #include <sepol/policydb/flask_types.h>
+ #include <sepol/policydb/policydb.h>
+ #include <sepol/policydb/util.h>
+-#include <dso.h>
++#include "dso.h"
+
+ struct val_to_name {
+ unsigned int val;
+diff -upr e2fsprogs.orig/contrib/android/perms.c e2fsprogs/contrib/android/perms.c
+--- e2fsprogs.orig/contrib/android/perms.c 2017-11-29 00:28:33.000000000 +0100
++++ e2fsprogs/contrib/android/perms.c 2018-02-25 10:37:13.048466147 +0100
+@@ -5,6 +5,7 @@
+ #include "support/nls-enable.h"
+ #include <time.h>
+ #include <sys/stat.h>
++#include "private/android_filesystem_capability.h"
+
+ #ifndef XATTR_SELINUX_SUFFIX
+ # define XATTR_SELINUX_SUFFIX "selinux"
+diff -upr e2fsprogs.orig/lib/ext2fs/bitops.h e2fsprogs/lib/ext2fs/bitops.h
+--- e2fsprogs.orig/lib/ext2fs/bitops.h 2017-11-29 00:28:33.000000000 +0100
++++ e2fsprogs/lib/ext2fs/bitops.h 2018-02-25 10:37:13.028466087 +0100
+@@ -233,11 +233,11 @@ extern errcode_t ext2fs_find_first_set_g
+ #if (__STDC_VERSION__ >= 199901L)
+ #define _INLINE_ extern inline
#else
-- const char *s = name.c_str();
--
-- // pthread_setname_np fails rather than truncating long strings.
-- const int max_task_comm_len = 16; // including the null terminator
-- if (name.length() > (max_task_comm_len - 1)) {
-- char buf[max_task_comm_len];
-- strncpy(buf, name.c_str(), sizeof(buf) - 1);
-- buf[sizeof(buf) - 1] = '\0';
-- s = buf;
-- }
--
-- return pthread_setname_np(pthread_self(), s) ;
-+ return 0;
+-#define _INLINE_ inline
++#define _INLINE_ static inline
#endif
- }
-
-diff --git core/adb/diagnose_usb.cpp core/adb/diagnose_usb.cpp
-index 0f067b0..1138f8d 100644
---- core/adb/diagnose_usb.cpp
-+++ core/adb/diagnose_usb.cpp
-@@ -32,28 +32,7 @@ static const char kPermissionsHelpUrl[] = "http://developer.android.com/tools/de
- // Returns a message describing any potential problems we find with udev, or nullptr if we can't
- // find plugdev information (i.e. udev is not installed).
- static const char* GetUdevProblem() {
--#if defined(__linux__)
-- errno = 0;
-- group* plugdev_group = getgrnam("plugdev");
--
-- if (plugdev_group == nullptr) {
-- if (errno != 0) {
-- perror("failed to read plugdev group info");
-- }
-- // We can't give any generally useful advice here, just let the caller print the help URL.
-- return nullptr;
-- }
--
-- // getgroups(2) indicates that the group_member() may not check the egid so we check it
-- // additionally just to be sure.
-- if (group_member(plugdev_group->gr_gid) || getegid() == plugdev_group->gr_gid) {
-- // The user is in plugdev so the problem is likely with the udev rules.
-- return "verify udev rules";
-- }
-- return "udev requires plugdev group membership";
--#else
- return nullptr;
+ #else /* !INCLUDE_INLINE FUNCS */
+ #if (__STDC_VERSION__ >= 199901L)
+-#define _INLINE_ inline
++#define _INLINE_ static inline
+ #else /* not C99 */
+ #ifdef __GNUC__
+ #define _INLINE_ extern __inline__
+diff -upr e2fsprogs.orig/lib/ext2fs/ext2fs.h e2fsprogs/lib/ext2fs/ext2fs.h
+--- e2fsprogs.orig/lib/ext2fs/ext2fs.h 2017-11-29 00:28:33.000000000 +0100
++++ e2fsprogs/lib/ext2fs/ext2fs.h 2018-02-25 10:37:13.028466087 +0100
+@@ -53,9 +53,7 @@ extern "C" {
+ */
+ #define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
+
+-#ifdef HAVE_SYS_TYPES_H
+ #include <sys/types.h>
-#endif
- }
- // Short help text must be a single line, and will look something like:
-diff --git core/fastboot/socket.cpp core/fastboot/socket.cpp
-index 14ecd93..aff905c 100644
---- core/fastboot/socket.cpp
-+++ core/fastboot/socket.cpp
-@@ -31,6 +31,8 @@
- #include <android-base/errors.h>
- #include <android-base/stringprintf.h>
-
-+#include <sys/select.h>
-+
- Socket::Socket(cutils_socket_t sock) : sock_(sock) {}
-
- Socket::~Socket() {
+ #include <stdio.h>
+ #include <stdlib.h>
+@@ -1736,7 +1734,7 @@ extern const struct ext2_inode *ext2fs_c
+ #define _INLINE_ extern
+ #else
+ #if (__STDC_VERSION__ >= 199901L)
+-#define _INLINE_ inline
++#define _INLINE_ static inline
+ #else
+ #ifdef __GNUC__
+ #define _INLINE_ extern __inline__