blob: 197a38d2adb5e5cb228b76474957138cfd37bb22 [file] [log] [blame]
Dan Albert65780b22016-10-19 14:17:19 -07001#!/bin/bash -ex
2
3if [ -z "${OUT_DIR}" ]; then
4 echo Must set OUT_DIR
5 exit 1
6fi
7
8TOP=$(pwd)
9
Colin Cross9fe6ea82016-11-09 13:00:16 -080010source build/envsetup.sh
11PLATFORM_SDK_VERSION=$(get_build_var PLATFORM_SDK_VERSION)
Dan Albert59034512017-07-31 14:23:39 -070012PLATFORM_VERSION_ALL_CODENAMES=$(get_build_var PLATFORM_VERSION_ALL_CODENAMES)
13
14# PLATFORM_VERSION_ALL_CODESNAMES is a comma separated list like O,P. We need to
15# turn this into ["O","P"].
Dan Albert6807ba22017-08-30 13:55:35 -070016PLATFORM_VERSION_ALL_CODENAMES=${PLATFORM_VERSION_ALL_CODENAMES/,/'","'}
Dan Albert59034512017-07-31 14:23:39 -070017PLATFORM_VERSION_ALL_CODENAMES="[\"${PLATFORM_VERSION_ALL_CODENAMES}\"]"
Colin Cross9fe6ea82016-11-09 13:00:16 -080018
Dan Albert65780b22016-10-19 14:17:19 -070019SOONG_OUT=${OUT_DIR}/soong
20SOONG_NDK_OUT=${OUT_DIR}/soong/ndk
21rm -rf ${SOONG_OUT}
22mkdir -p ${SOONG_OUT}
23cat > ${SOONG_OUT}/soong.config << EOF
24{
Dan Albert59034512017-07-31 14:23:39 -070025 "Ndk_abis": true
26}
27EOF
28
29# We only really need to set some of these variables, but soong won't merge this
30# with the defaults, so we need to write out all the defaults with our values
31# added.
32cat > ${SOONG_OUT}/soong.variables << EOF
33{
34 "Platform_sdk_version": ${PLATFORM_SDK_VERSION},
35 "Platform_version_active_codenames": ${PLATFORM_VERSION_ALL_CODENAMES},
36
37 "DeviceName": "flounder",
38 "DeviceArch": "arm64",
39 "DeviceArchVariant": "armv8-a",
40 "DeviceCpuVariant": "denver64",
41 "DeviceAbi": [
42 "arm64-v8a"
43 ],
44 "DeviceUsesClang": true,
45 "DeviceSecondaryArch": "arm",
46 "DeviceSecondaryArchVariant": "armv7-a-neon",
47 "DeviceSecondaryCpuVariant": "denver",
48 "DeviceSecondaryAbi": [
49 "armeabi-v7a"
50 ],
51 "HostArch": "x86_64",
52 "HostSecondaryArch": "x86",
53 "Malloc_not_svelte": false,
54 "Safestack": false
Dan Albert65780b22016-10-19 14:17:19 -070055}
56EOF
Dan Willemsene0879fc2017-08-04 15:06:27 -070057m --skip-make ${SOONG_OUT}/ndk.timestamp
Dan Albert65780b22016-10-19 14:17:19 -070058
59if [ -n "${DIST_DIR}" ]; then
60 mkdir -p ${DIST_DIR} || true
61 tar cjf ${DIST_DIR}/ndk_platform.tar.bz2 -C ${SOONG_OUT} ndk
62fi