/usr/bin/pg_buildext is in postgresql-server-dev-all 129.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | #!/bin/sh
#
# build a PostgreSQL module based on PGXS for give list of supported major
# versions
#
# Author: Dimitri Fontaine <dfontaine@hi-media.com>
set -e
action="$1"
srcdir="${2:-`pwd`}"
target="$3"
opt="$4"
die() {
echo "`basename $0`: error: $*" >&2
exit 1
}
prepare_env() {
version=$1
vtarget=`echo $target | sed -e "s:%v:$version:g"`
pgc="/usr/lib/postgresql/$version/bin/pg_config"
[ -e "$pgc" ] || die "$pgc does not exists"
}
configure() {
prepare_env $1
confopts=`echo $opt | sed -e "s:%v:$version:g"`
mkdir -p $vtarget
( echo "calling configure in $vtarget" &&
cd $vtarget && $srcdir/configure $confopts PG_CONFIG="$pgc" )
}
build() {
prepare_env $1
cflags="`$pgc --cflags` `echo $opt | sed -e "s:%v:$version:g"`"
mkdir -p $vtarget
# if a Makefile was created by configure, use it, else the top level Makefile
[ -f $vtarget/Makefile ] || makefile="-f $srcdir/Makefile"
make -C $vtarget $makefile CFLAGS="$cflags" PG_CONFIG="$pgc" VPATH="$srcdir"
}
install() {
prepare_env $1
package=`echo $opt | sed -e "s:%v:$version:g"`
mkdir -p $vtarget
# if a Makefile was created by configure, use it, else the top level Makefile
[ -f $vtarget/Makefile ] || makefile="-f $srcdir/Makefile"
make -C $vtarget $makefile install DESTDIR="$srcdir/debian/$package" PG_CONFIG="$pgc" VPATH="$srcdir"
}
clean() {
prepare_env $1
# if a Makefile was created by configure, use it, else the top level Makefile
[ -f $vtarget/Makefile ] || makefile="-f $srcdir/Makefile"
[ -d $vtarget ] && make -C $vtarget clean $makefile PG_CONFIG="$pgc" VPATH="$srcdir"
rm -rf $vtarget
}
versions() {
[ -e /usr/share/postgresql-common/supported-versions ] ||
die "/usr/share/postgresql-common/supported-versions not found"
[ -e $srcdir/debian/pgversions ] || die "$srcdir/debian/pgversions not found"
for v in `/usr/share/postgresql-common/supported-versions`
do
grep -q "^$v" $srcdir/debian/pgversions && echo $v
done
}
[ "$srcdir" ] || die "syntax: pg_buildext <action> <srcdir> ..."
[ -d $srcdir ] || die "no such directory '$srcdir'"
VERSIONS=`versions`
for v in $VERSIONS
do
case "$action" in
"supported-versions")
echo $v
;;
configure|build|install|clean)
[ "$target" ] || die "syntax: pg_buildext $action <srcdir> <target> ..."
# be verbose?
$action $v
;;
*)
die "unsupported $action."
;;
esac
done
|