diff --git a/0001-Add-string-h.patch b/0001-Add-string-h.patch new file mode 100644 index 0000000..e325c04 --- /dev/null +++ b/0001-Add-string-h.patch @@ -0,0 +1,36 @@ +diff --git a/base/errors_unix.cpp b/base/errors_unix.cpp +index 296995e..48269b6 100644 +--- a/base/errors_unix.cpp ++++ b/base/errors_unix.cpp +@@ -17,6 +17,7 @@ + #include "android-base/errors.h" + + #include ++#include + + namespace android { + namespace base { +diff --git a/base/file.cpp b/base/file.cpp +index da1adba..91a3901 100644 +--- a/base/file.cpp ++++ b/base/file.cpp +@@ -20,6 +20,7 @@ + #include + #include + #include ++#include + + #include + +diff --git a/base/logging.cpp b/base/logging.cpp +index 1741871..0f9e11a 100644 +--- a/base/logging.cpp ++++ b/base/logging.cpp +@@ -29,6 +29,7 @@ + #include + #endif + ++#include + #include + #include + #include diff --git a/0001-Remove-android-selinux-header.patch b/0001-Remove-android-selinux-header.patch deleted file mode 100644 index e78a664..0000000 --- a/0001-Remove-android-selinux-header.patch +++ /dev/null @@ -1,38 +0,0 @@ -From 239a63ace3d94c44561580f7e4d0db3e95cd557f Mon Sep 17 00:00:00 2001 -From: Jonathan Dieter -Date: Fri, 26 Dec 2014 17:04:54 +0200 -Subject: [PATCH 1/2] Remove android selinux header - -Signed-off-by: Jonathan Dieter ---- - ext4_utils/make_ext4fs.c | 1 - - f2fs_utils/f2fs_ioutils.c | 1 - - 2 files changed, 2 deletions(-) - -diff --git a/ext4_utils/make_ext4fs.c b/ext4_utils/make_ext4fs.c -index 2f89ae8..732afbe 100644 ---- a/ext4_utils/make_ext4fs.c -+++ b/ext4_utils/make_ext4fs.c -@@ -62,7 +62,6 @@ - - #include - #include --#include - - #define O_BINARY 0 - -diff --git a/f2fs_utils/f2fs_ioutils.c b/f2fs_utils/f2fs_ioutils.c -index 53b7b4b..2706d04 100644 ---- a/f2fs_utils/f2fs_ioutils.c -+++ b/f2fs_utils/f2fs_ioutils.c -@@ -78,7 +78,6 @@ struct selabel_handle; - - #include - #include --#include - - #define O_BINARY 0 - --- -2.1.0 - diff --git a/adb-Makefile b/adb-Makefile deleted file mode 100644 index b089eeb..0000000 --- a/adb-Makefile +++ /dev/null @@ -1,67 +0,0 @@ -SRCS+= adb.c -SRCS+= adb_client.c -SRCS+= adb_auth_host.c -SRCS+= commandline.c -SRCS+= console.c -SRCS+= file_sync_client.c -SRCS+= fdevent.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+= 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 -SRCS+= load_file.c - -VPATH+= ../libzipfile -SRCS+= centraldir.c -SRCS+= zipfile.c - -VPATH+= ../libmincrypt -SRCS+= rsa.c -SRCS+= sha256.c -SRCS+= sha.c -SRCS+= p256.c -SRCS+= p256_ec.c -SRCS+= p256_ecdsa.c - -CPPFLAGS+= -DADB_HOST=1 -CPPFLAGS+= -DHAVE_FORKEXEC=1 -CPPFLAGS+= -DHAVE_SYMLINKS -CPPFLAGS+= -DHAVE_TERMIO_H -CPPFLAGS+= -D_GNU_SOURCE -CPPFLAGS+= -D_XOPEN_SOURCE -CPPFLAGS+= -D_FILE_OFFSET_BITS=64 -CPPFLAGS+= -DHAVE_OFF64_T -CPPFLAGS+= -I. -CPPFLAGS+= -I../include - -CFLAGS+= $(RPM_OPT_FLAGS) -LIBS= -lrt -lpthread -lz -lcrypto -LDFLAGS+= $(RPM_LD_FLAGS) - -CC= $(TOOLCHAIN)gcc -LD= $(TOOLCHAIN)gcc - -OBJS= $(SRCS:.c=.o) - -all: adb - -adb: $(OBJS) - $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) - -install: adb - install adb $(DESTDIR)$(BINDIR) - -clean: - rm -rf $(OBJS) diff --git a/android-tools.spec b/android-tools.spec index b617558..7c1c142 100644 --- a/android-tools.spec +++ b/android-tools.spec @@ -1,15 +1,15 @@ -%global date 20141219 -%global git_commit 8393e50 +%global date 20160321 +%global git_commit 922e151ba2d8 %global packdname core-%{git_commit} -%global extras_git_commit 1e7d4f3 +%global extras_git_commit ea4a5a4 %global extras_packdname extras-%{extras_git_commit} %global _hardened_build 1 Name: android-tools Version: %{date}git%{git_commit} -Release: 5%{?dist} +Release: 1%{?dist} Summary: Android platform tools(adb, fastboot) Group: Applications/System @@ -25,14 +25,10 @@ URL: http://developer.android.com/guide/developing/tools/ Source0: %{packdname}.tar.xz Source1: %{extras_packdname}.tar.xz -Source2: core-Makefile -Source3: adb-Makefile -Source4: fastboot-Makefile +Source2: generate_build.rb Source5: 51-android.rules Source6: adb.service -# None of the code *we* compile uses anything from selinux/android.h, but -# other code may, so not upstreaming these patches -Patch1: 0001-Remove-android-selinux-header.patch +Patch1: 0001-Add-string-h.patch Requires(post): systemd Requires(preun): systemd Requires(postun): systemd @@ -40,6 +36,7 @@ BuildRequires: zlib-devel BuildRequires: openssl-devel BuildRequires: libselinux-devel BuildRequires: f2fs-tools-devel +BuildRequires: gtest-devel BuildRequires: systemd Provides: adb @@ -67,20 +64,18 @@ setup between the host and the target phone as adb. %prep %setup -q -b 1 -n extras -%patch1 -p1 %setup -q -b 0 -n %{packdname} -cp -p %{SOURCE2} Makefile -cp -p %{SOURCE3} adb/Makefile -cp -p %{SOURCE4} fastboot/Makefile +%patch1 -p1 cp -p %{SOURCE5} 51-android.rules %build -make %{?_smp_mflags} +ruby %{SOURCE2} | tee build.sh +PKGVER=%{git_commit} sh -xe build.sh %install install -d -m 0755 ${RPM_BUILD_ROOT}%{_bindir} install -d -m 0775 ${RPM_BUILD_ROOT}%{_sharedstatedir}/adb -make install DESTDIR=$RPM_BUILD_ROOT BINDIR=%{_bindir} +install -m 0755 -t ${RPM_BUILD_ROOT}%{_bindir} adb/adb fastboot/fastboot install -p -D -m 0644 %{SOURCE6} \ %{buildroot}%{_unitdir}/adb.service @@ -104,6 +99,10 @@ install -p -D -m 0644 %{SOURCE6} \ %changelog +* Wed Mar 26 2016 Ivan Afonichev - 20160321git922e151ba2d8-1 +- Update to upstream git commit 922e151ba2d8 +- Resolves: rhbz 1278769 1318099 Migrate to ruby generate_build. Support new versions + * Wed Feb 03 2016 Fedora Release Engineering - 20141219git8393e50-5 - Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild diff --git a/core-Makefile b/core-Makefile deleted file mode 100644 index 17f7152..0000000 --- a/core-Makefile +++ /dev/null @@ -1,11 +0,0 @@ -all: - $(MAKE) -C adb all - $(MAKE) -C fastboot all - -install: - $(MAKE) -C adb install - $(MAKE) -C fastboot install - -clean: - $(MAKE) -C adb clean - $(MAKE) -C fastboot clean diff --git a/fastboot-Makefile b/fastboot-Makefile deleted file mode 100644 index a139c61..0000000 --- a/fastboot-Makefile +++ /dev/null @@ -1,72 +0,0 @@ -SRCS+= protocol.c -SRCS+= engine.c -SRCS+= bootimg.c -SRCS+= fastboot.c -SRCS+= usb_linux.c -SRCS+= util_linux.c -SRCS+= util.c -SRCS+= fs.c - -VPATH+= ../libzipfile -SRCS+= centraldir.c -SRCS+= zipfile.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+= ../../extras/ext4_utils -SRCS+= allocate.c -SRCS+= contents.c -SRCS+= ext4_utils.c -SRCS+= extent.c -SRCS+= indirect.c -SRCS+= make_ext4fs.c -SRCS+= sha1.c -SRCS+= uuid.c -SRCS+= wipe.c -SRCS+= crc16.c -SRCS+= ext4_sb.c - -VPATH+= ../../extras/f2fs_utils -SRCS+= f2fs_ioutils.c - -CPPFLAGS+= -DADB_HOST=1 -CPPFLAGS+= -DHAVE_FORKEXEC=1 -CPPFLAGS+= -DHAVE_SYMLINKS -CPPFLAGS+= -DHAVE_TERMIO_H -CPPFLAGS+= -D_GNU_SOURCE -CPPFLAGS+= -D_XOPEN_SOURCE -CPPFLAGS+= -D_FILE_OFFSET_BITS=64 -CPPFLAGS+= -DHAVE_OFF64_T -CPPFLAGS+= -DHAVE_SYS_UIO_H -CPPFLAGS+= -I. -CPPFLAGS+= -I../include -CPPFLAGS+= -I../libsparse/include -CPPFLAGS+= -I../mkbootimg -CPPFLAGS+= -I../../extras/ext4_utils -CPPFLAGS+= -I../../extras/f2fs_utils - -CFLAGS+= $(RPM_OPT_FLAGS) -std=gnu99 -LIBS= -lrt -lpthread -lz -lselinux -LDFLAGS+= $(RPM_LD_FLAGS) - -CC= $(TOOLCHAIN)gcc -LD= $(TOOLCHAIN)gcc - -OBJS= $(SRCS:.c=.o) - -all: fastboot - -fastboot: $(OBJS) - $(LD) -o $@ $(LDFLAGS) $(OBJS) $(LIBS) - -install: fastboot - install fastboot $(DESTDIR)$(BINDIR) - -clean: - rm -rf $(OBJS) diff --git a/generate_build.rb b/generate_build.rb new file mode 100644 index 0000000..6ff62e5 --- /dev/null +++ b/generate_build.rb @@ -0,0 +1,176 @@ +#!/usr/bin/ruby + +# 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++14 $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} #{ldflags} $LDFLAGS #{objects.join(' ')}" +end + +minicryptfiles = %w( + dsa_sig.c + p256_ec.c + rsa.c + sha.c + p256.c + p256_ecdsa.c + sha256.c +) +libminicrypt = compile(expand('libmincrypt', minicryptfiles), '-Iinclude') + +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 + services.cpp + adb_trace.cpp + get_my_path_linux.cpp + usb_linux.cpp + diagnose_usb.cpp + adb_auth_host.cpp + sysdeps_unix.cpp +) +libadbd = compile(expand('adb', adbdfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=1 -fpermissive -Iinclude -Ibase/include') + +adbshfiles = %w( + fdevent.cpp + shell_service.cpp + shell_service_protocol.cpp +) +libadbsh = compile(expand('adb', adbshfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=0 -D_Nonnull= -D_Nullable= -fpermissive -Iadb -Iinclude -Ibase/include') + +adbfiles = %w( + console.cpp + commandline.cpp + adb_client.cpp + file_sync_client.cpp + line_printer.cpp + client/main.cpp +) +libadb = compile(expand('adb', adbfiles), '-DADB_REVISION=\"$PKGVER\" -D_GNU_SOURCE -DADB_HOST=1 -D_Nonnull= -D_Nullable= -fpermissive -Iadb -Iinclude -Ibase/include') + +basefiles = %w( + file.cpp + logging.cpp + parsenetaddress.cpp + stringprintf.cpp + strings.cpp + errors_unix.cpp +) +libbase = compile(expand('base', basefiles), '-DADB_HOST=1 -D_GNU_SOURCE -Ibase/include -Iinclude') + +logfiles = %w( + logd_write.c + log_event_list.c + log_event_write.c + fake_log_device.c +) +liblog = compile(expand('liblog', logfiles), '-DLIBLOG_LOG_TAG=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Ilog/include -Iinclude') + +cutilsfiles = %w( + load_file.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 + threads.c + sockets.cpp + sockets_unix.cpp +) +libcutils = compile(expand('libcutils', cutilsfiles), '-D_GNU_SOURCE -Iinclude') + +link('adb/adb', libbase + liblog + libcutils + libadbd + libadbsh + libadb, '-lrt -ldl -lpthread -lcrypto -lutil') + + +fastbootfiles = %w( + socket.cpp + tcp.cpp + udp.cpp + protocol.cpp + engine.cpp + bootimg_utils.cpp + fastboot.cpp + util.cpp + fs.cpp + usb_linux.cpp + util_linux.cpp +) +libfastboot = compile(expand('fastboot', fastbootfiles), '-DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Iadb -Iinclude -Imkbootimg -Ibase/include -Ilibsparse/include -I../extras/ext4_utils -I../extras/f2fs_utils') + +sparsefiles = %w( + backed_block.c + output_file.c + sparse.c + sparse_crc32.c + sparse_err.c + sparse_read.c +) +libsparse = compile(expand('libsparse', sparsefiles), '-Ilibsparse/include') + +zipfiles = %w( + zip_archive.cc +) +libzip = compile(expand('libziparchive', zipfiles), '-Ibase/include -Iinclude') + +utilfiles = %w( + FileMap.cpp +) +libutil = compile(expand('libutils', utilfiles), '-Iinclude') + +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), '-Ilibsparse/include -Iinclude') + +link('fastboot/fastboot', libsparse + libzip + liblog + libutil + libcutils + libbase + libext4 + libfastboot + libadbsh + libadbd, '-lpthread -lselinux -lz -lcrypto -lutil') + diff --git a/sources b/sources index 56628a0..afa176c 100644 --- a/sources +++ b/sources @@ -1,2 +1,2 @@ -33dcfae4eed6f53d70e4ee0181351bbc extras-1e7d4f3.tar.xz -8655a24339a2aefaca002b02d293ba77 core-8393e50.tar.xz +25e74fdf830ed1d7ea4ac5e4d81830c4 core-922e151ba2d8.tar.xz +fa12e4f713657844216c6870ab6c93ab extras-ea4a5a4.tar.xz