forked from ApsaraDB/PolarDB-for-PostgreSQL
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·74 lines (63 loc) · 1.91 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#!/bin/bash
echo "This script configure and build the code, It takes an optional"
echo "parameter that must be one of the following:"
echo " deploy: (default) configure the build with performance"
echo " optimization options and build."
echo " verify: configure the build with performance optimzation"
echo " with assertion enabled, and then build"
echo " debug: configure the build with debug options and then"
echo " build."
echo " repeat: skip configure, just build and install"
echo ""
set -e
pushd "$( dirname "${BASH_SOURCE[0]}" )"
CODEHOME=$PWD
if [ -z $PG_INSTALL ];
then
PG_INSTALL=$HOME/polardb/polardbhome
fi
echo "PG installation dir: "$PG_INSTALL
PGBIN=$PG_INSTALL/bin
if [ $# -gt 0 ]; then
BLD_OPT=$1
else
BLD_OPT="deploy"
fi
CMD=()
CFLAGS="-fno-omit-frame-pointer -Wno-declaration-after-statement"
LDFLAGS="-L/usr/local/lib"
if [[ "$BLD_OPT" == "deploy" ]]; then
CFLAGS="${CFLAGS} -g -O2"
CMD+=(--with-python)
elif [[ "$BLD_OPT" == "verify" ]]; then
CFLAGS="${CFLAGS} -g -O2"
CMD+=(--enable-cassert)
CMD+=(--with-python)
# CMD+=(--with-openssl)
elif [[ "$BLD_OPT" == "debug" ]]; then
CFLAGS="${CFLAGS} -ggdb -Og -g3 "
# CMD+=(--with-uuid=ossp --with-openssl)
CMD+=(--enable-cassert)
CMD+=(--with-python)
CMD+=(--enable-debug)
elif [[ "$BLD_OPT" != "repeat" ]]; then
echo "Invalid Parameter! Usage: $0 [deploy|verify|debug|repeat]"
popd
exit
fi
if [[ "$BLD_OPT" != "repeat" ]]; then
export CFLAGS
export LDFLAGS
./configure --prefix=$PG_INSTALL ${CMD[@]}
fi
make -sj 16
make install
# extensions
export PATH=$PGBIN:$PATH
export PG_CONFIG=$PGBIN/pg_config
cd $CODEHOME/contrib && make -sj &&make install
cd $CODEHOME/contrib/pg_cron && make && make install
cd $CODEHOME/src/pl/plpython && make install
echo "============> Enjoy coding! <==============="
echo "You could add $PGBIN to your PATH"
popd