package.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. #!/bin/bash
  2. set -e
  3. base_dir=$(
  4. cd "$(dirname "$0")"
  5. pwd
  6. )
  7. cd $base_dir
  8. cur_date="`date +%Y-%m-%d`"
  9. # Init common
  10. rm -rf ./tmp
  11. mkdir -p ./tmp/tsdb
  12. cp -rf ./include ./tmp/tsdb/
  13. cp -rf ./demo ./tmp/tsdb/
  14. mkdir -p ./tmp/tsdb/lib/aarch64
  15. mkdir -p ./tmp/tsdb/lib/x86-64
  16. # Build armv8
  17. ./deploy.sh armv8
  18. cp ./target/aarch64-unknown-linux-gnu/release/libtsdb_sdk_rs.a ./tmp/tsdb/lib/aarch64/libtsdb-merged.a
  19. # Build default (x64)
  20. ./deploy.sh
  21. cp ./target/release/libtsdb_sdk_rs.a ./tmp/tsdb/lib/x86-64/libtsdb-merged.a
  22. # Verify x64 build
  23. g++ -std=c++11 -Iinclude -L./tmp/tsdb/lib/x86-64/ demo/tsdbtest_lf.cpp -o ./tmp/tsdbtest_lf -ltsdb-merged -lpthread -ldl -O3
  24. if nc -zv 127.0.0.1 8123 2>&1 | grep -q 'succeeded'; then
  25. objdump -T ./tmp/tsdbtest_lf | grep GLIBC | sed 's/.*GLIBC_\([.0-9]*\).*/\1/g' | sort -Vu
  26. (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)
  27. fi
  28. if [ -s ./tmp/tsdb.log.error.log ]; then
  29. echo "./tmp/tsdb.log.error.log exists and is not empty, please check the log"
  30. exit 1
  31. fi
  32. rm -f ./tmp/tsdbtest_lf
  33. # Package lf & hf versions
  34. mkdir -p ./release
  35. cd ./tmp
  36. # cp -f $base_dir/README-hf.md ./tsdb/README.md
  37. # tar --exclude='tsdb/include/tsdb.h' --exclude='tsdb/demo/tsdbtest_lf.cpp' -czvf $base_dir/release/tsdb_hf-v${cur_date}.tar.gz tsdb
  38. cp -f $base_dir/README-lf.md ./tsdb/README.md
  39. 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
  40. cd $base_dir
  41. rm -rf ./tmp
  42. # Done!
  43. echo "✅ 打包成功"