• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    echo "the default support macro switch list:"
34    for var in "${enable_macro_switch_array[@]}"; do
35        echo "  ${var#enable_}"
36    done
37    exit
38}
39function set_enable_all_plugins_str() {
40    for var in "${enable_plugin_array[@]}"; do
41        enable_all_plugins_str="$enable_all_plugins_str$var=${!var} "
42    done
43    for var in "${enable_extend_plugin_array[@]}"; do
44        enable_all_plugins_str="$enable_all_plugins_str$var=${!var} "
45    done
46    for var in "${enable_macro_switch_array[@]}"; do
47        enable_all_plugins_str="$enable_all_plugins_str$var=${!var} "
48    done
49}
50function set_enable_plugin_array() {
51    for enable_plugin in "${enable_plugin_array[@]}"; do
52        eval "$enable_plugin=$1"
53    done
54}
55function set_enable_extend_plugin_array() {
56    for enable_extend_plugin in "${enable_extend_plugin_array[@]}"; do
57        eval "$enable_extend_plugin=$1"
58    done
59}
60function set_enable_macro_switch_array() {
61    for enable_macro in "${enable_macro_switch_array[@]}"; do
62        eval "$enable_macro=$1"
63    done
64}
65function choose_os_type() {
66    case "$OSTYPE" in
67        solaris*) echo "SOLARIS" ;;
68        darwin*)  gn_path="macx" target_os="macx" ;;
69        linux*)   gn_path="linux" target_os="linux"  ;;
70        bsd*)     echo "is bsd os" ;;
71        msys*)    gn_path="windows" target_os="windows" gn="gn.exe" ninja="ninja.exe"  ;;
72        *)        echo "unknown: $OSTYPE" ;;
73    esac
74}