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