[arch-commits] Commit in android-tools/trunk (PKGBUILD generate_build.rb)
Anatol Pomozov
anatolik at archlinux.org
Mon Aug 28 20:53:34 UTC 2017
Date: Monday, August 28, 2017 @ 20:53:33
Author: anatolik
Revision: 254682
Build boringssl project from upstream
Currently Android tools are build against boringssl headers and linked with systems openssl
library. It is obviously wrong and we should follow Android practice of linking with boringssl.
Unfortunately boringssl from Android tree use *.bp files and there is no easy way to build just
boringssl library. So we build upstream boringssl using CMake and then statically link it with adb.
Modified:
android-tools/trunk/PKGBUILD
android-tools/trunk/generate_build.rb
-------------------+
PKGBUILD | 10 ++++++----
generate_build.rb | 38 ++++++++++++++++++--------------------
2 files changed, 24 insertions(+), 24 deletions(-)
Modified: PKGBUILD
===================================================================
--- PKGBUILD 2017-08-28 20:53:22 UTC (rev 254681)
+++ PKGBUILD 2017-08-28 20:53:33 UTC (rev 254682)
@@ -10,14 +10,14 @@
arch=(i686 x86_64)
url='http://tools.android.com/'
license=(Apache MIT)
-depends=(pcre2 libusb ruby ninja)
+depends=(pcre2 libusb)
optdepends=('python: for mkbootimg script')
-makedepends=(git clang gtest)
+makedepends=(git clang gtest ruby cmake ninja)
source=(git+https://android.googlesource.com/platform/system/core#tag=android-$pkgver
git+https://android.googlesource.com/platform/system/extras#tag=android-$pkgver
- git+https://android.googlesource.com/platform/external/boringssl#tag=android-$pkgver
git+https://android.googlesource.com/platform/external/selinux#tag=android-$pkgver
git+https://android.googlesource.com/platform/external/f2fs-tools#tag=android-$pkgver
+ git+https://boringssl.googlesource.com/boringssl
generate_build.rb
fix_build_core.patch
fix_build_selinux.patch
@@ -28,7 +28,7 @@
'SKIP'
'SKIP'
'SKIP'
- '578973cebe0a496bf5e83d2c6dd2c29d283637e7'
+ '12b6bc1cbf850958850c3e4a5bc19d8b32f845b9'
'45e41bab3633bb0be96b238aae3164a5c90721f1'
'ec473160d7445f97bccabd1c32ac0ae2f77900c1'
'7004dbd0c193668827174880de6f8434de8ceaee')
@@ -41,6 +41,8 @@
cd $srcdir/selinux
patch -p1 < ../fix_build_selinux.patch
+
+ mkdir $srcdir/boringssl/build && cd $srcdir/boringssl/build && cmake -GNinja ..; ninja
}
build() {
Modified: generate_build.rb
===================================================================
--- generate_build.rb 2017-08-28 20:53:22 UTC (rev 254681)
+++ generate_build.rb 2017-08-28 20:53:33 UTC (rev 254682)
@@ -17,11 +17,11 @@
case ext
when '.c'
- cc = 'cc'
- lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
+ cc = 'cc'
+ lang_flags = '-std=gnu11 $CFLAGS $CPPFLAGS'
when '.cpp', '.cc'
- cc = 'cxx'
- lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
+ cc = 'cxx'
+ lang_flags = '-std=gnu++14 $CXXFLAGS $CPPFLAGS'
else
raise "Unknown extension #{ext}"
end
@@ -34,6 +34,13 @@
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"
@@ -120,7 +127,7 @@
stderr_write.c
logprint.c
)
-liblog = compile(expand('core/liblog', logfiles), '-DLIBLOG_LOG_TAG=1006 -DFAKE_LOG_DEVICE=1 -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
@@ -141,27 +148,18 @@
)
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')
-boringsslfiles = %w(
- crypto/bn/convert.c
- crypto/bn/bn.c
- crypto/bio/file.c
- crypto/bytestring/cbb.c
- crypto/buf/buf.c
- crypto/mem.c
- crypto/base64/base64.c
-)
-boringssl = compile(expand('boringssl/src', boringsslfiles), '-DBORINGSSL_ANDROID_SYSTEM -DOPENSSL_SMALL -DBORINGSSL_IMPLEMENTATION -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')
-link('adb', libbase + liblog + libcutils + libadbd + libadb + libdiagnoseusb + libcrypto + boringssl, '-lpthread -lcrypto -lusb-1.0')
-
fastbootfiles = %w(
protocol.cpp
engine.cpp
@@ -174,7 +172,7 @@
tcp.cpp
udp.cpp
)
-libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_REVISION="\"$PKGVER\"" -D_GNU_SOURCE -DUSE_F2FS -Icore/base/include -Icore/include -Icore/adb -Icore/libsparse/include -Icore/mkbootimg -Iextras/ext4_utils/include -Iextras/f2fs_utils')
+libfastboot = compile(expand('core/fastboot', fastbootfiles), '-DFASTBOOT_REVISION="\"$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
@@ -216,7 +214,7 @@
crc16.c
ext4_sb.c
)
-libext4 = compile(expand('extras/ext4_utils', ext4files), '-Icore/libsparse/include -Icore/include -Iselinux/libselinux/include -Iextras/ext4_utils/include')
+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
More information about the arch-commits
mailing list