diff --git a/packages/postgresql/build.sh b/packages/postgresql/build.sh index 785d499ae..266c8f655 100644 --- a/packages/postgresql/build.sh +++ b/packages/postgresql/build.sh @@ -69,9 +69,3 @@ termux_step_post_make_install() { (cd contrib/$contrib && make -s -j $TERMUX_MAKE_PROCESSES install) done } - -termux_step_post_massage() { - # Remove bin/pg_config so e.g. php doesn't try to use it, which won't - # work as it's a cross-compiled binary: - rm $TERMUX_PREFIX/bin/pg_config -} diff --git a/packages/postgresql/pg_config.in b/packages/postgresql/pg_config.in new file mode 100644 index 000000000..8e4960ead --- /dev/null +++ b/packages/postgresql/pg_config.in @@ -0,0 +1,98 @@ +#!/bin/sh + +# This script can be used instead of the cross-compile pg_config +# program for packages that depend on postgresql. It is not included +# in the postgresql package. + +show_help () { +echo "pg_config provides information about the installed version of PostgreSQL. + +Usage: + pg_config [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 "configure" script when 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 . +PostgreSQL home page: " +} + +version=@POSTGRESQL_VERSION@ +prefix=@TERMUX_PREFIX@ +BINDIR="$prefix/bin" +DOCDIR="$prefix/share/doc/postgresql" +HTMLDIR="$prefix/share/doc/postgresql" +INCLUDEDIR="$prefix/include" +PKGINCLUDEDIR="$prefix/include/postgresql" +INCLUDEDIR_SERVER="$prefix/include/postgresql/server" +LIBDIR="$prefix/lib" +PKGLIBDIR="$prefix/lib/postgresql" +LOCALEDIR="$prefix/share/locale" +MANDIR="$prefix/share/man" +SHAREDIR="$prefix/share/postgresql" +SYSCONFDIR="$prefix/etc/postgresql" +PGXS="$prefix/lib/postgresql/pgxs/src/makefiles/pgxs.mk" +CONFIGURE="--disable-dependency-tracking --prefix=$prefix --libdir=$prefix/lib --sbindir=$prefix/bin --disable-rpath --disable-rpath-hack --host=@TERMUX_HOST_PLATFORM@ pgac_cv_prog_cc_ldflags__Wl___as_needed=yes USE_UNNAMED_POSIX_SEMAPHORES=1 --with-icu --with-libxml --with-openssl --with-uuid=e2fs ZIC=/home/builder/.termux-build/postgresql/host-build/src/timezone/zic --disable-nls --enable-shared --enable-static --libexecdir=$prefix/libexec host_alias=@TERMUX_HOST_PLATFORM@ CC=@TERMUX_HOST_PLATFORM@-clang CFLAGS= -fstack-protector-strong -Oz LDFLAGS=-L$prefix/lib -Wl,-rpath=$prefix/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now CPPFLAGS= -I$prefix/include CXX=@TERMUX_HOST_PLATFORM@-clang++ CXXFLAGS= -fstack-protector-strong -Oz CPP=@TERMUX_HOST_PLATFORM@-cpp PKG_CONFIG=/home/builder/.termux-build/_cache/android-r23b-api-24-v1/bin/pkg-config PKG_CONFIG_LIBDIR=$prefix/lib/pkgconfig" +CC="@TERMUX_HOST_PLATFORM@-clang" +CPPFLAGS="-I$prefix/include -I$prefix/include -D_GNU_SOURCE -I$prefix/include/libxml2" +CFLAGS="-Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Werror=vla -Werror=unguarded-availability-new -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -Wno-unused-command-line-argument -fstack-protector-strong -Oz" +CFLAGS_SL="-fPIC" +LDFLAGS="-L$prefix/lib -Wl,-rpath=$prefix/lib -fopenmp -static-openmp -Wl,--enable-new-dtags -Wl,--as-needed -Wl,-z,relro,-z,now -L$prefix/lib -Wl,--as-needed" +LDFLAGS_EX="" +LDFLAGS_SL="" +LIBS="-lpgcommon -lpgport -lxml2 -lssl -lcrypto -lz -lreadline -lm" +VERSION="PostgreSQL $version" + +handle_args () { + case "${1##--}" in + bindir) echo "$BINDIR" ;; + cc) echo "@TERMUX_HOST_PLATFORM@-clang" ;; + cflags) echo "$CFLAGS" ;; + cflags_sl) echo "$CFLAGS_SL" ;; + configure) echo "$CONFIGURE" ;; + cppflags) echo "CPPFLAGS" ;; + docdir) echo "$DOCDIR" ;; + includedir) echo "$INCLUDEDIR" ;; + includedir-server) echo "$INCLUDEDIR_SERVER" ;; + ldflags) echo "$LDFLAGS" ;; + ldflags_ex) echo "$LDFLAGS_EX" ;; + ldflags_sl) echo "$LDFLAGS_SL" ;; + libdir) echo "$LIBDIR" ;; + localedir) echo "$LOCALEDIR" ;; + mandir) echo "$MANDIR" ;; + pgxs) echo "$PGXS" ;; + pkgincludedir) echo "$PKGINCLUDEDIR" ;; + pkglibdir) echo "$PKGLIBDIR" ;; + sharedir) echo "$SHAREDIR" ;; + sysconfdir) echo "$SYSCONFDIR" ;; + version) echo "$VERSION" ;; + *) show_help ;; + esac +} + +for arg in $@; do handle_args $arg; done diff --git a/scripts/build/termux_step_override_config_scripts.sh b/scripts/build/termux_step_override_config_scripts.sh index a4dd5f3b8..89b575ec4 100644 --- a/scripts/build/termux_step_override_config_scripts.sh +++ b/scripts/build/termux_step_override_config_scripts.sh @@ -24,4 +24,13 @@ termux_step_override_config_scripts() { -e "s|@TERMUX_ARCH@|$TERMUX_ARCH|g" > $TERMUX_PREFIX/bin/llvm-config chmod 755 $TERMUX_PREFIX/bin/llvm-config fi + + if [ "$TERMUX_PKG_DEPENDS" != "${TERMUX_PKG_DEPENDS/postgresql/}" ]; then + local postgresql_version=$(. $TERMUX_SCRIPTDIR/packages/postgresql/build.sh; echo $TERMUX_PKG_VERSION) + sed $TERMUX_SCRIPTDIR/packages/postgresql/pg_config.in \ + -e "s|@POSTGRESQL_VERSION@|$postgresql_version|g" \ + -e "s|@TERMUX_HOST_PLATFORM@|$TERMUX_HOST_PLATFORM|g" \ + -e "s|@TERMUX_PREFIX@|$TERMUX_PREFIX|g" > $TERMUX_PREFIX/bin/pg_config + chmod 755 $TERMUX_PREFIX/bin/pg_config + fi }