android-tools: update to 7.0.0 ()

This commit is contained in:
Remi Pommarel 2016-10-09 20:41:15 +02:00 committed by Juan RP
parent adbcd6f8ed
commit 1a64a7ba73
4 changed files with 986 additions and 149 deletions

View file

@ -0,0 +1,160 @@
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() {

View file

@ -0,0 +1,822 @@
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 \
+ strdup16to8.c \
+ strdup8to16.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
+
+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)
+

View file

@ -1,141 +0,0 @@
diff --git a/Makefile b/Makefile
new file mode 100644
index 000000000000..4644fc0b62ad
--- /dev/null
+++ Makefile
@@ -0,0 +1,7 @@
+all:
+ $(MAKE) -C core/adb all
+ $(MAKE) -C core/fastboot all
+
+install:
+ $(MAKE) -C core/adb install
+ $(MAKE) -C core/fastboot install
diff --git a/adb/Makefile b/adb/Makefile
new file mode 100644
index 000000000000..557c185293d7
--- /dev/null
+++ core/adb/Makefile
@@ -0,0 +1,46 @@
+SRCS+= adb.c
+SRCS+= adb_auth_host.c
+SRCS+= adb_client.c
+SRCS+= commandline.c
+SRCS+= console.c
+SRCS+= fdevent.c
+SRCS+= file_sync_client.c
+SRCS+= get_my_path_linux.c
+SRCS+= services.c
+SRCS+= sockets.c
+SRCS+= transport.c
+SRCS+= transport_local.c
+SRCS+= transport_usb.c
+SRCS+= usb_linux.c
+SRCS+= usb_vendors.c
+
+VPATH+= ../libcutils
+SRCS+= load_file.c
+SRCS+= socket_inaddr_any_server.c
+SRCS+= socket_local_client.c
+SRCS+= socket_local_server.c
+SRCS+= socket_loopback_client.c
+SRCS+= socket_loopback_server.c
+SRCS+= socket_network_client.c
+
+VPATH+= ../libzipfile
+SRCS+= centraldir.c
+SRCS+= zipfile.c
+
+CPPFLAGS+= -DADB_HOST=1
+CPPFLAGS+= -DHAVE_FORKEXEC=1
+CPPFLAGS+= -DHAVE_OFF64_T=1
+CPPFLAGS+= -I.
+CPPFLAGS+= -I../include
+
+LIBS+= -lcrypto -lpthread -lz
+
+OBJS= $(SRCS:.c=.o)
+
+all: adb
+
+adb: $(OBJS)
+ $(CC) -o $@ $(LDFLAGS) $(OBJS) $(LIBS)
+
+install: adb
+ install -Dm755 adb $(DESTDIR)$(PREFIX)/bin/adb
diff --git a/fastboot/Makefile b/fastboot/Makefile
new file mode 100644
index 000000000000..00ce75b2f4ad
--- /dev/null
+++ core/fastboot/Makefile
@@ -0,0 +1,70 @@
+SRCS+=bootimg.c
+SRCS+=engine.c
+SRCS+=fastboot.c
+SRCS+=protocol.c
+SRCS+=usb_linux.c
+SRCS+=util_linux.c
+SRCS+=util.c
+SRCS+=fs.c
+
+VPATH+= ../libsparse
+SRCS+= backed_block.c
+SRCS+= output_file.c
+SRCS+= sparse.c
+SRCS+= sparse_crc32.c
+SRCS+= sparse_err.c
+SRCS+= sparse_read.c
+
+VPATH+= ../libzipfile
+SRCS+= centraldir.c
+SRCS+= zipfile.c
+
+VPATH+= ../../extras/ext4_utils
+SRCS+= allocate.c
+SRCS+= contents.c
+SRCS+= crc16.c
+SRCS+= ext4_utils.c
+SRCS+= ext4_sb.c
+SRCS+= extent.c
+SRCS+= indirect.c
+SRCS+= make_ext4fs.c
+SRCS+= sha1.c
+SRCS+= uuid.c
+SRCS+= wipe.c
+
+VPATH+= ../../extras/f2fs_utils
+SRCS+= f2fs_utils.c
+SRCS+= f2fs_dlutils.c
+SRCS+= f2fs_ioutils.c
+
+VPATH+= ../../libselinux/src
+SRCS+= callbacks.c
+SRCS+= check_context.c
+SRCS+= freecon.c
+SRCS+= init.c
+SRCS+= label.c
+SRCS+= label_android_property.c
+SRCS+= label_file.c
+
+CPPFLAGS+= -I../include
+CPPFLAGS+= -I../libsparse/include
+CPPFLAGS+= -I../mkbootimg
+CPPFLAGS+= -I../../extras/ext4_utils
+CPPFLAGS+= -I../../extras/f2fs_utils/
+CPPFLAGS+= -I../../libselinux/include
+CPPFLAGS+= -I../../f2fs-tools/include
+CPPFLAGS+= -I../../f2fs-tools/mkfs
+CPPFLAGS+= -DHAVE_OFF64_T=1
+CPPFLAGS+= -std=gnu99
+
+LIBS+= -lz -ldl -lpcre
+
+OBJS= $(SRCS:.c=.o)
+
+all: fastboot
+
+fastboot: $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LIBS) $(LDFLAGS)
+
+install: fastboot
+ install -Dm755 fastboot $(DESTDIR)$(PREFIX)/bin/fastboot

View file

@ -1,6 +1,6 @@
# Template file for 'android-tools'
pkgname=android-tools
_distver=5.1.1_r13
_distver=7.0.0_r5
# NOTE: not all upstream updates has code changes for the parts
# of android used by android-tools. Check for diff with:
# curl -L http://git.io/vvC0Z | sh -s 5.0.2_r1 5.1.0_r1
@ -12,24 +12,20 @@ hostmakedepends="git"
makedepends="zlib-devel libressl-devel pcre-devel"
short_desc="Android platform tools (adb and fastboot)"
maintainer="Eivind Uggedal <eivind@uggedal.com>"
license="Apache-2.0 BSD"
license="Apache-2.0 BSD GPL-2"
homepage="http://developer.android.com/tools/help/adb.html"
do_fetch() {
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
git clone -b android-${_distver} \
https://android.googlesource.com/platform/$r \
${pkgname}-${version}/$(basename $r)
done
}
pre_build() {
sed -i 's/f2fs_sparse_file = NULL/f2fs_sparse_file = 0/g' \
extras/f2fs_utils/f2fs_utils.c
}
post_install() {
vlicense gtest/COPYING
vsv adb
}