Android NDK build tools

This CL enables building with Android NDK in the way that Chromium buildbots do it.

== Overview ==
* Add Android dependencies to DEPS (SDK, NDK, Android test runner). This also makes it possible to use Android's build/android/run_tests.py script to execute tests on Android devices.
* Add a Python script to build the WebRTC Video demo for Android using ndk-build and Ant. This is designed as an annotation script for Buildbots but is also fine to run locally.
* Update Android.mk so it works with the compiler output from a build performed by build/android/buildbot/bb_run_bot.py (which is how Chrome buildbots build).

== Syncing Android dependencies ==
To get the dependencies added in DEPS synced out, you must change the last line
of your .gclient file to look like this:
];target_os = ["android"]

That will append another variable to the .gclient file that causes these
dependencies to be synced during gclient sync.
If you want to get additional platform-specific dependencies in the same
checkout, add them to the list too, e.g. target_os = ["android", "unix"].

== Android.mk ==
The fix in Android.mk is needed since Chrome is building using build/android/buildbot/bb_run_bot.py, which only output the libraries into out/Debug. With the change it works for both that and a normal build (which copies the library files from out/Debug/obj.target/subpath to out/Debug anyway as a part of the build).

== svn:ignore ==
NOTICE: Before submitting, the following directories should be added to svn:ignore in third_party to avoid them from being removed and re-synced for every build:
* android_testrunner
* android_tools
* WebKit
This has to be done in a manual SVN commit since it's not possible to include in a git-svn CL (and I don't want to migrate this to a SVN CL).

BUG=none
TEST=local builds

Review URL: https://webrtc-codereview.appspot.com/1024009

git-svn-id: http://webrtc.googlecode.com/svn/trunk@3497 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
kjellander@webrtc.org 2013-02-11 17:43:19 +00:00
parent 00ab7cf4fd
commit 18a21a03c6
5 changed files with 147 additions and 50 deletions

9
.gitignore vendored
View File

@ -40,6 +40,8 @@
/out
/resources
/testing
/third_party/android_testrunner
/third_party/android_tools
/third_party/asan
/third_party/cygwin
/third_party/directxsdk
@ -62,13 +64,16 @@
/third_party/valgrind
/third_party/winsdk_samples/src
/third_party/yasm
/third_party/WebKit/Tools/Scripts
/tools/clang
/tools/gyp
/tools/python
/tools/valgrind
/tools/win
/webrtc/supplement.gypi
/webrtc/video_engine/main/test/android_test/bin
/webrtc/video_engine/main/test/android_test/gen
/webrtc/video_engine/test/android/bin
/webrtc/video_engine/test/android/gen
/webrtc/video_engine/test/android/libs
/webrtc/video_engine/test/android/obj
/x86-generic_out/
/xcodebuild

10
DEPS
View File

@ -106,6 +106,16 @@ deps_os = {
"third_party/gold":
From("chromium_deps", "src/third_party/gold"),
},
"android": {
"third_party/android_tools":
From("chromium_deps", "src/third_party/android_tools"),
"third_party/android_testrunner":
Var("chromium_trunk") + "/src/third_party/android_testrunner@" + Var("chromium_revision"),
"third_party/WebKit/Tools/Scripts":
From("chromium_deps", "src/third_party/WebKit/Tools/Scripts"),
},
}
hooks = [

7
OWNERS
View File

@ -2,4 +2,9 @@ henrika@webrtc.org
niklas.enbom@webrtc.org
andrew@webrtc.org
tina.legrand@webrtc.org
tommi@webrtc.org
tommi@webrtc.org
per-file .gitignore=*
per-file DEPS=*
per-file AUTHORS=*
per-file WATCHLISTS=*

View File

@ -0,0 +1,77 @@
#!/usr/bin/env python
#
# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
#
# Use of this source code is governed by a BSD-style license
# that can be found in the LICENSE file in the root of the source
# tree. An additional intellectual property rights grant can be found
# in the file PATENTS. All contributing project authors may
# be found in the AUTHORS file in the root of the source tree.
"""Builds the WebRTC Video Demo for Android.
This script is designed as an annotation script to be run by a Chrome Buildbot.
PREREQUISITES: You must have built WebRTC with the right environment set (the
one you get when sourcing build/android/envsetup.sh) before building with this
script.
NOTICE: To build successfully, you have to have Ant installed and have your
.gclient file setup with the target_os = ["android"] variable appended to the
last line of your WebRTC solution, so it looks like this:
];target_os = ["android"]
Then run 'gclient sync' to sync out the required Android SDK and NDK files into
the third_party directory.
If you want to get additional platform-specific dependencies in the same
checkout, add them to the list too, e.g. target_os = ["android", "unix"].
"""
import optparse
import os
import subprocess
import sys
_CURRENT_DIR = os.path.abspath(os.path.dirname(__file__))
_ROOT_DIR = os.path.abspath(os.path.join(_CURRENT_DIR, '..', '..', '..', '..'))
_ANDROID_ENV_SCRIPT = os.path.join(_ROOT_DIR, 'build', 'android', 'envsetup.sh')
def main():
parser = optparse.OptionParser('usage: %prog -t <target>')
parser.add_option('-t', '--target', default='debug',
help='Compile target (debug/release). Default: %default')
# Build and factory properties are currently unused but are required to avoid
# errors when the script is executed by the buildbots.
parser.add_option('--build-properties', help='Build properties (unused)')
parser.add_option('--factory-properties', help='Factory properties (unused)')
options, _args = parser.parse_args()
def RunInAndroidEnv(cmd):
return 'source %s && %s' % (_ANDROID_ENV_SCRIPT, cmd)
print '@@@BUILD_STEP ndk-build@@@'
cmd = RunInAndroidEnv('ndk-build')
print cmd
try:
subprocess.check_call(cmd, cwd=_CURRENT_DIR, shell=True)
except subprocess.CalledProcessError as e:
print 'NDK build failed: %s' % e
print '@@@STEP_FAILURE@@@'
return 1
print '@@@BUILD_STEP ant-build@@@'
cmd = RunInAndroidEnv('ant %s' % options.target.lower())
print cmd
try:
subprocess.check_call(cmd, cwd=_CURRENT_DIR, shell=True)
except subprocess.CalledProcessError as e:
print 'Ant build failed: %s' % e
print '@@@STEP_FAILURE@@@'
return 2
print 'WebRTC Demo build completed.'
return 0
if __name__ == '__main__':
sys.exit(main())

View File

@ -13,275 +13,275 @@ include $(call all-makefiles-under, $(LOCAL_PATH))
# Specify BUILDTYPE=Release on the command line for a release build.
BUILDTYPE ?= Debug
MY_LIBS_PATH := ../../../../../out/$(BUILDTYPE)/obj.target
MY_LIBS_PATH := ../../../../../out/$(BUILDTYPE)
include $(CLEAR_VARS)
LOCAL_MODULE := libvoice_engine_core
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/voice_engine/libvoice_engine_core.a
$(MY_LIBS_PATH)/libvoice_engine_core.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvideo_engine_core
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/video_engine/libvideo_engine_core.a
$(MY_LIBS_PATH)/libvideo_engine_core.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvideo_processing
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libvideo_processing.a
$(MY_LIBS_PATH)/libvideo_processing.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_video_coding
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libwebrtc_video_coding.a
$(MY_LIBS_PATH)/libwebrtc_video_coding.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvideo_render_module
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libvideo_render_module.a
$(MY_LIBS_PATH)/libvideo_render_module.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvideo_capture_module
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libvideo_capture_module.a
$(MY_LIBS_PATH)/libvideo_capture_module.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_coding_module
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudio_coding_module.a
$(MY_LIBS_PATH)/libaudio_coding_module.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_processing
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudio_processing.a
$(MY_LIBS_PATH)/libaudio_processing.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_processing_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudio_processing_neon.a
$(MY_LIBS_PATH)/libaudio_processing_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libPCM16B
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libPCM16B.a
$(MY_LIBS_PATH)/libPCM16B.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libCNG
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libCNG.a
$(MY_LIBS_PATH)/libCNG.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libNetEq
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libNetEq.a
$(MY_LIBS_PATH)/libNetEq.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libG722
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libG722.a
$(MY_LIBS_PATH)/libG722.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libiSAC
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libiSAC.a
$(MY_LIBS_PATH)/libiSAC.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libG711
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libG711.a
$(MY_LIBS_PATH)/libG711.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libiLBC
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libiLBC.a
$(MY_LIBS_PATH)/libiLBC.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libiSACFix
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libiSACFix.a
$(MY_LIBS_PATH)/libiSACFix.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libisac_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libisac_neon.a
$(MY_LIBS_PATH)/libisac_neon.a
include $(PREBUILT_STATIC_LIBRARY)
# Remove the following file existense check when opus is always enabled.
ifneq ($(wildcard jni/$(MY_LIBS_PATH)/third_party/opus/libopus.a),)
ifneq ($(wildcard jni/$(MY_LIBS_PATH)/libopus.a),)
include $(CLEAR_VARS)
LOCAL_MODULE := libopus
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/opus/libopus.a
$(MY_LIBS_PATH)/libopus.a
include $(PREBUILT_STATIC_LIBRARY)
endif
ifneq ($(wildcard jni/$(MY_LIBS_PATH)/webrtc/modules/libwebrtc_opus.a),)
ifneq ($(wildcard jni/$(MY_LIBS_PATH)/libwebrtc_opus.a),)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_opus
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libwebrtc_opus.a
$(MY_LIBS_PATH)/libwebrtc_opus.a
include $(PREBUILT_STATIC_LIBRARY)
endif
include $(CLEAR_VARS)
LOCAL_MODULE := libvad
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/common_audio/libvad.a
$(MY_LIBS_PATH)/libvad.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libbitrate_controller
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libbitrate_controller.a
$(MY_LIBS_PATH)/libbitrate_controller.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libresampler
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/common_audio/libresampler.a
$(MY_LIBS_PATH)/libresampler.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libsignal_processing
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/common_audio/libsignal_processing.a
$(MY_LIBS_PATH)/libsignal_processing.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libsignal_processing_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/common_audio/libsignal_processing_neon.a
$(MY_LIBS_PATH)/libsignal_processing_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcommon_video
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/common_video/libcommon_video.a
$(MY_LIBS_PATH)/libcommon_video.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libsystem_wrappers
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/system_wrappers/source/libsystem_wrappers.a
$(MY_LIBS_PATH)/libsystem_wrappers.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libcpu_features_android
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/system_wrappers/source/libcpu_features_android.a
$(MY_LIBS_PATH)/libcpu_features_android.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_device
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudio_device.a
$(MY_LIBS_PATH)/libaudio_device.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libremote_bitrate_estimator
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libremote_bitrate_estimator.a
$(MY_LIBS_PATH)/libremote_bitrate_estimator.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := librtp_rtcp
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/librtp_rtcp.a
$(MY_LIBS_PATH)/librtp_rtcp.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libmedia_file
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libmedia_file.a
$(MY_LIBS_PATH)/libmedia_file.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libudp_transport
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libudp_transport.a
$(MY_LIBS_PATH)/libudp_transport.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_utility
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libwebrtc_utility.a
$(MY_LIBS_PATH)/libwebrtc_utility.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudio_conference_mixer
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudio_conference_mixer.a
$(MY_LIBS_PATH)/libaudio_conference_mixer.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libyuv
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/libyuv/libyuv.a
$(MY_LIBS_PATH)/libyuv.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_i420
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libwebrtc_i420.a
$(MY_LIBS_PATH)/libwebrtc_i420.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libwebrtc_vp8
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/video_coding/codecs/vp8/libwebrtc_vp8.a
$(MY_LIBS_PATH)/libwebrtc_vp8.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libjpeg_turbo
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/libjpeg_turbo/libjpeg_turbo.a
$(MY_LIBS_PATH)/libjpeg_turbo.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libaudioproc_debug_proto
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libaudioproc_debug_proto.a
$(MY_LIBS_PATH)/libaudioproc_debug_proto.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libprotobuf_lite
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/protobuf/libprotobuf_lite.a
$(MY_LIBS_PATH)/libprotobuf_lite.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/libvpx/libvpx.a
$(MY_LIBS_PATH)/libvpx.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libvpx_arm_neon
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/third_party/libvpx/libvpx_arm_neon.a
$(MY_LIBS_PATH)/libvpx_arm_neon.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_MODULE := libpaced_sender
LOCAL_SRC_FILES := \
$(MY_LIBS_PATH)/webrtc/modules/libpaced_sender.a
$(MY_LIBS_PATH)/libpaced_sender.a
include $(PREBUILT_STATIC_LIBRARY)
include $(CLEAR_VARS)