summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--development/android-tools/android-tools.SlackBuild26
-rw-r--r--development/android-tools/android-tools.info20
-rw-r--r--development/android-tools/build.sh77
-rw-r--r--development/android-tools/fix_build.patch68
-rw-r--r--development/android-tools/generate_build.rb184
5 files changed, 252 insertions, 123 deletions
diff --git a/development/android-tools/android-tools.SlackBuild b/development/android-tools/android-tools.SlackBuild
index 5319905bfa..885478a27b 100644
--- a/development/android-tools/android-tools.SlackBuild
+++ b/development/android-tools/android-tools.SlackBuild
@@ -3,7 +3,7 @@
# Slackware build script for android-tools
# Thanks to the Arch linux maintainers for the makefiles
-# Copyright 2015 Philip van der Hoeven, Almere, NL
+# Copyright 2016 Philip van der Hoeven, Almere, NL
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
@@ -25,18 +25,18 @@
PRGNAM=android-tools
-VERSION=${VERSION:-6.0.1_r43}
-SRC1=core-ad54cfed4516292654c997910839153264ae00a0.tar.gz
-SRC2=extras-83eeed92430fc3f14c21cfc43d11fcecef6e8285.tar.gz
-SRC3=libselinux-943ed44a46ed95d557bf552b57fe61280a77489c.tar.gz
-SRC4=f2fs-tools-3686eecd8c8511ae7ecd7611a2f065b48b484b13.tar.gz
+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
BUILD=${BUILD:-1}
TAG=${TAG:-_SBo}
if [ -z "$ARCH" ]; then
case "$( uname -m )" in
- i?86) ARCH=i486 ;;
+ i?86) ARCH=i586 ;;
arm*) ARCH=arm ;;
*) ARCH=$( uname -m ) ;;
esac
@@ -47,8 +47,8 @@ TMP=${TMP:-/tmp/SBo}
PKG=$TMP/package-$PRGNAM
OUTPUT=${OUTPUT:-/tmp}
-if [ "$ARCH" = "i486" ]; then
- SLKCFLAGS="-O2 -march=i486 -mtune=i686"
+if [ "$ARCH" = "i586" ]; then
+ SLKCFLAGS="-O2 -march=i586 -mtune=i686"
LIBDIRSUFFIX=""
elif [ "$ARCH" = "i686" ]; then
SLKCFLAGS="-O2 -march=i686 -mtune=i686"
@@ -84,10 +84,10 @@ tar -xvf $CWD/$SRC4 -C f2fs-tools
#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 -p1 < $CWD/fix_build.patch
+patch -p0 < $CWD/fix_build.patch
-# build.sh borrowed from Arch linux
-cp -p $CWD/build.sh .
+# generate_build.rb borrowed from Arch Linux
+ruby $CWD/generate_build.rb > build.sh
chown -R root:root .
find . \
@@ -101,7 +101,7 @@ find . \
mkdir -p $PKG/usr/bin
install -Dm 755 adb $PKG/usr/bin/adb
install -Dm 755 fastboot $PKG/usr/bin/fastboot
-install -Dm 755 mkbootimg $PKG/usr/bin/mkbootimg
+install -Dm 755 core/mkbootimg/mkbootimg $PKG/usr/bin/mkbootimg
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
diff --git a/development/android-tools/android-tools.info b/development/android-tools/android-tools.info
index f5387fce91..ddbad6d76d 100644
--- a/development/android-tools/android-tools.info
+++ b/development/android-tools/android-tools.info
@@ -1,16 +1,16 @@
PRGNAM="android-tools"
-VERSION="6.0.1_r43"
+VERSION="7.1.0_r4"
HOMEPAGE="http://developer.android.com/sdk/"
-DOWNLOAD="https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/6.0.1_r43/core-ad54cfed4516292654c997910839153264ae00a0.tar.gz \
- https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/6.0.1_r43/extras-83eeed92430fc3f14c21cfc43d11fcecef6e8285.tar.gz \
- https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/6.0.1_r43/libselinux-943ed44a46ed95d557bf552b57fe61280a77489c.tar.gz \
- https://sourceforge.net/projects/slackbuildsdirectlinks/files/android-tools/6.0.1_r43/f2fs-tools-3686eecd8c8511ae7ecd7611a2f065b48b484b13.tar.gz"
-MD5SUM="311b52e7376744b761109d3426413e38 \
- 9e85d7a739d8f0d3efe9d1e755b55e21 \
- 699ebcb55aa01f3664e84cc4ccfe2d8a \
- bb8565b0617c7552ed272592d44ae2e4"
+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_x86_64=""
MD5SUM_x86_64=""
-REQUIRES=""
+REQUIRES="gtest"
MAINTAINER="Philip van der Hoeven"
EMAIL="philip@vd-hoeven.nl"
diff --git a/development/android-tools/build.sh b/development/android-tools/build.sh
deleted file mode 100644
index 73a1ad6b9a..0000000000
--- a/development/android-tools/build.sh
+++ /dev/null
@@ -1,77 +0,0 @@
-gcc -o core/libmincrypt/dsa_sig.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/dsa_sig.c
-gcc -o core/libmincrypt/p256_ec.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/p256_ec.c
-gcc -o core/libmincrypt/rsa.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/rsa.c
-gcc -o core/libmincrypt/sha.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/sha.c
-gcc -o core/libmincrypt/p256.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/p256.c
-gcc -o core/libmincrypt/p256_ecdsa.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/p256_ecdsa.c
-gcc -o core/libmincrypt/sha256.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/libmincrypt/sha256.c
-gcc -o core/mkbootimg/mkbootimg.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/include -c core/mkbootimg/mkbootimg.c
-g++ -o mkbootimg $LDFLAGS core/libmincrypt/dsa_sig.c.o core/libmincrypt/p256_ec.c.o core/libmincrypt/rsa.c.o core/libmincrypt/sha.c.o core/libmincrypt/p256.c.o core/libmincrypt/p256_ecdsa.c.o core/libmincrypt/sha256.c.o core/mkbootimg/mkbootimg.c.o
-g++ -o core/adb/adb.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb.cpp
-g++ -o core/adb/adb_auth.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_auth.cpp
-g++ -o core/adb/adb_io.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_io.cpp
-g++ -o core/adb/adb_listeners.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_listeners.cpp
-g++ -o core/adb/adb_utils.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_utils.cpp
-g++ -o core/adb/sockets.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/sockets.cpp
-g++ -o core/adb/transport.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/transport.cpp
-g++ -o core/adb/transport_local.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/transport_local.cpp
-g++ -o core/adb/transport_usb.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/transport_usb.cpp
-g++ -o core/adb/fdevent.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/fdevent.cpp
-g++ -o core/adb/get_my_path_linux.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/get_my_path_linux.cpp
-g++ -o core/adb/usb_linux.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/usb_linux.cpp
-g++ -o core/adb/adb_auth_host.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_auth_host.cpp
-g++ -o core/adb/adb_main.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_main.cpp
-g++ -o core/adb/console.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/console.cpp
-g++ -o core/adb/commandline.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/commandline.cpp
-g++ -o core/adb/adb_client.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/adb_client.cpp
-g++ -o core/adb/services.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/services.cpp
-g++ -o core/adb/file_sync_client.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -c core/adb/file_sync_client.cpp
-g++ -o core/base/file.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -Icore/base/include -Icore/include -c core/base/file.cpp
-g++ -o core/base/stringprintf.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -Icore/base/include -Icore/include -c core/base/stringprintf.cpp
-g++ -o core/base/strings.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DADB_HOST=1 -Icore/base/include -Icore/include -c core/base/strings.cpp
-gcc -o core/liblog/logd_write.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include -c core/liblog/logd_write.c
-gcc -o core/liblog/log_event_write.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include -c core/liblog/log_event_write.c
-gcc -o core/liblog/fake_log_device.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include -c core/liblog/fake_log_device.c
-gcc -o core/libcutils/load_file.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/load_file.c
-gcc -o core/libcutils/socket_inaddr_any_server.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_inaddr_any_server.c
-gcc -o core/libcutils/socket_local_client.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_local_client.c
-gcc -o core/libcutils/socket_local_server.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_local_server.c
-gcc -o core/libcutils/socket_loopback_client.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_loopback_client.c
-gcc -o core/libcutils/socket_loopback_server.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_loopback_server.c
-gcc -o core/libcutils/socket_network_client.c.o -std=gnu11 $CFLAGS $CPPFLAGS -D_GNU_SOURCE -Icore/include -c core/libcutils/socket_network_client.c
-g++ -o adb -lrt -ldl -lpthread -lcrypto $LDFLAGS core/base/file.cpp.o core/base/stringprintf.cpp.o core/base/strings.cpp.o core/liblog/logd_write.c.o core/liblog/log_event_write.c.o core/liblog/fake_log_device.c.o core/libcutils/load_file.c.o core/libcutils/socket_inaddr_any_server.c.o core/libcutils/socket_local_client.c.o core/libcutils/socket_local_server.c.o core/libcutils/socket_loopback_client.c.o core/libcutils/socket_loopback_server.c.o core/libcutils/socket_network_client.c.o core/adb/adb.cpp.o core/adb/adb_auth.cpp.o core/adb/adb_io.cpp.o core/adb/adb_listeners.cpp.o core/adb/adb_utils.cpp.o core/adb/sockets.cpp.o core/adb/transport.cpp.o core/adb/transport_local.cpp.o core/adb/transport_usb.cpp.o core/adb/fdevent.cpp.o core/adb/get_my_path_linux.cpp.o core/adb/usb_linux.cpp.o core/adb/adb_auth_host.cpp.o core/adb/adb_main.cpp.o core/adb/console.cpp.o core/adb/commandline.cpp.o core/adb/adb_client.cpp.o core/adb/services.cpp.o core/adb/file_sync_client.cpp.o
-gcc -o core/fastboot/protocol.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/protocol.c
-gcc -o core/fastboot/engine.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/engine.c
-g++ -o core/fastboot/bootimg_utils.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/bootimg_utils.cpp
-g++ -o core/fastboot/fastboot.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/fastboot.cpp
-gcc -o core/fastboot/util.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/util.c
-gcc -o core/fastboot/fs.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/fs.c
-gcc -o core/fastboot/usb_linux.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/usb_linux.c
-gcc -o core/fastboot/util_linux.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils -c core/fastboot/util_linux.c
-gcc -o core/libsparse/backed_block.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/backed_block.c
-gcc -o core/libsparse/output_file.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/output_file.c
-gcc -o core/libsparse/sparse.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/sparse.c
-gcc -o core/libsparse/sparse_crc32.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/sparse_crc32.c
-gcc -o core/libsparse/sparse_err.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/sparse_err.c
-gcc -o core/libsparse/sparse_read.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -c core/libsparse/sparse_read.c
-g++ -o core/libziparchive/zip_archive.cc.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -Icore/base/include -Icore/include -c core/libziparchive/zip_archive.cc
-g++ -o core/libutils/FileMap.cpp.o -std=gnu++11 $CXXFLAGS $CPPFLAGS -Icore/include -c core/libutils/FileMap.cpp
-gcc -o extras/ext4_utils/make_ext4fs.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/make_ext4fs.c
-gcc -o extras/ext4_utils/ext4fixup.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/ext4fixup.c
-gcc -o extras/ext4_utils/ext4_utils.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/ext4_utils.c
-gcc -o extras/ext4_utils/allocate.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/allocate.c
-gcc -o extras/ext4_utils/contents.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/contents.c
-gcc -o extras/ext4_utils/extent.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/extent.c
-gcc -o extras/ext4_utils/indirect.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/indirect.c
-gcc -o extras/ext4_utils/sha1.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/sha1.c
-gcc -o extras/ext4_utils/wipe.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/wipe.c
-gcc -o extras/ext4_utils/crc16.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/crc16.c
-gcc -o extras/ext4_utils/ext4_sb.c.o -std=gnu11 $CFLAGS $CPPFLAGS -Icore/libsparse/include -Icore/include -Ilibselinux/include -c extras/ext4_utils/ext4_sb.c
-gcc -o libselinux/src/callbacks.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/callbacks.c
-gcc -o libselinux/src/check_context.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/check_context.c
-gcc -o libselinux/src/freecon.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/freecon.c
-gcc -o libselinux/src/init.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/init.c
-gcc -o libselinux/src/label.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/label.c
-gcc -o libselinux/src/label_file.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/label_file.c
-gcc -o libselinux/src/label_android_property.c.o -std=gnu11 $CFLAGS $CPPFLAGS -DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include -c libselinux/src/label_android_property.c
-g++ -o fastboot -lz -lpcre $LDFLAGS core/libsparse/backed_block.c.o core/libsparse/output_file.c.o core/libsparse/sparse.c.o core/libsparse/sparse_crc32.c.o core/libsparse/sparse_err.c.o core/libsparse/sparse_read.c.o core/libziparchive/zip_archive.cc.o core/liblog/logd_write.c.o core/liblog/log_event_write.c.o core/liblog/fake_log_device.c.o core/libutils/FileMap.cpp.o core/base/file.cpp.o core/base/stringprintf.cpp.o core/base/strings.cpp.o extras/ext4_utils/make_ext4fs.c.o extras/ext4_utils/ext4fixup.c.o extras/ext4_utils/ext4_utils.c.o extras/ext4_utils/allocate.c.o extras/ext4_utils/contents.c.o extras/ext4_utils/extent.c.o extras/ext4_utils/indirect.c.o extras/ext4_utils/sha1.c.o extras/ext4_utils/wipe.c.o extras/ext4_utils/crc16.c.o extras/ext4_utils/ext4_sb.c.o libselinux/src/callbacks.c.o libselinux/src/check_context.c.o libselinux/src/freecon.c.o libselinux/src/init.c.o libselinux/src/label.c.o libselinux/src/label_file.c.o libselinux/src/label_android_property.c.o core/fastboot/protocol.c.o core/fastboot/engine.c.o core/fastboot/bootimg_utils.cpp.o core/fastboot/fastboot.cpp.o core/fastboot/util.c.o core/fastboot/fs.c.o core/fastboot/usb_linux.c.o core/fastboot/util_linux.c.o
diff --git a/development/android-tools/fix_build.patch b/development/android-tools/fix_build.patch
index 5747f1dddd..9f96915ecd 100644
--- a/development/android-tools/fix_build.patch
+++ b/development/android-tools/fix_build.patch
@@ -1,5 +1,37 @@
---- a/core/base/file.cpp
-+++ b/core/base/file.cpp
+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>
@@ -8,24 +40,14 @@
#include <string>
---- a/core/liblog/log_read.c
-+++ b/core/liblog/log_read.c
-@@ -26,6 +26,7 @@
- #include <string.h>
- #include <sys/cdefs.h>
- #include <unistd.h>
-+#include <sys/user.h>
-
- #include <cutils/list.h>
- #include <cutils/sockets.h>
-
---- a/libselinux/src/label_internal.h
-+++ b/libselinux/src/label_internal.h
-@@ -10,6 +10,7 @@
-
- #include <stdlib.h>
- #include <stdarg.h>
-+#include <stdbool.h>
- #include <selinux/selinux.h>
- #include <selinux/label.h>
- #include "dso.h"
+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__)
diff --git a/development/android-tools/generate_build.rb b/development/android-tools/generate_build.rb
new file mode 100644
index 0000000000..bc597a32af
--- /dev/null
+++ b/development/android-tools/generate_build.rb
@@ -0,0 +1,184 @@
+#!/usr/bin/ruby
+
+# Android build system is complicated and does not allow to build
+# separate parts easily.
+# This script tries to mimic Android build rules.
+
+def expand(dir, files)
+ files.map{|f| File.join(dir,f)}
+end
+
+# Compiles sources to *.o files.
+# Returns array of output *.o filenames
+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'
+ when '.cpp', '.cc'
+ cc = 'clang++'
+ 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"
+ 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(' ')}"
+end
+
+
+adbdfiles = %w(
+ adb.cpp
+ adb_auth.cpp
+ adb_io.cpp
+ adb_listeners.cpp
+ adb_trace.cpp
+ adb_utils.cpp
+ line_printer.cpp
+ sockets.cpp
+ transport.cpp
+ transport_local.cpp
+ transport_usb.cpp
+ sysdeps_unix.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')
+
+adbfiles = %w(
+ bugreport.cpp
+ console.cpp
+ commandline.cpp
+ adb_client.cpp
+ services.cpp
+ file_sync_client.cpp
+ client/main.cpp
+)
+libadb = compile(expand('core/adb', adbfiles), '-D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -Icore/adb')
+
+basefiles = %w(
+ file.cpp
+ logging.cpp
+ parsenetaddress.cpp
+ stringprintf.cpp
+ strings.cpp
+ errors_unix.cpp
+)
+libbase = compile(expand('core/base', basefiles), '-DADB_HOST=1 -Icore/base/include -Icore/include')
+
+logfiles = %w(
+ log_event_write.c
+ fake_log_device.c
+ log_event_list.c
+ logger_write.c
+ config_write.c
+ logger_lock.c
+ fake_writer.c
+ logger_name.c
+)
+liblog = compile(expand('core/liblog', logfiles), '-DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include')
+
+cutilsfiles = %w(
+ load_file.c
+ 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
+)
+libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/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')
+
+
+fastbootfiles = %w(
+ protocol.cpp
+ engine.cpp
+ bootimg_utils.cpp
+ fastboot.cpp
+ 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')
+
+sparsefiles = %w(
+ backed_block.c
+ output_file.c
+ sparse.c
+ sparse_crc32.c
+ sparse_err.c
+ sparse_read.c
+)
+libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/include')
+
+zipfiles = %w(
+ zip_archive.cc
+)
+libzip = compile(expand('core/libziparchive', zipfiles), '-Icore/base/include -Icore/include')
+
+utilfiles = %w(
+ FileMap.cpp
+)
+libutil = compile(expand('core/libutils', utilfiles), '-Icore/include')
+
+ext4files = %w(
+ make_ext4fs.c
+ ext4fixup.c
+ ext4_utils.c
+ allocate.c
+ contents.c
+ extent.c
+ indirect.c
+ sha1.c
+ wipe.c
+ crc16.c
+ ext4_sb.c
+)
+libext4 = compile(expand('extras/ext4_utils', ext4files), '-Icore/libsparse/include -Icore/include -Ilibselinux/include')
+
+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
+)
+libselinux = compile(expand('libselinux', selinuxfiles), '-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include')
+
+link('fastboot', libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + libselinux + libfastboot + libdiagnoseusb, '-lz -lpcre -lpthread')