postgis: add package
postgis is not really set up for cross-compilation. It wants to run cross-compiled programs to check proj and protobuf versions, so we need to patch that in configure script. The current patch added to do this will be annoying to maintain. I tried patching the configure.ac script instead but got weird errors that seemed to have more to do with the autoconf version we have in the docker image. Fixes https://github.com/termux/termux-packages/issues/8142
This commit is contained in:
parent
030e9e1d6f
commit
714aa0dfa7
28
packages/postgis/build.sh
Normal file
28
packages/postgis/build.sh
Normal file
@ -0,0 +1,28 @@
|
||||
TERMUX_PKG_HOMEPAGE=https://postgis.net
|
||||
TERMUX_PKG_DESCRIPTION="Spatial database extender for PostgreSQL object-relational database"
|
||||
TERMUX_PKG_LICENSE="GPL-2.0"
|
||||
TERMUX_PKG_MAINTAINER="@termux"
|
||||
TERMUX_PKG_VERSION=3.1.4
|
||||
TERMUX_PKG_SRCURL=https://download.osgeo.org/postgis/source/postgis-$TERMUX_PKG_VERSION.tar.gz
|
||||
TERMUX_PKG_SHA256=dc8e3fe8bc532e422f5d724c5a7c437f6555511716f6410d4d2db9762e1a3796
|
||||
TERMUX_PKG_DEPENDS="gdal, json-c, postgresql, proj, libprotobuf-c, libxml2, libiconv"
|
||||
|
||||
# both configure script and Makefile(s) look for files in current
|
||||
# directory rather than srcdir, so need to build in source
|
||||
TERMUX_PKG_BUILD_IN_SRC=true
|
||||
|
||||
termux_step_pre_configure() {
|
||||
# Configure script wants to run a cross-compiled program to
|
||||
# get proj and protobuf version, which won't work for us.
|
||||
local proj_version=$(. $TERMUX_SCRIPTDIR/packages/proj/build.sh; echo $TERMUX_PKG_VERSION)
|
||||
# 8.1.1 -> 81
|
||||
proj_version=${proj_version:0:1}${proj_version:2:1}
|
||||
local protobuf_version=$(. $TERMUX_SCRIPTDIR/packages/libprotobuf-c/build.sh; echo $TERMUX_PKG_VERSION)
|
||||
# 1.3.3 -> 1003003
|
||||
protobuf_version=${protobuf_version:0:1}00${protobuf_version:2:1}00${protobuf_version:4:1}
|
||||
echo "Patching configure script"
|
||||
sed -e "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" \
|
||||
-e "s|@PROJ_VERSION@|${proj_version}|g" \
|
||||
-e "s|@PROTOBUF_VERSION@|${protobuf_version}|g" \
|
||||
$TERMUX_PKG_BUILDER_DIR/configure.diff | patch -Np1
|
||||
}
|
170
packages/postgis/configure.diff
Normal file
170
packages/postgis/configure.diff
Normal file
@ -0,0 +1,170 @@
|
||||
--- ../configure.orig 2021-12-05 10:26:50.984021147 +0000
|
||||
+++ ./configure 2021-12-05 10:49:16.032713588 +0000
|
||||
@@ -14497,7 +14497,7 @@
|
||||
esac
|
||||
|
||||
CPPFLAGS_SAVE="$CPPFLAGS"
|
||||
-CPPFLAGS="$XML2_CPPFLAGS"
|
||||
+CPPFLAGS="$XML2_CPPFLAGS -I@TERMUX_PREFIX@/include"
|
||||
for ac_header in libxml/tree.h libxml/parser.h libxml/xpath.h libxml/xpathInternals.h
|
||||
do :
|
||||
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
|
||||
@@ -16989,106 +16989,7 @@
|
||||
|
||||
|
||||
|
||||
-
|
||||
- ac_fn_c_check_header_mongrel "$LINENO" "proj.h" "ac_cv_header_proj_h" "$ac_includes_default"
|
||||
-if test "x$ac_cv_header_proj_h" = xyes; then :
|
||||
-
|
||||
- if test "$cross_compiling" = yes; then :
|
||||
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
-as_fn_error $? "cannot run test program while cross compiling
|
||||
-See \`config.log' for more details" "$LINENO" 5; }
|
||||
-else
|
||||
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
-/* end confdefs.h. */
|
||||
-
|
||||
-
|
||||
- #ifdef HAVE_STDINT_H
|
||||
- #include <stdio.h>
|
||||
- #endif
|
||||
- #include "proj.h"
|
||||
-
|
||||
-int
|
||||
-main ()
|
||||
-{
|
||||
-
|
||||
- FILE *fp;
|
||||
- int vernum;
|
||||
-
|
||||
- fp = fopen("conftest.out", "w");
|
||||
- vernum = (100 * PROJ_VERSION_MAJOR) + (10 * PROJ_VERSION_MINOR) + PROJ_VERSION_PATCH;
|
||||
- fprintf(fp, "%d\n", vernum);
|
||||
- fclose(fp);
|
||||
-
|
||||
- ;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-_ACEOF
|
||||
-if ac_fn_c_try_run "$LINENO"; then :
|
||||
-
|
||||
- POSTGIS_PROJ_VERSION=`cat conftest.out | sed 's/\([0-9]\)\([0-9]\)\([0-9]\)/\1\2/'`
|
||||
-
|
||||
-else
|
||||
-
|
||||
- POSTGIS_PROJ_VERSION=""
|
||||
-
|
||||
-fi
|
||||
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
- conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-else
|
||||
-
|
||||
- if test "$cross_compiling" = yes; then :
|
||||
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
-as_fn_error $? "cannot run test program while cross compiling
|
||||
-See \`config.log' for more details" "$LINENO" 5; }
|
||||
-else
|
||||
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
-/* end confdefs.h. */
|
||||
-
|
||||
- #ifdef HAVE_STDINT_H
|
||||
- #include <stdio.h>
|
||||
- #endif
|
||||
- #include "proj_api.h"
|
||||
-
|
||||
-int
|
||||
-main ()
|
||||
-{
|
||||
-
|
||||
- FILE *fp;
|
||||
-
|
||||
- fp = fopen("conftest.out", "w");
|
||||
- fprintf(fp, "%d\n", PJ_VERSION);
|
||||
- fclose(fp);
|
||||
-
|
||||
- ;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-_ACEOF
|
||||
-if ac_fn_c_try_run "$LINENO"; then :
|
||||
-
|
||||
- POSTGIS_PROJ_VERSION=`cat conftest.out | sed 's/\([0-9]\)\([0-9]\)\([0-9]\)/\1\2/'`
|
||||
-
|
||||
-else
|
||||
-
|
||||
- POSTGIS_PROJ_VERSION=""
|
||||
-
|
||||
-fi
|
||||
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
- conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-fi
|
||||
-
|
||||
-
|
||||
-
|
||||
-
|
||||
+POSTGIS_PROJ_VERSION=@PROJ_VERSION@
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
#define POSTGIS_PROJ_VERSION $POSTGIS_PROJ_VERSION
|
||||
_ACEOF
|
||||
@@ -17709,49 +17610,7 @@
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking protobuf-c version" >&5
|
||||
$as_echo_n "checking protobuf-c version... " >&6; }
|
||||
|
||||
-
|
||||
- if test "$cross_compiling" = yes; then :
|
||||
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
|
||||
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
|
||||
-as_fn_error $? "cannot run test program while cross compiling
|
||||
-See \`config.log' for more details" "$LINENO" 5; }
|
||||
-else
|
||||
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
-/* end confdefs.h. */
|
||||
-
|
||||
-
|
||||
- #ifdef HAVE_STDINT_H
|
||||
- #include <stdio.h>
|
||||
- #endif
|
||||
- #include "protobuf-c/protobuf-c.h"
|
||||
-
|
||||
-int
|
||||
-main ()
|
||||
-{
|
||||
-
|
||||
- FILE *fp = fopen("conftest.out", "w");
|
||||
- fprintf(fp, "%d\n", PROTOBUF_C_VERSION_NUMBER);
|
||||
- fclose(fp);
|
||||
-
|
||||
- ;
|
||||
- return 0;
|
||||
-}
|
||||
-
|
||||
-_ACEOF
|
||||
-if ac_fn_c_try_run "$LINENO"; then :
|
||||
-
|
||||
- PROTOC_VERSION=`cat conftest.out`
|
||||
-
|
||||
-else
|
||||
-
|
||||
- PROTOC_VERSION="0"
|
||||
-
|
||||
-fi
|
||||
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
|
||||
- conftest.$ac_objext conftest.beam conftest.$ac_ext
|
||||
-fi
|
||||
-
|
||||
-
|
||||
+PROTOC_VERSION=@PROTOBUF_VERSION@
|
||||
|
||||
if test ! "$PROTOC_VERSION" -ge 1001000; then
|
||||
as_fn_error $? "\"Old protobuf-c release found but 1.1.0 is required. You can disable MVT and Geobuf support using --without-protobuf\"" "$LINENO" 5
|
Loading…
Reference in New Issue
Block a user