summaryrefslogtreecommitdiff
path: root/development/android-tools/generate_build.rb
diff options
context:
space:
mode:
authorPhilip van der Hoeven <philip@vd-hoeven.nl>2017-11-01 21:07:17 +0000
committerDavid Spencer <idlemoor@slackbuilds.org>2017-11-03 23:18:35 +0000
commitdedec715f4b01118c874076fa29dab0eafd0e61b (patch)
tree25382bc1c3f5169480c959e3e6da99253cb27795 /development/android-tools/generate_build.rb
parent5926dc0a445b9cd11f28ec2b4ea5bfcfd2adcb00 (diff)
downloadslackbuilds-dedec715f4b01118c874076fa29dab0eafd0e61b.tar.gz
development/android-tools: Updated for version 8.0.0_r24.
Signed-off-by: David Spencer <idlemoor@slackbuilds.org>
Diffstat (limited to 'development/android-tools/generate_build.rb')
-rw-r--r--development/android-tools/generate_build.rb179
1 files changed, 139 insertions, 40 deletions
diff --git a/development/android-tools/generate_build.rb b/development/android-tools/generate_build.rb
index bc597a32af..cb3e1e685c 100644
--- a/development/android-tools/generate_build.rb
+++ b/development/android-tools/generate_build.rb
@@ -14,67 +14,95 @@ def compile(sources, cflags)
outputs = []
for s in sources
ext = File.extname(s)
-
+
case ext
when '.c'
- cc = 'clang'
- lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
+ cc = 'cc'
+ lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
when '.cpp', '.cc'
- cc = 'clang++'
- lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
+ cc = 'cxx'
+ lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
else
raise "Unknown extension #{ext}"
end
output = s + '.o'
outputs << output
- puts "echo Compiling #{output}\n"
- puts "#{cc} -o #{output} #{lang_flags} #{cflags} -c #{s}\n"
+ 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 "echo Linking #{output}\n"
- puts "g++ -o #{output} #{ldflags} $LDFLAGS #{objects.join(' ')}"
+ 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_auth.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
- sysdeps_unix.cpp
-
+ transport_mdns_unsupported.cpp
fdevent.cpp
- get_my_path_linux.cpp
- usb_linux.cpp
-
adb_auth_host.cpp
shell_service_protocol.cpp
)
-libadbd = compile(expand('core/adb', adbdfiles), '-DADB_REVISION=\"$PKGVER\" -DADB_HOST=1 -fpermissive -Icore/include -Icore/base/include -Icore/adb')
+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(
- bugreport.cpp
console.cpp
+ socket_spec.cpp
commandline.cpp
adb_client.cpp
services.cpp
file_sync_client.cpp
+ sysdeps_unix.cpp
+ sysdeps/errno.cpp
+ sysdeps/posix/network.cpp
client/main.cpp
+ client/usb_dispatch.cpp
+ client/usb_linux.cpp
+ client/usb_libusb.cpp
)
-libadb = compile(expand('core/adb', adbfiles), '-D_GNU_SOURCE -DADB_HOST=1 -DWORKAROUND_BUG6558362 -fpermissive -Icore/include -Icore/base/include -Icore/adb')
+libadb = compile(expand('core/adb', adbfiles), '-D_GNU_SOURCE -DADB_HOST=1 -Icore/include -Icore/base/include -Icore/adb')
basefiles = %w(
file.cpp
@@ -83,6 +111,7 @@ basefiles = %w(
stringprintf.cpp
strings.cpp
errors_unix.cpp
+ test_utils.cpp
)
libbase = compile(expand('core/base', basefiles), '-DADB_HOST=1 -Icore/base/include -Icore/include')
@@ -92,31 +121,46 @@ logfiles = %w(
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=1005 -DFAKE_LOG_DEVICE=1 -D_GNU_SOURCE -Icore/log/include -Icore/include')
+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
+ canned_fs_config.c
+ fs_config.cpp
socket_local_client_unix.c
- socket_loopback_client_unix.c
socket_network_client_unix.c
- socket_loopback_server_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
)
-libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include')
+libcutils = compile(expand('core/libcutils', cutilsfiles), '-D_GNU_SOURCE -Icore/include -Icore/libcutils/include')
diagnoseusbfiles = %w(
diagnose_usb.cpp
)
libdiagnoseusb = compile(expand('core/adb', diagnoseusbfiles), '-Icore/include -Icore/base/include')
-link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb, '-lpthread -lcrypto')
+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(
@@ -127,12 +171,11 @@ fastbootfiles = %w(
util.cpp
fs.cpp
usb_linux.cpp
- util_linux.cpp
socket.cpp
tcp.cpp
udp.cpp
)
-libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_REVISION=\"$PKGVER\" -D_GNU_SOURCE -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils -Iextras/f2fs_utils')
+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')
sparsefiles = %w(
backed_block.c
@@ -140,9 +183,16 @@ sparsefiles = %w(
sparse.c
sparse_crc32.c
sparse_err.c
- sparse_read.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
)
-libsparse = compile(expand('core/libsparse', sparsefiles), '-Icore/libsparse/include')
+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
@@ -167,18 +217,67 @@ ext4files = %w(
crc16.c
ext4_sb.c
)
-libext4 = compile(expand('extras/ext4_utils', ext4files), '-Icore/libsparse/include -Icore/include -Ilibselinux/include')
+libext4 = compile(expand('extras/ext4_utils', ext4files), '-D_GNU_SOURCE -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -DANDROID -DHOST=1')
+
+make_ext4files = %w(
+ make_ext4fs_main.c
+)
+libmake_ext4 = compile(expand('extras/ext4_utils', make_ext4files), '-DANDROID -Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include -DHOST=1')
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
- src/label_support.c
-)
-libselinux = compile(expand('libselinux', selinuxfiles), '-DAUDITD_LOG_TAG=1003 -D_GNU_SOURCE -DHOST -Ilibselinux/include')
-
-link('fastboot', libsparse + libzip + libcutils + liblog + libutil + libbase + libext4 + libselinux + libfastboot + libdiagnoseusb, '-lz -lpcre -lpthread')
+ 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')
+link('make_ext4fs', libmake_ext4 + libzip + libcutils + liblog + libutil + libbase + libext4 + libselinux + libsepol + libsparse, '-lz -lpcre2-8 -lpthread')