sql-profiled-util.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. mkdir /tmp/profile-data
  2. rm -rf $IROOT/ffead-cpp-5.0-sql
  3. if [ "$1" = "batch" ]
  4. then
  5. apt remove -yqq libpq-dev
  6. apt autoremove -yqq
  7. rm -f /usr/lib/x86_64-linux-gnu/libpq.*
  8. apt update && apt install -y bison flex libreadline-dev
  9. cd /tmp
  10. #wget -q https://github.com/an-tao/postgres/archive/batch_mode_ubuntu.tar.gz
  11. #tar -xzf batch_mode_ubuntu.tar.gz
  12. #cd postgres-batch_mode_ubuntu
  13. #./configure --prefix=/usr CFLAGS='-O2 -pipe -march=native'
  14. #make && make install
  15. wget -nv https://github.com/postgres/postgres/archive/b787d4ce6d910080065025bcd5f968544997271f.zip
  16. unzip -q b787d4ce6d910080065025bcd5f968544997271f.zip
  17. cd postgres-b787d4ce6d910080065025bcd5f968544997271f
  18. wget -nv https://www.postgresql.org/message-id/attachment/115223/v22-0001-libpq-batch.patch
  19. git apply ./v22-0001-libpq-batch.patch
  20. ./configure --prefix=/usr CFLAGS='-O3 -march=native -flto'
  21. cd src/interfaces/libpq
  22. make all install -j4
  23. cp ../../../src/include/postgres_ext.h ../../../src/include/pg_config_ext.h libpq-fe.h /usr/include
  24. fi
  25. if [ "$2" = "clang" ]
  26. then
  27. apt update -yqq && apt install -yqq clang
  28. fi
  29. cd $IROOT/ffead-cpp-src/
  30. rm -rf $IROOT/ffead-cpp-sql-raw
  31. rm -rf CMakeCache.txt CMakeFiles
  32. rm -rf web/te-benchmark-um web/te-benchmark-um-mgr
  33. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um)||g' CMakeLists.txt
  34. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-mgr)||g' CMakeLists.txt
  35. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um/libte_benchmark_um${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  36. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-mgr/libte_benchmark_um_mgr${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  37. if [ "$3" = "async" ]
  38. then
  39. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-pq)||g' CMakeLists.txt
  40. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-pq/libte_benchmark_um_pq${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  41. sed -i 's|tfb-database|localhost|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq-async/config/sdorm.xml
  42. rm -rf web/te-benchmark-um-pq
  43. else
  44. sed -i 's|add_subdirectory(${PROJECT_SOURCE_DIR}/web/te-benchmark-um-pq-async)||g' CMakeLists.txt
  45. sed -i 's|install(FILES ${PROJECT_BINARY_DIR}/web/te-benchmark-um-pq-async/libte_benchmark_um_pq_async${LIB_EXT} DESTINATION ${PROJECT_NAME}-bin/lib)||g' CMakeLists.txt
  46. sed -i 's|tfb-database|localhost|g' $IROOT/ffead-cpp-src/web/te-benchmark-um-pq/config/sdorm.xml
  47. rm -rf web/te-benchmark-um-pq-async
  48. fi