#!/usr/bin/python # # Developer: Grigori Fursin, Grigori.Fursin@cTuning.org, http://fursin.net # import os import sys import json ############################################################################## # customize installation def setup(i): """ Input: { cfg - meta of this soft entry self_cfg - meta of module soft ck_kernel - import CK kernel module (to reuse functions) host_os_uoa - host OS UOA host_os_uid - host OS UID host_os_dict - host OS meta target_os_uoa - target OS UOA target_os_uid - target OS UID target_os_dict - target OS meta target_device_id - target device ID (if via ADB) tags - list of tags used to search this entry env - updated environment vars from meta customize - updated customize vars from meta deps - resolved dependencies for this soft interactive - if 'yes', can ask questions, otherwise quiet path - path to entry (with scripts) install_path - installation path } Output: { return - return code = 0, if successful > 0, if error (error) - error text if return > 0 (install_env) - prepare environment to be used before the install script } """ import os import shutil # Get variables o=i.get('out','') ck=i['ck_kernel'] hos=i['host_os_uoa'] tos=i['target_os_uoa'] hosd=i['host_os_dict'] tosd=i['target_os_dict'] hbits=hosd.get('bits','') tbits=tosd.get('bits','') hname=hosd.get('ck_name','') # win, linux hname2=hosd.get('ck_name2','') # win, mingw, linux, android macos=hosd.get('macos','') # yes/no hft=i.get('features',{}) # host platform features habi=hft.get('os',{}).get('abi','') # host ABI (only for ARM-based); if you want to get target ABI, use tosd ... # armv7l, etc... p=i['path'] env=i['env'] pi=i.get('install_path','') cus=i['customize'] ie=cus.get('install_env',{}) nie={} # new env # Update vars targets='' cmake_flags='' if habi.startswith('arm'): if hbits=='64': targets='AArch64' else: targets='ARM' elif tos.startswith('android'): if tbits=='64': targets='AArch64' else: targets='ARM' elif hbits=='64': targets='X86' if hname=='win': cmake_flags='-Thost=x64' else: targets='X86' nie['CK_LLVM_CMAKE_TARGETS']=targets nie['CK_LLVM_CMAKE_FLAGS']=cmake_flags return {'return':0, 'install_env':nie}