-
Notifications
You must be signed in to change notification settings - Fork 423
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: zhanghongtong <rory-z@outlook.com>
- Loading branch information
Showing
6 changed files
with
93 additions
and
145 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")" | ||
|
||
PLUGIN_TYPE=$1 | ||
PLUGIN_NAME=$2 | ||
VERSION=$(git describe --tags --always) | ||
|
||
pre(){ | ||
mkdir -p _plugins/debian/$PLUGIN_TYPE | ||
if [ $(cat etc/$PLUGIN_TYPE/$PLUGIN_NAME.json | jq -r ".libs") != 'null' ]; then | ||
for lib in $(cat etc/$PLUGIN_TYPE/$PLUGIN_NAME.json | jq -r ".libs[]"); do | ||
go get $lib; | ||
done | ||
fi | ||
} | ||
|
||
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/debian/$PLUGIN_TYPE | ||
} | ||
|
||
build(){ | ||
case $PLUGIN_NAME in | ||
influx ) | ||
go build -trimpath -modfile extensions.mod --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.2.0.5-Linux-x64.tar.gz" -O /tmp/TDengine-client-2.2.0.5.tar.gz; | ||
fi; | ||
if [ "$(uname -m)" = "aarch64" ]; then | ||
wget "https://www.taosdata.com/assets-download/TDengine-client-2.2.0.5-Linux-aarch64.tar.gz" -O /tmp/TDengine-client-2.2.0.5.tar.gz; | ||
fi; | ||
tar -zxvf /tmp/TDengine-client-2.2.0.5.tar.gz | ||
cd TDengine-client-2.2.0.5 && ./install_client.sh && cd - | ||
go build -trimpath -modfile extensions.mod --buildmode=plugin -tags plugins -o extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME.go | ||
;; | ||
labelImage ) | ||
git clone -b v2.2.0-rc3 --depth 1 https://github.com/tensorflow/tensorflow.git /tmp/tensorflow; | ||
CGO_CFLAGS=-I/tmp/tensorflow CGO_LDFLAGS=-L$(pwd)/extensions/functions/labelImage/lib go build -trimpath -modfile extensions.mod --buildmode=plugin -o extensions/functions/labelImage/labelImage.so extensions/functions/labelImage/*.go | ||
;; | ||
* ) | ||
go build -trimpath -modfile extensions.mod --buildmode=plugin -o extensions/$PLUGIN_TYPE/$PLUGIN_NAME/$PLUGIN_NAME@$VERSION.so extensions/$PLUGIN_TYPE/$PLUGIN_NAME/*.go | ||
;; | ||
esac | ||
} | ||
|
||
pre | ||
build | ||
post |