compile_clang-pipeline.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #! /bin/sh
  2. DB_FLAG=$1
  3. COMMIT=2d409878031f9c6ee7e7ef25535b8197fdd7d90c
  4. MONOTHREAD=$2
  5. # Remove conflicting libpq.
  6. rm /usr/lib/libpq.*
  7. # Compile libpq with pipelining support.
  8. wget -nv https://www.postgresql.org/message-id/attachment/112272/v18-0001-libpq-batch-support.patch
  9. wget -nv https://github.com/postgres/postgres/archive/bab150045bd9766869f471ede88734ea0989261c.zip
  10. unzip -q bab150045bd9766869f471ede88734ea0989261c.zip
  11. cd postgres-bab150045bd9766869f471ede88734ea0989261c
  12. git apply ../v18-0001-libpq-batch-support.patch
  13. ./configure --prefix=/usr CFLAGS='-O3 -march=native -flto'
  14. cd src/interfaces/libpq
  15. make all install -j4
  16. cd /
  17. if [ $DB_FLAG = "TFB_MYSQL" ]; then
  18. echo "ERROR: Only Postgres has pipelining support for now."
  19. exit 1
  20. CXX_FLAGS="-I /usr/include/mariadb -lmariadbclient "
  21. wget -nv https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_mysql.hh
  22. elif [ $DB_FLAG = "TFB_PGSQL" ]; then
  23. CXX_FLAGS="-lpthread -L/usr/lib -lpq -I/postgres-bab150045bd9766869f471ede88734ea0989261c/src/include"
  24. wget -nv https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_pgsql.hh
  25. fi
  26. wget https://raw.githubusercontent.com/matt-42/lithium/$COMMIT/single_headers/lithium_http_backend.hh
  27. echo "Compile server"
  28. clang++ -flto -DNDEBUG -D$DB_FLAG -DMONOTHREAD=$MONOTHREAD -DN_SQL_CONNECTIONS=1 -O3 -march=native -std=c++17 ./lithium_pipeline.cc $CXX_FLAGS -lpthread -lboost_context -lssl -lcrypto -o /lithium_tbf