aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
authorSören Tempel <soeren+git@soeren-tempel.net>2018-06-19 16:02:40 +0200
committerSören Tempel <soeren+git@soeren-tempel.net>2018-06-27 22:10:16 +0200
commit283f3d6700b08884a33654461765f146a9a8a7f1 (patch)
tree22e5e84ad3b4e08a1ead191297aa8c17ca54da46 /testing
parent75c3de02317a6af5b1e335eb221b4b8bbb7fa224 (diff)
downloadaports-283f3d6700b08884a33654461765f146a9a8a7f1.tar.bz2
aports-283f3d6700b08884a33654461765f146a9a8a7f1.tar.xz
testing/android-tools: switch to a hand-written CMake build system
The build system including all patches required to build android-tools on a musl-based system is located on my GitHub profile. This has the advantages that patches are collected in a central place and enables collaboration with package maintainers from other distribution. While the CMake based system doesn't built all the tools previously built by the ruby script it has some advantages over the previous setup. The biggest advantage being that the software compiles fine with gcc now. As a long time goal all previously supported commands will likely be supported again in the future but for now all tools I use regularly bases are included (fastboot and adb).
Diffstat (limited to 'testing')
-rw-r--r--testing/android-tools/APKBUILD86
-rw-r--r--testing/android-tools/generate_build.rb415
-rw-r--r--testing/android-tools/musl-fixes.patch199
3 files changed, 12 insertions, 688 deletions
diff --git a/testing/android-tools/APKBUILD b/testing/android-tools/APKBUILD
index 68d8d50f7a..6042cfa547 100644
--- a/testing/android-tools/APKBUILD
+++ b/testing/android-tools/APKBUILD
@@ -3,95 +3,33 @@
pkgname=android-tools
pkgver=8.1.0_p7
_realver=${pkgver/_p/_r}
-# See https://android.googlesource.com/platform/external/boringssl/+/$_realver/BORINGSSL_REVISION
-_boringssl=14308731e5446a73ac2258688a9688b524483cb6
-pkgrel=0
+pkgrel=1
pkgdesc="Android platform tools"
url="http://tools.android.com/"
arch="all !x86 !s390x" # build fails on x86
license="Apache-2.0 MIT"
depends=""
depends_dev=""
-makedepends="zlib-dev pcre2-dev linux-headers bsd-compat-headers go perl
- ruby gtest-dev cmake ninja clang clang-dev libressl-dev libusb-dev"
-source="https://dev.alpinelinux.org/archive/$pkgname/$pkgname-core-$_realver.tar.gz
- https://dev.alpinelinux.org/archive/$pkgname/$pkgname-extras-$_realver.tar.gz
- https://dev.alpinelinux.org/archive/$pkgname/$pkgname-selinux-$_realver.tar.gz
- https://dev.alpinelinux.org/archive/$pkgname/$pkgname-f2fs-tools-$_realver.tar.gz
- https://dev.alpinelinux.org/archive/$pkgname/$pkgname-e2fsprogs-$_realver.tar.gz
-
- $pkgname-boringssl-$_realver.tar.gz::https://github.com/google/boringssl/archive/$_boringssl.tar.gz
-
- musl-fixes.patch
- generate_build.rb
- "
-
-_giturl="https://android.googlesource.com/platform"
-_gittag="android-$_realver"
-
-builddir="$srcdir"
-patch_args="-p0"
-
-snapshot() {
- mkdir -p "$srcdir" && cd "$srcdir"
-
- local r=
- for r in system/core system/extras external/selinux external/f2fs-tools external/e2fsprogs; do
- local n="${r##*/}.git"
- local f=$pkgname-"${r##*/}"
-
- if [ -d "$n" ]; then
- git --git-dir $n fetch || return 1
- else
- git clone --bare $_giturl/$r || return 1
- fi
-
- git --git-dir $n archive --prefix ${f#$pkgname-}/ -o "$srcdir"/$f-$_realver.tar.gz $_gittag
- done
- scp "$srcdir"/$pkgname-*-$_realver.tar.gz dev.alpinelinux.org:/archive/$pkgname/
-}
-
-prepare() {
- default_prepare
-
- cd "$builddir"
- ln -s boringssl-$_boringssl boringssl
-
- PKGVER=$_realver \
- CFLAGS="$CFLAGS -Wno-cpp" \
- CXXFLAGS="$CXXFLAGS -Wno-#warnings" \
- ruby ./generate_build.rb > build.ninja
-}
+makedepends="pcre2-dev linux-headers libusb-dev gtest-dev go perl cmake"
+source="https://github.com/nmeum/$pkgname/releases/download/$_realver/$pkgname-$_realver.tar.xz"
+builddir="$srcdir/$pkgname-$_realver"
build() {
- mkdir -p "$builddir"/boringssl/build
- cd "$builddir"/boringssl/build
+ cd "$builddir"
- cmake -GNinja \
- -DBUILD_SHARED_LIBS=False \
+ mkdir build && cd build
+ cmake \
+ -DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
-DCMAKE_C_FLAGS="$CFLAGS" \
..
- ninja
-
- cd "$builddir"
- ninja
+ make
}
package() {
- cd "$builddir"
- mkdir -p "$pkgdir"/usr/bin
- install -m755 fastboot adb mke2fs.android \
- e2fsdroid ext2simg core/mkbootimg/mkbootimg \
- "$pkgdir"/usr/bin
+ cd "$builddir/build"
+ make DESTDIR="$pkgdir" install
}
-sha512sums="0592d04a12ee992750a2975c7c6eaa0db6001fcabdd046dd4385878600f5549d74c5b418306d29faa20f1aeb0342323f1a274d6209941ca6a09c696c267d0d4d android-tools-core-8.1.0_r7.tar.gz
-bd11d9b6c02f35715c8130f11f51ad74c1efbfe883a84c2c36bb6427de0d600494ffc5dfb9a6a60cca25b2410bd08c624fd319f01272e91afe983e72e8c9ea0d android-tools-extras-8.1.0_r7.tar.gz
-85a55a2b9ea2205a9fd81f04a899851b498745e11bd915db8297924ab1ed71fefc9a9ea3b360f8ed9798124bff590fd7408128f19b0ff36f6118407ed7318602 android-tools-selinux-8.1.0_r7.tar.gz
-9ead522e8e82d380833bb46b8b154f46f722ef6edd3f268ba992b746c1e896e61d3b8d92c69ef0862b7e00d8f8f54b9cc298de99a5ac80338ef91357f403e75b android-tools-f2fs-tools-8.1.0_r7.tar.gz
-722d30b43cbb7ff325927c1696cec02a4d0dbb4ded4b9016f35908d2e87d5f65875f9cbdbb935c3cb6c790ea722c3119240ad2f3adfb33e01a6a7ca62d69c158 android-tools-e2fsprogs-8.1.0_r7.tar.gz
-171b524b0452a48853b2c8010ff5e14d5d720e69eeaf1d3b79f675838f3afa94aee9de2f47b37303feb2d92cbf77639efe585786625b7b37b8cc2ba727c37fdc android-tools-boringssl-8.1.0_r7.tar.gz
-785e201dd8131a6dc49b6b40b54bc698a33cc9500ad2161187d2505541fddd68a66aac951f0794c0d852383bb4ae2f5bd9c37455b8777462b3e3c9fa7bfe455e musl-fixes.patch
-052bd5e602a600c21aaf30bd734dd6da37aaa62a0712a2a5cbb7f781bc2e59aad97516b65a6f985049307f849994a6b34a8646bd9b5eac247271ff5819b6a2e5 generate_build.rb"
+sha512sums="13de48915aab3f529fa02795e0a2a83280369a8e9244a63095739478f5ad0bb56647767edf9e24a7587ed617e9c45b72131bcc2b39dcd60e964de37215ff4649 android-tools-8.1.0_r7.tar.xz"
diff --git a/testing/android-tools/generate_build.rb b/testing/android-tools/generate_build.rb
deleted file mode 100644
index e9319557b6..0000000000
--- a/testing/android-tools/generate_build.rb
+++ /dev/null
@@ -1,415 +0,0 @@
-#!/usr/bin/ruby
-# This ruby script has been copied from Arch Linux.
-
-# 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
- fs_config.cpp
- canned_fs_config.c
-)
-libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/libcutils/include -Icore/include')
-
-diagnoseusbfiles = %w(
- diagnose_usb.cpp
-)
-libdiagnoseusb = compile(expand('core/adb', diagnoseusbfiles), '-Icore/include -Icore/base/include')
-
-libcryptofiles = %w(
- android_pubkey.c
-)
-libcrypto = compile(expand('core/libcrypto_utils', libcryptofiles), '-Icore/libcrypto_utils/include -Iboringssl/include')
-
-# TODO: make subninja working
-#boringssl = subninja('boringssl/build/', ['crypto/libcrypto.a'])
-boringssl = ['boringssl/build/crypto/libcrypto.a']
-
-link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, '-lpthread -lusb-1.0')
-
-
-fastbootfiles = %w(
- protocol.cpp
- engine.cpp
- bootimg_utils.cpp
- fastboot.cpp
- util.cpp
- fs.cpp
- usb_linux.cpp
- socket.cpp
- tcp.cpp
- udp.cpp
-)
-libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_VERSION="\"$PKGVER\"" -D_GNU_SOURCE -D_XOPEN_SOURCE=700 -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils -Icore/libziparchive/include')
-
-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')
-
-
-# mke2fs.android - a ustom version of mke2fs that supports --android_sparse (FS#56955)
-libext2fsfiles = %w(
- lib/blkid/cache.c
- lib/blkid/dev.c
- lib/blkid/devname.c
- lib/blkid/devno.c
- lib/blkid/getsize.c
- lib/blkid/llseek.c
- lib/blkid/probe.c
- lib/blkid/read.c
- lib/blkid/resolve.c
- lib/blkid/save.c
- lib/blkid/tag.c
- lib/e2p/feature.c
- lib/e2p/hashstr.c
- lib/e2p/mntopts.c
- lib/e2p/ostype.c
- lib/e2p/parse_num.c
- lib/e2p/uuid.c
- lib/et/com_err.c
- lib/et/error_message.c
- lib/et/et_name.c
- lib/ext2fs/alloc.c
- lib/ext2fs/alloc_sb.c
- lib/ext2fs/alloc_stats.c
- lib/ext2fs/alloc_tables.c
- lib/ext2fs/atexit.c
- lib/ext2fs/badblocks.c
- lib/ext2fs/bb_inode.c
- lib/ext2fs/bitmaps.c
- lib/ext2fs/bitops.c
- lib/ext2fs/blkmap64_ba.c
- lib/ext2fs/blkmap64_rb.c
- lib/ext2fs/blknum.c
- lib/ext2fs/block.c
- lib/ext2fs/bmap.c
- lib/ext2fs/closefs.c
- lib/ext2fs/crc16.c
- lib/ext2fs/crc32c.c
- lib/ext2fs/csum.c
- lib/ext2fs/dirblock.c
- lib/ext2fs/dir_iterate.c
- lib/ext2fs/expanddir.c
- lib/ext2fs/ext2_err.c
- lib/ext2fs/ext_attr.c
- lib/ext2fs/extent.c
- lib/ext2fs/fallocate.c
- lib/ext2fs/fileio.c
- lib/ext2fs/freefs.c
- lib/ext2fs/gen_bitmap64.c
- lib/ext2fs/gen_bitmap.c
- lib/ext2fs/get_num_dirs.c
- lib/ext2fs/getsectsize.c
- lib/ext2fs/getsize.c
- lib/ext2fs/i_block.c
- lib/ext2fs/ind_block.c
- lib/ext2fs/initialize.c
- lib/ext2fs/inline.c
- lib/ext2fs/inline_data.c
- lib/ext2fs/inode.c
- lib/ext2fs/io_manager.c
- lib/ext2fs/ismounted.c
- lib/ext2fs/link.c
- lib/ext2fs/llseek.c
- lib/ext2fs/lookup.c
- lib/ext2fs/mkdir.c
- lib/ext2fs/mkjournal.c
- lib/ext2fs/mmp.c
- lib/ext2fs/namei.c
- lib/ext2fs/newdir.c
- lib/ext2fs/openfs.c
- lib/ext2fs/progress.c
- lib/ext2fs/punch.c
- lib/ext2fs/rbtree.c
- lib/ext2fs/read_bb.c
- lib/ext2fs/read_bb_file.c
- lib/ext2fs/res_gdt.c
- lib/ext2fs/rw_bitmaps.c
- lib/ext2fs/sparse_io.c
- lib/ext2fs/symlink.c
- lib/ext2fs/undo_io.c
- lib/ext2fs/unix_io.c
- lib/ext2fs/valid_blk.c
- lib/support/dict.c
- lib/support/mkquota.c
- lib/support/parse_qtype.c
- lib/support/plausible.c
- lib/support/prof_err.c
- lib/support/profile.c
- lib/support/quotaio.c
- lib/support/quotaio_tree.c
- lib/support/quotaio_v2.c
- lib/uuid/gen_uuid.c
- lib/uuid/isnull.c
- lib/uuid/pack.c
- lib/uuid/parse.c
- lib/uuid/unpack.c
- lib/uuid/unparse.c
- misc/create_inode.c
-)
-libext2fs = compile(expand('e2fsprogs', libext2fsfiles), '-Ie2fsprogs/lib -Icore/libsparse/include')
-
-
-mke2fsfiles = %w(
- misc/default_profile.c
- misc/mke2fs.c
- misc/mk_hugefiles.c
- misc/util.c
-)
-mke2fs = compile(expand('e2fsprogs', mke2fsfiles), '-Ie2fsprogs/lib')
-
-link('mke2fs.android', mke2fs + libext2fs + libsparse + libbase + libzip + liblog + libutil, '-lpthread -lz')
-
-
-e2fsdroidfiles = %w(
- contrib/android/e2fsdroid.c
- contrib/android/basefs_allocator.c
- contrib/android/block_range.c
- contrib/android/hashmap.c
- contrib/android/base_fs.c
- contrib/android/fsmap.c
- contrib/android/block_list.c
- contrib/android/perms.c
-)
-e2fsdroid = compile(expand('e2fsprogs', e2fsdroidfiles), '-Ie2fsprogs/lib -Iselinux/libselinux/include -Icore/libcutils/include -Ie2fsprogs/misc')
-
-link('e2fsdroid', e2fsdroid + libext2fs + libsparse + libbase + libzip + liblog + libutil + libselinux + libsepol + libcutils, '-lz -lpthread -lpcre2-8')
-
-
-ext2simgfiles = %w(
- contrib/android/ext2simg.c
-)
-ext2simg = compile(expand('e2fsprogs', ext2simgfiles), '-Ie2fsprogs/lib -Icore/libsparse/include')
-
-link('ext2simg', ext2simg + libext2fs + libsparse + libbase + libzip + liblog + libutil, '-lz -lpthread')
diff --git a/testing/android-tools/musl-fixes.patch b/testing/android-tools/musl-fixes.patch
deleted file mode 100644
index 235ef68854..0000000000
--- a/testing/android-tools/musl-fixes.patch
+++ /dev/null
@@ -1,199 +0,0 @@
-Patch has been taken from Arch Linux with some minor modifications for
-needed to build android-tools with musl libc.
-
-diff -upr core.orig/adb/client/usb_libusb.cpp core/adb/client/usb_libusb.cpp
---- core.orig/adb/client/usb_libusb.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/adb/client/usb_libusb.cpp 2018-02-25 10:35:06.661418453 +0100
-@@ -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 -upr core.orig/adb/diagnose_usb.cpp core/adb/diagnose_usb.cpp
---- core.orig/adb/diagnose_usb.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/adb/diagnose_usb.cpp 2018-02-25 10:35:06.658085109 +0100
-@@ -45,9 +45,7 @@ static std::string GetUdevProblem() {
- return "";
- }
-
-- // getgroups(2) indicates that the GNU group_member(3) may not check the egid so we check it
-- // additionally just to be sure.
-- if (group_member(plugdev_group->gr_gid) || getegid() == plugdev_group->gr_gid) {
-+ if (getegid() == plugdev_group->gr_gid) {
- // The user is in plugdev so the problem is likely with the udev rules.
- return "user in plugdev group; are your udev rules wrong?";
- }
-diff -upr core.orig/adb/sysdeps/posix/network.cpp core/adb/sysdeps/posix/network.cpp
---- core.orig/adb/sysdeps/posix/network.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/adb/sysdeps/posix/network.cpp 2018-02-25 10:35:06.661418453 +0100
-@@ -21,6 +21,7 @@
- #include <sys/socket.h>
-
- #include <string>
-+#include <string.h>
-
- #include "adb_unique_fd.h"
-
-diff -upr core.orig/base/errors_unix.cpp core/base/errors_unix.cpp
---- core.orig/base/errors_unix.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/base/errors_unix.cpp 2018-02-25 10:35:06.654751766 +0100
-@@ -17,6 +17,7 @@
- #include "android-base/errors.h"
-
- #include <errno.h>
-+#include <string.h>
-
- namespace android {
- namespace base {
-diff -upr core.orig/base/file.cpp core/base/file.cpp
---- core.orig/base/file.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/base/file.cpp 2018-02-25 10:35:06.654751766 +0100
-@@ -22,6 +22,7 @@
- #include <sys/stat.h>
- #include <sys/types.h>
- #include <unistd.h>
-+#include <string.h>
-
- #include <memory>
- #include <mutex>
-diff -upr core.orig/base/logging.cpp core/base/logging.cpp
---- core.orig/base/logging.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/base/logging.cpp 2018-02-25 10:35:06.654751766 +0100
-@@ -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__)
-@@ -89,7 +90,7 @@ static thread_id GetThreadId() {
- }
-
- namespace {
--#if defined(__GLIBC__)
-+#if defined(__linux__)
- const char* getprogname() {
- return program_invocation_short_name;
- }
-diff -upr core.orig/fastboot/fs.cpp core/fastboot/fs.cpp
---- core.orig/fastboot/fs.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/fastboot/fs.cpp 2018-02-25 10:35:06.651418422 +0100
-@@ -108,7 +108,7 @@ static int generate_ext4_image(const cha
- static constexpr int block_size = 4096;
- const std::string exec_dir = android::base::GetExecutableDirectory();
-
-- const std::string mke2fs_path = exec_dir + "/mke2fs";
-+ const std::string mke2fs_path = exec_dir + "/mke2fs.android";
- std::vector<const char*> mke2fs_args = {mke2fs_path.c_str(), "-t", "ext4", "-b"};
-
- std::string block_size_str = std::to_string(block_size);
-diff -upr core.orig/fastboot/socket.cpp core/fastboot/socket.cpp
---- core.orig/fastboot/socket.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/fastboot/socket.cpp 2018-02-25 10:35:06.651418422 +0100
-@@ -28,6 +28,8 @@
-
- #include "socket.h"
-
-+#include <sys/select.h>
-+
- #include <android-base/errors.h>
- #include <android-base/stringprintf.h>
-
-diff -upr core.orig/libsparse/sparse_read.cpp core/libsparse/sparse_read.cpp
---- core.orig/libsparse/sparse_read.cpp 2017-11-29 19:11:44.000000000 +0100
-+++ core/libsparse/sparse_read.cpp 2018-02-25 10:35:06.621418331 +0100
-@@ -26,6 +26,7 @@
- #include <stdio.h>
- #include <stdlib.h>
- #include <string>
-+#include <string.h>
- #include <unistd.h>
-
- #include <sparse/sparse.h>
-diff -upr selinux.orig/libsepol/src/private.h selinux/libsepol/src/private.h
---- selinux.orig/libsepol/src/private.h 2017-08-13 09:34:17.000000000 +0200
-+++ selinux/libsepol/src/private.h 2018-02-25 10:36:31.765008355 +0100
-@@ -14,7 +14,7 @@
- #endif
-
- #include <errno.h>
--#include <dso.h>
-+#include "dso.h"
-
- #ifdef __APPLE__
- #define __BYTE_ORDER BYTE_ORDER
-diff -upr selinux.orig/libsepol/src/util.c selinux/libsepol/src/util.c
---- selinux.orig/libsepol/src/util.c 2017-08-13 09:34:17.000000000 +0200
-+++ selinux/libsepol/src/util.c 2018-02-25 10:36:31.765008355 +0100
-@@ -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;
-diff -upr e2fsprogs.orig/contrib/android/perms.c e2fsprogs/contrib/android/perms.c
---- e2fsprogs.orig/contrib/android/perms.c 2017-11-29 00:28:33.000000000 +0100
-+++ e2fsprogs/contrib/android/perms.c 2018-02-25 10:37:13.048466147 +0100
-@@ -5,6 +5,7 @@
- #include "support/nls-enable.h"
- #include <time.h>
- #include <sys/stat.h>
-+#include "private/android_filesystem_capability.h"
-
- #ifndef XATTR_SELINUX_SUFFIX
- # define XATTR_SELINUX_SUFFIX "selinux"
-diff -upr e2fsprogs.orig/lib/ext2fs/bitops.h e2fsprogs/lib/ext2fs/bitops.h
---- e2fsprogs.orig/lib/ext2fs/bitops.h 2017-11-29 00:28:33.000000000 +0100
-+++ e2fsprogs/lib/ext2fs/bitops.h 2018-02-25 10:37:13.028466087 +0100
-@@ -233,11 +233,11 @@ extern errcode_t ext2fs_find_first_set_g
- #if (__STDC_VERSION__ >= 199901L)
- #define _INLINE_ extern inline
- #else
--#define _INLINE_ inline
-+#define _INLINE_ static inline
- #endif
- #else /* !INCLUDE_INLINE FUNCS */
- #if (__STDC_VERSION__ >= 199901L)
--#define _INLINE_ inline
-+#define _INLINE_ static inline
- #else /* not C99 */
- #ifdef __GNUC__
- #define _INLINE_ extern __inline__
-diff -upr e2fsprogs.orig/lib/ext2fs/ext2fs.h e2fsprogs/lib/ext2fs/ext2fs.h
---- e2fsprogs.orig/lib/ext2fs/ext2fs.h 2017-11-29 00:28:33.000000000 +0100
-+++ e2fsprogs/lib/ext2fs/ext2fs.h 2018-02-25 10:37:13.028466087 +0100
-@@ -53,9 +53,7 @@ extern "C" {
- */
- #define EXT2_LIB_CURRENT_REV EXT2_DYNAMIC_REV
-
--#ifdef HAVE_SYS_TYPES_H
- #include <sys/types.h>
--#endif
-
- #include <stdio.h>
- #include <stdlib.h>
-@@ -1736,7 +1734,7 @@ extern const struct ext2_inode *ext2fs_c
- #define _INLINE_ extern
- #else
- #if (__STDC_VERSION__ >= 199901L)
--#define _INLINE_ inline
-+#define _INLINE_ static inline
- #else
- #ifdef __GNUC__
- #define _INLINE_ extern __inline__