From 832b33605fd45a37213f0e6b07386fc728356074 Mon Sep 17 00:00:00 2001 From: "Jeroen Ooms (via CI)" Date: Wed, 22 Nov 2023 11:44:46 +0000 Subject: [PATCH 1/3] Use pkg-config version when cross compiling --- configure | 34 ++++++++-------------------------- configure.ac | 34 ++++++++-------------------------- 2 files changed, 16 insertions(+), 52 deletions(-) diff --git a/configure b/configure index c66a1fc..9e7dd43 100755 --- a/configure +++ b/configure @@ -2302,7 +2302,7 @@ PROJ6="no" PROJH="no" if test "${proj_config_ok}" = yes; then PROJ_VERSION=`${PROJ_CONFIG} --modversion` - PROJV1=`echo "${PROJ_VERSION}" | cut -c 1` + PROJV1=`echo "${PROJ_VERSION}" | cut -d "." -f 1` if test "${PROJV1}" -ge 5; then PROJ6="yes" PROJ_CPPFLAGS="${PROJ_CPPFLAGS} -DHAVE_PROJ_H" @@ -3509,7 +3509,11 @@ fi ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o proj_conf_test proj_conf_test.c ${PROJ_LIBS} +if test "x$cross_compiling" = "xyes"; then +proj_version="${PROJ_VERSION}" +else proj_version=`./proj_conf_test` +fi # Check whether --with-proj-share was given. @@ -3697,31 +3701,9 @@ fi # proj >= 6 # # POSTGIS/PROJ version: # - -cat > proj_conf_test.c <<_EOCONF -#include -#ifdef HAVE_PROJ_H -#include -int main(void) { - printf("%d%d%d\n", PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH); - return 0; -} -#else -#include -int main(void) { - printf("%d\n", PJ_VERSION); - return 0; -} -#endif -_EOCONF - -# AC_MSG_NOTICE([PKG_LIBS: ${PKG_LIBS}]) - -${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o proj_conf_test proj_conf_test.c ${PROJ_LIBS} - -proj_version=`./proj_conf_test` - -POSTGIS_PROJ_VERSION=`echo $proj_version | cut -c "1,2"` +PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1 +PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2 +POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&5 printf "%s\n" "$as_me: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&6;} #AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"]) diff --git a/configure.ac b/configure.ac index 45de45e..a4fc9e3 100644 --- a/configure.ac +++ b/configure.ac @@ -58,7 +58,7 @@ PROJ6="no" PROJH="no" if test "${proj_config_ok}" = yes; then PROJ_VERSION=`${PROJ_CONFIG} --modversion` - PROJV1=`echo "${PROJ_VERSION}" | cut -c 1` + PROJV1=`echo "${PROJ_VERSION}" | cut -d "." -f 1` if test "${PROJV1}" -ge 5; then PROJ6="yes" PROJ_CPPFLAGS="${PROJ_CPPFLAGS} -DHAVE_PROJ_H" @@ -173,7 +173,11 @@ fi ${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o proj_conf_test proj_conf_test.c ${PROJ_LIBS} +if test "x$cross_compiling" = "xyes"; then +proj_version="${PROJ_VERSION}" +else proj_version=`./proj_conf_test` +fi AC_ARG_WITH([proj-share], AS_HELP_STRING([--with-proj-share=SHARE_PATH],[the location of proj metadata files]), @@ -347,31 +351,9 @@ fi # proj >= 6 # # POSTGIS/PROJ version: # - -[cat > proj_conf_test.c <<_EOCONF -#include -#ifdef HAVE_PROJ_H -#include -int main(void) { - printf("%d%d%d\n", PROJ_VERSION_MAJOR, PROJ_VERSION_MINOR, PROJ_VERSION_PATCH); - return 0; -} -#else -#include -int main(void) { - printf("%d\n", PJ_VERSION); - return 0; -} -#endif -_EOCONF] - -# AC_MSG_NOTICE([PKG_LIBS: ${PKG_LIBS}]) - -${CC} ${CFLAGS} ${CPPFLAGS} ${LDFLAGS} -o proj_conf_test proj_conf_test.c ${PROJ_LIBS} - -proj_version=`./proj_conf_test` - -POSTGIS_PROJ_VERSION=`echo $proj_version | cut -c "1,2"` +PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1 +PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2 +POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}" AC_MSG_NOTICE([POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}]) #AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"]) #AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version]) From 14c466bb38342f099ce7d283def1d8482773d447 Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Wed, 22 Nov 2023 15:21:02 +0100 Subject: [PATCH 2/3] Set POSTGIS_PROJ_VERSION from configure script --- configure | 7 +++---- configure.ac | 7 +++---- src/postgis_config.h | 2 +- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/configure b/configure index 9e7dd43..a747ebd 100755 --- a/configure +++ b/configure @@ -3701,22 +3701,21 @@ fi # proj >= 6 # # POSTGIS/PROJ version: # -PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1 -PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2 +PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1` +PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2` POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}" { printf "%s\n" "$as_me:${as_lineno-$LINENO}: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&5 printf "%s\n" "$as_me: POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}" >&6;} #AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"]) #AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version]) -# xxx +PKG_CPPFLAGS="${PKG_CPPFLAGS} -DPOSTGIS_PROJ_VERSION=${POSTGIS_PROJ_VERSION}" if test ${POSTGIS_PROJ_VERSION} -lt 60 ; then PKG_CPPFLAGS="${PKG_CPPFLAGS} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" else PKG_CPPFLAGS="${PKG_CPPFLAGS} -DUSE_PROJ_H" fi - # # GEOS: # diff --git a/configure.ac b/configure.ac index a4fc9e3..ff38ddc 100644 --- a/configure.ac +++ b/configure.ac @@ -351,21 +351,20 @@ fi # proj >= 6 # # POSTGIS/PROJ version: # -PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1 -PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2 +PROJ_VERSION_MAJOR=`echo $proj_version | cut -d "." -f 1` +PROJ_VERSION_MINOR=`echo $proj_version | cut -d "." -f 2` POSTGIS_PROJ_VERSION="${PROJ_VERSION_MAJOR}${PROJ_VERSION_MINOR}" AC_MSG_NOTICE([POSTGIS_PROJ_VERSION: ${POSTGIS_PROJ_VERSION}]) #AC_SUBST([POSTGIS_PROJ_VERSION],["${PROJV12}"]) #AC_DEFINE_UNQUOTED([POSTGIS_PROJ_VERSION], [$POSTGIS_PROJ_VERSION], [PROJ library version]) AC_SUBST(POSTGIS_PROJ_VERSION) -# xxx +PKG_CPPFLAGS="${PKG_CPPFLAGS} -DPOSTGIS_PROJ_VERSION=${POSTGIS_PROJ_VERSION}" if test ${POSTGIS_PROJ_VERSION} -lt 60 ; then PKG_CPPFLAGS="${PKG_CPPFLAGS} -DACCEPT_USE_OF_DEPRECATED_PROJ_API_H" else PKG_CPPFLAGS="${PKG_CPPFLAGS} -DUSE_PROJ_H" fi - # # GEOS: # diff --git a/src/postgis_config.h b/src/postgis_config.h index a88dc8c..df0ee6c 100644 --- a/src/postgis_config.h +++ b/src/postgis_config.h @@ -121,7 +121,7 @@ #define POSTGIS_PGSQL_VERSION 100 /* PROJ library version */ -#define POSTGIS_PROJ_VERSION 91 +/* #define POSTGIS_PROJ_VERSION 91 */ /* PostGIS Raster build date */ /* #undef POSTGIS_RASTER_BUILD_DATE */ From 95fa2245eebe88b52413b3b817d2d65fc2d104be Mon Sep 17 00:00:00 2001 From: Jeroen Ooms Date: Wed, 10 Jan 2024 15:32:00 +0100 Subject: [PATCH 3/3] fix build on windows --- src/Makevars.ucrt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makevars.ucrt b/src/Makevars.ucrt index 0c46c1a..1274e36 100644 --- a/src/Makevars.ucrt +++ b/src/Makevars.ucrt @@ -85,7 +85,7 @@ LIBSHARPYUV = $(or $(and $(wildcard $(R_TOOLS_SOFT)/lib/libsharpyuv.a),-lsharpyu PKG_LIBS = \ -L./liblwgeom -llwgeomstatic \ --fopenmp -lgdal -larmadillo -lopenblas -lgfortran -lquadmath -lpq -lpgcommon -lpgport -lodbc32 -lodbccp32 -lblosc -lkea -lhdf5_cpp -lhdf5 -lpoppler -llcms2 -lfreetype -lharfbuzz -lfreetype -llz4 -lpcre2-8 -lxml2 -lopenjp2 -lnetcdf -lmysqlclient -lspatialite -lgeos_c -lgeos -lminizip -lgeos -ljson-c -lgta -lfreexl -lexpat -lssl -lpsapi -lgif -lmfhdf -lhdf5_hl -lcrypto -lportablexdr -ldf -lhdf5 -lsz -lpng16 -lpng -lpoppler -llcms2 -lfreetype -lharfbuzz -lfreetype -llz4 -lpcre2-8 -lpcre -lcurl -lbcrypt -lrtmp -lssl -lssh2 -lidn2 -lunistring -liconv -lgcrypt -lcrypto -lgpg-error -lws2_32 -ltiff -llzma -ljpeg -lz -lcfitsio -lzstd -lwebpdecoder -lwebp $(LIBSHARPYUV) -lsbml-static -lgeotiff -lproj -lsqlite3 -lbz2 -lcrypt32 -lwldap32 -lsecur32 +-fopenmp -lgdal -larmadillo -lopenblas -lgfortran -lquadmath -lpq -lpgcommon -lpgport -lodbc32 -lodbccp32 -lblosc -lkea -lhdf5_cpp -lhdf5 -lpoppler -llcms2 -lfreetype -lharfbuzz -lfreetype -llz4 -lpcre2-8 -lxml2 -lopenjp2 -lnetcdf -lmysqlclient -lspatialite -lgeos_c -lgeos -lminizip -lgeos -ljson-c -lgta -lfreexl -lexpat -lssl -lpsapi -lgif -lmfhdf -lhdf5_hl -lcrypto -lportablexdr -ldf -lhdf5 -lsz -lpng16 -lpng -lpoppler -llcms2 -lfreetype -lharfbuzz -lfreetype -llz4 -lpcre2-8 -lpcre -lproj -lcurl -lbcrypt -lrtmp -lssl -lssh2 -lidn2 -lunistring -liconv -lgcrypt -lcrypto -lgpg-error -lws2_32 -ltiff -llzma -ljpeg -lz -lcfitsio -lzstd -lwebpdecoder -lwebp $(LIBSHARPYUV) -lsbml-static -lgeotiff -lsqlite3 -lbz2 -lcrypt32 -lwldap32 -lsecur32 all: clean winlibs