android-tools: update to 29.0.3.

This commit is contained in:
John 2019-09-30 18:26:37 +03:00 committed by John Zimmermann
parent d9dd0a3d60
commit ca265fbf3d
6 changed files with 37 additions and 332 deletions

View file

@ -1,30 +0,0 @@
--- core/adb/sysdeps.h
+++ core/adb/sysdeps.h
@@ -66,6 +66,11 @@
#endif
#endif
+#ifndef __clang__
+#define _Nonnull
+#define _Nullable
+#endif
+
#ifdef _WIN32
// Clang-only nullability specifiers
--- core/libcutils/include/cutils/trace.h
+++ core/libcutils/include/cutils/trace.h
@@ -18,7 +18,13 @@
#define _LIBS_CUTILS_TRACE_H
#include <inttypes.h>
+// https://gcc.gnu.org/PR60932
+#ifdef __cplusplus
+#include <atomic>
+using namespace std;
+#else
#include <stdatomic.h>
+#endif
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>

View file

@ -0,0 +1,23 @@
--- vendor/core/libcutils/include/cutils/threads.h 2019-08-21 20:14:13.000000000 +0300
+++ - 2019-10-01 12:14:10.187934016 +0300
@@ -33,7 +33,9 @@
// Deprecated: use android::base::GetThreadId instead, which doesn't truncate on Mac/Windows.
//
+#ifndef __GLIBC__
extern pid_t gettid();
+#endif
//
// Deprecated: use `_Thread_local` in C or `thread_local` in C++.
--- vendor/core/libcutils/threads.cpp 2018-10-25 18:22:12.000000000 +0300
+++ - 2019-10-01 12:14:27.548527357 +0300
@@ -32,7 +32,7 @@
#endif
// No definition needed for Android because we'll just pick up bionic's copy.
-#ifndef __ANDROID__
+#ifndef __GLIBC__
pid_t gettid() {
#if defined(__APPLE__)
uint64_t tid;

View file

@ -1,10 +0,0 @@
--- core/adb/client/usb_linux.cpp 2019-01-02 20:03:26.218600891 +0100
+++ - 2019-01-02 20:03:57.806149467 +0100
@@ -28,6 +28,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/sysmacros.h>
#include <sys/ioctl.h>
#include <sys/time.h>
#include <sys/types.h>

View file

@ -1,199 +0,0 @@
Patch has been taken from Arch Linux with some minor modifications for
needed to build android-tools with musl libc.
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 <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 <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() {
}
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();
- 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"};
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 @@
#include "socket.h"
+#include <sys/select.h>
+
#include <android-base/errors.h>
#include <android-base/stringprintf.h>
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>
#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
#include <errno.h>
-#include <dso.h>
+#include "dso.h"
#ifdef __APPLE__
#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
-#define _INLINE_ inline
+#define _INLINE_ static inline
#endif
#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
#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__

View file

@ -1,24 +0,0 @@
Source: John
Upstream: No
Reason: Conflicting declaration of copy_file_range on GLIBC
FAILED: e2fsprogs/misc/create_inode.c.o
cc -std=gnu11 -D_FORTIFY_SOURCE=2 -mtune=generic -O2 -pipe -Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Icore/libsparse/include -c e2fsprogs/misc/create_inode.c -o e2fsprogs/misc/create_inode.c.o
e2fsprogs/misc/create_inode.c:406:18: error: conflicting types for 'copy_file_range'
static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file,
^~~~~~~~~~~~~~~
In file included from e2fsprogs/misc/create_inode.c:20:
/usr/include/unistd.h:1107:9: note: previous declaration of 'copy_file_range' was here
ssize_t copy_file_range (int __infd, __off64_t *__pinoff,
^~~~~~~~~~~~~~~
--- e2fsprogs/misc/create_inode.c 2019-01-02 20:07:51.685424116 +0100
+++ - 2019-01-02 20:08:17.379127932 +0100
@@ -17,6 +17,7 @@
#include <time.h>
#include <sys/stat.h>
#include <sys/types.h>
+#undef __USE_GNU
#include <unistd.h>
#include <limits.h> /* for PATH_MAX */
#ifdef HAVE_ATTR_XATTR_H

View file

@ -1,56 +1,21 @@
# Template file for 'android-tools'
pkgname=android-tools
# NOTE: not all upstream updates has code changes for the parts
# of android used by android-tools. Check for diff with:
# curl -L http://git.io/vvC0Z | sh -s 5.0.2_r1 5.1.0_r1
version=9.0.0r45
revision=2
archs="x86_64* i686*"
_distver=${version/r/_r}
#See https://android.googlesource.com/platform/development/+/refs/tags/android-${_distver}/sdk/plat_tools_source.prop_template
_apiver="28.0.0 rc1"
create_wrksrc=yes
hostmakedepends="ruby cmake ninja perl go"
version=29.0.3
revision=1
archs="armv7l* aarch64* x86_64* i686*"
build_style=cmake
configure_args="-DCMAKE_CXX_FLAGS=-D_FILE_OFFSET_BITS=64
-DCMAKE_C_FLAGS=-D_FILE_OFFSET_BITS=64"
hostmakedepends="perl go"
makedepends="gtest-devel zlib-devel libressl-devel libusb-devel pcre2-devel"
short_desc="Android platform tools (adb and fastboot)"
maintainer="John <johnz@posteo.net>"
license="Apache-2.0, ISC, GPL-2.0-only, MIT"
homepage="http://developer.android.com/tools/help/adb.html"
_baseurl=https://android.googlesource.com/platform
distfiles="
${_baseurl}/system/core/+archive/android-${_distver}.tar.gz>core.tar.gz
${_baseurl}/system/extras/+archive/android-${_distver}.tar.gz>extras.tar.gz
${_baseurl}/external/selinux/+archive/android-${_distver}.tar.gz>selinux.tar.gz
${_baseurl}/external/f2fs-tools/+archive/android-${_distver}.tar.gz>f2fs-tools.tar.gz
${_baseurl}/external/e2fsprogs/+archive/android-${_distver}.tar.gz>e2fsprogs.tar.gz
${_baseurl}/external/avb/+archive/android-${_distver}.tar.gz>avb.tar.gz
https://boringssl.googlesource.com/boringssl/+archive/3538.tar.gz>boringssl.tar.gz"
# Contents checksums because the tarballs change with every download
checksum="@dfaea8c40be4a8bbd1df513ab3516ff88e92430ee0fde399dd7e7e09ec21cd29
@0a43d228088faabe8b7150fa752c8b0c002503c0d830d8470ecea351f195bbb3
@9f2b5e379eca4c56e2d422598831bfd7bdf2b7b3c3d011ce513c7603aa46b574
@f1efc86a1e78521f4754d184d682c1f6660c04f74496913f37cae9e2670db0e8
@e98509632e865e792dc4b344b0a1ada0662dda7571534fa7c5d1a8902dcfb0f4
@5c2fcb88154f9b6ffed8d24a069e4bad0a7aea1936be2ce18af972ad8762e09a
@452e29d95f8da494896e3335931e928d9b7c94500a5793101bb19629cd7dea8c"
do_extract() {
local tarball p
for p in ${distfiles}; do
tarball=${p##*>}
mkdir -p ${wrksrc}/${tarball/.*}
tar -x --no-same-permissions --no-same-owner -f \
${XBPS_SRCDISTDIR}/${pkgname}-${version}/${tarball} \
-C ${wrksrc}/${tarball/.*}
done
}
distfiles="https://github.com/nmeum/android-tools/releases/download/${version}/android-tools-${version}.tar.xz"
checksum=4cf79878356428b290eb5e659e7daebe036cbb99cf8c2dacb92586b2a5f856fc
pre_configure() {
PKGVER="${_apiver}-void-${version}_${revision}" ${FILESDIR}/generate_build.rb > build.ninja
mkdir -p boringssl/build
cd boringssl/build
# Don't check for CROSS_COMPILING, since i686 container/chroot inside
# x86_64 host will failed to build this.
if [ "${XBPS_TARGET_MACHINE}" = i686 ] && [ "$(uname -m)" = "x86_64" ]; then
@ -62,34 +27,14 @@ pre_configure() {
SET(CMAKE_CXX_COMPILER ${CXX})
SET(CMAKE_SYSTEM_PROCESSOR x86)
_EOF
configure_args+=" ${boring_ssl_cmake_args}"
fi
cmake -GNinja \
-DBUILD_SHARED_LIBS=FALSE \
-DCMAKE_BUILD_TYPE=RELEASE \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
$boring_ssl_cmake_args \
..
ninja
}
do_build() {
ninja
}
do_install() {
for i in adb fastboot mke2fs.android e2fsdroid ext2simg \
core/mkbootimg/mkbootimg avb/avbtool ;do
vbin $i
done
vlicense boringssl/LICENSE boringssl.LICENSE
vlicense boringssl/third_party/fiat/LICENSE fiat.LICENSE
vlicense boringssl/third_party/googletest/LICENSE gtest.LICENSE
vlicense boringssl/third_party/android-cmake/LICENSE android-cmake.LICENSE
post_install() {
vlicense vendor/boringssl/LICENSE boringssl.LICENSE
vlicense vendor/boringssl/third_party/fiat/LICENSE fiat.LICENSE
vlicense vendor/boringssl/third_party/googletest/LICENSE gtest.LICENSE
vsv adb
}
# REMARKS:
# If there is any reason at all that fastboot may not be a position independent
# executable, please document it here.