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 " -l Show the all plugin list." 21 echo " -h Show the help info." 22 exit 23} 24function list_all_plugins() { 25 echo "the default support plugin list:" 26 for var in "${enable_plugin_array[@]}"; do 27 echo " ${var#enable_}" 28 done 29 echo "the extend support plugin list:" 30 for var in "${enable_extend_plugin_array[@]}"; do 31 echo " ${var#enable_}" 32 done 33 exit 34} 35function set_enable_all_plugins_str() { 36 for var in "${enable_plugin_array[@]}"; do 37 enable_all_plugins_str="$enable_all_plugins_str$var=${!var} " 38 done 39 for var in "${enable_extend_plugin_array[@]}"; do 40 enable_all_plugins_str="$enable_all_plugins_str$var=${!var} " 41 done 42} 43function set_enable_plugin_array() { 44 for enable_plugin in "${enable_plugin_array[@]}"; do 45 eval "$enable_plugin=$1" 46 done 47} 48function set_enable_extend_plugin_array() { 49 for enable_extend_plugin in "${enable_extend_plugin_array[@]}"; do 50 eval "$enable_extend_plugin=$1" 51 done 52} 53function choose_os_type() { 54 case "$OSTYPE" in 55 solaris*) echo "SOLARIS" ;; 56 darwin*) gn_path="macx" target_os="macx" ;; 57 linux*) gn_path="linux" target_os="linux" ;; 58 bsd*) echo "is bsd os" ;; 59 msys*) gn_path="windows" target_os="windows" gn="gn.exe" ninja="ninja.exe" ;; 60 *) echo "unknown: $OSTYPE" ;; 61 esac 62}