Remove old Android build scripts

Change-Id: I72128ec3cda3ddc78442861af9ae9768510bef25
diff --git a/android/scripts/build.py b/android/scripts/build.py
deleted file mode 100644
index c952e3f..0000000
--- a/android/scripts/build.py
+++ /dev/null
@@ -1,265 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import os
-import re
-import sys
-import shutil
-import string
-import argparse
-import time
-
-import common
-
-def getStoreKeyPasswords (filename):
-	f			= open(filename)
-	storepass	= None
-	keypass		= None
-	for line in f:
-		m = re.search('([a-z]+)\s*\=\s*"([^"]+)"', line)
-		if m != None:
-			if m.group(1) == "storepass":
-				storepass = m.group(2)
-			elif m.group(1) == "keypass":
-				keypass = m.group(2)
-	f.close()
-	if storepass == None or keypass == None:
-		common.die("Could not read signing key passwords")
-	return (storepass, keypass)
-
-def getNativeBuildDir (buildRoot, nativeLib, buildType):
-	buildName = "%s-%d-%s" % (buildType.lower(), nativeLib.apiVersion, nativeLib.abiVersion)
-	return os.path.normpath(os.path.join(buildRoot, "native", buildName))
-
-def getAssetsDir (buildRoot, nativeLib, buildType):
-	return os.path.join(getNativeBuildDir(buildRoot, nativeLib, buildType), "assets")
-
-def buildNative (buildRoot, libTargetDir, nativeLib, buildType, gtfTarget):
-	deqpDir		= os.path.normpath(os.path.join(common.ANDROID_DIR, ".."))
-	buildDir	= getNativeBuildDir(buildRoot, nativeLib, buildType)
-	libsDir		= os.path.join(libTargetDir, nativeLib.abiVersion)
-	srcLibFile	= os.path.join(buildDir, common.NATIVE_LIB_NAME)
-	dstLibFile	= os.path.join(libsDir, common.NATIVE_LIB_NAME)
-
-	# Make build directory if necessary
-	if not os.path.exists(buildDir):
-		os.makedirs(buildDir)
-		toolchainFile = '%s/framework/delibs/cmake/toolchain-android-%s.cmake' % (deqpDir, common.ANDROID_NDK_TOOLCHAIN_VERSION)
-		common.execArgsInDirectory([
-				'cmake',
-				'-G%s' % common.CMAKE_GENERATOR,
-				'-DCMAKE_TOOLCHAIN_FILE=%s' % toolchainFile,
-				'-DCMAKE_C_FLAGS=-Werror',
-				'-DCMAKE_CXX_FLAGS=-Werror',
-				'-DANDROID_NDK_HOST_OS=%s' % common.ANDROID_NDK_HOST_OS,
-				'-DANDROID_NDK_PATH=%s' % common.ANDROID_NDK_PATH,
-				'-DANDROID_ABI=%s' % nativeLib.abiVersion,
-				'-DDE_ANDROID_API=%s' % nativeLib.apiVersion,
-				'-DCMAKE_BUILD_TYPE=%s' % buildType,
-				'-DGLCTS_GTF_TARGET=%s' % gtfTarget,
-				'-DDEQP_TARGET=android',
-				deqpDir
-			], buildDir)
-
-	common.execArgsInDirectory(['cmake', '--build', '.'] + common.EXTRA_BUILD_ARGS, buildDir)
-
-	if not os.path.exists(libsDir):
-		os.makedirs(libsDir)
-
-	shutil.copyfile(srcLibFile, dstLibFile)
-
-	# Copy gdbserver for debugging
-	if buildType.lower() == "debug":
-		srcGdbserverPath = os.path.join(common.ANDROID_NDK_PATH,
-										'prebuilt',
-										nativeLib.prebuiltDir,
-										'gdbserver',
-										'gdbserver')
-		dstGdbserverPath = os.path.join(libsDir, 'gdbserver')
-		shutil.copyfile(srcGdbserverPath, dstGdbserverPath)
-	else:
-		assert not os.path.exists(os.path.join(libsDir, "gdbserver"))
-
-def buildApp (buildRoot, androidBuildType, javaApi, package):
-	appDir	= os.path.join(buildRoot, package)
-
-	# Set up app
-	os.chdir(appDir)
-
-	manifestSrcPath = os.path.normpath(os.path.join(common.ANDROID_DIR, package, "AndroidManifest.xml"))
-	manifestDstPath = os.path.normpath(os.path.join(appDir, "AndroidManifest.xml"))
-
-	# Build dir can be the Android dir, in which case the copy is not needed.
-	if manifestSrcPath != manifestDstPath:
-		shutil.copy(manifestSrcPath, manifestDstPath)
-
-	common.execArgs([
-			common.ANDROID_BIN,
-			'update', 'project',
-			'--name', 'dEQP',
-			'--path', '.',
-			'--target', javaApi,
-		])
-
-	# Build
-	common.execArgs([
-			common.ANT_BIN,
-			androidBuildType,
-			"-Dsource.dir=" + os.path.join(common.ANDROID_DIR, package, "src"),
-			"-Dresource.absolute.dir=" + os.path.join(common.ANDROID_DIR,package, "res")
-		])
-
-def signApp (keystore, keyname, storepass, keypass, package):
-	os.chdir(os.path.join(common.ANDROID_DIR, package))
-	common.execArgs([
-			common.JARSIGNER_BIN,
-			'-keystore', keystore,
-			'-storepass', storepass,
-			'-keypass', keypass,
-			'-sigfile', 'CERT',
-			'-digestalg', 'SHA1',
-			'-sigalg', 'MD5withRSA',
-			'-signedjar', 'bin/dEQP-unaligned.apk',
-			'bin/dEQP-release-unsigned.apk',
-			keyname
-		])
-	common.execArgs([
-			common.ZIPALIGN_BIN,
-			'-f', '4',
-			'bin/dEQP-unaligned.apk',
-			'bin/dEQP-release.apk'
-		])
-
-def build (buildRoot=common.ANDROID_DIR, androidBuildType='debug', nativeBuildType="Release", javaApi=common.ANDROID_JAVA_API, doParallelBuild=False, package="package", gtfTarget='gles32'):
-	curDir = os.getcwd()
-
-	try:
-		assetsSrcDir = getAssetsDir(buildRoot, common.NATIVE_LIBS[0], nativeBuildType)
-		assetsDstDir = os.path.join(buildRoot, package, "assets")
-
-		# Remove assets from the first build dir where we copy assets from
-		# to avoid collecting cruft there.
-		if os.path.exists(assetsSrcDir):
-			shutil.rmtree(assetsSrcDir)
-		if os.path.exists(assetsDstDir):
-			shutil.rmtree(assetsDstDir)
-
-		# Remove old libs dir to avoid collecting out-of-date versions
-		# of libs for ABIs not built this time.
-		libTargetDir = os.path.join(buildRoot, package, "libs")
-		if os.path.exists(libTargetDir):
-			shutil.rmtree(libTargetDir)
-
-		# Build native code
-		nativeBuildArgs = [(buildRoot, libTargetDir, nativeLib, nativeBuildType, gtfTarget) for nativeLib in common.NATIVE_LIBS]
-		if doParallelBuild:
-			common.parallelApply(buildNative, nativeBuildArgs)
-		else:
-			common.serialApply(buildNative, nativeBuildArgs)
-
-		# Copy assets
-		if os.path.exists(assetsSrcDir):
-			shutil.copytree(assetsSrcDir, assetsDstDir)
-
-		# Build java code and .apk
-		buildApp(buildRoot, androidBuildType, javaApi, package)
-
-	finally:
-		# Restore working dir
-		os.chdir(curDir)
-
-def dumpConfig ():
-	print " "
-	for entry in common.CONFIG_STRINGS:
-		print "%-30s : %s" % (entry[0], entry[1])
-	print " "
-
-# Return NDK version as [<major>,<minor>] or None if cannot be figured out.
-def getNdkVersion (path):
-	if path == None:
-		return None
-
-	propFilePath = os.path.join(path, "source.properties")
-	try:
-		with open(propFilePath) as propFile:
-			for line in propFile:
-				keyValue = map(lambda x: string.strip(x), line.split("="))
-				if keyValue[0] == "Pkg.Revision":
-					versionParts = keyValue[1].split(".")
-					return tuple(map(int, versionParts[0:2]))
-	except:
-		print("Could not read source prop file '%s'" % propFilePath)
-
-	return None
-
-def checkConfig ():
-	HOST_OS_TO_DOWNLOAD_STRING = {
-			"linux-x86_64"		: "linux-x86_64",
-			"windows"			: "windows-x86",
-			"windows-x86_64"	: "windows-x86_64"
-		}
-
-	version = getNdkVersion(common.ANDROID_NDK_PATH)
-	# Note: NDK currently maintains compatibility between minor
-	# versions. Error out only on major version mismatch.
-	if version == None or version[0] != common.ANDROID_NDK_VERSION[0]:
-		print("**** WARNING! Deqp requires NDK version %s" % common.ANDROID_NDK_VERSION_STRING)
-		print("**** NDK Path %s does not appear to have that version." % common.ANDROID_NDK_PATH)
-
-		# Download hint will use the version encored in common.py, not
-		# the latest minor version available
-		versionString = common.ANDROID_NDK_VERSION_STRING
-		if common.ANDROID_NDK_HOST_OS in HOST_OS_TO_DOWNLOAD_STRING:
-			osString = HOST_OS_TO_DOWNLOAD_STRING[common.ANDROID_NDK_HOST_OS]
-			print("**** Please install from https://dl.google.com/android/repository/android-ndk-%s-%s.zip" % (versionString, osString))
-		else:
-			print("**** Please download version", versionString, "from https://developer.android.com/ndk/downloads/index.html")
-
-		return False
-
-	return True
-
-if __name__ == "__main__":
-	nativeBuildTypes = ['Release', 'Debug', 'MinSizeRel', 'RelWithAsserts', 'RelWithDebInfo']
-	androidBuildTypes = ['debug', 'release']
-
-	parser = argparse.ArgumentParser()
-	parser.add_argument('--android-build-type', dest='androidBuildType', choices=androidBuildTypes, default='debug', help="Build type for android project..")
-	parser.add_argument('--native-build-type', dest='nativeBuildType', default="RelWithAsserts", choices=nativeBuildTypes, help="Build type passed to cmake when building native code.")
-	parser.add_argument('--build-root', dest='buildRoot', default=common.ANDROID_DIR, help="Root directory for storing build results.")
-	parser.add_argument('--dump-config', dest='dumpConfig', action='store_true', help="Print out all configurations variables")
-	parser.add_argument('--java-api', dest='javaApi', default=common.ANDROID_JAVA_API, help="Set the API signature for the java build.")
-	parser.add_argument('--apk-package', dest='package', default='package', choices=['package', 'openglcts'], help="Folder with AndroidManifest.xml.")
-	parser.add_argument('--glcts-gtf-target', dest='gtfTarget', default='gles32', choices=['gles32', 'gles31', 'gles3', 'gles2', 'gl'], help="Build GLCTS GTF module for the given API.")
-	parser.add_argument('-p', '--parallel-build', dest='parallelBuild', action="store_true", help="Build native libraries in parallel.")
-	parser.add_argument('--skip-config-check', dest='skipConfigCheck', action="store_true", default=False, help="Skips config check. Warranty void.")
-
-	args = parser.parse_args()
-
-	if args.dumpConfig:
-		dumpConfig()
-
-	if not args.skipConfigCheck and not checkConfig():
-		print "Config check failed, exit"
-		exit(-1)
-
-	build(buildRoot=os.path.abspath(args.buildRoot), androidBuildType=args.androidBuildType, nativeBuildType=args.nativeBuildType, javaApi=args.javaApi, doParallelBuild=args.parallelBuild, package=args.package, gtfTarget=args.gtfTarget)
diff --git a/android/scripts/common.py b/android/scripts/common.py
deleted file mode 100644
index efbfc97..0000000
--- a/android/scripts/common.py
+++ /dev/null
@@ -1,335 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import os
-import re
-import sys
-import shlex
-import subprocess
-import multiprocessing
-import string
-
-try:
-	import threading
-except ImportError:
-	import dummy_threading as threading
-
-class NativeLib:
-	def __init__ (self, apiVersion, abiVersion, prebuiltDir):
-		self.apiVersion		= apiVersion
-		self.abiVersion		= abiVersion
-		self.prebuiltDir	= prebuiltDir
-
-	def __str__ (self):
-		return "(API: %s, ABI: %s)" % (self.apiVersion, self.abiVersion)
-
-	def __repr__ (self):
-		return "(API: %s, ABI: %s)" % (self.apiVersion, self.abiVersion)
-
-
-def getPlatform ():
-	if sys.platform.startswith('linux'):
-		return 'linux'
-	else:
-		return sys.platform
-
-def selectByOS (variants):
-	platform = getPlatform()
-	if platform in variants:
-		return variants[platform]
-	elif 'other' in variants:
-		return variants['other']
-	else:
-		raise Exception("No configuration for '%s'" % platform)
-
-def isExecutable (path):
-	return os.path.isfile(path) and os.access(path, os.X_OK)
-
-def which (binName):
-	for path in os.environ['PATH'].split(os.pathsep):
-		path = path.strip('"')
-		fullPath = os.path.join(path, binName)
-		if isExecutable(fullPath):
-			return fullPath
-
-	return None
-
-def isBinaryInPath (binName):
-	return which(binName) != None
-
-def selectFirstExistingBinary (filenames):
-	for filename in filenames:
-		if filename != None and isExecutable(filename):
-			return filename
-
-	return None
-
-def selectFirstExistingDir (paths):
-	for path in paths:
-		if path != None and os.path.isdir(path):
-			return path
-
-	return None
-
-def die (msg):
-	print msg
-	exit(-1)
-
-def shellquote(s):
-	return '"%s"' % s.replace('\\', '\\\\').replace('"', '\"').replace('$', '\$').replace('`', '\`')
-
-def execute (commandLine):
-	args	= shlex.split(commandLine)
-	retcode	= subprocess.call(args)
-	if retcode != 0:
-		raise Exception("Failed to execute '%s', got %d" % (commandLine, retcode))
-
-def execArgs (args):
-	# Make sure previous stdout prints have been written out.
-	sys.stdout.flush()
-	retcode	= subprocess.call(args)
-	if retcode != 0:
-		raise Exception("Failed to execute '%s', got %d" % (str(args), retcode))
-
-def execArgsInDirectory (args, cwd, linePrefix="", failOnNonZeroExit=True):
-
-	def readApplyPrefixAndPrint (source, prefix, sink):
-		while True:
-			line = source.readline()
-			if len(line) == 0: # EOF
-				break;
-			sink.write(prefix + line)
-
-	process = subprocess.Popen(args, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-	stdoutJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stdout, linePrefix, sys.stdout))
-	stderrJob = threading.Thread(target=readApplyPrefixAndPrint, args=(process.stderr, linePrefix, sys.stderr))
-	stdoutJob.start()
-	stderrJob.start()
-	retcode = process.wait()
-	if failOnNonZeroExit and retcode != 0:
-		raise Exception("Failed to execute '%s', got %d" % (str(args), retcode))
-
-def serialApply(f, argsList):
-	for args in argsList:
-		f(*args)
-
-def parallelApply(f, argsList):
-	class ErrorCode:
-		def __init__ (self):
-			self.error = None;
-
-	def applyAndCaptureError (func, args, errorCode):
-		try:
-			func(*args)
-		except:
-			errorCode.error = sys.exc_info()
-
-	errorCode = ErrorCode()
-	jobs = []
-	for args in argsList:
-		job = threading.Thread(target=applyAndCaptureError, args=(f, args, errorCode))
-		job.start()
-		jobs.append(job)
-
-	for job in jobs:
-		job.join()
-
-	if errorCode.error:
-		raise errorCode.error[0], errorCode.error[1], errorCode.error[2]
-
-class Device:
-	def __init__(self, serial, product, model, device):
-		self.serial		= serial
-		self.product	= product
-		self.model		= model
-		self.device		= device
-
-	def __str__ (self):
-		return "%s: {product: %s, model: %s, device: %s}" % (self.serial, self.product, self.model, self.device)
-
-def getDevices (adb):
-	proc = subprocess.Popen([adb, 'devices', '-l'], stdout=subprocess.PIPE)
-	(stdout, stderr) = proc.communicate()
-
-	if proc.returncode != 0:
-		raise Exception("adb devices -l failed, got %d" % proc.returncode)
-
-	ptrn = re.compile(r'^([a-zA-Z0-9\.:]+)\s+.*product:([^\s]+)\s+model:([^\s]+)\s+device:([^\s]+)')
-	devices = []
-	for line in stdout.splitlines()[1:]:
-		if len(line.strip()) == 0:
-			continue
-
-		m = ptrn.match(line)
-		if m == None:
-			print "WARNING: Failed to parse device info '%s'" % line
-			continue
-
-		devices.append(Device(m.group(1), m.group(2), m.group(3), m.group(4)))
-
-	return devices
-
-def getWin32Generator ():
-	if which("jom.exe") != None:
-		return "NMake Makefiles JOM"
-	else:
-		return "NMake Makefiles"
-
-def isNinjaSupported ():
-	return which("ninja") != None
-
-def getUnixGenerator ():
-	if isNinjaSupported():
-		return "Ninja"
-	else:
-		return "Unix Makefiles"
-
-def getExtraBuildArgs (generator):
-	if generator == "Unix Makefiles":
-		return ["--", "-j%d" % multiprocessing.cpu_count()]
-	else:
-		return []
-
-NDK_HOST_OS_NAMES = [
-	"windows",
-	"windows-x86_64",
-	"darwin-x86",
-	"darwin-x86_64",
-	"linux-x86",
-	"linux-x86_64"
-]
-
-def getNDKHostOsName (ndkPath):
-	for name in NDK_HOST_OS_NAMES:
-		if os.path.exists(os.path.join(ndkPath, "prebuilt", name)):
-			return name
-
-	raise Exception("Couldn't determine NDK host OS")
-
-# deqp/android path
-ANDROID_DIR				= os.path.realpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), ".."))
-
-# Build configuration
-NATIVE_LIBS				= [
-		#		  API		ABI				prebuiltsDir
-		NativeLib(21,		"armeabi-v7a",	'android-arm'),		# ARM v7a ABI
-		NativeLib(21,		"x86",			'android-x86'),		# x86
-		NativeLib(21,		"arm64-v8a",	'android-arm64'),	# ARM64 v8a ABI
-		NativeLib(21,		"x86_64",		'android-x86_64'),	# x86_64
-	]
-
-ANDROID_JAVA_API		= "android-22"
-NATIVE_LIB_NAME			= "libdeqp.so"
-
-def makeNdkVersionString (version):
-	minorVersionString = (chr(ord('a') + version[1]) if version[1] > 0 else "")
-	return "r%d%s" % (version[0], minorVersionString)
-
-ANDROID_NDK_VERSION			= (11,0)
-ANDROID_NDK_VERSION_STRING	= makeNdkVersionString(ANDROID_NDK_VERSION)
-def selectNDKPath ():
-	candidates =  [
-		os.path.expanduser("~/android-ndk-" + ANDROID_NDK_VERSION_STRING),
-		"C:/android/android-ndk-" + ANDROID_NDK_VERSION_STRING,
-		os.environ.get("ANDROID_NDK_PATH", None), # If not defined, return None
-	]
-
-	ndkPath = selectFirstExistingDir(candidates)
-
-	if ndkPath == None:
-		raise Exception("None of NDK directory candidates exist: %s. Check ANDROID_NDK_PATH in common.py" % candidates)
-
-	return ndkPath
-
-def noneSafePathJoin (*components):
-	if None in components:
-		return None
-	return os.path.join(*components)
-
-
-# NDK paths
-ANDROID_NDK_PATH				= selectNDKPath()
-ANDROID_NDK_HOST_OS				= getNDKHostOsName(ANDROID_NDK_PATH)
-ANDROID_NDK_TOOLCHAIN_VERSION	= "r11" # Toolchain file is selected based on this
-
-# Native code build settings
-CMAKE_GENERATOR			= selectByOS({
-		'win32':	getWin32Generator(),
-		'other':	getUnixGenerator()
-	})
-EXTRA_BUILD_ARGS		= getExtraBuildArgs(CMAKE_GENERATOR)
-
-# SDK paths
-ANDROID_SDK_PATH		= selectFirstExistingDir([
-		os.environ.get("ANDROID_SDK_PATH", None),
-		os.path.expanduser("~/android-sdk-linux"),
-		os.path.expanduser("~/android-sdk-mac_x86"),
-		"C:/android/android-sdk-windows",
-	])
-ANDROID_BIN				= selectFirstExistingBinary([
-		noneSafePathJoin(ANDROID_SDK_PATH, "tools", "android"),
-		noneSafePathJoin(ANDROID_SDK_PATH, "tools", "android.bat"),
-		which('android'),
-	])
-ADB_BIN					= selectFirstExistingBinary([
-		which('adb'), # \note Prefer adb in path to avoid version issues on dev machines
-		noneSafePathJoin(ANDROID_SDK_PATH, "platform-tools", "adb"),
-		noneSafePathJoin(ANDROID_SDK_PATH, "platform-tools", "adb.exe"),
-	])
-ZIPALIGN_BIN			= selectFirstExistingBinary([
-		noneSafePathJoin(ANDROID_SDK_PATH, "tools", "zipalign"),
-		noneSafePathJoin(ANDROID_SDK_PATH, "tools", "zipalign.exe"),
-		which('zipalign'),
-	])
-JARSIGNER_BIN			= which('jarsigner')
-
-# Apache ant
-ANT_BIN					= selectFirstExistingBinary([
-		which('ant.bat'),
-		which('ant'),
-		"C:/android/apache-ant-1.8.4/bin/ant.bat",
-		"C:/android/apache-ant-1.9.2/bin/ant.bat",
-		"C:/android/apache-ant-1.9.3/bin/ant.bat",
-		"C:/android/apache-ant-1.9.4/bin/ant.bat",
-	])
-
-def makeNameValueTuple (name):
-	return (name, str(eval(name)))
-
-CONFIG_VAR_NAMES = [
-		"ANDROID_DIR",
-		"NATIVE_LIBS",
-		"ANDROID_JAVA_API",
-		"NATIVE_LIB_NAME",
-		"ANDROID_NDK_PATH",
-		"ANDROID_NDK_HOST_OS",
-		"ANDROID_NDK_TOOLCHAIN_VERSION",
-		"CMAKE_GENERATOR",
-		"EXTRA_BUILD_ARGS",
-		"ANDROID_SDK_PATH",
-		"ANDROID_BIN",
-		"ADB_BIN",
-		"ZIPALIGN_BIN",
-		"JARSIGNER_BIN",
-		"ANT_BIN",
-	]
-CONFIG_STRINGS = [makeNameValueTuple(x) for x in CONFIG_VAR_NAMES]
diff --git a/android/scripts/debug.py b/android/scripts/debug.py
deleted file mode 100644
index a74a096..0000000
--- a/android/scripts/debug.py
+++ /dev/null
@@ -1,697 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import sys
-import os
-import time
-import string
-import shutil
-import subprocess
-import signal
-import argparse
-
-import common
-
-def getADBProgramPID (adbCmd, program, serial):
-	pid		= -1
-
-	process = subprocess.Popen([adbCmd]
-								+ (["-s", serial] if serial != None else [])
-								+ ["shell", "ps"], stdout=subprocess.PIPE)
-
-	firstLine = True
-	for line in process.stdout.readlines():
-		if firstLine:
-			firstLine = False
-			continue
-
-		fields = string.split(line)
-		fields = filter(lambda x: len(x) > 0, fields)
-
-		if len(fields) < 9:
-			continue
-
-		if fields[8] == program:
-			assert pid == -1
-			pid = int(fields[1])
-
-	process.wait()
-
-	if process.returncode != 0:
-		print("adb shell ps returned %s" % str(process.returncode))
-		pid = -1
-
-	return pid
-
-def debug (
-	adbCmd,
-	deqpCmdLine,
-	targetGDBPort,
-	hostGDBPort,
-	jdbPort,
-	jdbCmd,
-	gdbCmd,
-	buildDir,
-	deviceLibs,
-	breakpoints,
-	serial,
-	deviceGdbCmd,
-	appProcessName,
-	linkerName
-	):
-
-	programPid			= -1
-	gdbServerProcess	= None
-	gdbProcess			= None
-	jdbProcess			= None
-	curDir				= os.getcwd()
-	debugDir			= os.path.join(common.ANDROID_DIR, "debug")
-	serialArg			= "-s " + serial if serial != None else ""
-
-	if os.path.exists(debugDir):
-		shutil.rmtree(debugDir)
-
-	os.makedirs(debugDir)
-	os.chdir(debugDir)
-	try:
-		# Start execution
-		print("Starting intent...")
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["shell", "am", "start", "-W", "-D", "-n", "com.drawelements.deqp/android.app.NativeActivity", "-e", "cmdLine", "\"\"unused " + deqpCmdLine  + "\"\""])
-		print("Intent started")
-
-		# Kill existing gdbservers
-		print("Check and kill existing gdbserver")
-		gdbPid = getADBProgramPID(adbCmd, "gdbserver", serial)
-		if gdbPid != -1:
-			print("Found gdbserver with PID %i" % gdbPid)
-			common.execArgs([adbCmd]
-							+ (["-s", serial] if serial != None else [])
-							+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(gdbPid)])
-			print("Killed gdbserver")
-		else:
-			print("Couldn't find existing gdbserver")
-
-		programPid = getADBProgramPID(adbCmd, "com.drawelements.deqp:testercore", serial)
-
-		print("Find process PID")
-		if programPid == -1:
-			common.die("Couldn't get PID of testercore")
-		print("Process running with PID %i" % programPid)
-
-		# Start gdbserver
-		print("Start gdbserver for PID %i redirect stdout to gdbserver-stdout.txt" % programPid)
-		gdbServerProcess = subprocess.Popen([adbCmd]
-											+ (["-s", serial] if serial != None else [])
-											+ ["shell", "run-as", "com.drawelements.deqp", deviceGdbCmd, "localhost:" + str(targetGDBPort), "--attach", str(programPid)], stdin=subprocess.PIPE, stdout=open("gdbserver-stdout.txt", "wb"), stderr=open("gdbserver-stderr.txt", "wb"))
-		print("gdbserver started")
-
-		time.sleep(1)
-
-		gdbServerProcess.poll()
-
-		if gdbServerProcess.returncode != None:
-			common.die("gdbserver returned unexpectly with return code %i see gdbserver-stdout.txt for more info" % gdbServerProcess.returncode)
-
-		# Setup port forwarding
-		print("Forwarding local port to gdbserver port")
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["forward", "tcp:" + str(hostGDBPort), "tcp:" + str(targetGDBPort)])
-
-		# Pull some data files for debugger
-		print("Pull /system/bin/%s from device" % appProcessName)
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["pull", "/system/bin/" + str(appProcessName)])
-
-		print("Pull /system/bin/%s from device" % linkerName)
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["pull", "/system/bin/" + str(linkerName)])
-
-		for lib in deviceLibs:
-			print("Pull library %s from device" % lib)
-			try:
-				common.execArgs([adbCmd]
-								+ (["-s", serial] if serial != None else [])
-								+ ["pull", lib])
-			except Exception as e:
-				print("Failed to pull library '%s'. Error: %s" % (lib, str(e)))
-
-		print("Copy %s from build dir" % common.NATIVE_LIB_NAME)
-		shutil.copyfile(os.path.join(buildDir, common.NATIVE_LIB_NAME), common.NATIVE_LIB_NAME)
-
-		# Forward local port for jdb
-		print("Forward local port to jdb port")
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["forward", "tcp:" + str(jdbPort), "jdwp:" + str(programPid)])
-
-		# Connect JDB
-		print("Start jdb process redirectd stdout to jdb-stdout.txt")
-		jdbProcess = subprocess.Popen([jdbCmd, "-connect", "com.sun.jdi.SocketAttach:hostname=localhost,port=" + str(jdbPort), "-sourcepath", "../package"], stdin=subprocess.PIPE, stdout=open("jdb-stdout.txt", "wb"), stderr=open("jdb-stderr.txt", "wb"))
-		print("Started jdb process")
-
-		# Write gdb.setup
-		print("Write gdb.setup")
-		gdbSetup = open("gdb.setup", "wb")
-		gdbSetup.write("file %s\n" % appProcessName)
-		gdbSetup.write("set solib-search-path .\n")
-		gdbSetup.write("target remote :%i\n" % hostGDBPort)
-		gdbSetup.write("set breakpoint pending on\n")
-
-		for breakpoint in breakpoints:
-			print("Set breakpoint at %s" % breakpoint)
-			gdbSetup.write("break %s\n" % breakpoint)
-
-		gdbSetup.write("set breakpoint pending off\n")
-		gdbSetup.close()
-
-		print("Start gdb")
-		gdbProcess = subprocess.Popen(common.shellquote(gdbCmd) + " -x gdb.setup", shell=True)
-
-		gdbProcess.wait()
-
-		print("gdb returned with %i" % gdbProcess.returncode)
-		gdbProcess=None
-
-		print("Close jdb process with 'quit'")
-		jdbProcess.stdin.write("quit\n")
-		jdbProcess.wait()
-		print("JDB returned %s" % str(jdbProcess.returncode))
-		jdbProcess=None
-
-		print("Kill gdbserver process")
-		gdbServerProcess.kill()
-		gdbServerProcess=None
-		print("Killed gdbserver process")
-
-		print("Kill program %i" % programPid)
-		common.execArgs([adbCmd]
-						+ (["-s", serial] if serial != None else [])
-						+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(programPid)])
-		print("Killed program")
-
-	finally:
-		if jdbProcess and jdbProcess.returncode == None:
-			print("Kill jdb")
-			jdbProcess.kill()
-		elif jdbProcess:
-			print("JDB returned %i" % jdbProcess.returncode)
-
-		if gdbProcess and gdbProcess.returncode == None:
-			print("Kill gdb")
-			gdbProcess.kill()
-		elif gdbProcess:
-			print("GDB returned %i" % gdbProcess.returncode)
-
-		if gdbServerProcess and gdbServerProcess.returncode == None:
-			print("Kill gdbserver")
-			gdbServerProcess.kill()
-		elif gdbServerProcess:
-			print("GDB server returned %i" % gdbServerProcess.returncode)
-
-		if programPid != -1:
-			print("Kill program %i" % programPid)
-			common.execArgs([adbCmd]
-							+ (["-s", serial] if serial != None else [])
-							+ ["shell", "run-as", "com.drawelements.deqp", "kill", "-9", str(programPid)])
-			print("Killed program")
-
-		os.chdir(curDir)
-
-class Device:
-	def __init__ (self, libraries=[], nativeBuildDir=None, hostGdbBins=None, deviceGdbCmd=None, appProcessName=None, linkerName=None):
-		self.libraries = libraries
-		self.nativeBuildDir = nativeBuildDir
-		self.hostGdbBins = hostGdbBins
-		self.deviceGdbCmd = deviceGdbCmd
-		self.appProcessName = appProcessName
-		self.linkerName = linkerName
-
-	def getBuildDir (self):
-		return self.nativeBuildDir
-
-	def getGdbCommand (self, platform):
-		return self.hostGdbBins[platform]
-
-	def getDeviceGdbCommand (self):
-		return self.deviceGdbCmd
-
-	def getLibs (self):
-		return self.libraries
-
-	def getLinkerName (self):
-		return self.linkerName
-
-	def getAppProcessName (self):
-		return self.appProcessName
-
-if __name__ == "__main__":
-	parser = argparse.ArgumentParser()
-
-	devices = {
-		"nexus-4" : Device(
-			nativeBuildDir = "../native/debug-13-armeabi-v7a",
-			deviceGdbCmd = "lib/gdbserver",
-			hostGdbBins = {
-				"linux" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb")),
-				"windows" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gdb"))
-			},
-			appProcessName = "app_process",
-			linkerName = "linker",
-			libraries = [
-				"/system/lib/libgenlock.so",
-				"/system/lib/libmemalloc.so",
-				"/system/lib/libqdutils.so",
-				"/system/lib/libsc-a3xx.so"
-			]),
-		"nexus-6" : Device(
-			nativeBuildDir = "../native/debug-13-armeabi-v7a",
-			deviceGdbCmd = "lib/gdbserver",
-			hostGdbBins = {
-				"linux" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb")),
-				"windows" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gdb"))
-			},
-			appProcessName = "app_process",
-			linkerName = "linker",
-			libraries = [
-				"/system/lib/libutils.so",
-				"/system/lib/libstdc++.so",
-				"/system/lib/libm.so",
-				"/system/lib/liblog.so",
-				"/system/lib/libhardware.so",
-				"/system/lib/libbinder.so",
-				"/system/lib/libcutils.so",
-				"/system/lib/libc++.so",
-				"/system/lib/libLLVM.so",
-				"/system/lib/libbcinfo.so",
-				"/system/lib/libunwind.so",
-				"/system/lib/libz.so",
-				"/system/lib/libpng.so",
-				"/system/lib/libcommon_time_client.so",
-				"/system/lib/libstlport.so",
-				"/system/lib/libui.so",
-				"/system/lib/libsync.so",
-				"/system/lib/libgui.so",
-				"/system/lib/libft2.so",
-				"/system/lib/libbcc.so",
-				"/system/lib/libGLESv2.so",
-				"/system/lib/libGLESv1_CM.so",
-				"/system/lib/libEGL.so",
-				"/system/lib/libunwind-ptrace.so",
-				"/system/lib/libgccdemangle.so",
-				"/system/lib/libcrypto.so",
-				"/system/lib/libicuuc.so",
-				"/system/lib/libicui18n.so",
-				"/system/lib/libjpeg.so",
-				"/system/lib/libexpat.so",
-				"/system/lib/libpcre.so",
-				"/system/lib/libharfbuzz_ng.so",
-				"/system/lib/libstagefright_foundation.so",
-				"/system/lib/libsonivox.so",
-				"/system/lib/libnbaio.so",
-				"/system/lib/libcamera_client.so",
-				"/system/lib/libaudioutils.so",
-				"/system/lib/libinput.so",
-				"/system/lib/libhardware_legacy.so",
-				"/system/lib/libcamera_metadata.so",
-				"/system/lib/libgabi++.so",
-				"/system/lib/libskia.so",
-				"/system/lib/libRScpp.so",
-				"/system/lib/libRS.so",
-				"/system/lib/libwpa_client.so",
-				"/system/lib/libnetutils.so",
-				"/system/lib/libspeexresampler.so",
-				"/system/lib/libGLES_trace.so",
-				"/system/lib/libbacktrace.so",
-				"/system/lib/libusbhost.so",
-				"/system/lib/libssl.so",
-				"/system/lib/libsqlite.so",
-				"/system/lib/libsoundtrigger.so",
-				"/system/lib/libselinux.so",
-				"/system/lib/libprocessgroup.so",
-				"/system/lib/libpdfium.so",
-				"/system/lib/libnetd_client.so",
-				"/system/lib/libnativehelper.so",
-				"/system/lib/libnativebridge.so",
-				"/system/lib/libminikin.so",
-				"/system/lib/libmemtrack.so",
-				"/system/lib/libmedia.so",
-				"/system/lib/libinputflinger.so",
-				"/system/lib/libimg_utils.so",
-				"/system/lib/libhwui.so",
-				"/system/lib/libandroidfw.so",
-				"/system/lib/libETC1.so",
-				"/system/lib/libandroid_runtime.so",
-				"/system/lib/libsigchain.so",
-				"/system/lib/libbacktrace_libc++.so",
-				"/system/lib/libart.so",
-				"/system/lib/libjavacore.so",
-				"/system/lib/libvorbisidec.so",
-				"/system/lib/libstagefright_yuv.so",
-				"/system/lib/libstagefright_omx.so",
-				"/system/lib/libstagefright_enc_common.so",
-				"/system/lib/libstagefright_avc_common.so",
-				"/system/lib/libpowermanager.so",
-				"/system/lib/libopus.so",
-				"/system/lib/libdrmframework.so",
-				"/system/lib/libstagefright_amrnb_common.so",
-				"/system/lib/libstagefright.so",
-				"/system/lib/libmtp.so",
-				"/system/lib/libjhead.so",
-				"/system/lib/libexif.so",
-				"/system/lib/libmedia_jni.so",
-				"/system/lib/libsoundpool.so",
-				"/system/lib/libaudioeffect_jni.so",
-				"/system/lib/librs_jni.so",
-				"/system/lib/libjavacrypto.so",
-				"/system/lib/libqservice.so",
-				"/system/lib/libqdutils.so",
-				"/system/lib/libqdMetaData.so",
-				"/system/lib/libmemalloc.so",
-				"/system/lib/libandroid.so",
-				"/system/lib/libcompiler_rt.so",
-				"/system/lib/libjnigraphics.so",
-				"/system/lib/libwebviewchromium_loader.so",
-
-				"/system/lib/hw/gralloc.msm8084.so",
-				"/system/lib/hw/memtrack.msm8084.so",
-
-				"/vendor/lib/libgsl.so",
-				"/vendor/lib/libadreno_utils.so",
-				"/vendor/lib/egl/libEGL_adreno.so",
-				"/vendor/lib/egl/libGLESv1_CM_adreno.so",
-				"/vendor/lib/egl/libGLESv2_adreno.so",
-				"/vendor/lib/egl/eglSubDriverAndroid.so",
-				"/vendor/lib/libllvm-glnext.so",
-			]),
-		"nexus-7" : Device(
-			nativeBuildDir = "../native/debug-13-armeabi-v7a",
-			deviceGdbCmd = "lib/gdbserver",
-			hostGdbBins = {
-				"linux" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb")),
-				"windows" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gdb"))
-			},
-			appProcessName = "app_process",
-			linkerName = "linker",
-			libraries = [
-				"/system/lib/libm.so",
-				"/system/lib/libqdutils.so",
-				"/system/lib/libmemalloc.so",
-				"/system/lib/hw/gralloc.msm8960.so",
-				"/system/lib/libstdc++.so",
-				"/system/lib/liblog.so.",
-				"/system/lib/libstdc++.so",
-				"/system/lib/liblog.so",
-				"/system/lib/libsigchain.so",
-				"/system/lib/libcutils.so",
-				"/system/lib/libstlport.so",
-				"/system/lib/libgccdemangle.so",
-				"/system/lib/libunwind.so",
-				"/system/lib/libunwind-ptrace.so",
-				"/system/lib/libbacktrace.so",
-				"/system/lib/libutils.so",
-				"/system/lib/libGLES_trace.so",
-				"/system/lib/libEGL.so",
-				"/system/lib/libETC1.so",
-				"/system/lib/libGLESv1_CM.so",
-				"/system/lib/libGLESv2.so",
-				"/system/lib/libbinder.so",
-				"/system/lib/libz.so",
-				"/system/lib/libandroidfw.so",
-				"/system/lib/libspeexresampler.so",
-				"/system/lib/libaudioutils.so",
-				"/system/lib/libcamera_metadata.so",
-				"/system/lib/libsync.so",
-				"/system/lib/libhardware.so",
-				"/system/lib/libui.so",
-				"/vendor/lib/egl/eglsubAndroid.so",
-				"/vendor/lib/libsc-a3xx.so",
-				"/system/lib/libgui.so",
-				"/system/lib/libcamera_client.so",
-				"/system/lib/libcrypto.so",
-				"/system/lib/libexpat.so",
-				"/system/lib/libnetutils.so",
-				"/system/lib/libwpa_client.so",
-				"/system/lib/libhardware_legacy.so",
-				"/system/lib/libgabi++.so",
-				"/system/lib/libicuuc.so",
-				"/system/lib/libicui18n.so",
-				"/system/lib/libharfbuzz_ng.so",
-				"/system/lib/libc++.so",
-				"/system/lib/libLLVM.so",
-				"/system/lib/libbcinfo.so",
-				"/system/lib/libbcc.so",
-				"/system/lib/libpng.so",
-				"/system/lib/libft2.so",
-				"/system/lib/libRS.so",
-				"/system/lib/libRScpp.so",
-				"/system/lib/libjpeg.so",
-				"/system/lib/libskia.so",
-				"/system/lib/libhwui.so",
-				"/system/lib/libimg_utils.so",
-				"/system/lib/libinput.so",
-				"/system/lib/libinputflinger.so",
-				"/system/lib/libcommon_time_client.so",
-				"/system/lib/libnbaio.so",
-				"/system/lib/libsonivox.so",
-				"/system/lib/libstagefright_foundation.so",
-				"/system/lib/libmedia.so",
-				"/system/lib/libmemtrack.so",
-				"/system/lib/libminikin.so",
-				"/system/lib/libnativebridge.so",
-				"/system/lib/libnativehelper.so",
-				"/system/lib/libnetd_client.so",
-				"/system/lib/libpdfium.so",
-				"/system/lib/libprocessgroup.so",
-				"/system/lib/libselinux.so",
-				"/system/lib/libsoundtrigger.so",
-				"/system/lib/libsqlite.so",
-				"/system/lib/libssl.so",
-				"/system/lib/libusbhost.so",
-				"/system/lib/libandroid_runtime.so",
-				"/system/lib/libbacktrace_libc++.so",
-				"/system/lib/libart.so",
-				"/system/lib/libjavacore.so",
-				"/system/lib/libexif.so",
-				"/system/lib/libjhead.so",
-				"/system/lib/libmtp.so",
-				"/system/lib/libdrmframework.so",
-				"/system/lib/libopus.so",
-				"/system/lib/libpowermanager.so",
-				"/system/lib/libstagefright_avc_common.so",
-				"/system/lib/libstagefright_enc_common.so",
-				"/system/lib/libstagefright_omx.so",
-				"/system/lib/libstagefright_yuv.so",
-				"/system/lib/libvorbisidec.so",
-				"/system/lib/libstagefright.so",
-				"/system/lib/libstagefright_amrnb_common.so",
-				"/system/lib/libmedia_jni.so",
-				"/system/lib/libsoundpool.so",
-				"/system/lib/libaudioeffect_jni.so",
-				"/system/lib/librs_jni.so",
-				"/system/lib/libjavacrypto.so",
-				"/system/lib/libandroid.so",
-				"/system/lib/libcompiler_rt.so",
-				"/system/lib/libjnigraphics.so",
-				"/system/lib/libwebviewchromium_loader.so",
-
-				"/system/lib/hw/memtrack.msm8960.so",
-
-				"/vendor/lib/libgsl.so",
-				"/vendor/lib/libadreno_utils.so",
-				"/vendor/lib/egl/libEGL_adreno.so",
-				"/vendor/lib/egl/libGLESv1_CM_adreno.so",
-				"/vendor/lib/egl/libGLESv2_adreno.so",
-			]),
-		"nexus-10" : Device(
-			nativeBuildDir = "../native/debug-13-armeabi-v7a",
-			deviceGdbCmd = "lib/gdbserver",
-			hostGdbBins = {
-				"linux" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb")),
-				"windows" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gdb"))
-			},
-			appProcessName = "app_process",
-			linkerName = "linker",
-			libraries = [
-				"/system/lib/libutils.so",
-				"/system/lib/libstdc++.so",
-				"/system/lib/libm.so",
-				"/system/lib/liblog.so",
-				"/system/lib/libhardware.so",
-				"/system/lib/libbinder.so",
-				"/system/lib/libcutils.so",
-				"/system/lib/libc++.so",
-				"/system/lib/libLLVM.so",
-				"/system/lib/libbcinfo.so",
-				"/system/lib/libunwind.so",
-				"/system/lib/libz.so",
-				"/system/lib/libpng.so",
-				"/system/lib/libcommon_time_client.so",
-				"/system/lib/libstlport.so",
-				"/system/lib/libui.so",
-				"/system/lib/libsync.so",
-				"/system/lib/libgui.so",
-				"/system/lib/libft2.so",
-				"/system/lib/libbcc.so",
-				"/system/lib/libGLESv2.so",
-				"/system/lib/libGLESv1_CM.so",
-				"/system/lib/libEGL.so",
-				"/system/lib/libunwind-ptrace.so",
-				"/system/lib/libgccdemangle.so",
-				"/system/lib/libcrypto.so",
-				"/system/lib/libicuuc.so",
-				"/system/lib/libicui18n.so",
-				"/system/lib/libjpeg.so",
-				"/system/lib/libexpat.so",
-				"/system/lib/libpcre.so",
-				"/system/lib/libharfbuzz_ng.so",
-				"/system/lib/libstagefright_foundation.so",
-				"/system/lib/libsonivox.so",
-				"/system/lib/libnbaio.so",
-				"/system/lib/libcamera_client.so",
-				"/system/lib/libaudioutils.so",
-				"/system/lib/libinput.so",
-				"/system/lib/libhardware_legacy.so",
-				"/system/lib/libcamera_metadata.so",
-				"/system/lib/libgabi++.so",
-				"/system/lib/libskia.so",
-				"/system/lib/libRScpp.so",
-				"/system/lib/libRS.so",
-				"/system/lib/libwpa_client.so",
-				"/system/lib/libnetutils.so",
-				"/system/lib/libspeexresampler.so",
-				"/system/lib/libGLES_trace.so",
-				"/system/lib/libbacktrace.so",
-				"/system/lib/libusbhost.so",
-				"/system/lib/libssl.so",
-				"/system/lib/libsqlite.so",
-				"/system/lib/libsoundtrigger.so",
-				"/system/lib/libselinux.so",
-				"/system/lib/libprocessgroup.so",
-				"/system/lib/libpdfium.so",
-				"/system/lib/libnetd_client.so",
-				"/system/lib/libnativehelper.so",
-				"/system/lib/libnativebridge.so",
-				"/system/lib/libminikin.so",
-				"/system/lib/libmemtrack.so",
-				"/system/lib/libmedia.so",
-				"/system/lib/libinputflinger.so",
-				"/system/lib/libimg_utils.so",
-				"/system/lib/libhwui.so",
-				"/system/lib/libandroidfw.so",
-				"/system/lib/libETC1.so",
-				"/system/lib/libandroid_runtime.so",
-				"/system/lib/libsigchain.so",
-				"/system/lib/libbacktrace_libc++.so",
-				"/system/lib/libart.so",
-				"/system/lib/libjavacore.so",
-				"/system/lib/libvorbisidec.so",
-				"/system/lib/libstagefright_yuv.so",
-				"/system/lib/libstagefright_omx.so",
-				"/system/lib/libstagefright_enc_common.so",
-				"/system/lib/libstagefright_avc_common.so",
-				"/system/lib/libpowermanager.so",
-				"/system/lib/libopus.so",
-				"/system/lib/libdrmframework.so",
-				"/system/lib/libstagefright_amrnb_common.so",
-				"/system/lib/libstagefright.so",
-				"/system/lib/libmtp.so",
-				"/system/lib/libjhead.so",
-				"/system/lib/libexif.so",
-				"/system/lib/libmedia_jni.so",
-				"/system/lib/libsoundpool.so",
-				"/system/lib/libaudioeffect_jni.so",
-				"/system/lib/librs_jni.so",
-				"/system/lib/libjavacrypto.so",
-				"/system/lib/libandroid.so",
-				"/system/lib/libcompiler_rt.so",
-				"/system/lib/libjnigraphics.so",
-				"/system/lib/libwebviewchromium_loader.so",
-				"/system/lib/libion.so",
-				"/vendor/lib/hw/gralloc.exynos5.so",
-				"/vendor/lib/egl/libGLES_mali.so",
-			]),
-		"default" : Device(
-			nativeBuildDir = "../native/debug-13-armeabi-v7a",
-			deviceGdbCmd = "lib/gdbserver",
-			hostGdbBins = {
-				"linux" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi-gdb")),
-				"windows" : common.shellquote(os.path.join(common.ANDROID_NDK_PATH, "toolchains/arm-linux-androideabi-4.8/prebuilt/windows/bin/arm-linux-androideabi-gdb"))
-			},
-			appProcessName = "app_process",
-			linkerName = "linker",
-			libraries = [
-			]),
-	}
-
-	parser.add_argument('--adb',				dest='adbCmd',			default=common.ADB_BIN, help="Path to adb command. Use absolute paths.")
-	parser.add_argument('--deqp-commandline',	dest='deqpCmdLine',		default="--deqp-log-filename=/sdcard/TestLog.qpa", help="Command line arguments passed to dEQP test binary.")
-	parser.add_argument('--gdb',				dest='gdbCmd',			default=None, help="gdb command used by script. Use absolute paths")
-	parser.add_argument('--device-gdb',			dest='deviceGdbCmd',	default=None, help="gdb command used by script on device.")
-	parser.add_argument('--target-gdb-port',	dest='targetGDBPort',	default=60001, type=int, help="Port used by gdbserver on target.")
-	parser.add_argument('--host-gdb-port',		dest='hostGDBPort',		default=60002, type=int, help="Host port that is forwarded to device gdbserver port.")
-	parser.add_argument('--jdb',				dest='jdbCmd',			default="jdb", help="Path to jdb command. Use absolute paths.")
-	parser.add_argument('--jdb-port',			dest='jdbPort',			default=60003, type=int, help="Host port used to forward jdb commands to device.")
-	parser.add_argument('--build-dir',			dest='buildDir',		default=None, help="Path to dEQP native build directory.")
-	parser.add_argument('--device-libs',		dest='deviceLibs',		default=[], nargs='+', help="List of libraries that should be pulled from device for debugging.")
-	parser.add_argument('--breakpoints',		dest='breakpoints',		default=["tcu::App::App"], nargs='+', help="List of breakpoints that are set by gdb.")
-	parser.add_argument('--app-process-name',	dest='appProcessName',	default=None, help="Name of the app_process binary.")
-	parser.add_argument('--linker-name',		dest='linkerName',		default=None, help="Name of the linker binary.")
-	parser.add_argument('--device',				dest='device',			default="default", choices=devices, help="Pull default libraries for this device.")
-	parser.add_argument('--serial','-s',		dest='serial',			default=None, help="-s Argument for adb.")
-
-	args = parser.parse_args()
-	device = devices[args.device]
-
-	if args.deviceGdbCmd == None:
-		args.deviceGdbCmd = device.getDeviceGdbCommand()
-
-	if args.buildDir == None:
-		args.buildDir = device.getBuildDir()
-
-	if args.gdbCmd == None:
-		args.gdbCmd = device.getGdbCommand(common.getPlatform())
-
-	if args.linkerName == None:
-		args.linkerName = device.getLinkerName()
-
-	if args.appProcessName == None:
-		args.appProcessName = device.getAppProcessName()
-
-	debug(adbCmd=os.path.normpath(args.adbCmd),
-		  gdbCmd=os.path.normpath(args.gdbCmd),
-		  targetGDBPort=args.targetGDBPort,
-		  hostGDBPort=args.hostGDBPort,
-		  jdbCmd=os.path.normpath(args.jdbCmd),
-		  jdbPort=args.jdbPort,
-		  deqpCmdLine=args.deqpCmdLine,
-		  buildDir=args.buildDir,
-		  deviceLibs=["/system/lib/libc.so", "/system/lib/libdl.so"] + args.deviceLibs + device.getLibs(),
-		  breakpoints=args.breakpoints,
-		  serial=args.serial,
-		  deviceGdbCmd=args.deviceGdbCmd,
-		  appProcessName=args.appProcessName,
-		  linkerName=args.linkerName)
diff --git a/android/scripts/install.py b/android/scripts/install.py
deleted file mode 100644
index 5545cbb..0000000
--- a/android/scripts/install.py
+++ /dev/null
@@ -1,102 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import sys
-import os
-import time
-import string
-import argparse
-
-import common
-
-def install (buildRoot, extraArgs = [], printPrefix=""):
-	print printPrefix + "Removing old dEQP Package...\n",
-	common.execArgsInDirectory([common.ADB_BIN] + extraArgs + [
-			'uninstall',
-			'com.drawelements.deqp'
-		], buildRoot, printPrefix, failOnNonZeroExit=False)
-	print printPrefix + "Remove complete\n",
-
-	print printPrefix + "Installing dEQP Package from %s...\n" %(buildRoot),
-	common.execArgsInDirectory([common.ADB_BIN] + extraArgs + [
-			'install',
-			'-r',
-			'package/bin/dEQP-debug.apk'
-		], buildRoot, printPrefix)
-	print printPrefix + "Install complete\n",
-
-def installToDevice (device, buildRoot, printPrefix=""):
-	if len(printPrefix) == 0:
-		print "Installing to %s (%s)...\n" % (device.serial, device.model),
-	else:
-		print printPrefix + "Installing to %s\n" % device.serial,
-
-	install(buildRoot, ['-s', device.serial], printPrefix)
-
-def installToDevices (devices, doParallel, buildRoot):
-	padLen = max([len(device.model) for device in devices])+1
-	if doParallel:
-		common.parallelApply(installToDevice, [(device, buildRoot, ("(%s):%s" % (device.model, ' ' * (padLen - len(device.model))))) for device in devices]);
-	else:
-		common.serialApply(installToDevice, [(device, buildRoot) for device in devices]);
-
-def installToAllDevices (doParallel, buildRoot):
-	devices = common.getDevices(common.ADB_BIN)
-	installToDevices(devices, doParallel, buildRoot)
-
-if __name__ == "__main__":
-	parser = argparse.ArgumentParser()
-	parser.add_argument('-p', '--parallel', dest='doParallel', action="store_true", help="Install package in parallel.")
-	parser.add_argument('-s', '--serial', dest='serial', type=str, nargs='+', help="Install package to device with serial number.")
-	parser.add_argument('-a', '--all', dest='all', action="store_true", help="Install to all devices.")
-	parser.add_argument('-b', '--build-root', dest='buildRoot', default=common.ANDROID_DIR, help="Root directory from which to pick up APK. Generally, build root specified in build.py")
-
-	args = parser.parse_args()
-	absBuildRoot = os.path.abspath(args.buildRoot)
-
-	if args.all:
-		installToAllDevices(args.doParallel, absBuildRoot)
-	else:
-		if args.serial == None:
-			devices = common.getDevices(common.ADB_BIN)
-			if len(devices) == 0:
-				common.die('No devices connected')
-			elif len(devices) == 1:
-				installToDevice(devices[0], absBuildRoot)
-			else:
-				print "More than one device connected:"
-				for i in range(0, len(devices)):
-					print "%3d: %16s %s" % ((i+1), devices[i].serial, devices[i].model)
-
-				deviceNdx = int(raw_input("Choose device (1-%d): " % len(devices)))
-				installToDevice(devices[deviceNdx-1], absBuildRoot)
-		else:
-			devices = common.getDevices(common.ADB_BIN)
-
-			devices = [dev for dev in devices if dev.serial in args.serial]
-			devSerials = [dev.serial for dev in devices]
-			notFounds = [serial for serial in args.serial if not serial in devSerials]
-
-			for notFound in notFounds:
-				print("Couldn't find device matching serial '%s'" % notFound)
-
-			installToDevices(devices, args.doParallel, absBuildRoot)
diff --git a/android/scripts/launch.py b/android/scripts/launch.py
deleted file mode 100644
index cf0d765..0000000
--- a/android/scripts/launch.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# drawElements Quality Program utilities
-# --------------------------------------
-#
-# Copyright 2015 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import sys
-import os
-import time
-import string
-
-import common
-
-def launch (extraArgs = ""):
-	curDir = os.getcwd()
-
-	try:
-		os.chdir(common.ANDROID_DIR)
-
-		adbCmd = common.shellquote(common.ADB_BIN)
-		if len(extraArgs) > 0:
-			adbCmd += " %s" % extraArgs
-
-		print "Launching dEQP ExecService..."
-		common.execute("%s forward tcp:50016 tcp:50016" % adbCmd)
-		common.execute("%s shell setprop log.tag.dEQP DEBUG" % adbCmd)
-		common.execute("%s shell am start -n com.drawelements.deqp/.execserver.ServiceStarter" % adbCmd)
-		print "ExecService launched on device"
-	finally:
-		# Restore working dir
-		os.chdir(curDir)
-
-if __name__ == "__main__":
-	if len(sys.argv) > 1:
-		launch(string.join(sys.argv[1:], " "))
-	else:
-		launch()
diff --git a/external/openglcts/scripts/build_android.py b/external/openglcts/scripts/build_android.py
deleted file mode 100644
index 91a91d7..0000000
--- a/external/openglcts/scripts/build_android.py
+++ /dev/null
@@ -1,37 +0,0 @@
-# -*- coding: utf-8 -*-
-
-#-------------------------------------------------------------------------
-# Khronos OpenGL CTS
-# ------------------
-#
-# Copyright (c) 2016 The Khronos Group Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-import os
-import sys
-import argparse
-
-sys.path.append(os.path.join(os.path.dirname(__file__), "..", "..", "..", "android", "scripts"))
-
-import build
-
-if __name__ == "__main__":
-	parser = argparse.ArgumentParser()
-
-	parser.add_argument('--glcts-gtf-target', dest='gtfTarget', default='gles32', choices=['gles32', 'gles31', 'gles3', 'gles2', 'gl'], help="Build GLCTS GTF module for the given API.")
-	args = parser.parse_args()
-
-	build.build(package='openglcts', gtfTarget=args.gtfTarget)
diff --git a/framework/delibs/cmake/toolchain-android-r10c.cmake b/framework/delibs/cmake/toolchain-android-r10c.cmake
deleted file mode 100644
index f7cc938..0000000
--- a/framework/delibs/cmake/toolchain-android-r10c.cmake
+++ /dev/null
@@ -1,166 +0,0 @@
-#-------------------------------------------------------------------------
-# drawElements CMake utilities
-# ----------------------------
-#
-# Copyright 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-# Platform defines.
-set(CMAKE_SYSTEM_NAME Linux)
-
-set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
-
-set(CMAKE_CROSSCOMPILING 1)
-
-# NDK installation path
-if (NOT DEFINED ANDROID_NDK_PATH)
-	message(FATAL_ERROR "Please provide ANDROID_NDK_PATH")
-endif ()
-
-# Host os (for toolchain binaries)
-if (NOT DEFINED ANDROID_NDK_HOST_OS)
-	message(STATUS "Warning: ANDROID_NDK_HOST_OS is not set")
-	if (WIN32)
-		set(ANDROID_NDK_HOST_OS "windows")
-	elseif (UNIX)
-		set(ANDROID_NDK_HOST_OS "linux-86")
-	endif ()
-endif ()
-
-# Compile target
-set(ANDROID_ABI			"armeabi-v7a"			CACHE STRING "Android ABI")
-set(ANDROID_NDK_TARGET	"android-${DE_ANDROID_API}")
-
-# dE defines
-set(DE_OS		"DE_OS_ANDROID")
-set(DE_COMPILER	"DE_COMPILER_GCC")
-if (NOT DEFINED DE_ANDROID_API)
-	set(DE_ANDROID_API 9)
-endif ()
-
-set(COMMON_C_FLAGS		"-mandroid -D__STDC_INT64__")
-set(COMMON_CXX_FLAGS	"${COMMON_C_FLAGS} -frtti -fexceptions")
-set(COMMON_LINKER_FLAGS	"")
-set(ARM_C_FLAGS			"-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ")
-
-# ABI-dependent bits
-if (ANDROID_ABI STREQUAL "x86")
-	set(DE_CPU					"DE_CPU_X86")
-	set(CMAKE_SYSTEM_PROCESSOR	i686-android-linux)
-
-	set(ANDROID_CC_PATH			"${ANDROID_NDK_PATH}/toolchains/x86-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE			"${ANDROID_CC_PATH}bin/i686-linux-android-")
-	set(ANDROID_SYSROOT			"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86")
-	set(LIBGCC					"${ANDROID_CC_PATH}lib/gcc/i686-linux-android/4.9/libgcc.a")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}"
-		"${ANDROID_CC_PATH}i686-linux-android"
-		"${ANDROID_CC_PATH}lib/gcc/i686-linux-android/4.9"
-		${ANDROID_SYSROOT}
-		)
-
-	set(TARGET_C_FLAGS			"-march=i686 -msse3 -mstackrealign -mfpmath=sse")
-	set(TARGET_LINKER_FLAGS		"")
-
-elseif (ANDROID_ABI STREQUAL "armeabi" OR
-		ANDROID_ABI STREQUAL "armeabi-v7a")
-	set(DE_CPU					"DE_CPU_ARM")
-	set(CMAKE_SYSTEM_PROCESSOR	arm-linux-androideabi)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/arm-linux-androideabi-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm")
-
-	if (ANDROID_ABI STREQUAL "armeabi-v7a")
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv7-a")
-		set(LIBGCC				"${ANDROID_CC_PATH}lib/gcc/arm-linux-androideabi/4.9/armv7-a/libgcc.a")
-
-	else () # armeabi
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv5te -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv5te")
-		set(LIBGCC				"${ANDROID_CC_PATH}lib/gcc/arm-linux-androideabi/4.9/libgcc.a")
-	endif ()
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}"
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		${ANDROID_SYSROOT}
-		)
-
-elseif (ANDROID_ABI STREQUAL "arm64-v8a")
-	set(DE_CPU					"DE_CPU_ARM_64")
-	set(CMAKE_SYSTEM_PROCESSOR	aarch64-linux-android)
-	set(CMAKE_SIZEOF_VOID_P		8)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/aarch64-linux-android-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/aarch64-linux-android-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm64")
-	set(LIBGCC			"${ANDROID_CC_PATH}lib/gcc/aarch64-linux-android/4.9/libgcc.a")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}"
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		${ANDROID_SYSROOT}
-		)
-
-	set(TARGET_C_FLAGS		"-march=armv8-a -mabi=lp64")
-	set(TARGET_LINKER_FLAGS	"-march=armv8-a")
-
-else ()
-	message(FATAL_ERROR "Unknown ABI \"${ANDROID_ABI}\"")
-endif ()
-
-# crtbegin_so.o & crtend_so.o \todo [pyry] Is there some special CMake variable for these?
-if (DE_ANDROID_API GREATER 8)
-	set(CRTBEGIN_SO	"${ANDROID_SYSROOT}/usr/lib/crtbegin_so.o")
-	set(CRTEND_SO	"${ANDROID_SYSROOT}/usr/lib/crtend_so.o")
-endif ()
-
-# C++ library
-set(LIBCPP "${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/libgnustl_static.a")
-
-include(CMakeForceCompiler)
-
-if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
-	ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
-	ANDROID_NDK_HOST_OS STREQUAL "darwin-x86")
-	cmake_force_c_compiler("${CROSS_COMPILE}gcc"		GNU)
-	cmake_force_cxx_compiler("${CROSS_COMPILE}g++"		GNU)
-elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
-	cmake_force_c_compiler("${CROSS_COMPILE}gcc.exe"	GNU)
-	cmake_force_cxx_compiler("${CROSS_COMPILE}g++.exe"	GNU)
-else ()
-	message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
-endif ()
-
-set(CMAKE_SHARED_LIBRARY_C_FLAGS	"")
-set(CMAKE_SHARED_LIBRARY_CXX_FLAGS	"")
-
-set(CMAKE_C_CREATE_SHARED_LIBRARY	"<CMAKE_C_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
-set(CMAKE_CXX_CREATE_SHARED_LIBRARY	"<CMAKE_CXX_COMPILER> <LANGUAGE_COMPILE_FLAGS> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> ${CRTBEGIN_SO} <OBJECTS> <LINK_LIBRARIES> ${LIBCPP} ${LIBGCC} ${CRTEND_SO}")
-set(CMAKE_CXX_LINK_EXECUTABLE		"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES> ${LIBCPP} ${LIBGCC}")
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-# \note Without CACHE STRING FORCE cmake ignores these.
-set(CMAKE_C_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_C_FLAGS} ${TARGET_C_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_CXX_FLAGS} ${TARGET_C_FLAGS} -I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/include -I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/include" CACHE STRING "" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS	"-nostdlib -Wl,-shared,-Bsymbolic -Wl,--no-undefined ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS		"${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
diff --git a/framework/delibs/cmake/toolchain-android-r10e.cmake b/framework/delibs/cmake/toolchain-android-r10e.cmake
deleted file mode 100644
index 683232a..0000000
--- a/framework/delibs/cmake/toolchain-android-r10e.cmake
+++ /dev/null
@@ -1,225 +0,0 @@
-#-------------------------------------------------------------------------
-# drawElements CMake utilities
-# ----------------------------
-#
-# Copyright 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-# Platform defines.
-set(CMAKE_SYSTEM_NAME Linux)
-
-set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
-
-set(CMAKE_CROSSCOMPILING 1)
-
-# NDK installation path
-if (NOT DEFINED ANDROID_NDK_PATH)
-	message(FATAL_ERROR "Please provide ANDROID_NDK_PATH")
-endif ()
-
-# Host os (for toolchain binaries)
-if (NOT DEFINED ANDROID_NDK_HOST_OS)
-	message(STATUS "Warning: ANDROID_NDK_HOST_OS is not set")
-	if (WIN32)
-		set(ANDROID_NDK_HOST_OS "windows")
-	elseif (UNIX)
-		set(ANDROID_NDK_HOST_OS "linux-86")
-	endif ()
-endif ()
-
-# Compile target
-set(ANDROID_ABI			"armeabi-v7a"			CACHE STRING "Android ABI")
-set(ANDROID_NDK_TARGET	"android-${DE_ANDROID_API}")
-
-# dE defines
-set(DE_OS "DE_OS_ANDROID")
-
-if (NOT DEFINED DE_COMPILER)
-	set(DE_COMPILER	"DE_COMPILER_CLANG")
-endif ()
-
-if (NOT DEFINED DE_ANDROID_API)
-	set(DE_ANDROID_API 9)
-endif ()
-
-set(COMMON_C_FLAGS		"-D__STDC_INT64__")
-set(COMMON_CXX_FLAGS	"${COMMON_C_FLAGS} -frtti -fexceptions")
-set(COMMON_LINKER_FLAGS	"")
-set(ARM_C_FLAGS			"-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ")
-
-# ABI-dependent bits
-if (ANDROID_ABI STREQUAL "x86")
-	set(DE_CPU					"DE_CPU_X86")
-	set(CMAKE_SYSTEM_PROCESSOR	i686-android-linux)
-
-	set(ANDROID_CC_PATH			"${ANDROID_NDK_PATH}/toolchains/x86-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE			"${ANDROID_CC_PATH}bin/i686-linux-android-")
-	set(ANDROID_SYSROOT			"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}i686-linux-android"
-		"${ANDROID_CC_PATH}lib/gcc/i686-linux-android/4.9"
-		)
-
-	set(TARGET_C_FLAGS			"-march=i686 -msse3 -mstackrealign -mfpmath=sse")
-	set(TARGET_LINKER_FLAGS		"")
-	set(LLVM_TRIPLE				"i686-none-linux-android")
-
-elseif (ANDROID_ABI STREQUAL "armeabi" OR
-		ANDROID_ABI STREQUAL "armeabi-v7a")
-	set(DE_CPU					"DE_CPU_ARM")
-	set(CMAKE_SYSTEM_PROCESSOR	arm-linux-androideabi)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/arm-linux-androideabi-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm")
-
-	if (ANDROID_ABI STREQUAL "armeabi-v7a")
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv7-a")
-		set(LLVM_TRIPLE			"armv7-none-linux-androideabi")
-
-	else () # armeabi
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv5te -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv5te")
-		set(LLVM_TRIPLE			"armv5te-none-linux-androideabi")
-	endif ()
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		)
-
-elseif (ANDROID_ABI STREQUAL "arm64-v8a")
-	set(DE_CPU					"DE_CPU_ARM_64")
-	set(CMAKE_SYSTEM_PROCESSOR	aarch64-linux-android)
-	set(CMAKE_SIZEOF_VOID_P		8)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/aarch64-linux-android-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/aarch64-linux-android-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm64")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		)
-
-	set(TARGET_C_FLAGS		"-march=armv8-a")
-	set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a53-835769 -Wl,--fix-cortex-a53-835769 -march=armv8-a")
-	set(LLVM_TRIPLE			"aarch64-none-linux-android")
-
-	if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
-		set(TARGET_C_FLAGS "${TARGET_C_FLAGS} -mabi=lp64")
-	endif ()
-
-elseif (ANDROID_ABI STREQUAL "x86_64")
-	set(DE_CPU					"DE_CPU_X86_64")
-	set(CMAKE_SYSTEM_PROCESSOR	x86_64-linux-android)
-	set(CMAKE_SIZEOF_VOID_P		8)
-
-	set(CMAKE_LIBRARY_PATH "/usr/lib64")
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/x86_64-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/x86_64-linux-android-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86_64")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}x86_64-linux-android"
-		)
-
-	set(LLVM_TRIPLE			"x86_64-none-linux-android")
-
-else ()
-	message(FATAL_ERROR "Unknown ABI \"${ANDROID_ABI}\"")
-endif ()
-
-# C++ library
-if (ANDROID_ABI STREQUAL "x86")
-	# Use gnu-libstc++, since libc++ is currently broken on x86, bug #22124988
-	set(ANDROID_CXX_LIBRARY		"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/libgnustl_static.a")
-	set(CXX_INCLUDES			"-I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/include -I${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}/include")
-	set(CMAKE_FIND_ROOT_PATH	"${ANDROID_NDK_PATH}/sources/cxx-stl/gnu-libstdc++/4.9/libs/${ANDROID_ABI}" ${CMAKE_FIND_ROOT_PATH})
-else ()
-	# Use LLVM libc++ for full C++11 support
-	set(ANDROID_CXX_LIBRARY		"${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_static.a")
-	set(CXX_INCLUDES			"-I${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libcxx/include")
-	set(CMAKE_FIND_ROOT_PATH	"" ${CMAKE_FIND_ROOT_PATH})
-endif ()
-
-set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ANDROID_SYSROOT})
-
-include(CMakeForceCompiler)
-
-if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
-	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86")
-		cmake_force_c_compiler("${CROSS_COMPILE}gcc"		GNU)
-		cmake_force_cxx_compiler("${CROSS_COMPILE}g++"		GNU)
-	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
-		cmake_force_c_compiler("${CROSS_COMPILE}gcc.exe"	GNU)
-		cmake_force_cxx_compiler("${CROSS_COMPILE}g++.exe"	GNU)
-	else ()
-		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
-	endif ()
-
-	set(TARGET_C_FLAGS		"-mandroid ${TARGET_C_FLAGS}")
-
-elseif (DE_COMPILER STREQUAL "DE_COMPILER_CLANG")
-	if (NOT DEFINED LLVM_VERSION)
-		if (ANDROID_NDK_HOST_OS STREQUAL "windows" OR
-			ANDROID_NDK_HOST_OS STREQUAL "windows-x86_64")
-			# Windows NDK prebuilts don't include llvm-ar tool in version 3.6
-			set(LLVM_VERSION "3.5")
-		else ()
-			set(LLVM_VERSION "3.6")
-		endif ()
-	endif ()
-
-	set(LLVM_PATH "${ANDROID_NDK_PATH}/toolchains/llvm-${LLVM_VERSION}/prebuilt/${ANDROID_NDK_HOST_OS}/")
-
-	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86_64")
-		cmake_force_c_compiler("${LLVM_PATH}bin/clang"			Clang)
-		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++"		Clang)
-		set(CMAKE_AR "${LLVM_PATH}/bin/llvm-ar" CACHE FILEPATH "Archiver")
-		set(CMAKE_RANLIB "${CROSS_COMPILE}ranlib" CACHE FILEPATH "Indexer")
-	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows" OR
-			ANDROID_NDK_HOST_OS STREQUAL "windows-x86_64")
-		cmake_force_c_compiler("${LLVM_PATH}bin/clang.exe"		Clang)
-		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++.exe"	Clang)
-		set(CMAKE_AR "${LLVM_PATH}bin/llvm-ar.exe" CACHE FILEPATH "Archiver")
-	else ()
-		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
-	endif ()
-
-	set(TARGET_C_FLAGS		"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_C_FLAGS}")
-	set(TARGET_LINKER_FLAGS	"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_LINKER_FLAGS}")
-
-endif ()
-
-set(CMAKE_SHARED_LIBRARY_C_FLAGS	"")
-set(CMAKE_SHARED_LIBRARY_CXX_FLAGS	"")
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-# \note Without CACHE STRING FORCE cmake ignores these.
-set(CMAKE_C_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_C_FLAGS} ${TARGET_C_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${COMMON_CXX_FLAGS} ${TARGET_C_FLAGS} ${CXX_INCLUDES} -I${ANDROID_NDK_PATH}/sources/android/support/include" CACHE STRING "" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS	"-nodefaultlibs -Wl,-shared,-Bsymbolic -Wl,--no-undefined ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS		"-nodefaultlibs ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
diff --git a/framework/delibs/cmake/toolchain-android-r11.cmake b/framework/delibs/cmake/toolchain-android-r11.cmake
deleted file mode 100644
index d20ded1..0000000
--- a/framework/delibs/cmake/toolchain-android-r11.cmake
+++ /dev/null
@@ -1,210 +0,0 @@
-#-------------------------------------------------------------------------
-# drawElements CMake utilities
-# ----------------------------
-#
-# Copyright 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#      http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-#-------------------------------------------------------------------------
-
-# Platform defines.
-set(CMAKE_SYSTEM_NAME Linux)
-
-set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE)
-
-set(CMAKE_CROSSCOMPILING 1)
-
-# NDK installation path
-if (NOT DEFINED ANDROID_NDK_PATH)
-	message(FATAL_ERROR "Please provide ANDROID_NDK_PATH")
-endif ()
-
-# Host os (for toolchain binaries)
-if (NOT DEFINED ANDROID_NDK_HOST_OS)
-	message(STATUS "Warning: ANDROID_NDK_HOST_OS is not set")
-	if (WIN32)
-		set(ANDROID_NDK_HOST_OS "windows")
-	elseif (UNIX)
-		set(ANDROID_NDK_HOST_OS "linux-86")
-	endif ()
-endif ()
-
-# Compile target
-set(ANDROID_ABI			"armeabi-v7a"			CACHE STRING "Android ABI")
-set(ANDROID_NDK_TARGET	"android-${DE_ANDROID_API}")
-
-# dE defines
-set(DE_OS "DE_OS_ANDROID")
-
-if (NOT DEFINED DE_COMPILER)
-	set(DE_COMPILER	"DE_COMPILER_CLANG")
-endif ()
-
-if (NOT DEFINED DE_ANDROID_API)
-	set(DE_ANDROID_API 9)
-endif ()
-
-set(COMMON_C_FLAGS		"-D__STDC_INT64__")
-set(COMMON_CXX_FLAGS	"${COMMON_C_FLAGS} -frtti -fexceptions")
-set(COMMON_LINKER_FLAGS	"")
-set(ARM_C_FLAGS			"-D__ARM_ARCH_5__ -D__ARM_ARCH_5T__ -D__ARM_ARCH_5E__ -D__ARM_ARCH_5TE__ ")
-
-# ABI-dependent bits
-if (ANDROID_ABI STREQUAL "x86")
-	set(DE_CPU					"DE_CPU_X86")
-	set(CMAKE_SYSTEM_PROCESSOR	i686-android-linux)
-
-	set(ANDROID_CC_PATH			"${ANDROID_NDK_PATH}/toolchains/x86-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE			"${ANDROID_CC_PATH}bin/i686-linux-android-")
-	set(ANDROID_SYSROOT			"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}i686-linux-android"
-		"${ANDROID_CC_PATH}lib/gcc/i686-linux-android/4.9"
-		)
-
-	set(TARGET_C_FLAGS			"-march=i686 -msse3 -mstackrealign -mfpmath=sse")
-	set(TARGET_LINKER_FLAGS		"")
-	set(LLVM_TRIPLE				"i686-none-linux-android")
-
-elseif (ANDROID_ABI STREQUAL "armeabi" OR
-		ANDROID_ABI STREQUAL "armeabi-v7a")
-	set(DE_CPU					"DE_CPU_ARM")
-	set(CMAKE_SYSTEM_PROCESSOR	arm-linux-androideabi)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/arm-linux-androideabi-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/arm-linux-androideabi-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm")
-
-	if (ANDROID_ABI STREQUAL "armeabi-v7a")
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv7-a -mfpu=vfpv3-d16 -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv7-a")
-		set(LLVM_TRIPLE			"armv7-none-linux-androideabi")
-
-	else () # armeabi
-		set(TARGET_C_FLAGS		"${ARM_C_FLAGS} -march=armv5te -mfloat-abi=softfp")
-		set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a8 -march=armv5te")
-		set(LLVM_TRIPLE			"armv5te-none-linux-androideabi")
-	endif ()
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		)
-
-elseif (ANDROID_ABI STREQUAL "arm64-v8a")
-	set(DE_CPU					"DE_CPU_ARM_64")
-	set(CMAKE_SYSTEM_PROCESSOR	aarch64-linux-android)
-	set(CMAKE_SIZEOF_VOID_P		8)
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/aarch64-linux-android-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/aarch64-linux-android-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-arm64")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}arm-linux-androideabi"
-		)
-
-	set(TARGET_C_FLAGS		"-march=armv8-a")
-	set(TARGET_LINKER_FLAGS	"-Wl,--fix-cortex-a53-835769 -Wl,--fix-cortex-a53-835769 -march=armv8-a")
-	set(LLVM_TRIPLE			"aarch64-none-linux-android")
-
-	if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
-		set(TARGET_C_FLAGS "${TARGET_C_FLAGS} -mabi=lp64")
-	endif ()
-
-elseif (ANDROID_ABI STREQUAL "x86_64")
-	set(DE_CPU					"DE_CPU_X86_64")
-	set(CMAKE_SYSTEM_PROCESSOR	x86_64-linux-android)
-	set(CMAKE_SIZEOF_VOID_P		8)
-
-	set(CMAKE_LIBRARY_PATH "/usr/lib64")
-
-	set(ANDROID_CC_PATH	"${ANDROID_NDK_PATH}/toolchains/x86_64-4.9/prebuilt/${ANDROID_NDK_HOST_OS}/")
-	set(CROSS_COMPILE	"${ANDROID_CC_PATH}bin/x86_64-linux-android-")
-	set(ANDROID_SYSROOT	"${ANDROID_NDK_PATH}/platforms/${ANDROID_NDK_TARGET}/arch-x86_64")
-
-	set(CMAKE_FIND_ROOT_PATH
-		"${ANDROID_CC_PATH}x86_64-linux-android"
-		)
-
-	set(LLVM_TRIPLE			"x86_64-none-linux-android")
-
-else ()
-	message(FATAL_ERROR "Unknown ABI \"${ANDROID_ABI}\"")
-endif ()
-
-# Use LLVM libc++ for full C++11 support
-set(ANDROID_CXX_LIBRARY		"${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libs/${ANDROID_ABI}/libc++_static.a")
-set(CXX_INCLUDES			"-I${ANDROID_NDK_PATH}/sources/cxx-stl/llvm-libc++/libcxx/include")
-set(CMAKE_FIND_ROOT_PATH	"" ${CMAKE_FIND_ROOT_PATH})
-
-set(CMAKE_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH} ${ANDROID_SYSROOT})
-
-include(CMakeForceCompiler)
-
-if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
-	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86")
-		cmake_force_c_compiler("${CROSS_COMPILE}gcc"		GNU)
-		cmake_force_cxx_compiler("${CROSS_COMPILE}g++"		GNU)
-	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
-		cmake_force_c_compiler("${CROSS_COMPILE}gcc.exe"	GNU)
-		cmake_force_cxx_compiler("${CROSS_COMPILE}g++.exe"	GNU)
-	else ()
-		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
-	endif ()
-
-	set(TARGET_C_FLAGS		"-mandroid ${TARGET_C_FLAGS}")
-
-elseif (DE_COMPILER STREQUAL "DE_COMPILER_CLANG")
-	set(LLVM_PATH "${ANDROID_NDK_PATH}/toolchains/llvm/prebuilt/${ANDROID_NDK_HOST_OS}/")
-
-	if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86" OR
-		ANDROID_NDK_HOST_OS STREQUAL "darwin-x86_64")
-		cmake_force_c_compiler("${LLVM_PATH}bin/clang"			Clang)
-		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++"		Clang)
-		set(CMAKE_AR "${CROSS_COMPILE}ar" CACHE FILEPATH "Archiver")
-		set(CMAKE_RANLIB "${CROSS_COMPILE}ranlib" CACHE FILEPATH "Indexer")
-
-	elseif (ANDROID_NDK_HOST_OS STREQUAL "windows" OR
-			ANDROID_NDK_HOST_OS STREQUAL "windows-x86_64")
-		cmake_force_c_compiler("${LLVM_PATH}bin/clang.exe"		Clang)
-		cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++.exe"	Clang)
-		set(CMAKE_AR "${CROSS_COMPILE}ar.exe" CACHE FILEPATH "Archiver")
-		set(CMAKE_RANLIB "${CROSS_COMPILE}ranlib.exe" CACHE FILEPATH "Indexer")
-
-	else ()
-		message(FATAL_ERROR "Unknown ANDROID_NDK_HOST_OS")
-	endif ()
-
-	set(TARGET_C_FLAGS		"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_C_FLAGS}")
-	set(TARGET_LINKER_FLAGS	"-target ${LLVM_TRIPLE} -gcc-toolchain ${ANDROID_CC_PATH} ${TARGET_LINKER_FLAGS}")
-
-endif ()
-
-set(CMAKE_SHARED_LIBRARY_C_FLAGS	"")
-set(CMAKE_SHARED_LIBRARY_CXX_FLAGS	"")
-
-set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
-set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
-set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
-
-# \note Without CACHE STRING FORCE cmake ignores these.
-set(CMAKE_C_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${CMAKE_C_FLAGS} ${COMMON_C_FLAGS} ${TARGET_C_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_CXX_FLAGS				"--sysroot=${ANDROID_SYSROOT} ${CMAKE_CXX_FLAGS} ${COMMON_CXX_FLAGS} ${TARGET_C_FLAGS} ${CXX_INCLUDES} -I${ANDROID_NDK_PATH}/sources/android/support/include" CACHE STRING "" FORCE)
-set(CMAKE_SHARED_LINKER_FLAGS	"-nodefaultlibs -Wl,-shared,-Bsymbolic -Wl,--no-undefined ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)
-set(CMAKE_EXE_LINKER_FLAGS		"-nodefaultlibs ${COMMON_LINKER_FLAGS} ${TARGET_LINKER_FLAGS}" CACHE STRING "" FORCE)