5 Star 11 Fork 4

zettadb / kunlun

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
build.sh 1.95 KB
一键复制 编辑 原始数据 按行查看 历史
#! /bin/bash
# configure and build Kunlun computing node program.
# If you don't need to configure it, simply do make install.
# usage: build.sh <build-type> <prefix> Then build.sh install
# build-type: Release or Debug
# e.g. bash build.sh Release /home/dzw/mysql_installs/postgresql-11.5-rel
# then (probably run as root): bash build.sh install
export SRCROOT=`pwd`
action="$1"
usage(){
echo "Usage: build.sh <build-type> <prefix> Then build.sh install"
echo " build-type: Debug | Release"
exit 1
}
init() {
test "$1" = "" && usage
cd $SRCROOT
idir="$1"
echo "$idir" > installdir
cd $SRCROOT/resources
test -d mysql || tar -xzf mysql_client.tgz
# ln -s ./libmariadb.so.3 libmariadb.so
cd $SRCROOT/src/include/sharding
ln -s $SRCROOT/resources/mysql mysql
cd $SRCROOT
}
build() {
idir="$2"
init "$idir"
export LIBS=-lmariadb
export LDFLAGS=-L$SRCROOT/resources
if test "$1" = "Release"; then
export CFLAGS="-O2 -ggdb3"
export CXXFLAGS="-O2 -ggdb3"
./configure --with-openssl --with-icu --prefix="$idir"
# ./configure --with-openssl --with-icu --with-llvm --prefix="$idir"
elif test "$1" = "Debug"; then
export CFLAGS="-O0 -ggdb3 -DENABLE_DEBUG"
export CXXFLAGS="-O0 -ggdb3 -DENABLE_DEBUG "
./configure --with-openssl --with-icu --enable-debug --enable-cassert --prefix="$idir"
# ./configure --with-openssl --with-icu --with-llvm --enable-debug --enable-cassert --prefix="$idir"
# in current ubuntu-20.04 latest llvm there is build error.
else #defensive
usage
fi
cd $SRCROOT/src && make clean
cd $SRCROOT && make -j8 2> $SRCROOT/err.txt
}
install() {
test -f installdir || {
echo "installation directory is not set, call 'build.sh build' first!"
usage
}
idir=`cat installdir`
mkdir -p "$idir"
make install
bash ./post-install.sh "$idir"
}
if test "$action" = "Debug" -o "$action" = "Release"; then
test "$#" != 2 && usage
build "$1" "$2"
elif test "$action" = "install"; then
test "$#" != 1 && usage
install
else
usage
fi
1
https://gitee.com/zettadb/kunlun.git
git@gitee.com:zettadb/kunlun.git
zettadb
kunlun
kunlun
main

搜索帮助