forked from mnencia/pgenv
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathconfigure-all.sh
executable file
·74 lines (61 loc) · 2.25 KB
/
configure-all.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
set -e
ARGS=
if which port >/dev/null; then
ARGS+=" --with-libraries=/opt/local/lib --with-includes=/opt/local/include"
elif which brew >/dev/null; then
INCLUDES=
LIBS=
for pkg in openssl readline libxml2; do
prefix=$(brew --prefix $pkg)
if [ -n "$INCLUDES" ]; then INCLUDES+=:; fi
INCLUDES+="$prefix/include"
if [ -n "$LIBS" ]; then LIBS+=:; fi
LIBS+="$prefix/lib"
export PATH="$prefix/bin:$PATH"
done
ARGS+=" --with-includes=$INCLUDES"
ARGS+=" --with-libraries=$LIBS"
fi
ARGS+=" --with-libxml --with-openssl"
DEBUG_ARGS="--enable-depend --enable-cassert --enable-debug "
### unused args
# --enable-coverage
# Enable tap tests if IPC::Run is available
if [ -n "$(perldoc -lm IPC::Run)" ]; then
DEBUG_ARGS+=" --with-perl --enable-tap-tests"
fi
CFLAGS=" -Wall -Wextra -Wuninitialized -Wint-conversion -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -g3 -fno-omit-frame-pointer -Wno-missing-field-initializers "
# openSUSE and SUSE have tclConfig.sh in /usr/lib64 for x86_64 machines
if [ -f "/etc/SuSE-release" ] && [ "$(uname -m)" == 'x86_64' ]; then
ARGS+=" --with-tclconfig=/usr/lib64"
fi
if (which ccache && which clang) >/dev/null; then
ARGS+=" CC='ccache clang -Qunused-arguments -fcolor-diagnostics'"
fi
if [ -n "$2" ]; then
BASE_DIR="$HOME/work/$2"
else
BASE_DIR="$HOME/pgsql"
fi
pushd $BASE_DIR
for a in $(ls -rd *master) $(ls -rd *STABLE*); do
# if the directory doesn't exist skip it
[ -d $a ] || continue
# if an argument is provided install only that version
[ -n "$1" ] &&
[ "$1" != "$a" ] &&
[ "REL${1/./_}_STABLE" != "$a" ] &&
[ "REL_${1}_STABLE" != "$a" ] &&
[ "2QREL_${1#362q}_STABLE_3_6" != "$a" ] &&
[ "2QREL_${1#PGE}_STABLE_dev" != "$a" ] &&
[ "EDBAS_${1#EDBAS}_STABLE" != "$a" ] &&
[ "BDRPG_${1#BDRPG}_STABLE" != "$a" ] &&
continue
instdir="$BASE_DIR/.pgenv/versions/$a"
pushd $a
echo "Running configure with the following arguments: --prefix=$instdir ${DEBUG_ARGS} ${ARGS} CFLAGS=$CFLAGS" CPPFLAGS=$CPPFLAGS
./configure --prefix="$instdir" ${DEBUG_ARGS} ${ARGS} CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS"
# return in the $BASE_DIR and remain there
popd
done