diff --git a/ports/libspatialite/fix-linux-configure.patch b/ports/libspatialite/fix-linux-configure.patch index 426ab3b3527f6f..39883193d53c31 100644 --- a/ports/libspatialite/fix-linux-configure.patch +++ b/ports/libspatialite/fix-linux-configure.patch @@ -18,7 +18,7 @@ index ead87caff..47abb90f0 100644 AC_SUBST([GEOS_LDFLAGS]) AC_SUBST([GEOS_CFLAGS]) # Ensure that we can parse geos_c.h -@@ -335,11 +337,14 @@ if test x"$enable_geos" != "xno"; then +@@ -335,11 +337,13 @@ if test x"$enable_geos" != "xno"; then AC_CHECK_HEADERS([geos_c.h],, [AC_MSG_ERROR([could not find geos_c.h - you may need to specify the directory of a geos-config file using --with-geosconfig])]) CPPFLAGS="$CPPFLAGS_SAVE" # Ensure we can link against libgeos_c @@ -29,34 +29,6 @@ index ead87caff..47abb90f0 100644 LIBS="$LIBS_SAVE" LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c" + fi -+ LIBS="$LIBS $GEOS_LDFLAGS" #----------------------------------------------------------------------- # --enable-controlpoints -@@ -358,7 +363,7 @@ if test x"$enable_geos" != "xno"; then - [--enable-geosadvanced], [enables GEOS advanced features [default=yes]])], - [], [enable_geosadvanced=yes]) - if test x"$enable_geosadvanced" != "xno"; then -- AC_SEARCH_LIBS(GEOSDelaunayTriangulation,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.4.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geosadvanced parameter.])) -+ #AC_SEARCH_LIBS(GEOSDelaunayTriangulation,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.4.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geosadvanced parameter.])) - AC_DEFINE(GEOS_ADVANCED) - fi - -@@ -369,7 +374,7 @@ if test x"$enable_geos" != "xno"; then - [--enable-geosreentrant], [enables GEOS reentrant (fully thread safe) [default=yes]])], - [], [enable_geosreentrant=yes]) - if test x"$enable_geosreentrant" != "xno"; then -- AC_SEARCH_LIBS(GEOSContext_setErrorMessageHandler_r,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.5.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geosreentrant parameter.])) -+ #AC_SEARCH_LIBS(GEOSContext_setErrorMessageHandler_r,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.5.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geosreentrant parameter.])) - AC_DEFINE(GEOS_REENTRANT) - fi - -@@ -390,7 +395,7 @@ if test x"$enable_geos" != "xno"; then - [--enable-geos370], [enables GEOS 3.7.0 features [default=yes]])], - [], [enable_geos370=yes]) - if test x"$enable_geos370" != "xno"; then -- AC_SEARCH_LIBS(GEOSFrechetDistance_r,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.7.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geos370 parameter.])) -+ #AC_SEARCH_LIBS(GEOSFrechetDistance_r,geos_c,,AC_MSG_ERROR(['libgeos_c' (>= v.3.7.0) is required but it doesn't seem to be installed on this system. You may need to try re-running configure with a --disable-geos370 parameter.])) - AC_DEFINE(GEOS_370) - fi - diff --git a/ports/libspatialite/gaiaconfig-msvc.patch b/ports/libspatialite/gaiaconfig-msvc.patch new file mode 100644 index 00000000000000..3bf276d70d4dfe --- /dev/null +++ b/ports/libspatialite/gaiaconfig-msvc.patch @@ -0,0 +1,31 @@ +diff --git a/src/headers/spatialite/gaiaconfig-msvc.h b/src/headers/spatialite/gaiaconfig-msvc.h +index 37f0bd1..0053258 100644 +--- a/src/headers/spatialite/gaiaconfig-msvc.h ++++ b/src/headers/spatialite/gaiaconfig-msvc.h +@@ -2,7 +2,7 @@ + /* ./src/headers/spatialite/gaiaconfig-msvc.h.in - manually maintained */ + + /* Should be defined in order to enable GCP support. */ +-#define ENABLE_GCP 1 ++// #define ENABLE_GCP 1 + + /* Should be defined in order to enable GeoPackage support. */ + #define ENABLE_GEOPACKAGE 1 +@@ -11,7 +11,7 @@ + #define ENABLE_LIBXML2 1 + + /* Should be defined in order to enable RTTOPO support. */ +-#define ENABLE_RTTOPO 1 ++// #define ENABLE_RTTOPO 1 + + /* Should be defined in order to enable GEOS_370 support. */ + #define GEOS_370 1 +@@ -32,7 +32,7 @@ + /* #undef OMIT_FREEXL */ + + /* Should be defined in order to disable GEOCALLBACKS support. */ +-#define OMIT_GEOCALLBACKS 1 ++// #define OMIT_GEOCALLBACKS 1 + + /* Should be defined in order to disable GEOS support. */ + /* #undef OMIT_GEOS */ diff --git a/ports/libspatialite/portfile.cmake b/ports/libspatialite/portfile.cmake index 0865dda66de08d..20971f65681107 100644 --- a/ports/libspatialite/portfile.cmake +++ b/ports/libspatialite/portfile.cmake @@ -11,62 +11,72 @@ vcpkg_extract_source_archive_ex( PATCHES fix-makefiles.patch fix-linux-configure.patch + gaiaconfig-msvc.patch ) -if(VCPKG_TARGET_IS_WINDOWS) - if(VCPKG_CRT_LINKAGE STREQUAL "dynamic") - set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib") - set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib") - set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib") - set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib") - set(LIBRTTOPO_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/librttopo.lib") - set(LIBRTTOPO_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/librttopo.lib") - else() - set(GEOS_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/geos_c.lib ${CURRENT_INSTALLED_DIR}/lib/geos.lib") - set(GEOS_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/geos_cd.lib ${CURRENT_INSTALLED_DIR}/debug/lib/geosd.lib") - set(LIBXML2_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/lib/lzma.lib ws2_32.lib") - set(LIBXML2_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/libxml2.lib ${CURRENT_INSTALLED_DIR}/debug/lib/lzmad.lib ws2_32.lib") - set(LIBRTTOPO_LIBS_REL "${CURRENT_INSTALLED_DIR}/lib/librttopo.lib") - set(LIBRTTOPO_LIBS_DBG "${CURRENT_INSTALLED_DIR}/debug/lib/librttopo.lib") +vcpkg_check_features(OUT_FEATURE_OPTIONS unused + FEATURES + freexl ENABLE_FREEXL + gcp ENABLE_GCP + geocallbacks ENABLE_GEOCALLBACKS + rttopo ENABLE_RTTOPO +) + +set(pkg_config_modules geos libxml-2.0 proj sqlite3 zlib) +if(ENABLE_FREEXL) + list(APPEND pkg_config_modules freexl) +endif() +if(ENABLE_RTTOPO) + list(APPEND pkg_config_modules rttopo) +endif() + +if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW) + set(CL_FLAGS "") + if(NOT ENABLE_FREEXL) + string(APPEND CL_FLAGS " /DOMIT_FREEXL") + endif() + if(ENABLE_GCP) + string(APPEND CL_FLAGS " /DENABLE_GCP") + endif() + if(NOT ENABLE_GEOCALLBACKS) + string(APPEND CL_FLAGS " /DOMIT_GEOCALLBACKS") + endif() + if(ENABLE_RTTOPO) + string(APPEND CL_FLAGS " /DENABLE_RTTOPO") endif() - set(LIBS_ALL_DBG - "${CURRENT_INSTALLED_DIR}/debug/lib/iconv.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/charset.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/sqlite3.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/freexl.lib \ - ${CURRENT_INSTALLED_DIR}/debug/lib/zlibd.lib \ - ${LIBXML2_LIBS_DBG} \ - ${GEOS_LIBS_DBG} \ - ${LIBRTTOPO_LIBS_DBG} \ - ${CURRENT_INSTALLED_DIR}/debug/lib/proj_d.lib ole32.lib shell32.lib" + x_vcpkg_pkgconfig_get_modules( + PREFIX PKGCONFIG + MODULES --msvc-syntax ${pkg_config_modules} + LIBS ) - set(LIBS_ALL_REL - "${CURRENT_INSTALLED_DIR}/lib/iconv.lib \ - ${CURRENT_INSTALLED_DIR}/lib/charset.lib \ - ${CURRENT_INSTALLED_DIR}/lib/sqlite3.lib \ - ${CURRENT_INSTALLED_DIR}/lib/freexl.lib \ - ${CURRENT_INSTALLED_DIR}/lib/zlib.lib \ - ${LIBXML2_LIBS_REL} \ - ${GEOS_LIBS_REL} \ - ${LIBRTTOPO_LIBS_REL} \ - ${CURRENT_INSTALLED_DIR}/lib/proj.lib ole32.lib shell32.lib" + string(JOIN " " LIBS_ALL_DEBUG + "/LIBPATH:${CURRENT_INSTALLED_DIR}/debug/lib" + "${PKGCONFIG_LIBS_DEBUG}" + iconv.lib charset.lib + ) + string(JOIN " " LIBS_ALL_RELEASE + "/LIBPATH:${CURRENT_INSTALLED_DIR}/lib" + "${PKGCONFIG_LIBS_RELEASE}" + iconv.lib charset.lib ) string(REPLACE "/" "\\\\" INST_DIR "${CURRENT_PACKAGES_DIR}") - list(APPEND OPTIONS_RELEASE - "INST_DIR=${INST_DIR}" "LIBS_ALL=${LIBS_ALL_REL}" - ) - list(APPEND OPTIONS_DEBUG - "LINK_FLAGS=/debug" "INST_DIR=${INST_DIR}\\debug" "LIBS_ALL=${LIBS_ALL_DBG}" - ) + if(ENABLE_RTTOPO) + list(APPEND pkg_config_modules rttopo) + endif() vcpkg_install_nmake( SOURCE_PATH "${SOURCE_PATH}" + OPTIONS + "CL_FLAGS=${CL_FLAGS}" OPTIONS_RELEASE - ${OPTIONS_RELEASE} + "INST_DIR=${INST_DIR}" + "LIBS_ALL=${LIBS_ALL_RELEASE}" OPTIONS_DEBUG - ${OPTIONS_DEBUG} + "INST_DIR=${INST_DIR}\\debug" + "LIBS_ALL=${LIBS_ALL_DEBUG}" + "LINK_FLAGS=/debug" ) vcpkg_copy_pdbs() @@ -84,39 +94,84 @@ if(VCPKG_TARGET_IS_WINDOWS) file(RENAME "${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib" "${CURRENT_PACKAGES_DIR}/lib/spatialite.lib") file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib") endif() -else() # Build in UNIX - if(VCPKG_TARGET_IS_LINUX) - set(STDLIB stdc++) + + set(infile "${SOURCE_PATH}/spatialite.pc.in") + set(VERSION "${LIBSPATIALITE_VERSION_STR}") + set(libdir [[${prefix}/lib]]) + set(exec_prefix [[${prefix}]]) + list(JOIN pkg_config_modules " " requires_private) + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + set(includedir [[${prefix}/include]]) + set(outfile "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/spatialite.pc") + configure_file("${infile}" "${outfile}" @ONLY) + vcpkg_replace_string("${outfile}" "Libs:" "Requires.private: ${requires_private}\nLibs.private: -liconv -lcharset\nLibs:") + vcpkg_replace_string("${outfile}" " -lm" " ") + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + set(includedir [[${prefix}/../include]]) + set(outfile "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/spatialite.pc") + configure_file("${infile}" "${outfile}" @ONLY) + vcpkg_replace_string("${outfile}" "Libs:" "Requires.private: ${requires_private}\nLibs.private: -liconv -lcharset\nLibs:") + vcpkg_replace_string("${outfile}" " -lm" " ") + endif() +else() + if(ENABLE_FREEXL) + set(FREEXL_OPTION "--enable-freexl") + else() + set(FREEXL_OPTION "--disable-freexl") + endif() + if(ENABLE_GCP) + set(GCP_OPTION "--enable-gcp") else() - set(STDLIB c++) + set(GCP_OPTION "--disable-gcp") endif() - if(VCPKG_TARGET_IS_LINUX OR VCPKG_TARGET_IS_OSX) - SET(EXTRALIBS "-lpthread") + if(ENABLE_GEOCALLBACKS) + set(GEOCALLBACKS_OPTION "--enable-geocallbacks") + else() + set(GEOCALLBACKS_OPTION "--disable-geocallbacks") endif() - list(APPEND OPTIONS_RELEASE - "LIBXML2_LIBS=-lxml2 -llzma" - "GEOS_LDFLAGS=-lgeos_c -lgeos -l${STDLIB}" - ) - list(APPEND OPTIONS_DEBUG - "LIBXML2_LIBS=-lxml2 -llzmad" - "GEOS_LDFLAGS=-lgeos_cd -lgeosd -l${STDLIB}" + if(ENABLE_RTTOPO) + set(RTTOPO_OPTION "--enable-rttopo") + else() + set(RTTOPO_OPTION "--disable-rttopo") + endif() + list(REMOVE_ITEM pkg_config_modules libxml2) # handled properly by configure + x_vcpkg_pkgconfig_get_modules( + PREFIX PKGCONFIG + MODULES ${pkg_config_modules} + LIBS ) - + if(VCPKG_TARGET_IS_MINGW) + # Avoid system libs (as detected by cmake) in exported pc files + set(SYSTEM_LIBS "") + else() + set(SYSTEM_LIBS "\$LIBS") + endif() + # libspatialite needs some targets literally + if(VCPKG_TARGET_IS_ANDROID) + set(TARGET_ALIAS "--target=android") + elseif(VCPKG_TARGET_IS_MINGW) + set(TARGET_ALIAS "--target=mingw32") + elseif(VCPKG_TARGET_IS_OSX) + set(TARGET_ALIAS "--target=macosx") + else() + set(TARGET_ALIAS "") + endif() vcpkg_configure_make( SOURCE_PATH "${SOURCE_PATH}" AUTOCONFIG OPTIONS - "LIBS=${EXTRALIBS} -ldl -lm -l${STDLIB}" - "LIBXML2_CFLAGS=-I${CURRENT_INSTALLED_DIR}/include" - "--enable-rttopo" - "--enable-gcp" - "--enable-geocallbacks" + ${TARGET_ALIAS} + ${FREEXL_OPTION} + ${GCP_OPTION} + ${GEOCALLBACKS_OPTION} + ${RTTOPO_OPTION} "--disable-examples" "--disable-minizip" OPTIONS_DEBUG - ${OPTIONS_DEBUG} + "LIBS=${PKGCONFIG_LIBS_DEBUG} ${SYSTEM_LIBS}" OPTIONS_RELEASE - ${OPTIONS_RELEASE} + "LIBS=${PKGCONFIG_LIBS_RELEASE} ${SYSTEM_LIBS}" ) # automake adds the basedir of the generated config to `DEFAULT_INCLUDES`, @@ -130,9 +185,42 @@ else() # Build in UNIX endforeach() vcpkg_install_make() - vcpkg_fixup_pkgconfig() + + if(VCPKG_TARGET_IS_MINGW AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic") + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/plugins/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/lib/mod_spatialite.dll" "${CURRENT_PACKAGES_DIR}/plugins/${PORT}/mod_spatialite.dll") + endif() + if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug") + file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/debug/plugins/${PORT}") + file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/mod_spatialite.dll" "${CURRENT_PACKAGES_DIR}/debug/plugins/${PORT}/mod_spatialite.dll") + endif() + endif() endif() +vcpkg_fixup_pkgconfig() + # Handle copyright -# With rttopo and ground control points enabled, the license is GPLv2+. -file(INSTALL "${SOURCE_PATH}/src/control_points/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright) +set(outfile "${CURRENT_PACKAGES_DIR}/share/${PORT}/copyright") +if(NOT ENABLE_GCP AND NOT ENABLE_RTTOPO) + file(READ "${SOURCE_PATH}/COPYING" mpl) + file(WRITE "${outfile}" + "SpatiaLite[${FEATURES}] is licensed under the MPL tri-license terms;\n" + "you are free to choose the best-fit license between:\n" + "- the MPL 1.1\n" + "- the GPL v2.0 or any subsequent version\n" + "- the LGPL v2.1 or any subsequent version.\n\n" + "# MPL 1.1 (from COPYING)\n\n" + "${mpl}\n" + ) +else() + file(WRITE "${outfile}" + "SpatiaLite[${FEATURES}] is licensed under:\n" + "the GPL v2.0 or any subsequent version.\n\n" + ) +endif() +file(READ "${SOURCE_PATH}/src/control_points/COPYING" gpl) +file(APPEND "${outfile}" + "# GPL v2.0 (from src/control_points/COPYING)\n\n" + "${gpl}\n" +) diff --git a/ports/libspatialite/vcpkg.json b/ports/libspatialite/vcpkg.json index e8fd1d30cf3d3d..fbea1b6af9d545 100644 --- a/ports/libspatialite/vcpkg.json +++ b/ports/libspatialite/vcpkg.json @@ -1,16 +1,40 @@ { "name": "libspatialite", "version": "5.0.1", + "port-version": 1, "description": "SpatiaLite is an open source library intended to extend the SQLite core to support fully fledged Spatial SQL capabilities.", "homepage": "https://www.gaia-gis.it/gaia-sins/libspatialite-sources", "dependencies": [ - "freexl", "geos", "libiconv", - "librttopo", "libxml2", "proj4", "sqlite3", + "vcpkg-pkgconfig-get-modules", "zlib" - ] + ], + "default-features": [ + "freexl", + "geocallbacks" + ], + "features": { + "freexl": { + "description": "FreeXL spreadsheet file support.", + "dependencies": [ + "freexl" + ] + }, + "gcp": { + "description": "Ground control points support. This feature reduces the license options to GPLv2+." + }, + "geocallbacks": { + "description": "Geometry callbacks support." + }, + "rttopo": { + "description": "RTTOPO support. This feature reduces the license options to GPLv2+.", + "dependencies": [ + "librttopo" + ] + } + } } diff --git a/ports/spatialite-tools/vcpkg.json b/ports/spatialite-tools/vcpkg.json index a1a5bc3bb28984..3637c2807140c7 100644 --- a/ports/spatialite-tools/vcpkg.json +++ b/ports/spatialite-tools/vcpkg.json @@ -1,7 +1,7 @@ { "name": "spatialite-tools", "version-string": "5.0.0", - "port-version": 3, + "port-version": 4, "description": "Contains spatialite.exe and other command line tools to work with SpatiaLite databases (import, export, SQL queries)", "homepage": "https://www.gaia-gis.it/fossil/spatialite-tools/index", "dependencies": [ @@ -9,7 +9,13 @@ "geos", "libiconv", "librttopo", - "libspatialite", + { + "name": "libspatialite", + "features": [ + "gcp", + "rttopo" + ] + }, "proj4", "readosm", "sqlite3", diff --git a/scripts/ci.baseline.txt b/scripts/ci.baseline.txt index 65af43f105327f..aa2c1f4842cc98 100644 --- a/scripts/ci.baseline.txt +++ b/scripts/ci.baseline.txt @@ -1679,7 +1679,6 @@ gmp:x64-windows-static-md=fail ijg-libjpeg:x64-windows-static-md=fail libcerf:x64-windows-static-md=fail libmicrohttpd:x64-windows-static-md=fail -libspatialite:x64-windows-static-md=fail linenoise-ng:x64-windows-static-md=fail mmloader:x64-windows-static-md=fail netcdf-cxx4:x64-windows-static-md=fail diff --git a/versions/baseline.json b/versions/baseline.json index 789deb4be15625..4b4267ce3fd01f 100644 --- a/versions/baseline.json +++ b/versions/baseline.json @@ -3866,7 +3866,7 @@ }, "libspatialite": { "baseline": "5.0.1", - "port-version": 0 + "port-version": 1 }, "libspnav": { "baseline": "0.2.3", @@ -6366,7 +6366,7 @@ }, "spatialite-tools": { "baseline": "5.0.0", - "port-version": 3 + "port-version": 4 }, "spdk": { "baseline": "19.01.1", diff --git a/versions/l-/libspatialite.json b/versions/l-/libspatialite.json index 1e8dd8dd84c1ec..a41a3c5f9e8eb0 100644 --- a/versions/l-/libspatialite.json +++ b/versions/l-/libspatialite.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "9a0fe08cf3273de9def88a4fd388a1ade854cfac", + "version": "5.0.1", + "port-version": 1 + }, { "git-tree": "22ad27813f5f3bc3382718115ce3eb5a45174afd", "version": "5.0.1", diff --git a/versions/s-/spatialite-tools.json b/versions/s-/spatialite-tools.json index c3e83a118b6cae..5d2f0218897d9c 100644 --- a/versions/s-/spatialite-tools.json +++ b/versions/s-/spatialite-tools.json @@ -1,5 +1,10 @@ { "versions": [ + { + "git-tree": "e31f1f43c34f7ab68bfbfcfe1a9edcd8040c3373", + "version-string": "5.0.0", + "port-version": 4 + }, { "git-tree": "f9263bb3c351d6d5333538e6d22e29da6253a702", "version-string": "5.0.0",