代码拉取完成,页面将自动刷新
同步操作将从 wasome/plugin_modbus 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#!/bin/bash
#Copyright (c) Beijing Wansheng Intelligent Corp. All rights reserved.
#Licensed under the LGPL v3.0 license.
SCRIPT=$(readlink -f "$0")
script_path=$(cd "$(dirname "$0")/" && pwd)
repo_root_dir=$script_path
platform=host
clean=
pack=
usage ()
{
echo "[options]"
echo " -h print help infomation"
echo " -c clean build"
echo " -a pack"
echo " -p [host | arm-a7] set target toolchain"
exit 1
}
while getopts "cahp:" arg
do
case $arg in
p)
platform=$OPTARG;;
a)
pack="yes";;
c)
clean="yes";;
h)
usage;;
?)
echo $arg
usage;;
esac
done
if [ -z "$WA_IOT_EDGE_SDK_REPO_DIR" ]; then
echo "WA_IOT_EDGE_SDK_REPO_DIR not set. exit.."
echo "Please first download wa-iot-edge-sdk repository using command:"
echo " git clone https://gitee.com/wasome/wa-iot-edge-sdk.git"
echo "Then set the WA_IOT_EDGE_SDK_REPO_DIR to the directory of wa-iot-edge-sdk"
exit 1
fi
if [ ! -d "$WA_IOT_EDGE_SDK_REPO_DIR" ]; then
echo "WA_IOT_EDGE_SDK_REPO_DIR=[$WA_IOT_EDGE_SDK_REPO_DIR], the path not present. exit.."
exit 1
fi
platforms_dir=$WA_IOT_EDGE_SDK_REPO_DIR/scripts/platforms
echo platforms_dir=[$platforms_dir]
if [ "$platform" != "host" ]; then
[ -f $platforms_dir/$platform/toolchain.cmake ] || echo "toolchain.cmake is not present under $platforms_dir/$platform/" || exit 1
toolchain_def="-DCMAKE_TOOLCHAIN_FILE=$platforms_dir/$platform/toolchain.cmake"
setenv_file=$platforms_dir/$platform/setenv.sh
fi
[ -n "$WA_SDK_DIR" ] || WA_SDK_DIR=$WA_IOT_EDGE_SDK_REPO_DIR/wa-iot-sdk/$platform
if [ ! -d $WA_SDK_DIR ]; then
echo "Can find sdk path for WA_SDK_DIR"
exit 1
fi
[ ! -f $WA_SDK_DIR/wa-sdk.cmake ] && echo "No wa-sdk.cmake file under WA_SDK_DIR [$WA_SDK_DIR]. exit.." && exit 1
CMAKE_WA_SDK_DIR="-DWA_SDK_DIR=$WA_SDK_DIR"
echo "WA_SDK_DIR=$WA_SDK_DIR"
if [ ! -f $repo_root_dir/deps/libmodbus/src/modbus.c ]; then
git submodule update --init --recursive
[ $? -eq 0 ] || exit $?
fi
build_dir=$script_path/out
[ -d $build_dir ] || mkdir $build_dir
cd $build_dir
cmd="cmake .. -DCMAKE_BUILD_TYPE=Debug $toolchain_def $CMAKE_WA_SDK_DIR -DCMAKE_LIBRARY_OUTPUT_DIRECTORY=$build_dir/bin"
echo $cmd
$cmd
[ $? -eq 0 ] || exit $?
make
[ $? -eq 0 ] || exit $?
echo "Great! Build successful. plugin modules generated in folder:"
echo " $build_dir/bin"
if [ "$pack" = "yes" ]; then
[ -d pack ] && rm -r pack
echo ""
echo "start to pack the plugins..."
cd $build_dir
mkdir -p $build_dir/pack/staging
mkdir -p $build_dir/pack/staging/host
cp $script_path/pack/package.info ./pack/staging
cp -r $script_path/pack/ams pack/staging/host
cp -r $script_path/pack/plugin.manifest pack/staging/host
cp $build_dir/bin/*so pack/staging/host
manifest_version=`cat pack/staging/host/plugin.manifest |grep "version" | head -n 1`
echo "manifest_version=$manifest_version"
pack_version=$(echo "$manifest_version" | awk -F '"' '{print $4}')
echo "pack_version=$pack_version"
pattern="^[0-9]+\.[0-9]+\.[0-9]+$"
if [[ $pack_version =~ $pattern ]]; then
echo "Version is valid."
else
echo "Version got from plugin.manifest is invalid."
exit 1
fi
package_file_name=$build_dir/pack/plugin_modbus_$pack_version
[ -f $package_file_name ] && rm $package_file_name
echo "packing from the folder: [$build_dir/pack/staging]"
tree $build_dir/pack/staging
cmd="python3 $WA_SDK_DIR/tools/wa_pack.py -f $build_dir/pack/staging -o $package_file_name -v $pack_version"
echo "cmd=$cmd"
$cmd
if [ -f $package_file_name.zip ]; then
echo "Successful to generate $package_file_name"
else
echo "pack failed"
fi
fi
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。