1#!/usr/bin/env python 2# 3# Copyright (C) 2015 The Android Open Source Project 4# 5# Licensed under the Apache License, Version 2.0 (the "License"); 6# you may not use this file except in compliance with the License. 7# You may obtain a copy of the License at 8# 9# http://www.apache.org/licenses/LICENSE-2.0 10# 11# Unless required by applicable law or agreed to in writing, software 12# distributed under the License is distributed on an "AS IS" BASIS, 13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14# See the License for the specific language governing permissions and 15# limitations under the License. 16# 17"""Builds NDK sysroots.""" 18from __future__ import print_function 19 20import os 21import site 22 23site.addsitedir(os.path.join(os.path.dirname(__file__), '../lib')) 24 25import build_support 26 27 28class ArgParser(build_support.ArgParser): 29 def __init__(self): 30 super(ArgParser, self).__init__() 31 32 self.add_argument( 33 '--arch', choices=build_support.ALL_ARCHITECTURES, 34 help='Architectures to build. Builds all if not present.') 35 36 37def main(args): 38 arches = build_support.ALL_ARCHITECTURES 39 if args.arch is not None: 40 arches = [args.arch] 41 42 print('Building plaforms: {}'.format(' '.join(arches))) 43 arch_arg = '--arch={}'.format(','.join(arches)) 44 ndk_dir_arg = '--ndk-dir={}'.format(build_support.ndk_path()) 45 build_cmd = [ 46 'bash', 'gen-platforms.sh', '--fast-copy', arch_arg, ndk_dir_arg, 47 ] 48 49 if args.host != 'linux': 50 build_cmd.append('--case-insensitive') 51 52 build_support.build(build_cmd, args) 53 54if __name__ == '__main__': 55 build_support.run(main, ArgParser) 56