133eb0b6dSopenharmony_ci#!/bin/bash 233eb0b6dSopenharmony_ci# Copyright (c) 2023 Huawei Device Co., Ltd. 333eb0b6dSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 433eb0b6dSopenharmony_ci# you may not use this file except in compliance with the License. 533eb0b6dSopenharmony_ci# You may obtain a copy of the License at 633eb0b6dSopenharmony_ci# 733eb0b6dSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 833eb0b6dSopenharmony_ci# 933eb0b6dSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 1033eb0b6dSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1133eb0b6dSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1233eb0b6dSopenharmony_ci# See the License for the specific language governing permissions and 1333eb0b6dSopenharmony_ci# limitations under the License. 1433eb0b6dSopenharmony_ci 1533eb0b6dSopenharmony_ciset -e 1633eb0b6dSopenharmony_ci 1733eb0b6dSopenharmony_cideclare SCRIPT_PATCH 1833eb0b6dSopenharmony_cideclare SYSROOT 1933eb0b6dSopenharmony_cideclare PREFIX 2033eb0b6dSopenharmony_cideclare TARGET_CPU 2133eb0b6dSopenharmony_cideclare TARGET_GEN_DIR 2233eb0b6dSopenharmony_ci 2333eb0b6dSopenharmony_ciexport SCRIPT_PATCH=$(dirname $(readlink -f "$0")) 2433eb0b6dSopenharmony_ci 2533eb0b6dSopenharmony_cisource ${SCRIPT_PATCH}/build_jsvm_inter.sh 2633eb0b6dSopenharmony_ci 2733eb0b6dSopenharmony_cioptions="$(getopt -o h "help,sysroot:,node_path:,prefix:,target_cpu:,base_path:" -- "$@")" || usage 2833eb0b6dSopenharmony_ci 2933eb0b6dSopenharmony_cieval set -- "$options" 3033eb0b6dSopenharmony_ci 3133eb0b6dSopenharmony_ciusage() { 3233eb0b6dSopenharmony_ci echo "Tool $(basename "$0") Usage" 3333eb0b6dSopenharmony_ci echo "Options:" 3433eb0b6dSopenharmony_ci echo "-h|--help" 3533eb0b6dSopenharmony_ci echo "--sysroot <path> Sysroot path." 3633eb0b6dSopenharmony_ci echo "--prefix <perfix> Cross-compiler prefix." 3733eb0b6dSopenharmony_ci echo "--target_cpu <arm/arm64> Cross-compile CPU types." 3833eb0b6dSopenharmony_ci echo "--target_gen_dir <output path>" 3933eb0b6dSopenharmony_ci echo " if target_gen_dir not set, will install only to the default path." 4033eb0b6dSopenharmony_ci exit 0 4133eb0b6dSopenharmony_ci} 4233eb0b6dSopenharmony_ci 4333eb0b6dSopenharmony_cidie() { 4433eb0b6dSopenharmony_ci echo $@ 4533eb0b6dSopenharmony_ci exit 0 4633eb0b6dSopenharmony_ci} 4733eb0b6dSopenharmony_ci 4833eb0b6dSopenharmony_cido_man_process() { 4933eb0b6dSopenharmony_ci do_opt_process $@ 5033eb0b6dSopenharmony_ci do_env 0 5133eb0b6dSopenharmony_ci do_fetch > ${out_dir}/log.do_fetch 5233eb0b6dSopenharmony_ci do_patch > ${out_dir}/log.do_patch 5333eb0b6dSopenharmony_ci do_configure > ${out_dir}/log.do_configure 5433eb0b6dSopenharmony_ci do_compile > ${out_dir}/log.do_compile 5533eb0b6dSopenharmony_ci do_install > ${out_dir}/log.do_install 5633eb0b6dSopenharmony_ci do_strip 5733eb0b6dSopenharmony_ci do_env 1 5833eb0b6dSopenharmony_ci do_fetch > ${out_dir}/log.do_fetch_unstripped 5933eb0b6dSopenharmony_ci do_patch > ${out_dir}/log.do_patch_unstripped 6033eb0b6dSopenharmony_ci do_configure > ${out_dir}/log.do_configure_unstripped 6133eb0b6dSopenharmony_ci do_compile > ${out_dir}/log.do_compile_unstripped 6233eb0b6dSopenharmony_ci do_unstripped_copy 6333eb0b6dSopenharmony_ci} 6433eb0b6dSopenharmony_ci 6533eb0b6dSopenharmony_cido_opt_process() { 6633eb0b6dSopenharmony_ci while [[ $# -gt 0 ]]; do 6733eb0b6dSopenharmony_ci case "$1" in 6833eb0b6dSopenharmony_ci -h|--help) 6933eb0b6dSopenharmony_ci usage 7033eb0b6dSopenharmony_ci ;; 7133eb0b6dSopenharmony_ci --sysroot) 7233eb0b6dSopenharmony_ci export SYSROOT=$2 7333eb0b6dSopenharmony_ci shift 7433eb0b6dSopenharmony_ci ;; 7533eb0b6dSopenharmony_ci --node_path) 7633eb0b6dSopenharmony_ci export NODE_PATH=$2 7733eb0b6dSopenharmony_ci shift 7833eb0b6dSopenharmony_ci ;; 7933eb0b6dSopenharmony_ci --prefix) 8033eb0b6dSopenharmony_ci export PREFIX=$2 8133eb0b6dSopenharmony_ci shift 8233eb0b6dSopenharmony_ci ;; 8333eb0b6dSopenharmony_ci --target_cpu) 8433eb0b6dSopenharmony_ci export TARGET_CPU=$2 8533eb0b6dSopenharmony_ci shift 8633eb0b6dSopenharmony_ci ;; 8733eb0b6dSopenharmony_ci --target_gen_dir) 8833eb0b6dSopenharmony_ci export TARGET_GEN_DIR=$2 8933eb0b6dSopenharmony_ci shift 9033eb0b6dSopenharmony_ci ;; 9133eb0b6dSopenharmony_ci --target_clang_coverage) 9233eb0b6dSopenharmony_ci export TARGET_CLANG_COVERAGE=$2 9333eb0b6dSopenharmony_ci shift 9433eb0b6dSopenharmony_ci ;; 9533eb0b6dSopenharmony_ci *) 9633eb0b6dSopenharmony_ci ;; 9733eb0b6dSopenharmony_ci esac 9833eb0b6dSopenharmony_ci shift 9933eb0b6dSopenharmony_ci done 10033eb0b6dSopenharmony_ci} 10133eb0b6dSopenharmony_ci 10233eb0b6dSopenharmony_cido_man_process $@ 103