void-packages/srcpkgs/postgresql/files/pg_config.sh.in
Đoàn Trần Công Danh 3e16ec9653 postgresql: fix shell version of pg_config.sh
[skip ci]
2020-04-09 17:53:45 +02:00

144 lines
4.4 KiB
Bash

#!/bin/sh
# Released to Public Domain by Doan Tran Cong Danh
print() {
printf '%s\n' "$@"
}
sysroot="$(cd "${0%/*}" && cd ../.. && pwd)"
BINDIR="$sysroot/usr/bin"
DOCDIR="$sysroot/usr/share/doc/postgresql"
HTMLDIR="$sysroot/usr/share/doc/postgresql"
INCLUDEDIR="$sysroot/usr/include"
PKGINCLUDEDIR="$sysroot/usr/include/postgresql"
INCLUDEDIR_SERVER="$sysroot/usr/include/postgresql/server"
LIBDIR="$sysroot/usr/lib"
PKGLIBDIR="$sysroot/usr/lib/postgresql"
LOCALEDIR="$sysroot/usr/share/locale"
MANDIR="$sysroot/usr/share/man"
SHAREDIR="$sysroot/usr/share/postgresql"
SYSCONFDIR="$sysroot/etc/postgresql"
PGXS="$sysroot/usr/lib/postgresql/pgxs/src/makefiles/pgxs.mk"
CONFIGURE="@configure_args@"
CC="@CC@"
CPPFLAGS="@CPPFLAGS@"
CFLAGS="@CFLAGS@"
CFLAGS_SL="@CFLAGS_SL@"
LDFLAGS="@LDFLAGS@"
LDFLAGS_EX="@LDFLAGS_EX@"
LDFLAGS_SL="@LDFLAGS_SL@"
LIBS="@LIBS@"
VERSION="PostgreSQL @VERSION@"
if [ "$sysroot" != "/" ]; then
CPPFLAGS="$(print "$CPPFLAGS" | sed "s,-I *\\(/usr/include\\),-I$sysroot\\1,g")"
CFLAGS="$(print "$CFLAGS" | sed "s,-I *\\(/usr/include\\),-I$sysroot\\1,g")"
LDFLAGS="$(print "$LDFLAGS" | sed "s,-L *\\(/usr/lib\\),-L$sysroot\\1,g")"
fi
usage() {
cat <<-EOF
$0 provides information about the installed version of PostgreSQL.
Usage:
$0 [OPTION]...
Options:
--bindir show location of user executables
--docdir show location of documentation files
--htmldir show location of HTML documentation files
--includedir show location of C header files of the client interfaces
--pkgincludedir show location of other C header files
--includedir-server show location of C header files for the server
--libdir show location of object code libraries
--pkglibdir show location of dynamically loadable modules
--localedir show location of locale support files
--mandir show location of manual pages
--sharedir show location of architecture-independent support files
--sysconfdir show location of system-wide configuration files
--pgxs show location of extension makefile
--configure show options given to PostgreSQL was built
--cc show CC value used when PostgreSQL was built
--cppflags show CPPFLAGS value used when PostgreSQL was built
--cflags show CFLAGS value used when PostgreSQL was built
--cflags_sl show CFLAGS_SL value used when PostgreSQL was built
--ldflags show LDFLAGS value used when PostgreSQL was built
--ldflags_ex show LDFLAGS_EX value used when PostgreSQL was built
--ldflags_sl show LDFLAGS_SL value used when PostgreSQL was built
--libs show LIBS value used when PostgreSQL was built
--version show the PostgreSQL version
-?, --help show this help, then exit
With no arguments, all known items are shown.
Report bugs to <pgsql-bugs@postgresql.org>.
EOF
}
if test $# -eq 0; then
cat <<-EOF
BINDIR = $BINDIR
DOCDIR = $DOCDIR
HTMLDIR = $HTMLDIR
INCLUDEDIR = $INCLUDEDIR
PKGINCLUDEDIR = $PKGINCLUDEDIR
INCLUDEDIR-SERVER = $INCLUDEDIR_SERVER
LIBDIR = $LIBDIR
PKGLIBDIR = $PKGLIBDIR
LOCALEDIR = $LOCALEDIR
MANDIR = $MANDIR
SHAREDIR = $SHAREDIR
SYSCONFDIR = $SYSCONFDIR
PGXS = $PGXS
CONFIGURE = $CONFIGURE
CC = $CC
CPPFLAGS = $CPPFLAGS
CFLAGS = $CFLAGS
CFLAGS_SL = $CFLAGS_SL
LDFLAGS = $LDFLAGS
LDFLAGS_EX = $LDFLAGS_EX
LDFLAGS_SL = $LDFLAGS_SL
LIBS = $LIBS
VERSION = $VERSION
EOF
fi
for arg
do
if test "x$arg" = "x--help" || test "x$arg" = "x-?"; then
usage
exit 0
fi
done
for arg
do
case "$arg" in
--bindir) print "$BINDIR" ;;
--docdir) print "$DOCDIR" ;;
--htmldir) print "$HTMLDIR" ;;
--includedir) print "$INCLUDEDIR" ;;
--pkgincludedir) print "$PKGINCLUDEDIR" ;;
--includedir-server) print "$INCLUDEDIR_SERVER" ;;
--libdir) print "$LIBDIR" ;;
--pkglibdir) print "$PKGLIBDIR" ;;
--localedir) print "$LOCALEDIR" ;;
--mandir) print "$MANDIR" ;;
--sharedir) print "$SHAREDIR" ;;
--sysconfdir) print "$SYSCONFDIR" ;;
--pgxs) print "$PGXS" ;;
--configure) print "$CONFIGURE" ;;
--cc) print "$CC" ;;
--cppflags) print "$CPPFLAGS" ;;
--cflags) print "$CFLAGS" ;;
--cflags_sl) print "$CFLAGS_SL" ;;
--ldflags) print "$LDFLAGS" ;;
--ldflags_ex) print "$LDFLAGS_EX" ;;
--ldflags_sl) print "$LDFLAGS_SL" ;;
--libs) print "$LIBS" ;;
--version) print "$VERSION" ;;
esac
done