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 15PARAMS=$* 16SOURCE="${BASH_SOURCE[0]}" 17cd "$(dirname "${SOURCE}")" 18. build/build_stanalone_plugins.sh 19set_enable_plugin_array "true" 20set_enable_extend_plugin_array "false" 21set_enable_macro_switch_array "false" 22./pare_third_party.sh 23choose_os_type 24./dl_tools.sh $gn_path 25while [[ $# -gt 0 ]]; do 26 case "$1" in 27 -e) 28 enable_plugin "$2" 29 shift 2;; 30 -d) 31 enable_extend_plugin "$2" 32 shift 2;; 33 -m) 34 enable_macro "$2" 35 shift 2;; 36 -h) 37 help $0 38 shift;; 39 -l) 40 list_all_plugins 41 shift;; 42 *) 43 other_params+=("$1") 44 shift;; 45 esac 46done 47set -- "${other_params[@]}" 48if [ "$#" -ne 0 ] && { [ "$1" == "sdkdemo" ] || [ "$1" == "wasm" ] || [ "$1" == "test" ] || [ "$1" == "fuzz" ]; };then 49 prepare_proto $1 50fi 51prepare_windows $1 $2 52target_operator="$2" 53if [ "$#" -ne "0" ];then 54 if [ "$1" == "wasm" ] || [ "$1" == "sdkdemo" ];then 55 if command -v em++ &> /dev/null; then 56 use_local_emsdk="true" 57 else 58 ./dl_emsdk.sh 59 use_local_emsdk="false" 60 fi 61 target="$1" 62 fi 63 if [ "$1" == "test" ];then 64 target="test" 65 set_enable_plugin_array "true" 66 set_enable_macro_switch_array "true" 67 fi 68 if [ "$1" == "fuzz" ];then 69 target="fuzz" 70 fi 71 if [ "$1" == "protoc" ];then 72 target="protoc" 73 fi 74 if [ "$1" == "sdkdemotest" ];then 75 target="sdkdemotest" 76 fi 77 if [ "$1" == "spb" ];then 78 target="spb" 79 fi 80fi 81if [ "$target" == "wasm" ] && [ "$target_os" == "windows" ];then 82 echo "!!!build wasm on winows will occur unknown error, strongly suggest you build wasm on linux(Ubuntu)" 83 exit 84fi 85set_enable_all_plugins_str 86. ./build_operator.sh