123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- #!/bin/bash
- set -e
- base_dir=$(
- cd "$(dirname "$0")"
- pwd
- )
- cd $base_dir
- cur_date="`date +%Y-%m-%d`"
- # Init common
- rm -rf ./tmp
- mkdir -p ./tmp/tsdb
- cp -rf ./include ./tmp/tsdb/
- cp -rf ./demo ./tmp/tsdb/
- mkdir -p ./tmp/tsdb/lib/aarch64
- mkdir -p ./tmp/tsdb/lib/x86-64
- # Build armv8
- ./deploy.sh armv8
- cp ./target/aarch64-unknown-linux-gnu/release/libtsdb_sdk_rs.a ./tmp/tsdb/lib/aarch64/libtsdb-merged.a
- # Build default (x64)
- ./deploy.sh
- cp ./target/release/libtsdb_sdk_rs.a ./tmp/tsdb/lib/x86-64/libtsdb-merged.a
- # Verify x64 build
- g++ -std=c++11 -Iinclude -L./tmp/tsdb/lib/x86-64/ demo/tsdbtest_lf.cpp -o ./tmp/tsdbtest_lf -ltsdb-merged -lpthread -ldl -O3
- if nc -zv 127.0.0.1 8123 2>&1 | grep -q 'succeeded'; then
- objdump -T ./tmp/tsdbtest_lf | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
- (cd ./tmp && TSDBLOG_LEVEL="debug" PATH="/usr/lib/linux-tools/6.8.0-51-generic/:$PATH" RUST_BACKTRACE=1 flamegraph -o ../target/tsdb_lf-flamegraph.svg -- ./tsdbtest_lf)
- fi
- if [ -s ./tmp/tsdb.log.error.log ]; then
- echo "./tmp/tsdb.log.error.log exists and is not empty, please check the log"
- exit 1
- fi
- rm -f ./tmp/tsdbtest_lf
- # Package lf & hf versions
- mkdir -p ./release
- cd ./tmp
- # cp -f $base_dir/README-hf.md ./tsdb/README.md
- # tar --exclude='tsdb/include/tsdb.h' --exclude='tsdb/demo/tsdbtest_lf.cpp' -czvf $base_dir/release/tsdb_hf-v${cur_date}.tar.gz tsdb
- cp -f $base_dir/README-lf.md ./tsdb/README.md
- tar --exclude='tsdb/include/tsdb_hf.h' --exclude='tsdb/demo/tsdbtest_hf.cpp' -czvf $base_dir/release/tsdb_lf-v${cur_date}.tar.gz tsdb
- cd $base_dir
- rm -rf ./tmp
- # Done!
- echo "✅ 打包成功"
|