代码拉取完成,页面将自动刷新
同步操作将从 openEuler/libkperf 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
# Copyright (c) Huawei Technologies Co., Ltd. 2024. All rights reserved.
# libkperf licensed under the Mulan PSL v2.
# You can use this software according to the terms and conditions of the Mulan PSL v2.
# You may obtain a copy of Mulan PSL v2 at:
# http://license.coscl.org.cn/MulanPSL2
# THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
# PURPOSE.
# See the Mulan PSL v2 for more details.
# Author: Mr.Dai
# Create: 2024-04-03
# Description: Building mainstream processes.
set -e
set -x
CURRENT_DIR=$(cd $(dirname "$0"); pwd)
PROJECT_DIR=$(realpath "${CURRENT_DIR}")
BUILD_DIR=${PROJECT_DIR}/_build
THIRD_PARTY=${PROJECT_DIR}/third_party/
INSTALL_PATH=${PROJECT_DIR}/output/
BUILD_TYPE=Release
# Python module are not compiled by default.
PYTHON=false
# Test cases are not compiled by default.
INCLUDE_TEST=false
source ${PROJECT_DIR}/build/common.sh
creat_dir "${BUILD_DIR}"
# Specifies the gcc used by all dependencies.
export CC=gcc
export CXX=g++
PYTHON_EXE=""
if [ -d "${THIRD_PARTY}/local" ];then
echo ${THIRD_PARTY}/local "is exist"
else
echo ${THIRD_PARTY}local "is not exist"
creat_dir ${THIRD_PARTY}/local
fi
for arg in "$@"; do
case "$arg" in
test=*)
INCLUDE_TEST="${arg#*=}"
;;
python=*)
PYTHON="${arg#*=}"
;;
install_path=*)
INSTALL_PATH="${arg#*=}"
;;
build_type=*)
BUILD_TYPE="${arg#*=}"
;;
python_exe=*)
PYTHON_EXE="${arg#*=}"
;;
esac
done
if [[ "$INCLUDE_TEST" == "true" ]]; then
build_googletest $THIRD_PARTY
fi
function build_elfin() {
local cmake_target_dir=$THIRD_PARTY/local/elfin-parser
rm -rf ${cmake_target_dir}
if [ -d "${cmake_target_dir}" ];then
echo ${cmake_target_dir} "is exist"
return
else
echo ${cmake_target_dir} "is not exist"
mkdir ${cmake_target_dir}
fi
cd "$THIRD_PARTY/elfin-parser"
rm -rf build
sed -i 's/-mcpu=tsv110//g' Common.cmake
sed -i 's/-mno-outline-atomics//g' Common.cmake
sed -i 's/-march=armv8.2-a//g' Common.cmake
if ! grep -q "^add_compile_options(-Wno-error=switch-enum)" CMakeLists.txt; then
sed -i '1i\add_compile_options(-Wno-error=switch-enum)' CMakeLists.txt
fi
mkdir build
cd build
cmake -DCMAKE_INSTALL_PREFIX=${cmake_target_dir} -DCMAKE_CXX_FLAGS="-fPIC" ..
make --silent -j ${cpu_core_num}
cp ./lib64/libdwarf++.a ./lib64/libelf++.a ${cmake_target_dir}
echo "install log path: $cmake_target_dir"
}
build_libkperf()
{
cd $BUILD_DIR
# Remove the PYTHON_KPERF warning
if [ -z ${PYTHON_EXE} ];then
cmake -DINCLUDE_TEST=${INCLUDE_TEST} -DPYTHON=${PYTHON} -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} ..
else
cmake -DINCLUDE_TEST=${INCLUDE_TEST} -DPYTHON=${PYTHON} -DCMAKE_INSTALL_PREFIX=${INSTALL_PATH} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DPYTHON_KPERF=${PYTHON_EXE} ..
fi
make -j ${cpu_core_num}
make install
echo "build libkperf success"
}
function build_test()
{
if [ "$INCLUDE_TEST" = "true" ]; then
execute_binary "$PROJECT_DIR"
fi
}
main() {
build_elfin
build_libkperf
build_test
}
# bash build.sh test=true installPath=/home/ build_type=Release .The last three settings are optional.
main $@
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。