community/android-tools to 8.1.0_r33-1

This commit is contained in:
Kevin Mihelich 2018-06-11 18:03:28 +00:00
parent 56883e6849
commit 81ade964d4
3 changed files with 96 additions and 53 deletions

View file

@ -7,7 +7,7 @@
# - set -Wno-error=attributes to stop alignas(64) warnings as errors
pkgname=android-tools
pkgver=8.1.0_r7
pkgver=8.1.0_r33
pkgrel=1
pkgdesc='Android platform tools'
arch=(x86_64)
@ -35,10 +35,10 @@ sha1sums=('SKIP'
'SKIP'
'SKIP'
'SKIP'
'caf4dd68f94e7c745b915778c3f33946c0478eae'
'89c0b62805506c729f76c1aa3c901c4ea2e3bfbe'
'e6ab688d0decfae64302d1402e1eee6678fc2549'
'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
'8ccb2ef791a5b517b4371af7f529f4e731ce7260'
'e0d19de229f1a41a066ddb7a84f8e56e67bbc8bc'
'7004dbd0c193668827174880de6f8434de8ceaee')
prepare() {

View file

@ -1,3 +1,12 @@
diff --git a/contrib/android/e2fsdroid.c b/contrib/android/e2fsdroid.c
index f043822b..4d49bee4 100644
--- a/contrib/android/e2fsdroid.c
+++ b/contrib/android/e2fsdroid.c
@@ -1,3 +1,4 @@
+#define _GNU_SOURCE // for asprintf
#include <stdio.h>
#include <getopt.h>
#include <string.h>
diff --git a/contrib/android/perms.c b/contrib/android/perms.c
index 9ae8e586..433506fd 100644
--- a/contrib/android/perms.c
@ -41,3 +50,43 @@ index e153c817..dcae5947 100644
#else
#ifdef __GNUC__
#define _INLINE_ extern __inline__
diff --git a/misc/create_inode.c b/misc/create_inode.c
index 94c29b8d..6e59151c 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);

View file

@ -5,7 +5,7 @@
# This script tries to mimic Android build rules.
def expand(dir, files)
files.map{|f| File.join(dir,f)}
files.map { |f| File.join(dir, f) }
end
# Compiles sources to *.o files.
@ -16,17 +16,17 @@ def compile(sources, cflags)
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'
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}"
raise "Unknown extension #{ext}"
end
output = s + '.o'
output = s + ".o"
outputs << output
puts "build #{output}: #{cc} #{s}\n cflags = #{lang_flags} #{cflags}"
end
@ -38,24 +38,23 @@ end
# lib - static library path relative to dir
def subninja(dir, lib)
puts "subninja #{dir}build.ninja"
return lib.each{|l| dir + l}
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"
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 "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 """
puts "" "
rule cc
command = $CC $cflags -c $in -o $out
@ -66,7 +65,7 @@ rule link
command = $CXX $ldflags $LDFLAGS $in -o $out
"""
" ""
adbdfiles = %w(
adb.cpp
@ -85,7 +84,7 @@ adbdfiles = %w(
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')
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
@ -102,7 +101,7 @@ adbfiles = %w(
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')
libadb = compile(expand("core/adb", adbfiles), "-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb")
basefiles = %w(
file.cpp
@ -113,7 +112,7 @@ basefiles = %w(
errors_unix.cpp
test_utils.cpp
)
libbase = compile(expand('core/base', basefiles), '-DADB_HOST=1 -Icore/base/include -Icore/include')
libbase = compile(expand("core/base", basefiles), "-DADB_HOST=1 -Icore/base/include -Icore/include")
logfiles = %w(
log_event_write.c
@ -129,7 +128,7 @@ logfiles = %w(
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')
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
@ -144,24 +143,23 @@ cutilsfiles = %w(
fs_config.cpp
canned_fs_config.c
)
libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/libcutils/include -Icore/include')
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')
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')
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')
boringssl = ["boringssl/build/crypto/libcrypto.a"]
link("adb", libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, "-lpthread -lusb-1.0")
fastbootfiles = %w(
protocol.cpp
@ -175,7 +173,7 @@ fastbootfiles = %w(
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')
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
@ -185,24 +183,24 @@ sparsefiles = %w(
sparse_err.c
sparse_read.cpp
)
libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/include -Icore/base/include')
libsparse = compile(expand("core/libsparse", sparsefiles), "-Icore/libsparse/include -Icore/base/include")
f2fsfiles = %w(
f2fs_utils.c
f2fs_ioutils.c
f2fs_dlutils.c
)
f2fs = compile(expand('extras/f2fs_utils', f2fsfiles), '-Iextras/f2fs_utils -If2fs-tools/include -If2fs-tools/mkfs -Icore/libsparse/include -Iselinux/libselinux/include')
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')
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')
libutil = compile(expand("core/libutils", utilfiles), "-Icore/include")
ext4files = %w(
make_ext4fs.c
@ -217,7 +215,7 @@ ext4files = %w(
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')
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
@ -245,7 +243,7 @@ selinuxfiles = %w(
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')
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
@ -272,10 +270,9 @@ libsepolfiles = %w(
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')
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(
@ -377,8 +374,7 @@ libext2fsfiles = %w(
lib/uuid/unparse.c
misc/create_inode.c
)
libext2fs = compile(expand('e2fsprogs', libext2fsfiles), '-Ie2fsprogs/lib -Icore/libsparse/include')
libext2fs = compile(expand("e2fsprogs", libext2fsfiles), "-Ie2fsprogs/lib -Icore/libsparse/include")
mke2fsfiles = %w(
misc/default_profile.c
@ -386,10 +382,9 @@ mke2fsfiles = %w(
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')
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
@ -401,14 +396,13 @@ e2fsdroidfiles = %w(
contrib/android/block_list.c
contrib/android/perms.c
)
e2fsdroid = compile(expand('e2fsprogs', e2fsdroidfiles), '-Ie2fsprogs/lib -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc')
link('e2fsdroid', e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, '-lz -lpthread -lpcre2-8')
e2fsdroid = compile(expand("e2fsprogs", e2fsdroidfiles), "-Ie2fsprogs/lib -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')
ext2simg = compile(expand("e2fsprogs", ext2simgfiles), "-Ie2fsprogs/lib -Icore/libsparse/include")
link('ext2simg', ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, '-lz -lpthread')
link("ext2simg", ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, "-lz -lpthread")