diff --git a/srcpkgs/android-tools/files/generate_build.rb b/srcpkgs/android-tools/files/generate_build.rb new file mode 100755 index 00000000000..e9319557b62 --- /dev/null +++ b/srcpkgs/android-tools/files/generate_build.rb @@ -0,0 +1,415 @@ +#!/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/srcpkgs/android-tools/patches/android-tools-musl.patch b/srcpkgs/android-tools/patches/android-tools-musl.patch deleted file mode 100644 index e3630ce48c4..00000000000 --- a/srcpkgs/android-tools/patches/android-tools-musl.patch +++ /dev/null @@ -1,160 +0,0 @@ -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 - #include --#include - #include - #include - --__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 - #include - - /* 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 - #include - #include - -@@ -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 - #include - -+#include -+ - Socket::Socket(cutils_socket_t sock) : sock_(sock) {} - - Socket::~Socket() { diff --git a/srcpkgs/android-tools/patches/android-tools-uchar.patch b/srcpkgs/android-tools/patches/android-tools-uchar.patch deleted file mode 100644 index 2656c43948f..00000000000 --- a/srcpkgs/android-tools/patches/android-tools-uchar.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- core/include/cutils/jstring.h.orig 2017-04-13 09:40:53.139449328 +0200 -+++ core/include/cutils/jstring.h 2017-04-13 09:39:36.520748834 +0200 -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - #ifdef __cplusplus - extern "C" { diff --git a/srcpkgs/android-tools/patches/android-tools.patch b/srcpkgs/android-tools/patches/android-tools.patch deleted file mode 100644 index 5089eb7f1c0..00000000000 --- a/srcpkgs/android-tools/patches/android-tools.patch +++ /dev/null @@ -1,822 +0,0 @@ -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 -+#include - - 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 - #include - #include -+#include - #include - #include - -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 - #include -+#ifdef __cplusplus -+#include -+using namespace std; -+#else - #include -+#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 - - #ifdef __cplusplus -+#include - 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 - #include -+#include - #include - #include - #include -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/srcpkgs/android-tools/patches/gcc-fixes.patch b/srcpkgs/android-tools/patches/gcc-fixes.patch new file mode 100644 index 00000000000..fc0e60fa06e --- /dev/null +++ b/srcpkgs/android-tools/patches/gcc-fixes.patch @@ -0,0 +1,30 @@ +--- core/adb/sysdeps.h ++++ core/adb/sysdeps.h +@@ -66,6 +66,11 @@ + #endif + #endif + ++#ifndef __clang__ ++#define _Nonnull ++#define _Nullable ++#endif ++ + #ifdef _WIN32 + + // Clang-only nullability specifiers +--- core/libcutils/include/cutils/trace.h ++++ core/libcutils/include/cutils/trace.h +@@ -18,7 +18,13 @@ + #define _LIBS_CUTILS_TRACE_H + + #include ++// https://gcc.gnu.org/PR60932 ++#ifdef __cplusplus ++#include ++using namespace std; ++#else + #include ++#endif + #include + #include + #include diff --git a/srcpkgs/android-tools/patches/musl-fixes.patch b/srcpkgs/android-tools/patches/musl-fixes.patch new file mode 100644 index 00000000000..235ef68854e --- /dev/null +++ b/srcpkgs/android-tools/patches/musl-fixes.patch @@ -0,0 +1,199 @@ +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 + + #include ++#include + #include + #include + #include +@@ -28,7 +29,7 @@ + #include + #include + +-#include ++#include + + #include + #include +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 + + #include ++#include + + #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 ++#include + + 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 + #include + #include ++#include + + #include + #include +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 + #include + #include ++#include + + // 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 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 ++ + #include + #include + +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 + #include + #include ++#include + #include + + #include +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 +-#include ++#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 + #include + #include +-#include ++#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 + #include ++#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 +-#endif + + #include + #include +@@ -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__ diff --git a/srcpkgs/android-tools/template b/srcpkgs/android-tools/template index 0e68193059a..610f05bfcda 100644 --- a/srcpkgs/android-tools/template +++ b/srcpkgs/android-tools/template @@ -1,33 +1,75 @@ # Template file for 'android-tools' pkgname=android-tools -_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 -version=${_distver/_/} -revision=6 +version=8.1.0r14 +revision=1 +_distver=${version/r/_r} create_wrksrc=yes -build_style=gnu-makefile -hostmakedepends="git" -makedepends="zlib-devel libressl-devel pcre-devel" +hostmakedepends="ruby cmake ninja perl go" +makedepends="gtest-devel zlib-devel libressl-devel libusb-devel pcre2-devel" short_desc="Android platform tools (adb and fastboot)" maintainer="Eivind Uggedal " -license="Apache-2.0 BSD GPL-2" +license="Apache-2.0 ISC GPL-2 MIT" homepage="http://developer.android.com/tools/help/adb.html" +_baseurl=https://android.googlesource.com/platform +distfiles=" + ${_baseurl}/system/core/+archive/ac8169f45dc9e5332d3ec24d0b14f812668b0c8e.tar.gz>core.tar.gz + ${_baseurl}/system/extras/+archive/e563ed1bca5ea0421f654eef82d758ec25c10bdd.tar.gz>extras.tar.gz + ${_baseurl}/external/selinux/+archive/90efe04c55f82a7ea166c913405758fd91bc9aa9.tar.gz>selinux.tar.gz + ${_baseurl}/external/f2fs-tools/+archive/a3f779d308a10d7e6b87cf0134445e7378de4770.tar.gz>f2fs-tools.tar.gz + ${_baseurl}/external/e2fsprogs/+archive/6bdf355a7c96ddd5eb867778d857de82fca793a5.tar.gz>e2fsprogs.tar.gz + https://boringssl.googlesource.com/boringssl/+archive/a20bb7ff8bb5057065a2e7941249773f9676cf45.tar.gz>boringssl.tar.gz" +# Contents checksums because the tarballs change with every download +checksum="@ce40cf2757bdd87d458655dc00d8ad835c69304ecab88faa7eb7e514712ba98d + @7f697f84f3454658ecc609620be344f3496603605158304f2cd1055f143a07c6 + @4c7d9b0650f47e83f75088c3fbbedab45e9f1a15081fa20f25104558eb81e406 + @ae8c85b3db0f5bdc9b01eacb8b0490e5a34c9d20a9ed962d8b9942b3451c6111 + @e4ab1880f0f043da29a04f1c446155f365933a4e46a9f4e8865ec104f64a982b + @748945a2c1f50c40286c963bd4e7a08a8e5bd450a6dc71a9de1a2b451d614a38" -broken="https://github.com/voidlinux/void-packages/issues/9146" +nocross="error: requested alignment 64 is larger than 8 [-Werror=attributes]" -do_fetch() { - local r - 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) +do_extract() { + local tarball p + for p in ${distfiles}; do + tarball=${p##*>} + mkdir -p ${wrksrc}/${tarball/.*} + tar -x --no-same-permissions --no-same-owner -f \ + ${XBPS_SRCDISTDIR}/${pkgname}-${version}/${tarball} \ + -C ${wrksrc}/${tarball/.*} done } -post_install() { - vlicense gtest/COPYING +pre_configure() { + PKGVER=${_distver} ${FILESDIR}/generate_build.rb > build.ninja + + mkdir -p boringssl/build + cd boringssl/build + + cmake -GNinja \ + -DBUILD_SHARED_LIBS=FALSE \ + -DCMAKE_BUILD_TYPE=RELEASE \ + -DCMAKE_CXX_FLAGS="$CXXFLAGS" \ + -DCMAKE_C_FLAGS="$CFLAGS" \ + .. + ninja +} + +do_build() { + ninja +} + +do_install() { + for i in adb fastboot mke2fs.android e2fsdroid ext2simg \ + core/mkbootimg/mkbootimg ;do + vbin $i + done + vlicense boringssl/LICENSE boringssl.LICENSE + vlicense boringssl/third_party/fiat/LICENSE fiat.LICENSE + vlicense boringssl/third_party/googletest/LICENSE gtest.LICENSE + vlicense boringssl/third_party/android-cmake/LICENSE android-cmake.LICENSE vsv adb }