@@ -16,22 +16,80 @@ function pgbuild() {
1616 return
1717 fi
1818 local destname=" ${1:- " $( basename $( pwd) ) " } "
19- local dest=" $HOME /pg/$destname "
19+ local variant=" ${2:- } "
20+ local configure_args
21+ case " ${variant:- } " in
22+ " " )
23+ configure_args=" --enable-debug --enable-cassert --enable-tap-tests --enable-dtrace"
24+ ;;
25+ " NDEBUG" )
26+ configure_args=" "
27+ ;;
28+ * )
29+ echo " unrecognised build variant $variant "
30+ return
31+ ;;
32+ esac
33+ local srcdir=" $( pwd) "
34+ local dest=" $HOME /pg/$destname " ${variant: +-${variant} }
35+ if [ -z " $NO_VPATH " ]; then
36+ local builddir=$HOME /build/$( basename " $srcdir " ) ${variant: +${variant} }
37+ if [ -z " $builddir " ]; then
38+ echo " unable to determine valid build-directory, aborting"
39+ return 1
40+ else
41+ echo " Building $srcdir out-of-tree in $builddir "
42+ fi
43+ if [ -d " $builddir " .old ]; then
44+ rm -rf " $builddir " .old
45+ fi
46+ if [ -d " $builddir " ]; then
47+ mv " $builddir " " $builddir " .old
48+ fi
49+ mkdir -p " $builddir " ;
50+ local configurepath=" $srcdir /configure"
51+ else
52+ echo " in-tree build"
53+ local builddir=$srcdir
54+ local configurepath=" ./configure"
55+ fi
2056 if [ -z " ${NO_SILENT:- } " ]
2157 then
2258 local CONFQUIET=" --quiet"
2359 local SILENT=" -s"
2460 else
2561 echo " NO_SILENT assigned, going loud"
2662 fi
27- echo " configuring for $dest "
28- CFLAGS=" -ggdb3 -O0" ./configure $CONFQUIET --cache-file=config.cache --prefix=" $dest " --enable-debug --enable-cassert --enable-tap-tests --enable-dtrace && \
29- echo " configured, making" && \
30- make $SILENT clean && \
31- make $SILENT -j4 && make $SILENT -C contrib -j4 && \
32- echo " compiled" && \
33- make $SILENT install && make $SILENT -C contrib install && \
34- echo " installed to $dest "
63+ (
64+ cd $builddir
65+ set -e
66+ echo " configuring for $dest "
67+ CFLAGS=" -ggdb3 -O0" $configurepath $CONFQUIET --cache-file=config.cache --prefix=" $dest " --enable-debug --enable-cassert --enable-tap-tests --enable-dtrace
68+ echo " configured, making"
69+ make $SILENT clean
70+ make $SILENT -j4
71+ make $SILENT -C contrib -j4
72+ echo " compiled"
73+ make $SILENT install
74+ make $SILENT -C contrib install
75+ echo " installed to $dest "
76+ )
77+ rm -f build${variant: +-${variant} }
78+ ln -s $builddir build${variant: +-${variant} }
79+ }
80+
81+ function pgbuildall() {
82+ if [ -n " ${NO_VPATH:- } " ]; then
83+ echo " VO_VPATH set but cannot pgbuildall without vpath"
84+ return
85+ fi
86+ echo " building base variant..."
87+ pgbuild " $( basename $( pwd) ) "
88+ echo " base variant built"
89+ echo " building NDEBUG variant"
90+ pgbuild " $( basename $( pwd) ) " " NDEBUG"
91+ echo " NDEBUG variant built"
92+ ls -d build*
3593}
3694
3795#
@@ -82,7 +140,7 @@ function extbuild() {
82140 echo " ${extgenfile} still exists in srcdir, clean vpath build not possible. Clean source dir."
83141 return 1
84142 fi
85- local builddir=$( dirname " $srcdir " ) / $( basename " $srcdir " ) -build
143+ local builddir=$HOME /build/ $( basename " $srcdir " )
86144 if [ -z " $builddir " ]; then
87145 echo " unable to determine valid build-directory, aborting"
88146 return 1
@@ -114,6 +172,8 @@ function extbuild() {
114172 PATH=" $newpath " make $MAKEFILEARG $SILENT REGRESS_LOG_MIN_MESSAGES=debug2 PROVE_FLAGS=" --verbose" " $@ "
115173 )
116174 echo " rebuild and install done"
175+ rm -f build
176+ ln -s $builddir build
117177}
118178
119179function pgl3build() {
@@ -176,3 +236,56 @@ PROMPT_COMMAND='__git_ps1 "\\j \\w" "\\\$ "'
176236PROMPT_DIRTRIM=2
177237export PROMPT_COMMAND PROMPT_DIRTRIM
178238
239+
240+ function pg() {
241+ local ver=${1:- 2q1136}
242+ local subdir
243+ case " ${ver} " in
244+ 2[qQ]10)
245+ subdir=2QREL_10_STABLE
246+ ;;
247+ 2[qQ]11* 3* 6)
248+ subdir=2QREL_11_STABLE_3_6
249+ ;;
250+ 2[qQ]11* 3* 7|2[qQ]11)
251+ subdir=2QREL_11_STABLE_dev
252+ ;;
253+ 2[qQ]12)
254+ subdir=2QREL_12_STABLE_dev
255+ ;;
256+ 10|11|12)
257+ subdir=REL_${ver} _STABLE
258+ ;;
259+ 9* 4)
260+ subdir=REL9_4_STABLE
261+ ;;
262+ 9* 5)
263+ subdir=REL9_5_STABLE
264+ ;;
265+ 9* 5)
266+ subdir=REL9_6_STABLE
267+ ;;
268+ * )
269+ subdir=" ${ver} "
270+ ;;
271+ esac
272+ pushd ~ /projects/2Q/postgres/${subdir}
273+ }
274+
275+ function pgl() {
276+ local subdir=" ${1:- master} "
277+ if [ " ${1:- } " == " 36" ]; then
278+ subdir=REL3_6_STABLE
279+ fi
280+ pushd ~ /projects/2Q/pglogical/pglogical-${subdir}
281+ }
282+
283+ function bdr() {
284+ local subdir=" ${1:- master} "
285+ if [ " ${1:- } " == " 36" ]; then
286+ subdir=REL3_6_STABLE
287+ fi
288+ pushd ~ /projects/2Q/bdr/bdr-${subdir}
289+ }
290+
291+ # vim: ts=4 sw=4 et ai
0 commit comments