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 gdbserver for Android.""" 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 GCC_VERSION = '4.9' 39 40 arches = build_support.ALL_ARCHITECTURES 41 if args.arch is not None: 42 arches = [args.arch] 43 44 print('Building gdbservers: {}'.format(' '.join(arches))) 45 for arch in arches: 46 toolchain = build_support.arch_to_toolchain(arch) 47 toolchain_name = '-'.join([toolchain, GCC_VERSION]) 48 build_cmd = [ 49 'bash', 'build-gdbserver.sh', build_support.toolchain_path(), 50 build_support.ndk_path(), toolchain_name, build_support.jobs_arg(), 51 ] 52 53 build_support.build(build_cmd, args) 54 55if __name__ == '__main__': 56 build_support.run(main, ArgParser) 57