development/android-tools: Updated for version 8.0.0_r24.

Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
This commit is contained in:
Philip van der Hoeven 2017-11-01 21:07:17 +00:00 committed by David Spencer
parent 5926dc0a44
commit dedec715f4
7 changed files with 290 additions and 117 deletions

View File

@ -1,2 +1,2 @@
These are the adb and fastboot tools from the android sdk.
These are the adb, fastboot, mkbootimg and make_ext4fs tools from the
android sdk.

View File

@ -3,7 +3,7 @@
# Slackware build script for android-tools
# Thanks to the Arch linux maintainers for the makefiles
# Copyright 2016 Philip van der Hoeven, Almere, NL
# Copyright 2016, 2017 Philip van der Hoeven, Almere, NL
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@ -25,11 +25,12 @@
PRGNAM=android-tools
VERSION=${VERSION:-7.1.0_r4}
SRC1=core-75a38b87f3044a48fee359b49766c64a87a34c74.tar.gz
SRC2=extras-614a6c7cf8296302de559ad7bf65d3ebd43ca023.tar.gz
SRC3=libselinux-9d7eba17309e2d8761354e054c8800cf34402549.tar.gz
SRC4=f2fs-tools-5bd943d50d103eb6f48a72f199a49dce4feeb61a.tar.gz
VERSION=${VERSION:-8.0.0_r24}
SRC1=core-6cd85e2a89347e0a107f59e38ece61fa19e6da78.tar.gz
SRC2=extras-af2dce5151ad478673401211dd71ae1579d2b5be.tar.gz
SRC3=selinux-be29c2550c3ff6551a56048c075a88da01b46cab.tar.gz
SRC4=f2fs-tools-b8baf1712d991541141bb0bdddd625f527e6d41f.tar.gz
SRC5=boringssl-58e449904e248f34bdfc2be7a609c58bcb0257b7.tar.gz
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
@ -74,20 +75,29 @@ mkdir core
tar -xvf $CWD/$SRC1 -C core
mkdir extras
tar -xvf $CWD/$SRC2 -C extras
mkdir libselinux
tar -xvf $CWD/$SRC3 -C libselinux
mkdir selinux
tar -xvf $CWD/$SRC3 -C selinux
mkdir f2fs-tools
tar -xvf $CWD/$SRC4 -C f2fs-tools
mkdir boringssl
tar -xvf $CWD/$SRC5 -C boringssl
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/system/core
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/system/extras
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/external/libselinux
#git clone --branch android-$VERSION --depth 1 https://android.googlesource.com/platform/external/f2fs-tools
patch -p0 < $CWD/fix_build.patch
# generate_build.rb borrowed from Arch Linux
ruby $CWD/generate_build.rb > build.sh
# And thanks to Alan Alberghini for the make_ext4fs patch.
PKGVER=$VERSION ruby $CWD/generate_build.rb > build.ninja
cd core
patch -p1 < $CWD/fix_build_core.patch
cd ..
cd selinux
patch -p1 < $CWD/fix_build_selinux.patch
cd ..
chown -R root:root .
find . \
@ -96,12 +106,20 @@ find . \
\( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
-o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
/bin/sh ./build.sh
# Build boringssl
mkdir -p boringssl/build
cd boringssl/build
cmake -GNinja ..
ninja
cd ../..
ninja
mkdir -p $PKG/usr/bin
install -Dm 755 adb $PKG/usr/bin/adb
install -Dm 755 fastboot $PKG/usr/bin/fastboot
install -Dm 755 core/mkbootimg/mkbootimg $PKG/usr/bin/mkbootimg
install -Dm 755 make_ext4fs $PKG/usr/bin/make_ext4fs
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true

View File

@ -1,16 +1,18 @@
PRGNAM="android-tools"
VERSION="7.1.0_r4"
VERSION="8.0.0_r24"
HOMEPAGE="http://developer.android.com/sdk/"
DOWNLOAD="https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/7.1.0_r4/core-75a38b87f3044a48fee359b49766c64a87a34c74.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/7.1.0_r4/extras-614a6c7cf8296302de559ad7bf65d3ebd43ca023.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/7.1.0_r4/libselinux-9d7eba17309e2d8761354e054c8800cf34402549.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/7.1.0_r4/f2fs-tools-5bd943d50d103eb6f48a72f199a49dce4feeb61a.tar.gz"
MD5SUM="1e945881a7464839d812ab12cd14b972 \
5997f89e2932af06ef4f7faf4de2ae48 \
32626e68015e1f761e0af48dcee9185f \
df7b4a8a5f831b45a7f48d3890c6c309"
DOWNLOAD="https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/8.0.0_r24/core-6cd85e2a89347e0a107f59e38ece61fa19e6da78.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/8.0.0_r24/extras-af2dce5151ad478673401211dd71ae1579d2b5be.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/8.0.0_r24/f2fs-tools-b8baf1712d991541141bb0bdddd625f527e6d41f.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/8.0.0_r24/selinux-be29c2550c3ff6551a56048c075a88da01b46cab.tar.gz \
https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/8.0.0_r24/boringssl-58e449904e248f34bdfc2be7a609c58bcb0257b7.tar.gz"
MD5SUM="b5b3857b5edae7305f5348e1db148b61 \
19bdc27835ed340fdbb4205d6af8e721 \
2ebe16bb82a5b24706d78d9e16d66f6e \
0599c72a1ff3142ad6baed8886d074a3 \
83ed1371eee7769f29b767c217e865e7"
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""
REQUIRES="gtest"
REQUIRES="gtest ninja pcre2"
MAINTAINER="Philip van der Hoeven"
EMAIL="philip@vd-hoeven.nl"

View File

@ -1,53 +0,0 @@
diff -ru core.org/adb/sysdeps.h core/adb/sysdeps.h
--- core.org/adb/sysdeps.h 2016-11-07 10:10:52.000000000 +0100
+++ core/adb/sysdeps.h 2016-11-07 16:57:55.952716945 +0100
@@ -25,6 +25,7 @@
#endif
#include <errno.h>
+#include <sys/syscall.h>
#include <string>
#include <vector>
@@ -810,7 +811,7 @@
static __inline__ unsigned long adb_thread_id()
{
- return (unsigned long)gettid();
+ return syscall(__NR_gettid);
}
#endif /* !_WIN32 */
diff -ru core.org/base/errors_unix.cpp core/base/errors_unix.cpp
--- core.org/base/errors_unix.cpp 2016-11-07 10:10:52.000000000 +0100
+++ core/base/errors_unix.cpp 2016-11-07 10:44:15.217399254 +0100
@@ -17,6 +17,7 @@
#include "android-base/errors.h"
#include <errno.h>
+#include <string.h>
namespace android {
namespace base {
diff -ru core.org/base/file.cpp core/base/file.cpp
--- core.org/base/file.cpp 2016-11-07 10:10:52.000000000 +0100
+++ core/base/file.cpp 2016-11-07 10:44:35.901793592 +0100
@@ -20,6 +20,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <sys/types.h>
+#include <string.h>
#include <string>
diff -ru core.org/base/logging.cpp core/base/logging.cpp
--- core.org/base/logging.cpp 2016-11-07 10:10:52.000000000 +0100
+++ core/base/logging.cpp 2016-11-07 10:45:12.527487064 +0100
@@ -21,6 +21,7 @@
#include "android-base/logging.h"
#include <libgen.h>
+#include <string.h>
// For getprogname(3) or program_invocation_short_name.
#if defined(__ANDROID__) || defined(__APPLE__)

View File

@ -0,0 +1,81 @@
diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
index 7025f283c..66fad6564 100644
--- a/adb/client/usb_libusb.cpp
+++ b/adb/client/usb_libusb.cpp
@@ -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 --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp
index 45da5af4a..516c716d9 100644
--- a/adb/sysdeps/posix/network.cpp
+++ b/adb/sysdeps/posix/network.cpp
@@ -16,6 +16,7 @@
#include "sysdeps/network.h"
+#include <cstring>
#include <errno.h>
#include <netinet/in.h>
#include <sys/socket.h>
diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp
index 296995efe..48269b675 100644
--- a/base/errors_unix.cpp
+++ b/base/errors_unix.cpp
@@ -17,6 +17,7 @@
#include "android-base/errors.h"
#include <errno.h>
+#include <string.h>
namespace android {
namespace base {
diff --git a/base/file.cpp b/base/file.cpp
index 2f697a1cc..81aef5758 100644
--- a/base/file.cpp
+++ b/base/file.cpp
@@ -22,6 +22,7 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <unistd.h>
+#include <string.h>
#include <memory>
#include <mutex>
diff --git a/base/logging.cpp b/base/logging.cpp
index 6357b4ba7..3c7dbce13 100644
--- a/base/logging.cpp
+++ b/base/logging.cpp
@@ -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__)
diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp
index bd668735a..76cf43299 100644
--- a/libsparse/sparse_read.cpp
+++ b/libsparse/sparse_read.cpp
@@ -18,6 +18,7 @@
#define _LARGEFILE64_SOURCE 1
#include <algorithm>
+#include <cstring>
#include <inttypes.h>
#include <fcntl.h>
#include <stdarg.h>

View File

@ -0,0 +1,26 @@
diff --git a/libsepol/src/private.h b/libsepol/src/private.h
index b884c23b..447fa64b 100644
--- a/libsepol/src/private.h
+++ b/libsepol/src/private.h
@@ -14,7 +14,7 @@
#endif
#include <errno.h>
-#include <dso.h>
+#include "dso.h"
#ifdef __APPLE__
#define __BYTE_ORDER BYTE_ORDER
diff --git a/libsepol/src/util.c b/libsepol/src/util.c
index b00251c6..68e7c6a0 100644
--- a/libsepol/src/util.c
+++ b/libsepol/src/util.c
@@ -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;

View File

@ -14,67 +14,95 @@ def compile(sources, cflags)
outputs = []
for s in sources
ext = File.extname(s)
case ext
when '.c'
cc = 'clang'
lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
cc = 'cc'
lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
when '.cpp', '.cc'
cc = 'clang++'
lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
cc = 'cxx'
lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
else
raise "Unknown extension #{ext}"
end
output = s + '.o'
outputs << output
puts "echo Compiling #{output}\n"
puts "#{cc} -o #{output} #{lang_flags} #{cflags} -c #{s}\n"
puts "build #{output}: #{cc} #{s}\n cflags = #{lang_flags} #{cflags}"
end
return outputs
end
# Links object files
def link(output, objects, ldflags)
puts "echo Linking #{output}\n"
puts "g++ -o #{output} #{ldflags} $LDFLAGS #{objects.join(' ')}"
# dir - directory where ninja file is located
# lib - static library path relative to dir
def subninja(dir, lib)
puts "subninja #{dir}build.ninja"
return lib.each{|l| dir + l}
end
# Links object files
def link(output, objects, ldflags)
puts "build #{output}: link #{objects.join(' ')}\n ldflags = #{ldflags} $LDFLAGS"
end
puts "# This set of commands generated by generate_build.rb script\n\n"
puts "CC = #{ENV['CC'] || 'clang'}"
puts "CXX = #{ENV['CXX'] || 'clang++'}\n\n"
puts "CFLAGS = #{ENV['CFLAGS']}"
puts "CXXFLAGS = #{ENV['CXXFLAGS']}"
puts "LDFLAGS = #{ENV['LDFLAGS']}"
puts "PKGVER = #{ENV['PKGVER']}\n\n"
puts """
rule cc
command = $CC $cflags -c $in -o $out
rule cxx
command = $CXX $cflags -c $in -o $out
rule link
command = $CXX $ldflags $LDFLAGS $in -o $out
"""
adbdfiles = %w(
adb.cpp
adb_auth.cpp
adb_io.cpp
adb_listeners.cpp
adb_trace.cpp
adb_utils.cpp
bugreport.cpp
line_printer.cpp
sockets.cpp
transport.cpp
transport_local.cpp
transport_usb.cpp
sysdeps_unix.cpp
transport_mdns_unsupported.cpp
fdevent.cpp
get_my_path_linux.cpp
usb_linux.cpp
adb_auth_host.cpp
shell_service_protocol.cpp
)
libadbd = compile(expand('core/adb', adbdfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -Icore/adb')
libadbd = compile(expand('core/adb', adbdfiles), '-DADB_VERSION="\"$PKGVER\"" -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb -Icore/libcrypto_utils/include -Iboringssl/include')
adbfiles = %w(
bugreport.cpp
console.cpp
socket_spec.cpp
commandline.cpp
adb_client.cpp
services.cpp
file_sync_client.cpp
sysdeps_unix.cpp
sysdeps/errno.cpp
sysdeps/posix/network.cpp
client/main.cpp
client/usb_dispatch.cpp
client/usb_linux.cpp
client/usb_libusb.cpp
)
libadb = compile(expand('core/adb', adbfiles), '-D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -Icore/adb')
libadb = compile(expand('core/adb', adbfiles), '-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb')
basefiles = %w(
file.cpp
@ -83,6 +111,7 @@ basefiles = %w(
stringprintf.cpp
strings.cpp
errors_unix.cpp
test_utils.cpp
)
libbase = compile(expand('core/base', basefiles), '-DADB_HOST=1 -Icore/base/include -Icore/include')
@ -92,31 +121,46 @@ logfiles = %w(
log_event_list.c
logger_write.c
config_write.c
config_read.c
logger_lock.c
local_logger.c
fake_writer.c
logger_name.c
stderr_write.c
logprint.c
)
liblog = compile(expand('core/liblog', logfiles), '-DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include')
liblog = compile(expand('core/liblog', logfiles), '-DLIBLOG_LOG_TAG=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include')
cutilsfiles = %w(
load_file.c
canned_fs_config.c
fs_config.cpp
socket_local_client_unix.c
socket_loopback_client_unix.c
socket_network_client_unix.c
socket_loopback_server_unix.c
socket_local_server_unix.c
sockets_unix.cpp
socket_inaddr_any_server_unix.c
sockets.cpp
android_get_control_file.cpp
threads.c
)
libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include')
libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include -Icore/libcutils/include')
diagnoseusbfiles = %w(
diagnose_usb.cpp
)
libdiagnoseusb = compile(expand('core/adb', diagnoseusbfiles), '-Icore/include -Icore/base/include')
link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb, '-lpthread -lcrypto')
libcryptofiles = %w(
android_pubkey.c
)
libcrypto = compile(expand('core/libcrypto_utils', libcryptofiles), '-Icore/libcrypto_utils/include -Iboringssl/include')
# TODO: make subninja working
#boringssl = subninja('boringssl/build/', ['crypto/libcrypto.a'])
boringssl = ['boringssl/build/crypto/libcrypto.a']
link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, '-lpthread -lusb-1.0')
fastbootfiles = %w(
@ -127,12 +171,11 @@ fastbootfiles = %w(
util.cpp
fs.cpp
usb_linux.cpp
util_linux.cpp
socket.cpp
tcp.cpp
udp.cpp
)
libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils')
libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_VERSION="\"$PKGVER\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils')
sparsefiles = %w(
backed_block.c
@ -140,9 +183,16 @@ sparsefiles = %w(
sparse.c
sparse_crc32.c
sparse_err.c
sparse_read.c
sparse_read.cpp
)
libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/include')
libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/include -Icore/base/include')
f2fsfiles = %w(
f2fs_utils.c
f2fs_ioutils.c
f2fs_dlutils.c
)
f2fs = compile(expand('extras/f2fs_utils', f2fsfiles), '-Iextras/f2fs_utils -If2fs-tools/include -If2fs-tools/mkfs -Icore/libsparse/include -Iselinux/libselinux/include')
zipfiles = %w(
zip_archive.cc
@ -167,18 +217,67 @@ ext4files = %w(
crc16.c
ext4_sb.c
)
libext4 = compile(expand('extras/ext4_utils', ext4files), '-Icore/libsparse/include -Icore/include -Ilibselinux/include')
libext4 = compile(expand('extras/ext4_utils', ext4files), '-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -DANDROID -DHOST=1')
make_ext4files = %w(
make_ext4fs_main.c
)
libmake_ext4 = compile(expand('extras/ext4_utils', make_ext4files), '-DANDROID -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -DHOST=1')
selinuxfiles = %w(
src/callbacks.c
src/check_context.c
src/freecon.c
src/init.c
src/label.c
src/label_file.c
src/label_android_property.c
src/label_support.c
callbacks.c
check_context.c
freecon.c
init.c
label.c
label_file.c
label_support.c
setrans_client.c
regex.c
matchpathcon.c
selinux_config.c
label_backends_android.c
canonicalize_context.c
lsetfilecon.c
policyvers.c
lgetfilecon.c
load_policy.c
seusers.c
sha1.c
booleans.c
disable.c
enabled.c
getenforce.c
setenforce.c
)
libselinux = compile(expand('libselinux', selinuxfiles), '-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include')
libselinux = compile(expand('selinux/libselinux/src', selinuxfiles), '-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -DUSE_PCRE2 -DNO_PERSISTENTLY_STORED_PATTERNS -DDISABLE_SETRANS -DDISABLE_BOOL -DNO_MEDIA_BACKEND -DNO_X_BACKEND -DNO_DB_BACKEND -DPCRE2_CODE_UNIT_WIDTH=8 -Iselinux/libselinux/include -Iselinux/libsepol/include')
link('fastboot', libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + libselinux + libfastboot + libdiagnoseusb, '-lz -lpcre -lpthread')
libsepolfiles = %w(
policydb_public.c
genbools.c
debug.c
policydb.c
conditional.c
services.c
ebitmap.c
util.c
assertion.c
avtab.c
hashtab.c
sidtab.c
context.c
genusers.c
context_record.c
mls.c
avrule_block.c
symtab.c
policydb_convert.c
write.c
constraint.c
expand.c
hierarchy.c
)
libsepol = compile(expand('selinux/libsepol/src', libsepolfiles), '-Iselinux/libsepol/include')
link('fastboot', libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + f2fs + libselinux + libsepol + libfastboot + libdiagnoseusb, '-lz -lpcre2-8 -lpthread -ldl')
link('make_ext4fs', libmake_ext4 + libzip + libcutils + liblog + libutil + libbase + libext4 + libselinux + libsepol + libsparse, '-lz -lpcre2-8 -lpthread')