[arch-commits] Commit in android-tools/repos (20 files)

Anatol Pomozov anatolik at archlinux.org
Fri Sep 8 22:05:23 UTC 2017


    Date: Friday, September 8, 2017 @ 22:05:22
  Author: anatolik
Revision: 256454

archrelease: copy trunk to community-i686, community-x86_64

Added:
  android-tools/repos/community-i686/PKGBUILD
    (from rev 256453, android-tools/trunk/PKGBUILD)
  android-tools/repos/community-i686/bash_completion.fastboot
    (from rev 256453, android-tools/trunk/bash_completion.fastboot)
  android-tools/repos/community-i686/fix_build_core.patch
    (from rev 256453, android-tools/trunk/fix_build_core.patch)
  android-tools/repos/community-i686/fix_build_selinux.patch
    (from rev 256453, android-tools/trunk/fix_build_selinux.patch)
  android-tools/repos/community-i686/generate_build.rb
    (from rev 256453, android-tools/trunk/generate_build.rb)
  android-tools/repos/community-x86_64/PKGBUILD
    (from rev 256453, android-tools/trunk/PKGBUILD)
  android-tools/repos/community-x86_64/bash_completion.fastboot
    (from rev 256453, android-tools/trunk/bash_completion.fastboot)
  android-tools/repos/community-x86_64/fix_build_core.patch
    (from rev 256453, android-tools/trunk/fix_build_core.patch)
  android-tools/repos/community-x86_64/fix_build_selinux.patch
    (from rev 256453, android-tools/trunk/fix_build_selinux.patch)
  android-tools/repos/community-x86_64/generate_build.rb
    (from rev 256453, android-tools/trunk/generate_build.rb)
Deleted:
  android-tools/repos/community-i686/PKGBUILD
  android-tools/repos/community-i686/bash_completion.fastboot
  android-tools/repos/community-i686/fix_build_core.patch
  android-tools/repos/community-i686/fix_build_selinux.patch
  android-tools/repos/community-i686/generate_build.rb
  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_selinux.patch
  android-tools/repos/community-x86_64/generate_build.rb

-------------------------------------------+
 /PKGBUILD                                 |  112 +++++
 /bash_completion.fastboot                 |  180 +++++++++
 /fix_build_core.patch                     |  114 +++++
 /fix_build_selinux.patch                  |   52 ++
 /generate_build.rb                        |  548 ++++++++++++++++++++++++++++
 community-i686/PKGBUILD                   |   54 --
 community-i686/bash_completion.fastboot   |   90 ----
 community-i686/fix_build_core.patch       |   57 --
 community-i686/fix_build_selinux.patch    |   26 -
 community-i686/generate_build.rb          |  276 --------------
 community-x86_64/PKGBUILD                 |   54 --
 community-x86_64/bash_completion.fastboot |   90 ----
 community-x86_64/fix_build_core.patch     |   57 --
 community-x86_64/fix_build_selinux.patch  |   26 -
 community-x86_64/generate_build.rb        |  276 --------------
 15 files changed, 1006 insertions(+), 1006 deletions(-)

Deleted: community-i686/PKGBUILD
===================================================================
--- community-i686/PKGBUILD	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-i686/PKGBUILD	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,54 +0,0 @@
-# $Id$
-# Maintainer: Anatol Pomozov
-# Contributor: 謝致邦 <Yeking at Red54.com>
-# Contributor: Alucryd <alucryd at gmail dot com>
-
-pkgname=android-tools
-pkgver=8.0.0_r4
-pkgrel=1
-pkgdesc='Android platform tools'
-arch=(i686 x86_64)
-url='http://tools.android.com/'
-license=(Apache MIT)
-depends=(pcre2 libusb ruby ninja)
-optdepends=('python: for mkbootimg script')
-makedepends=(git clang gtest)
-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/boringssl#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
-        generate_build.rb
-        fix_build_core.patch
-        fix_build_selinux.patch
-        bash_completion.fastboot)
-        # Bash completion file was taken from https://github.com/mbrubeck/android-completion
-sha1sums=('SKIP'
-          'SKIP'
-          'SKIP'
-          'SKIP'
-          'SKIP'
-          '578973cebe0a496bf5e83d2c6dd2c29d283637e7'
-          '45e41bab3633bb0be96b238aae3164a5c90721f1'
-          'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
-          '7004dbd0c193668827174880de6f8434de8ceaee')
-
-prepare() {
-  PKGVER=$pkgver ./generate_build.rb > build.ninja
-
-  cd $srcdir/core
-  patch -p1 < ../fix_build_core.patch
-
-  cd $srcdir/selinux
-  patch -p1 < ../fix_build_selinux.patch
-}
-
-build() {
-  ninja
-}
-
-package(){
-  install -m755 -d "$pkgdir"/usr/bin
-  install -m755 -t "$pkgdir"/usr/bin fastboot adb core/mkbootimg/mkbootimg
-  install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
-}

Copied: android-tools/repos/community-i686/PKGBUILD (from rev 256453, android-tools/trunk/PKGBUILD)
===================================================================
--- community-i686/PKGBUILD	                        (rev 0)
+++ community-i686/PKGBUILD	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Anatol Pomozov
+# Contributor: 謝致邦 <Yeking at Red54.com>
+# Contributor: Alucryd <alucryd at gmail dot com>
+
+pkgname=android-tools
+pkgver=8.0.0_r4
+pkgrel=2
+pkgdesc='Android platform tools'
+arch=(i686 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)
+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://boringssl.googlesource.com/boringssl
+        generate_build.rb
+        fix_build_core.patch
+        fix_build_selinux.patch
+        bash_completion.fastboot)
+        # Bash completion file was taken from https://github.com/mbrubeck/android-completion
+sha1sums=('SKIP'
+          'SKIP'
+          'SKIP'
+          'SKIP'
+          'SKIP'
+          '12b6bc1cbf850958850c3e4a5bc19d8b32f845b9'
+          '45e41bab3633bb0be96b238aae3164a5c90721f1'
+          'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
+          '7004dbd0c193668827174880de6f8434de8ceaee')
+
+prepare() {
+  PKGVER=$pkgver ./generate_build.rb > build.ninja
+
+  cd $srcdir/core
+  patch -p1 < ../fix_build_core.patch
+
+  cd $srcdir/selinux
+  patch -p1 < ../fix_build_selinux.patch
+
+  mkdir $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 core/mkbootimg/mkbootimg
+  install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
+}

Deleted: community-i686/bash_completion.fastboot
===================================================================
--- community-i686/bash_completion.fastboot	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-i686/bash_completion.fastboot	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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-i686/bash_completion.fastboot (from rev 256453, android-tools/trunk/bash_completion.fastboot)
===================================================================
--- community-i686/bash_completion.fastboot	                        (rev 0)
+++ community-i686/bash_completion.fastboot	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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: community-i686/fix_build_core.patch
===================================================================
--- community-i686/fix_build_core.patch	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-i686/fix_build_core.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,57 +0,0 @@
-diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
-index 7adb26213..7596c123b 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/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 d4e58942c..ca7655fa2 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__)

Copied: android-tools/repos/community-i686/fix_build_core.patch (from rev 256453, android-tools/trunk/fix_build_core.patch)
===================================================================
--- community-i686/fix_build_core.patch	                        (rev 0)
+++ community-i686/fix_build_core.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,57 @@
+diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
+index 7adb26213..7596c123b 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/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 d4e58942c..ca7655fa2 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__)

Deleted: community-i686/fix_build_selinux.patch
===================================================================
--- community-i686/fix_build_selinux.patch	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-i686/fix_build_selinux.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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-i686/fix_build_selinux.patch (from rev 256453, android-tools/trunk/fix_build_selinux.patch)
===================================================================
--- community-i686/fix_build_selinux.patch	                        (rev 0)
+++ community-i686/fix_build_selinux.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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: community-i686/generate_build.rb
===================================================================
--- community-i686/generate_build.rb	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-i686/generate_build.rb	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,276 +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++14 $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
-
-# 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_REVISION="\"$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
-)
-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
-)
-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 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include')
-
-cutilsfiles = %w(
-  load_file.c
-  socket_local_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')
-
-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')
-
-boringsslfiles = %w(
-  crypto/bn/convert.c
-  crypto/bn/bn.c
-  crypto/bio/file.c
-  crypto/bytestring/cbb.c
-  crypto/buf/buf.c
-  crypto/mem.c
-  crypto/base64/base64.c
-)
-boringssl = compile(expand('boringssl/src', boringsslfiles), '-DBORINGSSL_ANDROID_SYSTEM -DOPENSSL_SMALL -DBORINGSSL_IMPLEMENTATION -Iboringssl/include')
-
-
-link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, '-lpthread -lcrypto -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_REVISION="\"$PKGVER\"" -D_GNU_SOURCE -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
-  output_file.c
-  sparse.c
-  sparse_crc32.c
-  sparse_err.c
-  sparse_read.c
-)
-libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/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
-)
-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 -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')

Copied: android-tools/repos/community-i686/generate_build.rb (from rev 256453, android-tools/trunk/generate_build.rb)
===================================================================
--- community-i686/generate_build.rb	                        (rev 0)
+++ community-i686/generate_build.rb	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,274 @@
+#!/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++14 $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_REVISION="\"$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
+)
+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
+)
+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.c
+  socket_local_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')
+
+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_REVISION="\"$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
+  output_file.c
+  sparse.c
+  sparse_crc32.c
+  sparse_err.c
+  sparse_read.c
+)
+libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/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
+)
+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), '-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')

Deleted: community-x86_64/PKGBUILD
===================================================================
--- community-x86_64/PKGBUILD	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-x86_64/PKGBUILD	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,54 +0,0 @@
-# $Id$
-# Maintainer: Anatol Pomozov
-# Contributor: 謝致邦 <Yeking at Red54.com>
-# Contributor: Alucryd <alucryd at gmail dot com>
-
-pkgname=android-tools
-pkgver=8.0.0_r4
-pkgrel=1
-pkgdesc='Android platform tools'
-arch=(i686 x86_64)
-url='http://tools.android.com/'
-license=(Apache MIT)
-depends=(pcre2 libusb ruby ninja)
-optdepends=('python: for mkbootimg script')
-makedepends=(git clang gtest)
-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/boringssl#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
-        generate_build.rb
-        fix_build_core.patch
-        fix_build_selinux.patch
-        bash_completion.fastboot)
-        # Bash completion file was taken from https://github.com/mbrubeck/android-completion
-sha1sums=('SKIP'
-          'SKIP'
-          'SKIP'
-          'SKIP'
-          'SKIP'
-          '578973cebe0a496bf5e83d2c6dd2c29d283637e7'
-          '45e41bab3633bb0be96b238aae3164a5c90721f1'
-          'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
-          '7004dbd0c193668827174880de6f8434de8ceaee')
-
-prepare() {
-  PKGVER=$pkgver ./generate_build.rb > build.ninja
-
-  cd $srcdir/core
-  patch -p1 < ../fix_build_core.patch
-
-  cd $srcdir/selinux
-  patch -p1 < ../fix_build_selinux.patch
-}
-
-build() {
-  ninja
-}
-
-package(){
-  install -m755 -d "$pkgdir"/usr/bin
-  install -m755 -t "$pkgdir"/usr/bin fastboot adb core/mkbootimg/mkbootimg
-  install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
-}

Copied: android-tools/repos/community-x86_64/PKGBUILD (from rev 256453, android-tools/trunk/PKGBUILD)
===================================================================
--- community-x86_64/PKGBUILD	                        (rev 0)
+++ community-x86_64/PKGBUILD	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,56 @@
+# $Id$
+# Maintainer: Anatol Pomozov
+# Contributor: 謝致邦 <Yeking at Red54.com>
+# Contributor: Alucryd <alucryd at gmail dot com>
+
+pkgname=android-tools
+pkgver=8.0.0_r4
+pkgrel=2
+pkgdesc='Android platform tools'
+arch=(i686 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)
+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://boringssl.googlesource.com/boringssl
+        generate_build.rb
+        fix_build_core.patch
+        fix_build_selinux.patch
+        bash_completion.fastboot)
+        # Bash completion file was taken from https://github.com/mbrubeck/android-completion
+sha1sums=('SKIP'
+          'SKIP'
+          'SKIP'
+          'SKIP'
+          'SKIP'
+          '12b6bc1cbf850958850c3e4a5bc19d8b32f845b9'
+          '45e41bab3633bb0be96b238aae3164a5c90721f1'
+          'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
+          '7004dbd0c193668827174880de6f8434de8ceaee')
+
+prepare() {
+  PKGVER=$pkgver ./generate_build.rb > build.ninja
+
+  cd $srcdir/core
+  patch -p1 < ../fix_build_core.patch
+
+  cd $srcdir/selinux
+  patch -p1 < ../fix_build_selinux.patch
+
+  mkdir $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 core/mkbootimg/mkbootimg
+  install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
+}

Deleted: community-x86_64/bash_completion.fastboot
===================================================================
--- community-x86_64/bash_completion.fastboot	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-x86_64/bash_completion.fastboot	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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 256453, android-tools/trunk/bash_completion.fastboot)
===================================================================
--- community-x86_64/bash_completion.fastboot	                        (rev 0)
+++ community-x86_64/bash_completion.fastboot	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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: community-x86_64/fix_build_core.patch
===================================================================
--- community-x86_64/fix_build_core.patch	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-x86_64/fix_build_core.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,57 +0,0 @@
-diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
-index 7adb26213..7596c123b 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/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 d4e58942c..ca7655fa2 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__)

Copied: android-tools/repos/community-x86_64/fix_build_core.patch (from rev 256453, android-tools/trunk/fix_build_core.patch)
===================================================================
--- community-x86_64/fix_build_core.patch	                        (rev 0)
+++ community-x86_64/fix_build_core.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,57 @@
+diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
+index 7adb26213..7596c123b 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/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 d4e58942c..ca7655fa2 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__)

Deleted: community-x86_64/fix_build_selinux.patch
===================================================================
--- community-x86_64/fix_build_selinux.patch	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-x86_64/fix_build_selinux.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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 256453, android-tools/trunk/fix_build_selinux.patch)
===================================================================
--- community-x86_64/fix_build_selinux.patch	                        (rev 0)
+++ community-x86_64/fix_build_selinux.patch	2017-09-08 22:05:22 UTC (rev 256454)
@@ -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: community-x86_64/generate_build.rb
===================================================================
--- community-x86_64/generate_build.rb	2017-09-08 22:04:06 UTC (rev 256453)
+++ community-x86_64/generate_build.rb	2017-09-08 22:05:22 UTC (rev 256454)
@@ -1,276 +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++14 $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
-
-# 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_REVISION="\"$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
-)
-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
-)
-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 -DFAKE_LOG_DEVICE=1 -Icore/log/include -Icore/include')
-
-cutilsfiles = %w(
-  load_file.c
-  socket_local_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')
-
-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')
-
-boringsslfiles = %w(
-  crypto/bn/convert.c
-  crypto/bn/bn.c
-  crypto/bio/file.c
-  crypto/bytestring/cbb.c
-  crypto/buf/buf.c
-  crypto/mem.c
-  crypto/base64/base64.c
-)
-boringssl = compile(expand('boringssl/src', boringsslfiles), '-DBORINGSSL_ANDROID_SYSTEM -DOPENSSL_SMALL -DBORINGSSL_IMPLEMENTATION -Iboringssl/include')
-
-
-link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, '-lpthread -lcrypto -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_REVISION="\"$PKGVER\"" -D_GNU_SOURCE -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
-  output_file.c
-  sparse.c
-  sparse_crc32.c
-  sparse_err.c
-  sparse_read.c
-)
-libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/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
-)
-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 -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')

Copied: android-tools/repos/community-x86_64/generate_build.rb (from rev 256453, android-tools/trunk/generate_build.rb)
===================================================================
--- community-x86_64/generate_build.rb	                        (rev 0)
+++ community-x86_64/generate_build.rb	2017-09-08 22:05:22 UTC (rev 256454)
@@ -0,0 +1,274 @@
+#!/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++14 $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_REVISION="\"$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
+)
+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
+)
+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.c
+  socket_local_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')
+
+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_REVISION="\"$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
+  output_file.c
+  sparse.c
+  sparse_crc32.c
+  sparse_err.c
+  sparse_read.c
+)
+libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/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
+)
+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), '-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')



More information about the arch-commits mailing list