2021-12-14 02:24:48 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Copyright (C) 2021 Huawei Device Co., Ltd.
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2024-04-29 01:33:27 +00:00
|
|
|
usage() {
|
2021-12-14 02:24:48 +00:00
|
|
|
echo
|
|
|
|
echo "USAGE"
|
|
|
|
echo " ./build.sh [suite=BUILD_TARGET] [target_os=TARGET_OS] [target_arch=TARGET_ARCH] [variant=BUILD_VARIANT] [target_subsystem=TARGET_SUBSYSTEM]"
|
|
|
|
echo " suite : BUILD_TARGET cts/hit/vts and so on, default value is hit"
|
|
|
|
echo " target_arch : TARGET_ARCH arm64 or arm32, default value is arm64"
|
|
|
|
echo " variant : BUILD_VARIANT release or debug, default value is debug"
|
|
|
|
echo " target_subsystem : TARGET_SUBSYSTEM the target subsystem to build"
|
|
|
|
echo " system_size : SYSTEM_SIZE standard, large and son on, large is for L3-L5, standard is for L2 default value is large"
|
|
|
|
echo " product_name : PRODUCT_NAME the name of product. such as hikey960, Hi3516DV300, and so on."
|
|
|
|
echo
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
2024-04-29 01:33:27 +00:00
|
|
|
parse_cmdline() {
|
2021-12-14 02:24:48 +00:00
|
|
|
BASE_HOME=$(dirname $(cd $(dirname $0); pwd))
|
|
|
|
BASE_HOME=${BASE_HOME}/../..
|
|
|
|
# build all parts for all products by default
|
|
|
|
BUILD_TARGET=""
|
|
|
|
TARGET_PLATFORM=all
|
2022-05-17 02:55:19 +00:00
|
|
|
TARGET_ARCH=arm
|
2021-12-14 02:24:48 +00:00
|
|
|
BUILD_VARIANT=release
|
|
|
|
UPLOAD_API_INFO=False
|
2022-10-25 10:20:37 +00:00
|
|
|
SYSTEM_SIZE=standard
|
2021-12-14 02:24:48 +00:00
|
|
|
PRODUCT_NAME=""
|
2022-10-25 10:20:37 +00:00
|
|
|
USE_MUSL=false
|
2021-12-14 02:24:48 +00:00
|
|
|
export PATH=${BASE_HOME}/prebuilts/python/linux-x86/3.8.3/bin:$PATH
|
|
|
|
|
2024-04-29 01:33:27 +00:00
|
|
|
while [ -n "$1" ]; do
|
2021-12-14 02:24:48 +00:00
|
|
|
var="$1"
|
|
|
|
OPTIONS=${var%%=*}
|
|
|
|
PARAM=${var#*=}
|
2024-04-29 01:33:27 +00:00
|
|
|
echo "OPTIONS=$OPTIONS, PARAM=$PARAM"
|
2021-12-14 02:24:48 +00:00
|
|
|
case "$OPTIONS" in
|
|
|
|
suite) BUILD_TARGET="$PARAM"
|
|
|
|
;;
|
|
|
|
target_arch) TARGET_ARCH="$PARAM"
|
|
|
|
;;
|
|
|
|
variant) BUILD_VARIANT="$PARAM"
|
2022-10-25 10:20:37 +00:00
|
|
|
;;
|
|
|
|
use_musl) USE_MUSL="$PARAM"
|
2024-04-29 01:33:27 +00:00
|
|
|
;;
|
2022-10-25 10:20:37 +00:00
|
|
|
target_platform) TARGET_PLATFORM="$PARAM"
|
2021-12-14 02:24:48 +00:00
|
|
|
;;
|
|
|
|
target_subsystem) export target_subsystem=${PARAM}
|
|
|
|
;;
|
|
|
|
system_size) SYSTEM_SIZE="$PARAM"
|
|
|
|
;;
|
|
|
|
product_name) PRODUCT_NAME="$PARAM"
|
|
|
|
;;
|
2024-04-29 01:33:27 +00:00
|
|
|
upload_api_info) UPLOAD_API_INFO=$(echo $PARAM | tr [a-z] [A-Z])
|
2024-02-22 07:39:13 +00:00
|
|
|
;;
|
|
|
|
cache_type) CACHE_TYPE="$PARAM"
|
|
|
|
;;
|
|
|
|
*)
|
2024-04-29 01:33:27 +00:00
|
|
|
usage
|
|
|
|
break ;;
|
2021-12-14 02:24:48 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
if [ "$SYSTEM_SIZE" = "standard" ]; then
|
2024-04-29 01:33:27 +00:00
|
|
|
BUILD_TARGET=${BUILD_TARGET:-"test/xts/hats:xts_hats"}
|
|
|
|
PRODUCT_NAME=${PRODUCT_NAME:-"Hi3516DV300"}
|
2021-12-14 02:24:48 +00:00
|
|
|
else
|
2024-04-29 01:33:27 +00:00
|
|
|
BUILD_TARGET=${BUILD_TARGET:-"hats hats_ivi hats_intellitv hats_wearable"}
|
|
|
|
PRODUCT_NAME=${PRODUCT_NAME:-"arm64"}
|
2021-12-14 02:24:48 +00:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-04-29 01:33:27 +00:00
|
|
|
do_make() {
|
2021-12-14 02:24:48 +00:00
|
|
|
cd $BASE_HOME
|
|
|
|
HATS_ROOT="$BASE_HOME/test/xts/hats"
|
|
|
|
|
2024-07-05 04:21:19 +00:00
|
|
|
${BASE_HOME}/prebuilts/python/linux-x86/current/bin/python3 -B ${HATS_ROOT}/check_hvigor.py
|
2024-04-29 01:33:27 +00:00
|
|
|
if [ "$?" != 0 ]; then
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2021-12-14 02:24:48 +00:00
|
|
|
rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
|
|
|
|
export XTS_SUITENAME=hats
|
2024-04-29 01:33:27 +00:00
|
|
|
if [ "$SYSTEM_SIZE" = "standard" ]; then
|
2022-10-25 10:20:37 +00:00
|
|
|
MUSL_ARGS=""
|
|
|
|
if [ "$PRODUCT_NAME" = "m40" ]; then
|
2024-04-29 01:33:27 +00:00
|
|
|
if [ "$USE_MUSL" = "false" ]; then
|
|
|
|
MUSL_ARGS="--gn-args use_musl=false --gn-args use_custom_libcxx=true --gn-args use_custom_clang=true"
|
|
|
|
fi
|
2022-10-25 10:20:37 +00:00
|
|
|
fi
|
2024-04-29 01:33:27 +00:00
|
|
|
CACHE_ARG=""
|
|
|
|
if [ "$CACHE_TYPE" == "xcache" ]; then
|
2024-02-22 07:39:13 +00:00
|
|
|
CACHE_ARG="--ccache false --xcache true"
|
|
|
|
fi
|
2024-04-29 01:33:27 +00:00
|
|
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools" --gn-args is_standard_system=true $MUSL_ARGS --target-cpu $TARGET_ARCH --get-warning-list=false --stat-ccache=true --compute-overlap-rate=false --deps-guard=false --generate-ninja-trace=false $CACHE_ARG --gn-args skip_generate_module_list_file=true
|
2021-12-14 02:24:48 +00:00
|
|
|
else
|
2024-04-29 01:33:27 +00:00
|
|
|
if [ "$BUILD_TARGET" = "hats hats_ivi hats_intellitv hats_wearable" ]; then
|
|
|
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target "hats" --build-target "hats_ivi" --build-target "hats_intellitv" --build-target "hats_wearable" --build-target "deploy_testtools"
|
|
|
|
else
|
|
|
|
./build.sh --product-name $PRODUCT_NAME --gn-args build_xts=true --build-target $BUILD_TARGET --build-target "deploy_testtools"
|
|
|
|
fi
|
2021-12-14 02:24:48 +00:00
|
|
|
fi
|
|
|
|
ret=$?
|
|
|
|
|
|
|
|
rm -rf "$BASE_HOME/test/xts/autogen_apiobjs"
|
|
|
|
if [ "$ret" != 0 ]; then
|
|
|
|
echo "build error"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
parse_cmdline $@
|
|
|
|
do_make
|
|
|
|
exit 0
|