~alpine/aports

testing/android-tools: upgrade to 7.0.0_p24 v1 PROPOSED

Sören Tempel: 1
 testing/android-tools: upgrade to 7.0.0_p24

 6 files changed, 1025 insertions(+), 318 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.alpinelinux.org/~alpine/aports/patches/2725/mbox | git am -3
Learn more about email & git

[alpine-aports] [PATCH] testing/android-tools: upgrade to 7.0.0_p24 Export this patch

---
 testing/android-tools/APKBUILD            |  76 ++-
 testing/android-tools/android-tools.patch | 826 ++++++++++++++++++++++++++++++
 testing/android-tools/fix-build.patch     |  69 ---
 testing/android-tools/fix-getcwd.patch    |  36 --
 testing/android-tools/generate-build.rb   | 172 -------
 testing/android-tools/musl-fixes.patch    | 164 ++++++
 6 files changed, 1025 insertions(+), 318 deletions(-)
 create mode 100644 testing/android-tools/android-tools.patch
 delete mode 100644 testing/android-tools/fix-build.patch
 delete mode 100644 testing/android-tools/fix-getcwd.patch
 delete mode 100644 testing/android-tools/generate-build.rb
 create mode 100644 testing/android-tools/musl-fixes.patch

diff --git a/testing/android-tools/APKBUILD b/testing/android-tools/APKBUILD
index 39fa992b0a..9710b31f96 100644
--- a/testing/android-tools/APKBUILD
+++ b/testing/android-tools/APKBUILD
@@ -1,7 +1,7 @@
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Sören Tempel <soeren+alpine@soeren-tempel.net>
pkgname=android-tools
pkgver=6.0.1_p46
pkgver=7.0.0_p24
_realver=${pkgver/_p/_r}
pkgrel=2
pkgdesc="Android platform tools"
@@ -10,37 +10,31 @@ arch="all"
license="Apache BSD"
depends=""
depends_dev=""
makedepends="zlib-dev libressl-dev pcre-dev linux-headers bsd-compat-headers
	ruby"
makedepends="zlib-dev libressl-dev pcre-dev linux-headers bsd-compat-headers"
install=""
subpackages=""
source="http://dev.alpinelinux.org/archive/$pkgname/$pkgname-core-$_realver.tar.gz
	http://dev.alpinelinux.org/archive/$pkgname/$pkgname-extras-$_realver.tar.gz
	http://dev.alpinelinux.org/archive/$pkgname/$pkgname-libselinux-$_realver.tar.gz
	http://dev.alpinelinux.org/archive/$pkgname/$pkgname-f2fs-tools-$_realver.tar.gz
	http://dev.alpinelinux.org/archive/$pkgname/$pkgname-safe-iop-$_realver.tar.gz
	http://dev.alpinelinux.org/archive/$pkgname/$pkgname-gtest-$_realver.tar.gz

	fix-build.patch
	fix-getcwd.patch
	generate-build.rb
	android-tools.patch
	musl-fixes.patch
	"

_giturl="https://android.googlesource.com/platform"
_gittag="android-$_realver"

builddir="$srcdir"
prepare() {
	default_prepare || return 1

	cd "$builddir"
	echo "set -x -e" > build.sh
	ruby generate-build.rb >> build.sh
}
patch_args="-p0"

snapshot() {
	mkdir -p "$srcdir" && cd "$srcdir"

	local r=
	for r in system/core system/extras external/libselinux external/f2fs-tools; do
	for r in system/core system/extras external/libselinux external/f2fs-tools external/gtest external/safe-iop; do
		local n="${r##*/}.git"
		local f=$pkgname-"${r##*/}"

@@ -56,35 +50,35 @@ snapshot() {
}

build() {
	cd "$builddir"
	PKGVER=$pkgver sh build.sh || return 1
	make -C "$builddir" || return 1
}

package() {
	cd "$builddir"
	mkdir -p "$pkgdir"/usr/bin/
	install -Dm755 mkbootimg fastboot adb \
		"$pkgdir"/usr/bin/ || return 1
	make DESTDIR="$pkgdir" PREFIX=/usr \
		-C "$builddir" install || return 1
}

md5sums="db66109fd5ca02ad4ad6c879441ee96c  android-tools-core-6.0.1_r46.tar.gz
1d5f3bdf8a54c94e27f9f663ff5ec6c9  android-tools-extras-6.0.1_r46.tar.gz
0ae3837c990c4262f3ada4917acc8153  android-tools-libselinux-6.0.1_r46.tar.gz
b99b09cfef42ac2faad237d51338abad  android-tools-f2fs-tools-6.0.1_r46.tar.gz
7272c0aea987e1d4450ed316cb19937a  fix-build.patch
b3d1da647a52bf0dd6ca562033648b41  fix-getcwd.patch
3c77207b30748bcf2cbb6dab257bf6ff  generate-build.rb"
sha256sums="1e0186dc1160f2db44aee4afb68909760dbf421d9e82de04a850547d70a5fd05  android-tools-core-6.0.1_r46.tar.gz
de52852ee2a172cf193bf43840e2d4418d6dfbdcae68cbff3c77ba0c09f325cb  android-tools-extras-6.0.1_r46.tar.gz
5c60e5bfa33e0977ddb6e5f1e0c4df19d88447640d308aaf9665da13b1d370ee  android-tools-libselinux-6.0.1_r46.tar.gz
0883c9017c8e498456563c2088e7436eb725a7720d01ac565f27fd2c82263ac8  android-tools-f2fs-tools-6.0.1_r46.tar.gz
bb91e2a8855a5b47d64fbe2a13dcfb5c3bfca5b9e79e06a790cdabe48d55bc2c  fix-build.patch
d9e2ba5337c2dbea2d9747c232f56953562494e44faeee88dd0abddb3c810796  fix-getcwd.patch
802f565f7204b720ff86f6acb02aa1ba03b9438b84a38911ba76edeb0824dd3d  generate-build.rb"
sha512sums="091c663ff5ba36fed872f30c4d32e4961657ce3bf3c039dd641cc4e003194c5b40aa2dd373f909e58df4529465d5c80784423e8a71229104af75c84c835ead90  android-tools-core-6.0.1_r46.tar.gz
bb3953bfaed031a46dc707896df303a44ea7c764adc48757344c38b805a820c95aa6a702a5e8247c73872466600706e66bf2d3487e6c988cc009197f893426d5  android-tools-extras-6.0.1_r46.tar.gz
765491488780e1da7510fa3146b6ae7443e98ee5b64490aea1fe95d05eb3f96f31c389cbcc33178ffac602f12bda0948f8d7e8dd23bb27628061fd0ba00a106c  android-tools-libselinux-6.0.1_r46.tar.gz
b5433ac4b9e3f6b180ebc0b8b5c623b0e1008111e40a179ab4383bd7730ecd09a74d524ee8a5ff8bc1dd0ab8c8cef824c8e8212cf9ad461cff1399de0e96b113  android-tools-f2fs-tools-6.0.1_r46.tar.gz
38e5ce4bfc0305585b1071b52c5d2e47927adc24318abdc466c9eed53ad6ed4fa83b6c1342db51d3a62b76996d2649632012d73c340eaf8b131ac6023248c59a  fix-build.patch
d6ab3595d1f77f4baea03d828cc03291cb08e7787ebd653faac4776a2d27ff899f0746516f52c8b533dd104f9e9a1fcede59936de3146f7b8e8955101dacd889  fix-getcwd.patch
421596678ab767d4bf59c54878e82a4faa0e3b5a070803ea37b5ee3c8cd41972d2d8ae46d081ee54a0d5b24874c893f32ad2aae7426090632f8c6099a241030b  generate-build.rb"
md5sums="dbd92a13e6671aa97be8e18d90a2fb34  android-tools-core-7.0.0_r24.tar.gz
2acdfc14cbfc161c2cab9d10bb6693ce  android-tools-extras-7.0.0_r24.tar.gz
10cb77a3246a57827593b7d891d0ecd3  android-tools-libselinux-7.0.0_r24.tar.gz
c1f9c17034889d0cea408ce96372fe17  android-tools-f2fs-tools-7.0.0_r24.tar.gz
2411f3ee3404d958283b48b9beb640f1  android-tools-safe-iop-7.0.0_r24.tar.gz
ebe8f1776e55552edd24b4b97f171844  android-tools-gtest-7.0.0_r24.tar.gz
883cfac28233868a458aab9cfc5da9a1  android-tools.patch
4f1a962a06ce980cc1623e0cd3417a45  musl-fixes.patch"
sha256sums="c5b16078c92d9d1407e23bc1a54a2f4f1d3a34809cfff3b81e79dfc35ed08047  android-tools-core-7.0.0_r24.tar.gz
ca581aaad72771e40cb7a5439e77cc61dcf21e524924c5aa68a3530ae9af4267  android-tools-extras-7.0.0_r24.tar.gz
5f7a799f30957de0c5265078600baede94f2cfacc031ac69414f4f42f68008fb  android-tools-libselinux-7.0.0_r24.tar.gz
2f255d4c6eea21d12254da7bdee1e92cedc07c7ef807a09e0a4d6fbec1abc33c  android-tools-f2fs-tools-7.0.0_r24.tar.gz
22a5cd6e316ea6833f2b48be384d10f8375f8474c93bc1c355abaf980a9ff15f  android-tools-safe-iop-7.0.0_r24.tar.gz
c4460385f3a3b3ee5409e768297e698838d67a6d7d3d566b3fec6c15e32b818e  android-tools-gtest-7.0.0_r24.tar.gz
08686f177f6c1bd6901b43816aa83e5f1f3c512f583470b1a520b62d54c3d3e6  android-tools.patch
e4423745d2ac88e24b42250b97345753c954218ec3fc98a1cb3f8b27016eab1f  musl-fixes.patch"
sha512sums="a923512ba3bce7b45c31dba09aead29312e943e94ed4ea768f5524da531256cd2f17f80ce78e71c3214f073ac032bbe90fa7f5038e2a7239d66033a1a6b9a3c3  android-tools-core-7.0.0_r24.tar.gz
53cc938752266bb65e752abb456c870dc560b67cd623c917d02e87ae9fdc8d2d303ce305475fee64940ef4c246f98c4b4e1e088f5edc91b544eca954bfe9b6da  android-tools-extras-7.0.0_r24.tar.gz
570bd1be68445229dd72e9fedb78c93ccf586d9fd901531ce218be9bc60247e147e496a2f2dc8867400def753aaf20d27fee68230a5831626e102f90bf732998  android-tools-libselinux-7.0.0_r24.tar.gz
ee68982ccf106763dab6c80a6d405d9c79892dc73444b89e0d9b3cfd7fb584fbef3f0809947c148938d6e9a5865974ecca88037db39719c20ac652b69dcfb3c7  android-tools-f2fs-tools-7.0.0_r24.tar.gz
7f35a1fe8bb07411a5cf9dd48dd393a7451934fa57dc1516943c80dee9f721ae71d4c61b917c937848b756ab25d99391edf90f37107f6acccd8717d8f7b66ae7  android-tools-safe-iop-7.0.0_r24.tar.gz
4a26d15027ae8db842b6d2c6f6136f8025d231b8e7c883bac20aae4cc6878c0fc7be31498aa897d9b5c255da97750c594789f32b09bb6e7b4f8824b07c3703ec  android-tools-gtest-7.0.0_r24.tar.gz
211fb8d6c37522b26306b75a3d1d2ee05f7c914f32b91a55cfea7375f5f5a99dae484ab11f798caea96de91bb9e345fb67efab19b12c779539fb15b2a687569b  android-tools.patch
75e09d7391dba7858cf50d98893c84986b5117e6b920109b0adb4a2e1215b8b85b427fb4e855402f21541cbf01a21430ed2d30296d041ba56c01d0c735334dca  musl-fixes.patch"
diff --git a/testing/android-tools/android-tools.patch b/testing/android-tools/android-tools.patch
new file mode 100644
index 0000000000..9052703861
--- /dev/null
+++ b/testing/android-tools/android-tools.patch
@@ -0,0 +1,826 @@
This patch has been taken from the Void Linux distribution.

https://github.com/voidlinux/void-packages/tree/master/srcpkgs/android-tools/patches/android-tools.patch

diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..4644fc0b62ad
--- /dev/null
+++ Makefile
@@ -0,0 +1,47 @@
+all:
+	$(MAKE) -C core/libcutils all
+	$(MAKE) -C libselinux all
+	$(MAKE) -C core/libziparchive all
+	$(MAKE) -C extras/ext4_utils all
+	$(MAKE) -C core/libsparse all
+	$(MAKE) -C core/libutils all
+	$(MAKE) -C core/liblog all
+	$(MAKE) -C core/base all
+	$(MAKE) -C gtest all
+	$(MAKE) -C extras/f2fs_utils all
+	$(MAKE) -C core/adb all
+	$(MAKE) -C core/fastboot all
+
+install: all
+	$(MAKE) -C core/adb install
+	$(MAKE) -C core/fastboot install
+
+clean:
+	$(MAKE) -C core/libcutils clean
+	$(MAKE) -C libselinux clean
+	$(MAKE) -C core/libziparchive clean
+	$(MAKE) -C extras/ext4_utils clean
+	$(MAKE) -C core/libsparse clean
+	$(MAKE) -C core/libutils clean
+	$(MAKE) -C core/liblog clean
+	$(MAKE) -C core/adb libdiagnose_usb
+	$(MAKE) -C core/base clean
+	$(MAKE) -C gtest clean
+	$(MAKE) -C extras/f2fs_utils clean
+	$(MAKE) -C core/adb clean
+	$(MAKE) -C core/fastboot clean
+
+mrproper:
+	$(MAKE) -C core/libcutils mrproper
+	$(MAKE) -C libselinux mrproper
+	$(MAKE) -C core/libziparchive mrproper
+	$(MAKE) -C extras/ext4_utils mrproper
+	$(MAKE) -C core/libsparse mrproper
+	$(MAKE) -C core/libutils mrproper
+	$(MAKE) -C core/liblog mrproper
+	$(MAKE) -C core/adb libdiagnose_usb
+	$(MAKE) -C core/base mrproper
+	$(MAKE) -C gtest mrproper
+	$(MAKE) -C extras/f2fs_utils mrproper
+	$(MAKE) -C core/adb mrproper
+	$(MAKE) -C core/fastboot mrproper
diff --git core/adb/Makefile core/adb/Makefile
new file mode 100644
index 0000000..8ef539b
--- /dev/null
+++ core/adb/Makefile
@@ -0,0 +1,97 @@
+adb_version := $(shell git -C . rev-parse --short=12 HEAD 2>/dev/null)-android
+
+SRCS+= \
+	adb_client.cpp \
+	client/main.cpp \
+	console.cpp \
+	commandline.cpp \
+	file_sync_client.cpp \
+	line_printer.cpp \
+	services.cpp \
+	shell_service_protocol.cpp \
+
+LIBADB_SRCS= \
+	adb.cpp \
+	adb_auth.cpp \
+	adb_io.cpp \
+	adb_listeners.cpp \
+	adb_trace.cpp \
+	adb_utils.cpp \
+	fdevent.cpp \
+	sockets.cpp \
+	transport.cpp \
+	transport_local.cpp \
+	transport_usb.cpp \
+	adb_auth_host.cpp \
+	get_my_path_linux.cpp \
+	sysdeps_unix.cpp \
+	usb_linux.cpp \
+
+LIBDIAGNOSE_USB_SRCS= \
+	diagnose_usb.cpp
+
+
+override CXXFLAGS+= \
+	-I. \
+	-I../include \
+	-I../base/include \
+	-D_Nonnull="" \
+	-D_Nullable="" \
+	-D_GNU_SOURCE \
+	-Wall \
+	-Wextra \
+	-Wno-unused-parameter \
+	-Wno-missing-field-initializers \
+	-Wvla \
+	-DADB_REVISION='"$(adb_version)"' \
+	-std=gnu++14 \
+	-DADB_HOST=1 \
+	-fpermissive \
+	-fvisibility=hidden
+
+
+LIBS= \
+	./libadb.a \
+	./libdiagnose_usb.a \
+	../base/libbase.a \
+	../libcutils/libcutils.a \
+	../liblog/liblog.a
+
+override LDFLAGS+= -lssl -lcrypto -lpthread
+
+OBJS= $(SRCS:.cpp=.o)
+LIBADB_OBJS= $(LIBADB_SRCS:.cpp=.o)
+LIBDIAGNOSE_USB_OBJS= $(LIBDIAGNOSE_USB_SRCS:.cpp=.o)
+
+BIN= adb
+
+all: $(BIN)
+
+adb: $(OBJS) libadb libdiagnose_usb
+	$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+
+libadb: libadb.a
+
+libadb.a: $(LIBADB_OBJS)
+	$(AR) rcs $@ $(LIBADB_OBJS)
+
+libdiagnose_usb: libdiagnose_usb.a
+
+libdiagnose_usb.a: $(LIBDIAGNOSE_USB_OBJS)
+	$(AR) rcs $@ $(LIBDIAGNOSE_USB_OBJS)
+
+%.o: %.cpp
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+install: adb
+	install -Dm755 adb $(DESTDIR)$(PREFIX)/bin/adb
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS) $(LIBADB_OBJS) $(LIBDIAGNOSE_USB_OBJS)
+
+mrproper: clean
+	rm -rf $(BIN) *.a
+
diff --git core/base/Makefile core/base/Makefile
new file mode 100644
index 0000000..d3e7436
--- /dev/null
+++ core/base/Makefile
@@ -0,0 +1,37 @@
+SRCS+= \
+	file.cpp \
+	logging.cpp \
+	parsenetaddress.cpp \
+	stringprintf.cpp \
+	strings.cpp \
+	test_utils.cpp \
+	errors_unix.cpp
+
+override CXXFLAGS+= \
+	-I./include \
+	-I../include \
+	-D__GLIBC__ \
+	-Wall \
+	-Wextra \
+	-Werror \
+	-std=gnu++14
+
+OBJS= $(SRCS:.cpp=.o)
+
+BIN= libbase.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.cpp
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/base/errors_unix.cpp core/base/errors_unix.cpp
index 296995e..3b983d3 100644
--- core/base/errors_unix.cpp
+++ core/base/errors_unix.cpp
@@ -17,6 +17,7 @@
 #include "android-base/errors.h"
 
 #include <errno.h>
+#include <cstring>
 
 namespace android {
 namespace base {
diff --git core/base/logging.cpp core/base/logging.cpp
index 1741871..0aaae2e 100644
--- core/base/logging.cpp
+++ core/base/logging.cpp
@@ -33,6 +33,7 @@
 #include <limits>
 #include <sstream>
 #include <string>
+#include <cstring>
 #include <utility>
 #include <vector>
 
diff --git core/fastboot/Makefile core/fastboot/Makefile
new file mode 100644
index 0000000..6d81f7c
--- /dev/null
+++ core/fastboot/Makefile
@@ -0,0 +1,70 @@
+fastboot_version := $(shell git -C . rev-parse --short=12 HEAD 2>/dev/null)-android
+
+SRCS+= \
+	bootimg_utils.cpp \
+	engine.cpp \
+	fastboot.cpp \
+	fs.cpp\
+	protocol.cpp \
+	socket.cpp \
+	tcp.cpp \
+	udp.cpp \
+	util.cpp \
+	usb_linux.cpp \
+	util_linux.cpp
+
+
+override CXXFLAGS+= \
+	-I../mkbootimg/ \
+	-I../base/include \
+	-I../libsparse/include \
+	-I../include \
+	-I../adb \
+	-I../../gtest/include \
+	-I../../extras/ext4_utils \
+	-I../../extras/f2fs_utils \
+	-Wall \
+	-Wextra \
+	-Werror \
+	-Wunreachable-code \
+	-DFASTBOOT_REVISION='"$(fastboot_version)"' \
+	-std=gnu++14
+
+LIBS= \
+	../libziparchive/libziparchive.a \
+	../../extras/ext4_utils/libext4_utils.a \
+	../libsparse/libsparse.a \
+	../libutils/libutils.a \
+	../liblog/liblog.a \
+	../adb/libdiagnose_usb.a \
+	../base/libbase.a \
+	../libcutils/libcutils.a \
+	../../gtest/libgtest.a \
+	../../extras/f2fs_utils/libf2fs.a \
+	../libcutils/libcutils.a \
+	../../libselinux/libselinux.a
+
+override LDFLAGS+= -lz -lpcre -lpthread
+
+OBJS= $(SRCS:.cpp=.o)
+
+BIN= fastboot
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(CXX) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+%.o: %.cpp
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+install: fastboot
+	install -Dm755 fastboot $(DESTDIR)$(PREFIX)/bin/fastboot
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/include/cutils/atomic.h core/include/cutils/atomic.h
index ded972a..2ff6fce 100644
--- core/include/cutils/atomic.h
+++ core/include/cutils/atomic.h
@@ -19,7 +19,12 @@
 
 #include <stdint.h>
 #include <sys/types.h>
+#ifdef __cplusplus
+#include <atomic>
+using namespace std;
+#else
 #include <stdatomic.h>
+#endif
 
 #ifndef ANDROID_ATOMIC_INLINE
 #define ANDROID_ATOMIC_INLINE static inline
@@ -114,6 +119,7 @@ int32_t android_atomic_or(int32_t value, volatile int32_t* addr)
     return atomic_fetch_or_explicit(a, value, memory_order_release);
 }
 
+#ifndef __cplusplus
 /*
  * Perform an atomic load with "acquire" or "release" ordering.
  *
@@ -208,6 +214,7 @@ int android_atomic_release_cas(int32_t oldvalue, int32_t newvalue,
                                           memory_order_release,
                                           memory_order_relaxed));
 }
+#endif
 
 /*
  * Fence primitives.
diff --git core/include/log/log.h core/include/log/log.h
index e606a84..963347a 100644
--- core/include/log/log.h
+++ core/include/log/log.h
@@ -38,6 +38,7 @@
 #include <log/uio.h>
 
 #ifdef __cplusplus
+#include <cstring>
 extern "C" {
 #endif
 
diff --git core/libcutils/Makefile core/libcutils/Makefile
new file mode 100644
index 0000000..ec9c573
--- /dev/null
+++ core/libcutils/Makefile
@@ -0,0 +1,59 @@
+CSRCS+= \
+	config_utils.c \
+	fs_config.c \
+	canned_fs_config.c \
+	hashmap.c \
+	iosched_policy.c \
+	load_file.c \
+	native_handle.c \
+	open_memstream.c \
+	process_name.c \
+	record_stream.c \
+	sched_policy.c \
+	strlcpy.c \
+	threads.c \
+	fs.c \
+	multiuser.c \
+	socket_inaddr_any_server_unix.c \
+	socket_local_client_unix.c \
+	socket_local_server_unix.c \
+	socket_loopback_client_unix.c \
+	socket_loopback_server_unix.c \
+	socket_network_client_unix.c \
+	str_parms.c \
+	ashmem-host.c \
+	trace-host.c \
+	dlmalloc_stubs.c
+
+CXXSRCS+= \
+	sockets_unix.cpp \
+	sockets.cpp \
+	strdup16to8.c \
+	strdup8to16.c
+
+override CFLAGS+= -I../include
+
+override CXXFLAGS+= -I../include
+
+COBJS= $(CSRCS:.c=.o)
+CXXOBJS= $(CXXSRCS:.cpp=.o)
+BIN= libcutils.a
+
+all: $(BIN)
+
+$(BIN): $(COBJS) $(CXXOBJS)
+	$(AR) rcs $@ $(COBJS) $(CXXOBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+%.o: %.cpp
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(COBJS) $(CXXOBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/libcutils/fs.c core/libcutils/fs.c
index 3f14de7..175df6a 100644
--- core/libcutils/fs.c
+++ core/libcutils/fs.c
@@ -79,7 +79,7 @@ static int fs_prepare_path_impl(const char* path, mode_t mode, uid_t uid, gid_t
 create:
     create_result = prepare_as_dir
         ? TEMP_FAILURE_RETRY(mkdir(path, mode))
-        : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY));
+        : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY, mode));
     if (create_result == -1) {
         if (errno != EEXIST) {
             ALOGE("Failed to %s(%s): %s",
diff --git core/liblog/Makefile core/liblog/Makefile
new file mode 100644
index 0000000..75a0af3
--- /dev/null
+++ core/liblog/Makefile
@@ -0,0 +1,39 @@
+SRCS+= \
+	log_event_list.c \
+	log_event_write.c \
+	logger_write.c \
+	config_write.c \
+	logger_name.c \
+	logger_lock.c \
+	fake_log_device.c \
+	fake_writer.c \
+	event_tag_map.c
+
+
+override CFLAGS+= \
+	-I../include \
+	-DLIBLOG_LOG_TAG=1005 \
+	-DSNET_EVENT_LOG_TAG=1397638484 \
+	-DFAKE_LOG_DEVICE=1 \
+	-Werror \
+	-fvisibility=hidden
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= liblog.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/libpackagelistparser/Makefile core/libpackagelistparser/Makefile
new file mode 100644
index 0000000..38a0158
--- /dev/null
+++ core/libpackagelistparser/Makefile
@@ -0,0 +1,20 @@
+SRCS+= \
+	packagelistparser.c
+
+override CFLAGS+= -I../include
+override CFLAGS+= -I./include
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= libpackagelistparser.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+clean:
+	rm -rf *.o
diff --git core/libsparse/Makefile core/libsparse/Makefile
new file mode 100644
index 0000000..418c028
--- /dev/null
+++ core/libsparse/Makefile
@@ -0,0 +1,31 @@
+SRCS+= \
+	backed_block.c \
+	output_file.c \
+	sparse.c \
+	sparse_crc32.c \
+	sparse_err.c \
+	sparse_read.c
+
+override CFLAGS+= \
+	-I./include \
+	-Werror
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= libsparse.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/libutils/Makefile core/libutils/Makefile
new file mode 100644
index 0000000..82a22b9
--- /dev/null
+++ core/libutils/Makefile
@@ -0,0 +1,50 @@
+SRCS+= \
+	CallStack.cpp \
+	FileMap.cpp \
+	JenkinsHash.cpp \
+	LinearTransform.cpp \
+	Log.cpp \
+	NativeHandle.cpp \
+	Printer.cpp \
+	PropertyMap.cpp \
+	RefBase.cpp \
+	SharedBuffer.cpp \
+	Static.cpp \
+	StopWatch.cpp \
+	String8.cpp \
+	String16.cpp \
+	SystemClock.cpp \
+	Threads.cpp \
+	Timers.cpp \
+	Tokenizer.cpp \
+	Unicode.cpp \
+	VectorImpl.cpp \
+	misc.cpp \
+	Looper.cpp \
+	ProcessCallStack.cpp
+
+override CXXFLAGS+= \
+	-I../include \
+	-I../../safe-iop/include \
+	-DLIBUTILS_NATIVE=1 \
+	-std=gnu++14
+
+OBJS= $(SRCS:.cpp=.o)
+
+BIN= libutils.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.cpp
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/libziparchive/Makefile core/libziparchive/Makefile
new file mode 100644
index 0000000..4eef274
--- /dev/null
+++ core/libziparchive/Makefile
@@ -0,0 +1,34 @@
+SRCS+= \
+	zip_archive.cc \
+	zip_archive_stream_entry.cc \
+	zip_writer.cc \
+
+override CXXFLAGS+= \
+	-I./include \
+	-I../include \
+	-I../base/include \
+	-DZLIB_CONST \
+	-Werror \
+	-fno-strict-aliasing \
+	-std=gnu++14 \
+	-Wall
+
+OBJS= $(SRCS:.cc=.o)
+
+BIN= libziparchive.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git core/libziparchive/zip_writer.cc core/libziparchive/zip_writer.cc
index 1ebed30..5c622d0 100644
--- core/libziparchive/zip_writer.cc
+++ core/libziparchive/zip_writer.cc
@@ -24,6 +24,7 @@
 
 #include <cassert>
 #include <cstdio>
+#include <cstring>
 #include <memory>
 #include <vector>
 #include <zlib.h>
diff --git extras/ext4_utils/Makefile extras/ext4_utils/Makefile
new file mode 100644
index 0000000..000aaca
--- /dev/null
+++ extras/ext4_utils/Makefile
@@ -0,0 +1,38 @@
+SRCS+= \
+	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
+
+override CFLAGS+= \
+	-I../../core/libsparse/include \
+	-I../../core/include \
+	-I../../libselinux/include \
+	-fno-strict-aliasing
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= libext4_utils.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git extras/f2fs_utils/Makefile extras/f2fs_utils/Makefile
new file mode 100644
index 0000000..d81ac9a
--- /dev/null
+++ extras/f2fs_utils/Makefile
@@ -0,0 +1,34 @@
+SRCS+= \
+	f2fs_utils.c \
+	f2fs_ioutils.c \
+	f2fs_dlutils.c
+
+
+override CFLAGS+= \
+	-I../../f2fs-tools/include \
+	-I../../f2fs-tools/mkfs \
+	-I../../core/libsparse/include \
+	-I../../libselinux/include \
+	-Wno-unused-parameter
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= libf2fs.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
+
+
diff --git extras/f2fs_utils/f2fs_utils.c extras/f2fs_utils/f2fs_utils.c
index 6254c08..05ec599 100644
--- extras/f2fs_utils/f2fs_utils.c
+++ extras/f2fs_utils/f2fs_utils.c
@@ -53,7 +53,7 @@ static void reset_f2fs_info() {
 	config.fd = -1;
 	if (f2fs_sparse_file) {
 		sparse_file_destroy(f2fs_sparse_file);
-		f2fs_sparse_file = NULL;
+		f2fs_sparse_file = 0;
 	}
 }
 
@@ -73,6 +73,6 @@ int make_f2fs_sparse_fd(int fd, long long len,
 	sparse_file_write(f2fs_sparse_file, fd, /*gzip*/0, /*sparse*/1, /*crc*/0);
 	sparse_file_destroy(f2fs_sparse_file);
 	flush_sparse_buffs();
-	f2fs_sparse_file = NULL;
+	f2fs_sparse_file = 0;
 	return 0;
 }
diff --git libselinux/Makefile libselinux/Makefile
new file mode 100644
index 0000000..52ef5cc
--- /dev/null
+++ libselinux/Makefile
@@ -0,0 +1,31 @@
+SRCS+= \
+	src/callbacks.c \
+	src/check_context.c \
+	src/freecon.c \
+	src/init.c \
+	src/label.c \
+	src/label_file.c \
+	src/label_android_property.c \
+	src/label_support.c
+
+override CFLAGS+= -I./include
+
+OBJS= $(SRCS:.c=.o)
+
+BIN= libselinux.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.c
+	$(CC) -c $< $(CFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
diff --git gtest/Makefile gtest/Makefile
new file mode 100644
index 0000000..49a50aa
--- /dev/null
+++ gtest/Makefile
@@ -0,0 +1,36 @@
+SRCS+= \
+	src/gtest-all.cc \
+	src/gtest-filepath.cc \
+	src/gtest-printers.cc \
+	src/gtest-typed-test.cc \
+	src/gtest_main.cc \
+	src/gtest-death-test.cc \
+	src/gtest-port.cc \
+	src/gtest-test-part.cc \
+	src/gtest.cc
+
+
+override CXXFLAGS+= \
+	-I./include \
+	-I.
+
+OBJS= $(SRCS:.cc=.o)
+
+BIN= libgtest.a
+
+all: $(BIN)
+
+$(BIN): $(OBJS)
+	$(AR) rcs $@ $(OBJS)
+
+%.o: %.cc
+	$(CXX) -c $< $(CXXFLAGS) -o $@
+
+.PHONY: clean mrproper
+
+clean:
+	rm -rf $(OBJS)
+
+mrproper: clean
+	rm -rf $(BIN)
+
diff --git a/testing/android-tools/fix-build.patch b/testing/android-tools/fix-build.patch
deleted file mode 100644
index d86ad54e5e..0000000000
--- a/testing/android-tools/fix-build.patch
@@ -1,69 +0,0 @@
--- a/core/base/file.cpp
+++ b/core/base/file.cpp
@@ -20,6 +20,7 @@
 #include <fcntl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <string.h>
 
 #include <string>
 
--- a/core/liblog/log_read.c
+++ b/core/liblog/log_read.c
@@ -26,6 +26,7 @@
 #include <string.h>
 #include <sys/cdefs.h>
 #include <unistd.h>
+#include <sys/user.h>
 
 #include <cutils/list.h>
 #include <cutils/sockets.h>

--- a/libselinux/src/label_internal.h
+++ b/libselinux/src/label_internal.h
@@ -10,6 +10,7 @@
 
 #include <stdlib.h>
 #include <stdarg.h>
+#include <stdbool.h>
 #include <selinux/selinux.h>
 #include <selinux/label.h>
 #include "dso.h"
diff -upr core.orig/include/utils/Compat.h core/include/utils/Compat.h
--- a/core/include/utils/Compat.h	2016-07-10 15:30:25.935363345 +0200
+++ b/core/include/utils/Compat.h	2016-07-10 15:31:01.785149166 +0200
@@ -35,10 +35,11 @@ static inline ssize_t pread64(int fd, vo
 
 #endif /* __APPLE__ */
 
+#define DEFFILEMODE 0666
+
 #if defined(_WIN32)
 #define O_CLOEXEC O_NOINHERIT
 #define O_NOFOLLOW 0
-#define DEFFILEMODE 0666
 #endif /* _WIN32 */
 
 #if defined(_WIN32)
diff -upr core/adb/adb_auth_host.cpp core.orig/adb/adb_auth_host.cpp
--- a/core/adb/adb_auth_host.cpp	2016-04-22 04:11:37.000000000 +0200
+++ b/core/adb/adb_auth_host.cpp	2016-07-10 20:28:54.553727489 +0200
@@ -46,6 +46,7 @@
 #include <base/strings.h>
 #include <cutils/list.h>
 
+#include <openssl/bn.h>
 #include <openssl/evp.h>
 #include <openssl/objects.h>
 #include <openssl/pem.h>
diff -upr core.orig/include/ziparchive/zip_archive.h core/include/ziparchive/zip_archive.h
--- a/core/include/ziparchive/zip_archive.h	2016-07-10 20:41:30.509065561 +0200
+++ b/core/include/ziparchive/zip_archive.h	2016-07-10 20:41:47.117424874 +0200
@@ -23,6 +23,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <sys/types.h>
+#include <sys/cdefs.h>
 #include <utils/Compat.h>
 
 __BEGIN_DECLS
diff --git a/testing/android-tools/fix-getcwd.patch b/testing/android-tools/fix-getcwd.patch
deleted file mode 100644
index d96ab42523..0000000000
--- a/testing/android-tools/fix-getcwd.patch
@@ -1,36 +0,0 @@
diff -upr core.orig/adb/adb_utils.cpp core/adb/adb_utils.cpp
--- a/core.orig/adb/adb_utils.cpp	2016-07-10 15:17:54.889682995 +0200
+++ b/core/adb/adb_utils.cpp	2016-07-10 15:18:04.338747965 +0200
@@ -30,7 +30,7 @@
 #include "adb_trace.h"
 #include "sysdeps.h"
 
-bool getcwd(std::string* s) {
+bool agetcwd(std::string* s) {
   char* cwd = getcwd(nullptr, 0);
   if (cwd != nullptr) *s = cwd;
   free(cwd);
diff -upr core.orig/adb/commandline.cpp core/adb/commandline.cpp
--- a/core.orig/adb/commandline.cpp	2016-07-10 15:17:54.889682995 +0200
+++ b/core/adb/commandline.cpp	2016-07-10 15:18:11.671355701 +0200
@@ -863,7 +863,7 @@ static std::string find_product_out_path
     // make it absolute.
     if (adb_dirstart(hint) != nullptr) {
         std::string cwd;
-        if (!getcwd(&cwd)) {
+        if (!agetcwd(&cwd)) {
             fprintf(stderr, "adb: getcwd failed: %s\n", strerror(errno));
             return "";
         }
diff -upr core.orig/adb/adb_utils.h core/adb/adb_utils.h
--- a/core.orig/adb/adb_utils.h	2016-07-10 15:21:09.327109127 +0200
+++ b/core/adb/adb_utils.h	2016-07-10 15:21:18.272890564 +0200
@@ -19,7 +19,7 @@
 
 #include <string>
 
-bool getcwd(std::string* cwd);
+bool agetcwd(std::string* cwd);
 bool directory_exists(const std::string& path);
 
 std::string escape_arg(const std::string& s);
diff --git a/testing/android-tools/generate-build.rb b/testing/android-tools/generate-build.rb
deleted file mode 100644
index 448b23da03..0000000000
--- a/testing/android-tools/generate-build.rb
@@ -1,172 +0,0 @@
#!/usr/bin/ruby
# Copied from the archlinux android-tools PKGBUILD.

# 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 = 'gcc'
        lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
    when '.cpp', '.cc'
        cc = 'g++'
        lang_flags = '-std=gnu++11 $CXXFLAGS $CPPFLAGS'
    else
        raise "Unknown extension #{ext}"
    end

    output = s + '.o'
    outputs << output
    puts "#{cc} -o #{output} #{lang_flags} #{cflags} -c #{s}\n"
  end

  return outputs
end

# Links object files
def link(output, objects, ldflags)
  puts "g++ -o #{output} #{objects.join(' ')} #{ldflags} $LDFLAGS"
end

minicryptfiles = %w(
  dsa_sig.c
  p256_ec.c
  rsa.c
  sha.c
  p256.c
  p256_ecdsa.c
  sha256.c
)
libminicrypt = compile(expand('core/libmincrypt', minicryptfiles), '-Icore/include')
libmkbootimg = compile(['core/mkbootimg/mkbootimg.c'], '-Icore/include')
link('mkbootimg', libminicrypt + libmkbootimg, nil)


adbdfiles = %w(
  adb.cpp
  adb_auth.cpp
  adb_io.cpp
  adb_listeners.cpp
  adb_utils.cpp
  sockets.cpp
  transport.cpp
  transport_local.cpp
  transport_usb.cpp

  fdevent.cpp
  get_my_path_linux.cpp
  usb_linux.cpp

  adb_auth_host.cpp
)
libadbd = compile(expand('core/adb', adbdfiles), '-DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include')

adbfiles = %w(
  adb_main.cpp
  console.cpp
  commandline.cpp
  adb_client.cpp
  services.cpp
  file_sync_client.cpp
)
libadb = compile(expand('core/adb', adbfiles), '-DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include')

basefiles = %w(
  file.cpp
  stringprintf.cpp
  strings.cpp
)
libbase = compile(expand('core/base', basefiles), '-DADB_HOST=1 -Icore/base/include -Icore/include')

logfiles = %w(
  logd_write.c
  log_event_write.c
  fake_log_device.c
)
liblog = compile(expand('core/liblog', logfiles), '-DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include')

cutilsfiles = %w(
  load_file.c
  socket_inaddr_any_server.c
  socket_local_client.c
  socket_local_server.c
  socket_loopback_client.c
  socket_loopback_server.c
  socket_network_client.c
)
libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include')

link('adb', libbase + liblog + libcutils + libadbd + libadb, '-lrt -ldl -lpthread -lssl -lcrypto')


fastbootfiles = %w(
  protocol.c
  engine.c
  bootimg_utils.cpp
  fastboot.cpp
  util.c
  fs.c
  usb_linux.c
  util_linux.c
)
libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/include -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -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')

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 -Ilibselinux/include')

selinuxfiles = %w(
  src/callbacks.c
  src/check_context.c
  src/freecon.c
  src/init.c
  src/label.c
  src/label_file.c
  src/label_android_property.c
)
libselinux = compile(expand('libselinux', selinuxfiles), '-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include')

link('fastboot', libsparse + libzip + liblog + libutil + libbase + libext4 + libselinux + libfastboot, '-lz -lpcre')
diff --git a/testing/android-tools/musl-fixes.patch b/testing/android-tools/musl-fixes.patch
new file mode 100644
index 0000000000..4c093ce918
--- /dev/null
+++ b/testing/android-tools/musl-fixes.patch
@@ -0,0 +1,164 @@
This patch has been taken from the Void Linux distribution.

https://github.com/voidlinux/void-packages/tree/master/srcpkgs/android-tools/patches/android-tools-musl.patch

diff --git core/include/ziparchive/zip_archive.h core/include/ziparchive/zip_archive.h
index 7dc60ae..8886a35 100644
--- core/include/ziparchive/zip_archive.h
+++ core/include/ziparchive/zip_archive.h
@@ -22,11 +22,12 @@
 
 #include <stdint.h>
 #include <string.h>
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <utils/Compat.h>
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
 
 /* Zip compression methods we support */
 enum {
@@ -215,6 +216,8 @@ int GetFileDescriptor(const ZipArchiveHandle handle);
 
 const char* ErrorCodeString(int32_t error_code);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif  // LIBZIPARCHIVE_ZIPARCHIVE_H_
diff --git core/liblog/log_portability.h core/liblog/log_portability.h
index 3ad2060..2b859c4 100644
--- core/liblog/log_portability.h
+++ core/liblog/log_portability.h
@@ -17,7 +17,6 @@
 #ifndef _LIBLOG_PORTABILITY_H__
 #define _LIBLOG_PORTABILITY_H__
 
-#include <sys/cdefs.h>
 #include <unistd.h>
 
 /* Helpful private sys/cdefs.h like definitions */

diff --git core/include/private/android_filesystem_config.h core/include/private/android_filesystem_config.h
index c220a0c..d38f971 100644
--- core/include/private/android_filesystem_config.h
+++ core/include/private/android_filesystem_config.h
@@ -22,7 +22,6 @@
 #ifndef _ANDROID_FILESYSTEM_CONFIG_H_
 #define _ANDROID_FILESYSTEM_CONFIG_H_
 
-#include <sys/cdefs.h>
 #include <sys/types.h>
 #include <stdint.h>
 
@@ -230,7 +229,10 @@ struct fs_path_config {
 
 /* Rules for directories and files has moved to system/code/libcutils/fs_config.c */
 
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 
 /*
  * Used in:
@@ -247,7 +249,9 @@ void fs_config(const char *path, int dir, const char *target_out_path,
 
 ssize_t fs_config_generate(char *buffer, size_t length, const struct fs_path_config *pc);
 
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
 
 #endif
 #endif
diff --git core/base/file.cpp core/base/file.cpp
index da1adba..7ba6d23 100644
--- core/base/file.cpp
+++ core/base/file.cpp
@@ -111,7 +111,7 @@ bool WriteStringToFile(const std::string& content, const std::string& path,
 
 bool WriteStringToFile(const std::string& content, const std::string& path) {
   int flags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC | O_NOFOLLOW | O_BINARY;
-  int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, DEFFILEMODE));
+  int fd = TEMP_FAILURE_RETRY(open(path.c_str(), flags, (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)));
   if (fd == -1) {
     return false;
   }
diff --git core/adb/sysdeps.h core/adb/sysdeps.h
index 75dcc86..2dba172 100644
--- core/adb/sysdeps.h
+++ core/adb/sysdeps.h
@@ -757,18 +757,7 @@ static __inline__ int adb_thread_setname(const std::string& name) {
 #ifdef __APPLE__
     return pthread_setname_np(name.c_str());
 #else
-    const char *s = name.c_str();
-
-    // pthread_setname_np fails rather than truncating long strings.
-    const int max_task_comm_len = 16; // including the null terminator
-    if (name.length() > (max_task_comm_len - 1)) {
-        char buf[max_task_comm_len];
-        strncpy(buf, name.c_str(), sizeof(buf) - 1);
-        buf[sizeof(buf) - 1] = '\0';
-        s = buf;
-    }
-
-    return pthread_setname_np(pthread_self(), s) ;
+    return 0;
 #endif
 }
 
diff --git core/adb/diagnose_usb.cpp core/adb/diagnose_usb.cpp
index 0f067b0..1138f8d 100644
--- core/adb/diagnose_usb.cpp
+++ core/adb/diagnose_usb.cpp
@@ -32,28 +32,7 @@ static const char kPermissionsHelpUrl[] = "http://developer.android.com/tools/de
 // Returns a message describing any potential problems we find with udev, or nullptr if we can't
 // find plugdev information (i.e. udev is not installed).
 static const char* GetUdevProblem() {
-#if defined(__linux__)
-    errno = 0;
-    group* plugdev_group = getgrnam("plugdev");
-
-    if (plugdev_group == nullptr) {
-        if (errno != 0) {
-            perror("failed to read plugdev group info");
-        }
-        // We can't give any generally useful advice here, just let the caller print the help URL.
-        return nullptr;
-    }
-
-    // getgroups(2) indicates that the group_member() 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) {
-        // The user is in plugdev so the problem is likely with the udev rules.
-        return "verify udev rules";
-    }
-    return "udev requires plugdev group membership";
-#else
     return nullptr;
-#endif
 }
 
 // Short help text must be a single line, and will look something like:
diff --git core/fastboot/socket.cpp core/fastboot/socket.cpp
index 14ecd93..aff905c 100644
--- core/fastboot/socket.cpp
+++ core/fastboot/socket.cpp
@@ -31,6 +31,8 @@
 #include <android-base/errors.h>
 #include <android-base/stringprintf.h>
 
+#include <sys/select.h>
+
 Socket::Socket(cutils_socket_t sock) : sock_(sock) {}
 
 Socket::~Socket() {
-- 
2.11.0



---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---