1#!/bin/bash 2# Copyright (c) Huawei Technologies Co., Ltd. 2023. All rights reserved. 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14set -e 15. build/build_base_var.sh 16function help() { 17 echo "Usage: $1 [linux/wasm/windows/macx] [debug] [-e <plugin1...>] [-d <plugin1...>]" 18 echo " -e <plugin1,plugin2,plugin3...>, enable the default plugins." 19 echo " -d <plugin1,plugin2,plugin3...>, enable the extend plugins." 20 echo " -m <macro1,macro2,macro3...>, enable the macro plugins." 21 echo " -l Show the all plugin list." 22 echo " -h Show the help info." 23 exit 24} 25function list_all_plugins() { 26 echo "the default support plugin list:" 27 for var in "${enable_plugin_array[@]}"; do 28 echo " ${var#enable_}" 29 done 30 echo "the extend support plugin list:" 31 for var in "${enable_extend_plugin_array[@]}"; do 32 echo " ${var#enable_}" 33 done 34 echo "the default support macro switch list:" 35 for var in "${enable_macro_switch_array[@]}"; do 36 echo " ${var#enable_}" 37 done 38 exit 39} 40function set_enable_all_plugins_str() { 41 for var in "${enable_plugin_array[@]}"; do 42 enable_all_plugins_str="$enable_all_plugins_str$var=${!var} " 43 done 44 for var in "${enable_extend_plugin_array[@]}"; do 45 enable_all_plugins_str="$enable_all_plugins_str$var=${!var} " 46 done 47 for var in "${enable_macro_switch_array[@]}"; do 48 enable_all_plugins_str="$enable_all_plugins_str$var=${!var} " 49 done 50} 51function set_enable_plugin_array() { 52 for enable_plugin in "${enable_plugin_array[@]}"; do 53 eval "$enable_plugin=$1" 54 done 55} 56function set_enable_extend_plugin_array() { 57 for enable_extend_plugin in "${enable_extend_plugin_array[@]}"; do 58 eval "$enable_extend_plugin=$1" 59 done 60} 61function set_enable_macro_switch_array() { 62 for enable_macro in "${enable_macro_switch_array[@]}"; do 63 eval "$enable_macro=$1" 64 done 65} 66function choose_os_type() { 67 case "$OSTYPE" in 68 solaris*) echo "SOLARIS" ;; 69 darwin*) gn_path="macx" target_os="macx" ;; 70 linux*) gn_path="linux" target_os="linux" ;; 71 bsd*) echo "is bsd os" ;; 72 msys*) gn_path="windows" target_os="windows" gn="gn.exe" ninja="ninja.exe" ;; 73 *) echo "unknown: $OSTYPE" ;; 74 esac 75}