Date: Friday, January 25, 2019 @ 00:38:19 Author: anatolik Revision: 427678
archrelease: copy trunk to community-x86_64 Added: android-tools/repos/community-x86_64/PKGBUILD (from rev 427677, android-tools/trunk/PKGBUILD) android-tools/repos/community-x86_64/bash_completion.fastboot (from rev 427677, android-tools/trunk/bash_completion.fastboot) android-tools/repos/community-x86_64/fix_build_core.patch (from rev 427677, android-tools/trunk/fix_build_core.patch) android-tools/repos/community-x86_64/fix_build_e2fsprogs.patch (from rev 427677, android-tools/trunk/fix_build_e2fsprogs.patch) android-tools/repos/community-x86_64/fix_build_selinux.patch (from rev 427677, android-tools/trunk/fix_build_selinux.patch) android-tools/repos/community-x86_64/generate_build.rb (from rev 427677, android-tools/trunk/generate_build.rb) Deleted: android-tools/repos/community-x86_64/PKGBUILD android-tools/repos/community-x86_64/bash_completion.fastboot android-tools/repos/community-x86_64/fix_build_core.patch android-tools/repos/community-x86_64/fix_build_e2fsprogs.patch android-tools/repos/community-x86_64/fix_build_selinux.patch android-tools/repos/community-x86_64/generate_build.rb ---------------------------+ PKGBUILD | 138 +++---- bash_completion.fastboot | 180 ++++----- fix_build_core.patch | 236 ++++++------- fix_build_e2fsprogs.patch | 166 ++++----- fix_build_selinux.patch | 52 +- generate_build.rb | 796 ++++++++++++++++++++++---------------------- 6 files changed, 784 insertions(+), 784 deletions(-) Deleted: PKGBUILD =================================================================== --- PKGBUILD 2019-01-25 00:37:34 UTC (rev 427677) +++ PKGBUILD 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,69 +0,0 @@ -# Maintainer: Anatol Pomozov -# Contributor: 謝致邦 <yek...@red54.com> -# Contributor: Alucryd <alucryd at gmail dot com> - -pkgname=android-tools -pkgver=9.0.0_r30 -pkgrel=1 -pkgdesc='Android platform tools' -arch=(x86_64) -url='http://tools.android.com/' -license=(Apache MIT) -depends=(pcre2 libusb) -optdepends=('python: for mkbootimg script') -makedepends=(git clang gtest ruby cmake ninja go-pie) -# keep the boringssl commit in sync with android tree https://android.googlesource.com/platform/external/boringssl/+/$pkgver/BORINGSSL_REVISION -_boringssl_commit=45210dd4e21ace9d28cb76b3f83303fcdd2efcce -source=(git+https://android.googlesource.com/platform/system/core#tag=android-$pkgver - git+https://android.googlesource.com/platform/system/extras#tag=android-$pkgver - git+https://android.googlesource.com/platform/external/selinux#tag=android-$pkgver - git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver - git+https://android.googlesource.com/platform/external/e2fsprogs#tag=android-$pkgver - git+https://android.googlesource.com/platform/external/avb#tag=android-$pkgver - git+https://boringssl.googlesource.com/boringssl#commit=$_boringssl_commit - generate_build.rb - fix_build_core.patch - fix_build_selinux.patch - fix_build_e2fsprogs.patch - bash_completion.fastboot) - # Bash completion file was taken from https://github.com/mbrubeck/android-completion -sha1sums=('SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - 'SKIP' - '238507086a99134820cc9900545cbff06772dc30' - '62446582a96b3a39e5d91e3e2ef8b8b38a5a735e' - 'ec473160d7445f97bccabd1c32ac0ae2f77900c1' - '5df8c7e00a4066733d59050e8e1fcd4cc2b22104' - '7004dbd0c193668827174880de6f8434de8ceaee') - -prepare() { - PKGVER=$pkgver LDFLAGS='-Wl,-z,relro,-z,now' ./generate_build.rb > build.ninja - - cd $srcdir/core - patch -p1 < ../fix_build_core.patch - - cd $srcdir/selinux - patch -p1 < ../fix_build_selinux.patch - - cd $srcdir/e2fsprogs - patch -p1 < ../fix_build_e2fsprogs.patch - - cd $srcdir/avb - sed -i 's|/usr/bin/env python$|/usr/bin/env python2|g' avbtool - - mkdir -p $srcdir/boringssl/build && cd $srcdir/boringssl/build && cmake -GNinja ..; ninja -} - -build() { - ninja -} - -package(){ - install -m755 -d "$pkgdir"/usr/bin - install -m755 -t "$pkgdir"/usr/bin fastboot adb mke2fs.android e2fsdroid ext2simg core/mkbootimg/mkbootimg avb/avbtool - install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot -} Copied: android-tools/repos/community-x86_64/PKGBUILD (from rev 427677, android-tools/trunk/PKGBUILD) =================================================================== --- PKGBUILD (rev 0) +++ PKGBUILD 2019-01-25 00:38:19 UTC (rev 427678) @@ -0,0 +1,69 @@ +# Maintainer: Anatol Pomozov +# Contributor: 謝致邦 <yek...@red54.com> +# Contributor: Alucryd <alucryd at gmail dot com> + +pkgname=android-tools +pkgver=9.0.0_r30 +pkgrel=2 +pkgdesc='Android platform tools' +arch=(x86_64) +url='http://tools.android.com/' +license=(Apache MIT) +depends=(pcre2 libusb) +optdepends=('python: for mkbootimg script') +makedepends=(git clang gtest ruby cmake ninja go-pie) +# keep the boringssl commit in sync with android tree https://android.googlesource.com/platform/external/boringssl/+/$pkgver/BORINGSSL_REVISION +_boringssl_commit=45210dd4e21ace9d28cb76b3f83303fcdd2efcce +source=(git+https://android.googlesource.com/platform/system/core#tag=android-$pkgver + git+https://android.googlesource.com/platform/system/extras#tag=android-$pkgver + git+https://android.googlesource.com/platform/external/selinux#tag=android-$pkgver + git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver + git+https://android.googlesource.com/platform/external/e2fsprogs#tag=android-$pkgver + git+https://android.googlesource.com/platform/external/avb#tag=android-$pkgver + git+https://boringssl.googlesource.com/boringssl#commit=$_boringssl_commit + generate_build.rb + fix_build_core.patch + fix_build_selinux.patch + fix_build_e2fsprogs.patch + bash_completion.fastboot) + # Bash completion file was taken from https://github.com/mbrubeck/android-completion +sha1sums=('SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + 'SKIP' + '238507086a99134820cc9900545cbff06772dc30' + '62446582a96b3a39e5d91e3e2ef8b8b38a5a735e' + 'ec473160d7445f97bccabd1c32ac0ae2f77900c1' + '5df8c7e00a4066733d59050e8e1fcd4cc2b22104' + '7004dbd0c193668827174880de6f8434de8ceaee') + +prepare() { + PKGVER=$pkgver LDFLAGS='-Wl,-z,relro,-z,now' ./generate_build.rb > build.ninja + + cd $srcdir/core + patch -p1 < ../fix_build_core.patch + + cd $srcdir/selinux + patch -p1 < ../fix_build_selinux.patch + + cd $srcdir/e2fsprogs + patch -p1 < ../fix_build_e2fsprogs.patch + + cd $srcdir/avb + sed -i 's|/usr/bin/env python$|/usr/bin/env python2|g' avbtool + + mkdir -p $srcdir/boringssl/build && cd $srcdir/boringssl/build && cmake -GNinja ..; ninja +} + +build() { + ninja +} + +package(){ + install -m755 -d "$pkgdir"/usr/bin + install -m755 -t "$pkgdir"/usr/bin fastboot adb mke2fs.android e2fsdroid ext2simg core/mkbootimg/mkbootimg avb/avbtool + install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot +} Deleted: bash_completion.fastboot =================================================================== --- bash_completion.fastboot 2019-01-25 00:37:34 UTC (rev 427677) +++ bash_completion.fastboot 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,90 +0,0 @@ -## Bash completion for the Android SDK tools. -## -## Copyright (c) 2009 Matt Brubeck -## -## Permission is hereby granted, free of charge, to any person obtaining a copy -## of this software and associated documentation files (the "Software"), to deal -## in the Software without restriction, including without limitation the rights -## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -## copies of the Software, and to permit persons to whom the Software is -## furnished to do so, subject to the following conditions: -## -## The above copyright notice and this permission notice shall be included in -## all copies or substantial portions of the Software. -## -## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -## THE SOFTWARE. - - -function _fastboot() -{ - local cur prev opts cmds c subcommand device_selected - COMPREPLY=() - cur="${COMP_WORDS[COMP_CWORD]}" - prev="${COMP_WORDS[COMP_CWORD-1]}" - opts="-w -s -p -c -i -b -n" - cmds="update flashall flash erase getvar boot devices \ - reboot reboot-bootloader oem continue" - subcommand="" - partition_list="boot recovery system userdata bootloader radio" - device_selected="" - - # Look for the subcommand. - c=1 - while [ $c -lt $COMP_CWORD ]; do - word="${COMP_WORDS[c]}" - if [ "$word" = "-s" ]; then - device_selected=true - fi - for cmd in $cmds; do - if [ "$cmd" = "$word" ]; then - subcommand="$word" - fi - done - c=$((++c)) - done - - case "${subcommand}" in - '') - case "${prev}" in - -s) - # Use 'fastboot devices' to list serial numbers. - COMPREPLY=( $(compgen -W "$(fastboot devices|cut -f1)" -- ${cur} ) ) - return 0 - ;; - esac - case "${cur}" in - -*) - COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) - return 0 - ;; - esac - if [ -z "$device_selected" ]; then - local num_devices=$(( $(fastboot devices 2>/dev/null|wc -l) )) - if [ "$num_devices" -gt "1" ]; then - # With multiple devices, you must choose a device first. - COMPREPLY=( $(compgen -W "-s" -- ${cur}) ) - return 0 - fi - fi - COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) ) - return 0 - ;; - flash) - # partition name - COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) - return 0 - ;; - erase) - # partition name - COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) - return 0 - ;; - esac -} -complete -o default -F _fastboot fastboot Copied: android-tools/repos/community-x86_64/bash_completion.fastboot (from rev 427677, android-tools/trunk/bash_completion.fastboot) =================================================================== --- bash_completion.fastboot (rev 0) +++ bash_completion.fastboot 2019-01-25 00:38:19 UTC (rev 427678) @@ -0,0 +1,90 @@ +## Bash completion for the Android SDK tools. +## +## Copyright (c) 2009 Matt Brubeck +## +## Permission is hereby granted, free of charge, to any person obtaining a copy +## of this software and associated documentation files (the "Software"), to deal +## in the Software without restriction, including without limitation the rights +## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +## copies of the Software, and to permit persons to whom the Software is +## furnished to do so, subject to the following conditions: +## +## The above copyright notice and this permission notice shall be included in +## all copies or substantial portions of the Software. +## +## THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +## IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +## FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +## AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +## LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +## OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +## THE SOFTWARE. + + +function _fastboot() +{ + local cur prev opts cmds c subcommand device_selected + COMPREPLY=() + cur="${COMP_WORDS[COMP_CWORD]}" + prev="${COMP_WORDS[COMP_CWORD-1]}" + opts="-w -s -p -c -i -b -n" + cmds="update flashall flash erase getvar boot devices \ + reboot reboot-bootloader oem continue" + subcommand="" + partition_list="boot recovery system userdata bootloader radio" + device_selected="" + + # Look for the subcommand. + c=1 + while [ $c -lt $COMP_CWORD ]; do + word="${COMP_WORDS[c]}" + if [ "$word" = "-s" ]; then + device_selected=true + fi + for cmd in $cmds; do + if [ "$cmd" = "$word" ]; then + subcommand="$word" + fi + done + c=$((++c)) + done + + case "${subcommand}" in + '') + case "${prev}" in + -s) + # Use 'fastboot devices' to list serial numbers. + COMPREPLY=( $(compgen -W "$(fastboot devices|cut -f1)" -- ${cur} ) ) + return 0 + ;; + esac + case "${cur}" in + -*) + COMPREPLY=( $(compgen -W "$opts" -- ${cur}) ) + return 0 + ;; + esac + if [ -z "$device_selected" ]; then + local num_devices=$(( $(fastboot devices 2>/dev/null|wc -l) )) + if [ "$num_devices" -gt "1" ]; then + # With multiple devices, you must choose a device first. + COMPREPLY=( $(compgen -W "-s" -- ${cur}) ) + return 0 + fi + fi + COMPREPLY=( $(compgen -W "${cmds}" -- ${cur}) ) + return 0 + ;; + flash) + # partition name + COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) + return 0 + ;; + erase) + # partition name + COMPREPLY=( $(compgen -W "${partition_list}" -- ${cur}) ) + return 0 + ;; + esac +} +complete -o default -F _fastboot fastboot Deleted: fix_build_core.patch =================================================================== --- fix_build_core.patch 2019-01-25 00:37:34 UTC (rev 427677) +++ fix_build_core.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,118 +0,0 @@ -diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp -index 46c3f58ec5..a0c36f0151 100644 ---- a/adb/client/usb_libusb.cpp -+++ b/adb/client/usb_libusb.cpp -@@ -22,6 +22,7 @@ - #include <stdlib.h> - - #include <atomic> -+#include <condition_variable> - #include <chrono> - #include <condition_variable> - #include <memory> -@@ -30,7 +31,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/client/usb_linux.cpp b/adb/client/usb_linux.cpp -index 1f376a4c93..f1d6779159 100644 ---- a/adb/client/usb_linux.cpp -+++ b/adb/client/usb_linux.cpp -@@ -29,6 +29,7 @@ - #include <stdlib.h> - #include <string.h> - #include <sys/ioctl.h> -+#include <sys/sysmacros.h> - #include <sys/time.h> - #include <sys/types.h> - #include <unistd.h> -diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp -index ecd1fd24ec..86166c0e2c 100644 ---- a/adb/sysdeps/posix/network.cpp -+++ b/adb/sysdeps/posix/network.cpp -@@ -21,6 +21,7 @@ - #include <sys/socket.h> - - #include <string> -+#include <string.h> - - #include "adb_unique_fd.h" - -diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp -index 296995efe2..48269b6750 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 2f697a1cc1..81aef5758c 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 a31feefab2..d746cc4d78 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/fastboot/fs.cpp b/fastboot/fs.cpp -index c30ca1e4b3..fdc042ff36 100644 ---- a/fastboot/fs.cpp -+++ b/fastboot/fs.cpp -@@ -117,7 +117,7 @@ static int generate_ext4_image(const char* fileName, long long partSize, - 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 --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp -index 4379635270..ccb565bb63 100644 ---- a/libsparse/sparse_read.cpp -+++ b/libsparse/sparse_read.cpp -@@ -26,6 +26,7 @@ - #include <stdlib.h> - #include <string.h> - #include <string> -+#include <string.h> - #include <unistd.h> - - #include <sparse/sparse.h> -diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc -index 5e5e7afd18..ebbc819a7a 100644 ---- a/libziparchive/zip_archive.cc -+++ b/libziparchive/zip_archive.cc -@@ -29,6 +29,7 @@ - #include <string.h> - #include <time.h> - #include <unistd.h> -+#include <string_view> - - #include <memory> - #include <vector> Copied: android-tools/repos/community-x86_64/fix_build_core.patch (from rev 427677, android-tools/trunk/fix_build_core.patch) =================================================================== --- fix_build_core.patch (rev 0) +++ fix_build_core.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -0,0 +1,118 @@ +diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp +index 46c3f58ec5..a0c36f0151 100644 +--- a/adb/client/usb_libusb.cpp ++++ b/adb/client/usb_libusb.cpp +@@ -22,6 +22,7 @@ + #include <stdlib.h> + + #include <atomic> ++#include <condition_variable> + #include <chrono> + #include <condition_variable> + #include <memory> +@@ -30,7 +31,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/client/usb_linux.cpp b/adb/client/usb_linux.cpp +index 1f376a4c93..f1d6779159 100644 +--- a/adb/client/usb_linux.cpp ++++ b/adb/client/usb_linux.cpp +@@ -29,6 +29,7 @@ + #include <stdlib.h> + #include <string.h> + #include <sys/ioctl.h> ++#include <sys/sysmacros.h> + #include <sys/time.h> + #include <sys/types.h> + #include <unistd.h> +diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp +index ecd1fd24ec..86166c0e2c 100644 +--- a/adb/sysdeps/posix/network.cpp ++++ b/adb/sysdeps/posix/network.cpp +@@ -21,6 +21,7 @@ + #include <sys/socket.h> + + #include <string> ++#include <string.h> + + #include "adb_unique_fd.h" + +diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp +index 296995efe2..48269b6750 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 2f697a1cc1..81aef5758c 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 a31feefab2..d746cc4d78 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/fastboot/fs.cpp b/fastboot/fs.cpp +index c30ca1e4b3..fdc042ff36 100644 +--- a/fastboot/fs.cpp ++++ b/fastboot/fs.cpp +@@ -117,7 +117,7 @@ static int generate_ext4_image(const char* fileName, long long partSize, + 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 --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp +index 4379635270..ccb565bb63 100644 +--- a/libsparse/sparse_read.cpp ++++ b/libsparse/sparse_read.cpp +@@ -26,6 +26,7 @@ + #include <stdlib.h> + #include <string.h> + #include <string> ++#include <string.h> + #include <unistd.h> + + #include <sparse/sparse.h> +diff --git a/libziparchive/zip_archive.cc b/libziparchive/zip_archive.cc +index 5e5e7afd18..ebbc819a7a 100644 +--- a/libziparchive/zip_archive.cc ++++ b/libziparchive/zip_archive.cc +@@ -29,6 +29,7 @@ + #include <string.h> + #include <time.h> + #include <unistd.h> ++#include <string_view> + + #include <memory> + #include <vector> Deleted: fix_build_e2fsprogs.patch =================================================================== --- fix_build_e2fsprogs.patch 2019-01-25 00:37:34 UTC (rev 427677) +++ fix_build_e2fsprogs.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,83 +0,0 @@ -diff --git a/contrib/android/perms.c b/contrib/android/perms.c -index d83ad35a..dca5b620 100644 ---- a/contrib/android/perms.c -+++ b/contrib/android/perms.c -@@ -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 --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h -index 505b3c9c..7be5105f 100644 ---- a/lib/ext2fs/bitops.h -+++ b/lib/ext2fs/bitops.h -@@ -233,11 +233,11 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap - #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 --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h -index 470e7d7a..95a41e0d 100644 ---- a/lib/ext2fs/ext2fs.h -+++ b/lib/ext2fs/ext2fs.h -@@ -1743,7 +1743,7 @@ extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large - #define _INLINE_ extern - #else - #if (__STDC_VERSION__ >= 199901L) --#define _INLINE_ inline -+#define _INLINE_ static inline - #else - #ifdef __GNUC__ - #define _INLINE_ extern __inline__ -diff --git a/misc/create_inode.c b/misc/create_inode.c -index 1373b46b..e6f34bd9 100644 ---- a/misc/create_inode.c -+++ b/misc/create_inode.c -@@ -403,7 +403,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset) - } - #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */ - --static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, -+static errcode_t e2_copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, - off_t start, off_t end, char *buf, - char *zerobuf) - { -@@ -477,7 +477,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf, - - data_blk = data & ~(fs->blocksize - 1); - hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); -- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, -+ err = e2_copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, - zerobuf); - if (err) - return err; -@@ -527,7 +527,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file, - } - for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents; - i++, ext++) { -- err = copy_file_range(fs, fd, e2_file, ext->fe_logical, -+ err = e2_copy_file_range(fs, fd, e2_file, ext->fe_logical, - ext->fe_logical + ext->fe_length, - buf, zerobuf); - if (err) -@@ -580,7 +580,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf, - goto out; - #endif - -- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, -+ err = e2_copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, - zerobuf); - out: - ext2fs_free_mem(&zerobuf); Copied: android-tools/repos/community-x86_64/fix_build_e2fsprogs.patch (from rev 427677, android-tools/trunk/fix_build_e2fsprogs.patch) =================================================================== --- fix_build_e2fsprogs.patch (rev 0) +++ fix_build_e2fsprogs.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -0,0 +1,83 @@ +diff --git a/contrib/android/perms.c b/contrib/android/perms.c +index d83ad35a..dca5b620 100644 +--- a/contrib/android/perms.c ++++ b/contrib/android/perms.c +@@ -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 --git a/lib/ext2fs/bitops.h b/lib/ext2fs/bitops.h +index 505b3c9c..7be5105f 100644 +--- a/lib/ext2fs/bitops.h ++++ b/lib/ext2fs/bitops.h +@@ -233,11 +233,11 @@ extern errcode_t ext2fs_find_first_set_generic_bmap(ext2fs_generic_bitmap bitmap + #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 --git a/lib/ext2fs/ext2fs.h b/lib/ext2fs/ext2fs.h +index 470e7d7a..95a41e0d 100644 +--- a/lib/ext2fs/ext2fs.h ++++ b/lib/ext2fs/ext2fs.h +@@ -1743,7 +1743,7 @@ extern const struct ext2_inode *ext2fs_const_inode(const struct ext2_inode_large + #define _INLINE_ extern + #else + #if (__STDC_VERSION__ >= 199901L) +-#define _INLINE_ inline ++#define _INLINE_ static inline + #else + #ifdef __GNUC__ + #define _INLINE_ extern __inline__ +diff --git a/misc/create_inode.c b/misc/create_inode.c +index 1373b46b..e6f34bd9 100644 +--- a/misc/create_inode.c ++++ b/misc/create_inode.c +@@ -403,7 +403,7 @@ static ssize_t my_pread(int fd, void *buf, size_t count, off_t offset) + } + #endif /* !defined HAVE_PREAD64 && !defined HAVE_PREAD */ + +-static errcode_t copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, ++static errcode_t e2_copy_file_range(ext2_filsys fs, int fd, ext2_file_t e2_file, + off_t start, off_t end, char *buf, + char *zerobuf) + { +@@ -477,7 +477,7 @@ static errcode_t try_lseek_copy(ext2_filsys fs, int fd, struct stat *statbuf, + + data_blk = data & ~(fs->blocksize - 1); + hole_blk = (hole + (fs->blocksize - 1)) & ~(fs->blocksize - 1); +- err = copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, ++ err = e2_copy_file_range(fs, fd, e2_file, data_blk, hole_blk, buf, + zerobuf); + if (err) + return err; +@@ -527,7 +527,7 @@ static errcode_t try_fiemap_copy(ext2_filsys fs, int fd, ext2_file_t e2_file, + } + for (i = 0, ext = ext_buf; i < fiemap_buf->fm_mapped_extents; + i++, ext++) { +- err = copy_file_range(fs, fd, e2_file, ext->fe_logical, ++ err = e2_copy_file_range(fs, fd, e2_file, ext->fe_logical, + ext->fe_logical + ext->fe_length, + buf, zerobuf); + if (err) +@@ -580,7 +580,7 @@ static errcode_t copy_file(ext2_filsys fs, int fd, struct stat *statbuf, + goto out; + #endif + +- err = copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, ++ err = e2_copy_file_range(fs, fd, e2_file, 0, statbuf->st_size, buf, + zerobuf); + out: + ext2fs_free_mem(&zerobuf); Deleted: fix_build_selinux.patch =================================================================== --- fix_build_selinux.patch 2019-01-25 00:37:34 UTC (rev 427677) +++ fix_build_selinux.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,26 +0,0 @@ -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; Copied: android-tools/repos/community-x86_64/fix_build_selinux.patch (from rev 427677, android-tools/trunk/fix_build_selinux.patch) =================================================================== --- fix_build_selinux.patch (rev 0) +++ fix_build_selinux.patch 2019-01-25 00:38:19 UTC (rev 427678) @@ -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; Deleted: generate_build.rb =================================================================== --- generate_build.rb 2019-01-25 00:37:34 UTC (rev 427677) +++ generate_build.rb 2019-01-25 00:38:19 UTC (rev 427678) @@ -1,398 +0,0 @@ -#!/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 = "cc" - lang_flags = "-std=gnu11 $CFLAGS $CPPFLAGS" - when ".cpp", ".cc" - cc = "cxx" - lang_flags = "-std=gnu++17 $CXXFLAGS $CPPFLAGS" - else - raise "Unknown extension #{ext}" - end - - output = s + ".o" - outputs << output - puts "build #{output}: #{cc} #{s}\n cflags = #{lang_flags} #{cflags}" - end - - return outputs -end - -# 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_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 - transport_mdns_unsupported.cpp - fdevent.cpp - adb_auth_host.cpp - shell_service_protocol.cpp -) -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( - console.cpp - socket_spec.cpp - commandline.cpp - adb_client.cpp - services.cpp - file_sync_client.cpp - sysdeps_unix.cpp - sysdeps/errno.cpp - client/main.cpp - client/usb_dispatch.cpp - client/usb_linux.cpp - client/usb_libusb.cpp - sysdeps/posix/network.cpp -) -libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb") - -basefiles = %w( - file.cpp - logging.cpp - parsenetaddress.cpp - stringprintf.cpp - strings.cpp - errors_unix.cpp - test_utils.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 - 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=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include") - -cutilsfiles = %w( - load_file.cpp - socket_local_client_unix.cpp - socket_network_client_unix.cpp - socket_local_server_unix.cpp - sockets_unix.cpp - socket_inaddr_any_server_unix.cpp - sockets.cpp - android_get_control_file.cpp - threads.cpp - fs_config.cpp - canned_fs_config.cpp -) -libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include") - -diagnoseusbfiles = %w( - diagnose_usb.cpp -) -libdiagnoseusb = compile(expand("core/adb", diagnoseusbfiles), "-Icore/include -Icore/base/include") - -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( - protocol.cpp - engine.cpp - bootimg_utils.cpp - fastboot.cpp - util.cpp - fs.cpp - usb_linux.cpp - socket.cpp - tcp.cpp - udp.cpp -) -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 -Icore/libziparchive/include -Icore/mkbootimg/include/bootimg') - -sparsefiles = %w( - backed_block.c - output_file.c - sparse.c - sparse_crc32.c - sparse_err.c - sparse_read.cpp -) -libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include") - -f2fsfiles = %w( -) -f2fs = compile(expand("extras/f2fs_utils", f2fsfiles), "-DHAVE_LINUX_TYPES_H -If2fs-tools/include -Icore/liblog/include") - -zipfiles = %w( - zip_archive.cc -) -libzip = compile(expand("core/libziparchive", zipfiles), "-Icore/base/include -Icore/include -Icore/libziparchive/include") - -utilfiles = %w( - FileMap.cpp -) -libutil = compile(expand("core/libutils", utilfiles), "-Icore/include") - -ext4files = %w( - ext4_utils.c - wipe.c - ext4_sb.c -) -libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include") - -selinuxfiles = %w( - 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("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") - -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") - -# mke2fs.android - a ustom version of mke2fs that supports --android_sparse (FS#56955) -libext2fsfiles = %w( - lib/blkid/cache.c - lib/blkid/dev.c - lib/blkid/devname.c - lib/blkid/devno.c - lib/blkid/getsize.c - lib/blkid/llseek.c - lib/blkid/probe.c - lib/blkid/read.c - lib/blkid/resolve.c - lib/blkid/save.c - lib/blkid/tag.c - lib/e2p/feature.c - lib/e2p/hashstr.c - lib/e2p/mntopts.c - lib/e2p/ostype.c - lib/e2p/parse_num.c - lib/e2p/uuid.c - lib/et/com_err.c - lib/et/error_message.c - lib/et/et_name.c - lib/ext2fs/alloc.c - lib/ext2fs/alloc_sb.c - lib/ext2fs/alloc_stats.c - lib/ext2fs/alloc_tables.c - lib/ext2fs/atexit.c - lib/ext2fs/badblocks.c - lib/ext2fs/bb_inode.c - lib/ext2fs/bitmaps.c - lib/ext2fs/bitops.c - lib/ext2fs/blkmap64_ba.c - lib/ext2fs/blkmap64_rb.c - lib/ext2fs/blknum.c - lib/ext2fs/block.c - lib/ext2fs/bmap.c - lib/ext2fs/closefs.c - lib/ext2fs/crc16.c - lib/ext2fs/crc32c.c - lib/ext2fs/csum.c - lib/ext2fs/dirblock.c - lib/ext2fs/dir_iterate.c - lib/ext2fs/expanddir.c - lib/ext2fs/ext2_err.c - lib/ext2fs/ext_attr.c - lib/ext2fs/extent.c - lib/ext2fs/fallocate.c - lib/ext2fs/fileio.c - lib/ext2fs/freefs.c - lib/ext2fs/gen_bitmap64.c - lib/ext2fs/gen_bitmap.c - lib/ext2fs/get_num_dirs.c - lib/ext2fs/getsectsize.c - lib/ext2fs/getsize.c - lib/ext2fs/hashmap.c - lib/ext2fs/i_block.c - lib/ext2fs/ind_block.c - lib/ext2fs/initialize.c - lib/ext2fs/inline.c - lib/ext2fs/inline_data.c - lib/ext2fs/inode.c - lib/ext2fs/io_manager.c - lib/ext2fs/ismounted.c - lib/ext2fs/link.c - lib/ext2fs/llseek.c - lib/ext2fs/lookup.c - lib/ext2fs/mkdir.c - lib/ext2fs/mkjournal.c - lib/ext2fs/mmp.c - lib/ext2fs/namei.c - lib/ext2fs/newdir.c - lib/ext2fs/openfs.c - lib/ext2fs/progress.c - lib/ext2fs/punch.c - lib/ext2fs/rbtree.c - lib/ext2fs/read_bb.c - lib/ext2fs/read_bb_file.c - lib/ext2fs/res_gdt.c - lib/ext2fs/rw_bitmaps.c - lib/ext2fs/sha512.c - lib/ext2fs/sparse_io.c - lib/ext2fs/symlink.c - lib/ext2fs/undo_io.c - lib/ext2fs/unix_io.c - lib/ext2fs/valid_blk.c - lib/support/dict.c - lib/support/mkquota.c - lib/support/parse_qtype.c - lib/support/plausible.c - lib/support/prof_err.c - lib/support/profile.c - lib/support/quotaio.c - lib/support/quotaio_tree.c - lib/support/quotaio_v2.c - lib/uuid/gen_uuid.c - lib/uuid/isnull.c - lib/uuid/pack.c - lib/uuid/parse.c - lib/uuid/unpack.c - lib/uuid/unparse.c - misc/create_inode.c -) -libext2fs = compile(expand("e2fsprogs", libext2fsfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Icore/libsparse/include") - -mke2fsfiles = %w( - misc/default_profile.c - misc/mke2fs.c - misc/mk_hugefiles.c - misc/util.c -) -mke2fs = compile(expand("e2fsprogs", mke2fsfiles), "-Ie2fsprogs/lib") - -link("mke2fs.android", mke2fs + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lpthread -lz") - -e2fsdroidfiles = %w( - contrib/android/e2fsdroid.c - contrib/android/basefs_allocator.c - contrib/android/block_range.c - contrib/android/base_fs.c - contrib/android/fsmap.c - contrib/android/block_list.c - contrib/android/perms.c -) -e2fsdroid = compile(expand("e2fsprogs", e2fsdroidfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc") - -link("e2fsdroid", e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, "-lz -lpthread -lpcre2-8") - -ext2simgfiles = %w( - contrib/android/ext2simg.c -) -ext2simg = compile(expand("e2fsprogs", ext2simgfiles), "-Ie2fsprogs/lib -Icore/libsparse/include") - -link("ext2simg", ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lz -lpthread") Copied: android-tools/repos/community-x86_64/generate_build.rb (from rev 427677, android-tools/trunk/generate_build.rb) =================================================================== --- generate_build.rb (rev 0) +++ generate_build.rb 2019-01-25 00:38:19 UTC (rev 427678) @@ -0,0 +1,398 @@ +#!/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 = "cc" + lang_flags = "-std=gnu11 $CFLAGS $CPPFLAGS" + when ".cpp", ".cc" + cc = "cxx" + lang_flags = "-std=gnu++17 $CXXFLAGS $CPPFLAGS" + else + raise "Unknown extension #{ext}" + end + + output = s + ".o" + outputs << output + puts "build #{output}: #{cc} #{s}\n cflags = #{lang_flags} #{cflags}" + end + + return outputs +end + +# 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_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 + transport_mdns_unsupported.cpp + fdevent.cpp + adb_auth_host.cpp + shell_service_protocol.cpp +) +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( + console.cpp + socket_spec.cpp + commandline.cpp + adb_client.cpp + services.cpp + file_sync_client.cpp + sysdeps_unix.cpp + sysdeps/errno.cpp + client/main.cpp + client/usb_dispatch.cpp + client/usb_linux.cpp + client/usb_libusb.cpp + sysdeps/posix/network.cpp +) +libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb") + +basefiles = %w( + file.cpp + logging.cpp + parsenetaddress.cpp + stringprintf.cpp + strings.cpp + errors_unix.cpp + test_utils.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 + 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=1006 -D_XOPEN_SOURCE=700 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include") + +cutilsfiles = %w( + load_file.cpp + socket_local_client_unix.cpp + socket_network_client_unix.cpp + socket_local_server_unix.cpp + sockets_unix.cpp + socket_inaddr_any_server_unix.cpp + sockets.cpp + android_get_control_file.cpp + threads.cpp + fs_config.cpp + canned_fs_config.cpp +) +libcutils = compile(expand("core/libcutils", cutilsfiles), "-D_GNU_SOURCE -Icore/libcutils/include -Icore/include") + +diagnoseusbfiles = %w( + diagnose_usb.cpp +) +libdiagnoseusb = compile(expand("core/adb", diagnoseusbfiles), "-Icore/include -Icore/base/include") + +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( + protocol.cpp + engine.cpp + bootimg_utils.cpp + fastboot.cpp + util.cpp + fs.cpp + usb_linux.cpp + socket.cpp + tcp.cpp + udp.cpp +) +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 -Icore/libziparchive/include -Icore/mkbootimg/include/bootimg') + +sparsefiles = %w( + backed_block.c + output_file.c + sparse.c + sparse_crc32.c + sparse_err.c + sparse_read.cpp +) +libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include") + +f2fsfiles = %w( +) +f2fs = compile(expand("extras/f2fs_utils", f2fsfiles), "-DHAVE_LINUX_TYPES_H -If2fs-tools/include -Icore/liblog/include") + +zipfiles = %w( + zip_archive.cc +) +libzip = compile(expand("core/libziparchive", zipfiles), "-Icore/base/include -Icore/include -Icore/libziparchive/include") + +utilfiles = %w( + FileMap.cpp +) +libutil = compile(expand("core/libutils", utilfiles), "-Icore/include") + +ext4files = %w( + ext4_utils.c + wipe.c + ext4_sb.c +) +libext4 = compile(expand("extras/ext4_utils", ext4files), "-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include") + +selinuxfiles = %w( + 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("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") + +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") + +# mke2fs.android - a ustom version of mke2fs that supports --android_sparse (FS#56955) +libext2fsfiles = %w( + lib/blkid/cache.c + lib/blkid/dev.c + lib/blkid/devname.c + lib/blkid/devno.c + lib/blkid/getsize.c + lib/blkid/llseek.c + lib/blkid/probe.c + lib/blkid/read.c + lib/blkid/resolve.c + lib/blkid/save.c + lib/blkid/tag.c + lib/e2p/feature.c + lib/e2p/hashstr.c + lib/e2p/mntopts.c + lib/e2p/ostype.c + lib/e2p/parse_num.c + lib/e2p/uuid.c + lib/et/com_err.c + lib/et/error_message.c + lib/et/et_name.c + lib/ext2fs/alloc.c + lib/ext2fs/alloc_sb.c + lib/ext2fs/alloc_stats.c + lib/ext2fs/alloc_tables.c + lib/ext2fs/atexit.c + lib/ext2fs/badblocks.c + lib/ext2fs/bb_inode.c + lib/ext2fs/bitmaps.c + lib/ext2fs/bitops.c + lib/ext2fs/blkmap64_ba.c + lib/ext2fs/blkmap64_rb.c + lib/ext2fs/blknum.c + lib/ext2fs/block.c + lib/ext2fs/bmap.c + lib/ext2fs/closefs.c + lib/ext2fs/crc16.c + lib/ext2fs/crc32c.c + lib/ext2fs/csum.c + lib/ext2fs/dirblock.c + lib/ext2fs/dir_iterate.c + lib/ext2fs/expanddir.c + lib/ext2fs/ext2_err.c + lib/ext2fs/ext_attr.c + lib/ext2fs/extent.c + lib/ext2fs/fallocate.c + lib/ext2fs/fileio.c + lib/ext2fs/freefs.c + lib/ext2fs/gen_bitmap64.c + lib/ext2fs/gen_bitmap.c + lib/ext2fs/get_num_dirs.c + lib/ext2fs/getsectsize.c + lib/ext2fs/getsize.c + lib/ext2fs/hashmap.c + lib/ext2fs/i_block.c + lib/ext2fs/ind_block.c + lib/ext2fs/initialize.c + lib/ext2fs/inline.c + lib/ext2fs/inline_data.c + lib/ext2fs/inode.c + lib/ext2fs/io_manager.c + lib/ext2fs/ismounted.c + lib/ext2fs/link.c + lib/ext2fs/llseek.c + lib/ext2fs/lookup.c + lib/ext2fs/mkdir.c + lib/ext2fs/mkjournal.c + lib/ext2fs/mmp.c + lib/ext2fs/namei.c + lib/ext2fs/newdir.c + lib/ext2fs/openfs.c + lib/ext2fs/progress.c + lib/ext2fs/punch.c + lib/ext2fs/rbtree.c + lib/ext2fs/read_bb.c + lib/ext2fs/read_bb_file.c + lib/ext2fs/res_gdt.c + lib/ext2fs/rw_bitmaps.c + lib/ext2fs/sha512.c + lib/ext2fs/sparse_io.c + lib/ext2fs/symlink.c + lib/ext2fs/undo_io.c + lib/ext2fs/unix_io.c + lib/ext2fs/valid_blk.c + lib/support/dict.c + lib/support/mkquota.c + lib/support/parse_qtype.c + lib/support/plausible.c + lib/support/prof_err.c + lib/support/profile.c + lib/support/quotaio.c + lib/support/quotaio_tree.c + lib/support/quotaio_v2.c + lib/uuid/gen_uuid.c + lib/uuid/isnull.c + lib/uuid/pack.c + lib/uuid/parse.c + lib/uuid/unpack.c + lib/uuid/unparse.c + misc/create_inode.c +) +libext2fs = compile(expand("e2fsprogs", libext2fsfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Icore/libsparse/include") + +mke2fsfiles = %w( + misc/default_profile.c + misc/mke2fs.c + misc/mk_hugefiles.c + misc/util.c +) +mke2fs = compile(expand("e2fsprogs", mke2fsfiles), "-Ie2fsprogs/lib") + +link("mke2fs.android", mke2fs + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lpthread -lz") + +e2fsdroidfiles = %w( + contrib/android/e2fsdroid.c + contrib/android/basefs_allocator.c + contrib/android/block_range.c + contrib/android/base_fs.c + contrib/android/fsmap.c + contrib/android/block_list.c + contrib/android/perms.c +) +e2fsdroid = compile(expand("e2fsprogs", e2fsdroidfiles), "-Ie2fsprogs/lib -Ie2fsprogs/lib/ext2fs -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc") + +link("e2fsdroid", e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, "-lz -lpthread -lpcre2-8") + +ext2simgfiles = %w( + contrib/android/ext2simg.c +) +ext2simg = compile(expand("e2fsprogs", ext2simgfiles), "-Ie2fsprogs/lib -Icore/libsparse/include") + +link("ext2simg", ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lz -lpthread")