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

Anatol Pomozov anatolik at archlinux.org
Wed Dec 6 00:07:01 UTC 2017


    Date: Wednesday, December 6, 2017 @ 00:07:00
  Author: anatolik
Revision: 272349

archrelease: copy trunk to community-testing-x86_64

Added:
  android-tools/repos/community-testing-x86_64/
  android-tools/repos/community-testing-x86_64/PKGBUILD
    (from rev 272348, android-tools/trunk/PKGBUILD)
  android-tools/repos/community-testing-x86_64/bash_completion.fastboot
    (from rev 272348, android-tools/trunk/bash_completion.fastboot)
  android-tools/repos/community-testing-x86_64/fix_build_core.patch
    (from rev 272348, android-tools/trunk/fix_build_core.patch)
  android-tools/repos/community-testing-x86_64/fix_build_selinux.patch
    (from rev 272348, android-tools/trunk/fix_build_selinux.patch)
  android-tools/repos/community-testing-x86_64/generate_build.rb
    (from rev 272348, android-tools/trunk/generate_build.rb)

--------------------------+
 PKGBUILD                 |   57 +++++++++
 bash_completion.fastboot |   90 ++++++++++++++
 fix_build_core.patch     |   81 +++++++++++++
 fix_build_selinux.patch  |   26 ++++
 generate_build.rb        |  275 +++++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 529 insertions(+)

Copied: android-tools/repos/community-testing-x86_64/PKGBUILD (from rev 272348, android-tools/trunk/PKGBUILD)
===================================================================
--- community-testing-x86_64/PKGBUILD	                        (rev 0)
+++ community-testing-x86_64/PKGBUILD	2017-12-06 00:07:00 UTC (rev 272349)
@@ -0,0 +1,57 @@
+# $Id$
+# Maintainer: Anatol Pomozov
+# Contributor: 謝致邦 <Yeking at Red54.com>
+# Contributor: Alucryd <alucryd at gmail dot com>
+
+pkgname=android-tools
+pkgver=8.1.0_r1
+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)
+_boringssl_commit=14308731e5446a73ac2258688a9688b524483cb6 # keep it in sync with android https://android.googlesource.com/platform/external/boringssl/+/$pkgver/BORINGSSL_REVISION
+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#commit=$_boringssl_commit
+        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'
+          'fa0e4579f2f26a0e0efe53549e9a91ef3a334eff'
+          '640db48e8e915f8c7f525dd044f16a3b502d4689'
+          '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 -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 core/mkbootimg/mkbootimg
+  install -Dm 644 bash_completion.fastboot "$pkgdir"/usr/share/bash-completion/completions/fastboot
+}

Copied: android-tools/repos/community-testing-x86_64/bash_completion.fastboot (from rev 272348, android-tools/trunk/bash_completion.fastboot)
===================================================================
--- community-testing-x86_64/bash_completion.fastboot	                        (rev 0)
+++ community-testing-x86_64/bash_completion.fastboot	2017-12-06 00:07:00 UTC (rev 272349)
@@ -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

Copied: android-tools/repos/community-testing-x86_64/fix_build_core.patch (from rev 272348, android-tools/trunk/fix_build_core.patch)
===================================================================
--- community-testing-x86_64/fix_build_core.patch	                        (rev 0)
+++ community-testing-x86_64/fix_build_core.patch	2017-12-06 00:07:00 UTC (rev 272349)
@@ -0,0 +1,81 @@
+diff --git a/adb/client/usb_libusb.cpp b/adb/client/usb_libusb.cpp
+index 81201995a0..cfd60fce97 100644
+--- a/adb/client/usb_libusb.cpp
++++ b/adb/client/usb_libusb.cpp
+@@ -21,6 +21,7 @@
+ #include <stdint.h>
+ 
+ #include <atomic>
++#include <condition_variable>
+ #include <chrono>
+ #include <memory>
+ #include <mutex>
+@@ -28,7 +29,7 @@
+ #include <thread>
+ #include <unordered_map>
+ 
+-#include <libusb/libusb.h>
++#include <libusb-1.0/libusb.h>
+ 
+ #include <android-base/file.h>
+ #include <android-base/logging.h>
+diff --git a/adb/sysdeps/posix/network.cpp b/adb/sysdeps/posix/network.cpp
+index 45da5af4a1..ee3bf06994 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 a2f28878e8..0aa185e972 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 6357b4ba73..3c7dbce131 100644
+--- a/base/logging.cpp
++++ b/base/logging.cpp
+@@ -23,6 +23,7 @@
+ #include <fcntl.h>
+ #include <libgen.h>
+ #include <time.h>
++#include <string.h>
+ 
+ // For getprogname(3) or program_invocation_short_name.
+ #if defined(__ANDROID__) || defined(__APPLE__)
+diff --git a/libsparse/sparse_read.cpp b/libsparse/sparse_read.cpp
+index bd668735a3..6168f2e248 100644
+--- a/libsparse/sparse_read.cpp
++++ b/libsparse/sparse_read.cpp
+@@ -26,6 +26,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string>
++#include <string.h>
+ #include <unistd.h>
+ 
+ #include <sparse/sparse.h>

Copied: android-tools/repos/community-testing-x86_64/fix_build_selinux.patch (from rev 272348, android-tools/trunk/fix_build_selinux.patch)
===================================================================
--- community-testing-x86_64/fix_build_selinux.patch	                        (rev 0)
+++ community-testing-x86_64/fix_build_selinux.patch	2017-12-06 00:07:00 UTC (rev 272349)
@@ -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;

Copied: android-tools/repos/community-testing-x86_64/generate_build.rb (from rev 272348, android-tools/trunk/generate_build.rb)
===================================================================
--- community-testing-x86_64/generate_build.rb	                        (rev 0)
+++ community-testing-x86_64/generate_build.rb	2017-12-06 00:07:00 UTC (rev 272349)
@@ -0,0 +1,275 @@
+#!/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_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.c
+  socket_local_client_unix.c
+  socket_network_client_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_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')
+
+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_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 -Icore/libziparchive/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