1 Star 0 Fork 0

全科/ekuiper

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
build-plugins.sh 4.03 KB
一键复制 编辑 原始数据 按行查看 历史
Jiyong Huang 提交于 2024-08-15 09:17 +08:00 . build: version ignore sub-mod tag
#!/bin/bash
#
# Copyright 2023-2024 EMQ Technologies 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 -euo pipefail
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")"
PLUGIN_TYPE=$1
PLUGIN_NAME=$2
VERSION=$(git describe --tags --always --match 'v[0-9]*.[0-9]*.[0-9]*' | sed 's/^v//g')
OS=$(sed -n '/^ID=/p' /etc/os-release | sed -r 's/ID=(.*)/\1/g')
pre(){
mkdir -p _plugins/$OS/$PLUGIN_TYPE
}
post(){
if [ -f "etc/$PLUGIN_TYPE/$PLUGIN_NAME.yaml" ]; then
cp etc/$PLUGIN_TYPE/$PLUGIN_NAME.yaml extensions/$PLUGIN_TYPE/$PLUGIN_NAME;
fi
cd extensions/$PLUGIN_TYPE/$PLUGIN_NAME
zip -r ${PLUGIN_NAME}_$(go env GOARCH).zip .
cd -
mv $(find extensions/$PLUGIN_TYPE/$PLUGIN_NAME -name "*.zip") _plugins/$OS/$PLUGIN_TYPE
}
build(){
case $PLUGIN_NAME in
influx )
go build -trimpath --buildmode=plugin -tags plugins -o extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go
;;
tdengine )
if [ "$(uname -m)" = "x86_64" ]; then
wget "https://www.taosdata.com/assets-download/TDengine-client-2.4.0.18-Linux-x64.tar.gz" -O /tmp/TDengine-client-2.4.0.18.tar.gz;
fi;
if [ "$(uname -m)" = "aarch64" ]; then
wget "https://www.taosdata.com/assets-download/TDengine-client-2.4.0.18-Linux-aarch64.tar.gz" -O /tmp/TDengine-client-2.4.0.18.tar.gz;
fi;
tar -zxvf /tmp/TDengine-client-2.4.0.18.tar.gz
cd TDengine-client-2.4.0.18 && ./install_client.sh && cd -
go build -trimpath --buildmode=plugin -tags plugins -o extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go
;;
labelImage )
if [ ! -d "/tmp/tensorflow" ];then
git clone -b v2.2.0-rc3 --depth 1 https://github.com/tensorflow/tensorflow.git /tmp/tensorflow;
fi;
if [ "$(uname -m)" = "x86_64" ]; then
cp $(pwd)/extensions/functions/dependencies/tensorflow/amd64/*.so $(pwd)/extensions/functions/labelImage/lib
fi;
if [ "$(uname -m)" = "aarch64" ]; then
cp $(pwd)/extensions/functions/dependencies/tensorflow/arm64/*.so $(pwd)/extensions/functions/labelImage/lib
fi;
CGO_CFLAGS=-I/tmp/tensorflow CGO_LDFLAGS=-L$(pwd)/extensions/functions/labelImage/lib go build -trimpath --buildmode=plugin -o extensions/functions/labelImage/labelImage@$VERSION.so extensions/functions/labelImage/*.go
;;
tfLite )
if [ ! -d "/tmp/tensorflow" ];then
git clone -b v2.2.0-rc3 --depth 1 https://github.com/tensorflow/tensorflow.git /tmp/tensorflow;
fi;
if [ "$(uname -m)" = "x86_64" ]; then
cp $(pwd)/extensions/functions/dependencies/tensorflow/amd64/*.so $(pwd)/extensions/functions/tfLite/lib
fi;
if [ "$(uname -m)" = "aarch64" ]; then
cp $(pwd)/extensions/functions/dependencies/tensorflow/arm64/*.so $(pwd)/extensions/functions/tfLite/lib
fi;
CGO_CFLAGS=-I/tmp/tensorflow CGO_LDFLAGS=-L$(pwd)/extensions/functions/tfLite/lib go build -trimpath --buildmode=plugin -o extensions/functions/tfLite/tfLite@$VERSION.so extensions/functions/tfLite/*.go
;;
* )
go build -trimpath --buildmode=plugin -o extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/*.go
;;
esac
}
pre
build
post
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/quanke/ekuiper.git
git@gitee.com:quanke/ekuiper.git
quanke
ekuiper
ekuiper
master

搜索帮助