Skip to content

Instantly share code, notes, and snippets.

@hucsmn
Created December 5, 2020 07:50
Show Gist options
  • Save hucsmn/42e8fd75181f9141f0c3ccc33b295fb2 to your computer and use it in GitHub Desktop.
Save hucsmn/42e8fd75181f9141f0c3ccc33b295fb2 to your computer and use it in GitHub Desktop.
Build script for Qihoo360/pika on CentOS 8 (gcc 8.3.1)
#!/bin/bash
PIKA_VERSION=3.2.9
fetch_pika() {
if [[ ! -d pika ]]; then
git clone https://github.com/Qihoo360/pika.git && cd pika
fi
}
install_deps() {
dnf group install -y 'Development Tools'
yum install -y {gflags,glog,protobuf,zlib,lz4,snappy,libzstd}-devel
yum install -y tcl
}
patch_rocksdb() {
local gcc_major_version="$(g++ --version | head -1 | cut -d' ' -f3 | cut -d. -f1)"
if [[ "${gcc_major_version}" -lt 8 ]]; then return; fi
(cd ./third/rocksdb && git checkout . && git clean -df && curl -s 'https://github.com/facebook/rocksdb/commit/c156f8b1fd6ebf4ccda5955fc3aa1d67a3d4e170.patch' | patch -p1)
}
perform_tests() {
ls tests/unit/*.tcl | sed -E 's:.*/(.*)\.tcl$:\1:' | while read -r test_name; do
echo "[test] ${test_name}..."
./pikatests.sh "${test_name}"
done
}
echo 'fetch pika...'
fetch_pika && cd pika
echo 'prepare dependencies...'
install_deps
git checkout "v${PIKA_VERSION}" && git submodule init && git submodule update && patch_rocksdb
echo 'cleaning...'
make distclean
echo 'building...'
make -j "$(cat /proc/cpuinfo | grep processor | wc -l)"
#echo 'testing...'
#perform_tests
echo 'packaging...'
cd ..
tar czf "pika-${PIKA_VERSION}_build_$(date +%Y%m%d%H%M%S).tar.gz" --exclude pika/output/db --exclude pika/output/dbsync --exclude pika/output/log -C pika/output .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment