Merge changes I3c930d2e,I2ee3ebbf

* changes:
  Add a script to build the NDK prebuilts.
  Add an NDK ABIs mega build configuration.
This commit is contained in:
Treehugger Robot
2016-10-20 21:25:33 +00:00
committed by Gerrit Code Review
3 changed files with 57 additions and 9 deletions

View File

@@ -799,13 +799,15 @@ func decodeTargetProductVariables(config *config) (map[OsClass][]Target, error)
return targets, nil
}
func decodeMegaDevice() ([]Target, error) {
archSettings := []struct {
arch string
archVariant string
cpuVariant string
abi []string
}{
type archConfig struct {
arch string
archVariant string
cpuVariant string
abi []string
}
func getMegaDeviceConfig() []archConfig {
return []archConfig{
// armv5 is only used for unbundled apps
//{"arm", "armv5te", "", []string{"armeabi"}},
{"arm", "armv7-a", "generic", []string{"armeabi-v7a"}},
@@ -846,10 +848,23 @@ func decodeMegaDevice() ([]Target, error) {
{"x86_64", "sandybridge", "", []string{"x86_64"}},
{"x86_64", "silvermont", "", []string{"x86_64"}},
}
}
func getNdkAbisConfig() []archConfig {
return []archConfig{
{"arm", "armv5te", "", []string{"armeabi"}},
{"arm64", "armv8-a", "", []string{"arm64-v8a"}},
{"mips", "mips32-fp", "", []string{"mips"}},
{"mips64", "mips64r6", "", []string{"mips64"}},
{"x86", "", "", []string{"x86"}},
{"x86_64", "", "", []string{"x86_64"}},
}
}
func decodeArchSettings(archConfigs []archConfig) ([]Target, error) {
var ret []Target
for _, config := range archSettings {
for _, config := range archConfigs {
arch, err := decodeArch(config.arch, &config.archVariant,
&config.cpuVariant, &config.abi)
if err != nil {

View File

@@ -37,6 +37,7 @@ const productVariablesFileName = "soong.variables"
// config file. These will be included in the config struct.
type FileConfigurableOptions struct {
Mega_device *bool `json:",omitempty"`
Ndk_abis *bool `json:",omitempty"`
}
func (f *FileConfigurableOptions) SetDefaultConfig() {
@@ -211,8 +212,15 @@ func NewConfig(srcDir, buildDir string) (Config, error) {
return Config{}, err
}
var archConfig []archConfig
if Bool(config.Mega_device) {
deviceTargets, err := decodeMegaDevice()
archConfig = getMegaDeviceConfig()
} else if Bool(config.Ndk_abis) {
archConfig = getNdkAbisConfig()
}
if archConfig != nil {
deviceTargets, err := decodeArchSettings(archConfig)
if err != nil {
return Config{}, err
}

25
scripts/build-ndk-prebuilts.sh Executable file
View File

@@ -0,0 +1,25 @@
#!/bin/bash -ex
if [ -z "${OUT_DIR}" ]; then
echo Must set OUT_DIR
exit 1
fi
TOP=$(pwd)
SOONG_OUT=${OUT_DIR}/soong
SOONG_NDK_OUT=${OUT_DIR}/soong/ndk
rm -rf ${SOONG_OUT}
mkdir -p ${SOONG_OUT}
cat > ${SOONG_OUT}/soong.config << EOF
{
"Ndk_abis": true
}
EOF
BUILDDIR=${SOONG_OUT} ./bootstrap.bash
${SOONG_OUT}/soong ${SOONG_OUT}/ndk.timestamp
if [ -n "${DIST_DIR}" ]; then
mkdir -p ${DIST_DIR} || true
tar cjf ${DIST_DIR}/ndk_platform.tar.bz2 -C ${SOONG_OUT} ndk
fi