aboutsummaryrefslogtreecommitdiff
path: root/vcpkg/ports/libspatialite
diff options
context:
space:
mode:
authorEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
committerEthan Morgan <ethan@gweithio.com>2026-02-14 16:44:06 +0000
commit54409423f767d8b1cf30cb7d0efca6b4ca138823 (patch)
treed915ac7828703ce4b963efdd9728a1777ba18c1e /vcpkg/ports/libspatialite
move to own git serverHEADmaster
Diffstat (limited to 'vcpkg/ports/libspatialite')
-rw-r--r--vcpkg/ports/libspatialite/android-builtin-iconv.diff35
-rw-r--r--vcpkg/ports/libspatialite/fix-linux-configure.patch30
-rw-r--r--vcpkg/ports/libspatialite/fix-makefiles.patch44
-rw-r--r--vcpkg/ports/libspatialite/fix-mingw.patch11
-rw-r--r--vcpkg/ports/libspatialite/fix-utf8-source.patch32
-rw-r--r--vcpkg/ports/libspatialite/gaiaconfig-msvc.patch31
-rw-r--r--vcpkg/ports/libspatialite/libxml2-no-http.diff34
-rw-r--r--vcpkg/ports/libspatialite/portfile.cmake230
-rw-r--r--vcpkg/ports/libspatialite/vcpkg.json55
9 files changed, 502 insertions, 0 deletions
diff --git a/vcpkg/ports/libspatialite/android-builtin-iconv.diff b/vcpkg/ports/libspatialite/android-builtin-iconv.diff
new file mode 100644
index 0000000..db07926
--- /dev/null
+++ b/vcpkg/ports/libspatialite/android-builtin-iconv.diff
@@ -0,0 +1,35 @@
+diff --git a/src/gaiaaux/gg_utf8.c b/src/gaiaaux/gg_utf8.c
+index f11e604..620696e 100644
+--- a/src/gaiaaux/gg_utf8.c
++++ b/src/gaiaaux/gg_utf8.c
+@@ -73,7 +73,7 @@ extern const char *locale_charset (void);
+ #include <localcharset.h>
+ #endif /* end localcharset */
+ #else /* not MINGW32 - WIN32 */
+-#if defined(__APPLE__) || defined(__ANDROID__)
++#if defined(__APPLE__) || (defined(__ANDROID__) && __ANDROID_API__ < 28)
+ #include <iconv.h>
+ #include <localcharset.h>
+ #else /* neither Mac OsX nor Android */
+@@ -89,7 +89,7 @@ gaiaGetLocaleCharset ()
+ #if defined(__MINGW32__) || defined(_WIN32)
+ return locale_charset ();
+ #else /* not MINGW32 - WIN32 */
+-#if defined(__APPLE__) || defined(__ANDROID__)
++#if defined(__APPLE__) || (defined(__ANDROID__) && __ANDROID_API__ < 28)
+ return locale_charset ();
+ #else /* neither Mac OsX nor Android */
+ return nl_langinfo (CODESET);
+diff --git a/src/gaiageo/gg_shape.c b/src/gaiageo/gg_shape.c
+index 8917535..e5e0240 100644
+--- a/src/gaiageo/gg_shape.c
++++ b/src/gaiageo/gg_shape.c
+@@ -75,7 +75,7 @@ extern const char *locale_charset (void);
+ #include <localcharset.h>
+ #endif /* end localcharset */
+ #else /* not MINGW32 */
+-#if defined(__APPLE__) || defined(__ANDROID__)
++#if defined(__APPLE__) || (defined(__ANDROID__) && __ANDROID_API__ < 28)
+ #include <iconv.h>
+ #include <localcharset.h>
+ #else /* neither Mac OsX nor Android */
diff --git a/vcpkg/ports/libspatialite/fix-linux-configure.patch b/vcpkg/ports/libspatialite/fix-linux-configure.patch
new file mode 100644
index 0000000..afb54db
--- /dev/null
+++ b/vcpkg/ports/libspatialite/fix-linux-configure.patch
@@ -0,0 +1,30 @@
+diff --git a/configure.ac b/configure.ac
+index ead87caff..47abb90f0 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -302,6 +302,7 @@ if test x"$enable_geos" != "xno"; then
+ #-----------------------------------------------------------------------
+ # --with-geosconfig
+ #
++ if 0; then
+ AC_ARG_WITH([geosconfig],
+ [AS_HELP_STRING([--with-geosconfig=FILE], [specify an alternative geos-config file])],
+ [GEOSCONFIG="$withval"], [GEOSCONFIG=""])
+@@ -327,14 +328,17 @@ if test x"$enable_geos" != "xno"; then
+ # Ensure that we can parse geos_c.h
+ CPPFLAGS_SAVE="$CPPFLAGS"
+ CPPFLAGS="$GEOS_CFLAGS"
++ fi
+ 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])])
++ if 0; then
+ CPPFLAGS="$CPPFLAGS_SAVE"
+ # Ensure we can link against libgeos_c
+ LIBS_SAVE="$LIBS"
+ LIBS="$GEOS_LDFLAGS"
+ AC_SEARCH_LIBS(GEOSCoveredBy,geos_c,,AC_MSG_ERROR([could not find libgeos_c (or obsolete 'libgeos_c' < v.3.3.0 found) - you may need to specify the directory of a geos-config file using --with-geosconfig]))
+ LIBS="$LIBS_SAVE"
+ LIBS="$LIBS $GEOS_LDFLAGS -lgeos_c"
++ fi
+
+ #-----------------------------------------------------------------------
+ # --enable-controlpoints
diff --git a/vcpkg/ports/libspatialite/fix-makefiles.patch b/vcpkg/ports/libspatialite/fix-makefiles.patch
new file mode 100644
index 0000000..6466020
--- /dev/null
+++ b/vcpkg/ports/libspatialite/fix-makefiles.patch
@@ -0,0 +1,44 @@
+diff --git a/makefile.vc b/makefile.vc
+index 120090eba..049c0d0b0 100644
+--- a/makefile.vc
++++ b/makefile.vc
+@@ -93,7 +93,7 @@ LIBOBJ = src\gaiaaux\gg_sqlaux.obj src\gaiaaux\gg_utf8.obj \
+ SPATIALITE_DLL = spatialite$(VERSION).dll
+
+ CFLAGS = /nologo -I.\src\headers -I.\src\topology \
+- -I. -IC:\OSGeo4W\include $(OPTFLAGS)
++ -I. $(OPTFLAGS)
+
+ default: all
+
+@@ -107,12 +107,9 @@ spatialite.lib: $(LIBOBJ)
+ $(SPATIALITE_DLL): spatialite_i.lib
+
+ spatialite_i.lib: $(LIBOBJ)
+- link /dll /out:$(SPATIALITE_DLL) \
++ link $(LINK_FLAGS) /dll /out:$(SPATIALITE_DLL) \
+ /implib:spatialite_i.lib $(LIBOBJ) \
+- C:\OSGeo4W\lib\proj_i.lib C:\OSGeo4W\lib\geos_c.lib \
+- C:\OSGeo4w\lib\freexl_i.lib C:\OSGeo4w\lib\iconv.lib \
+- C:\OSGeo4W\lib\sqlite3_i.lib C:\OSGeo4W\lib\zlib.lib \
+- C:\OSGeo4W\lib\libxml2.lib C:\OSGeo4W\lib\librttopo.lib
++ $(LIBS_ALL)
+ if exist $(SPATIALITE_DLL).manifest mt -manifest \
+ $(SPATIALITE_DLL).manifest -outputresource:$(SPATIALITE_DLL);2
+
+
+diff --git a/nmake.opt b/nmake.opt
+index c048aa758..be68e21cd 100644
+--- a/nmake.opt
++++ b/nmake.opt
+@@ -1,8 +1,8 @@
+ # Directory tree where SpatiaLite will be installed.
+-INSTDIR=C:\OSGeo4W
++INSTDIR=$(INST_DIR)
+
+ # Uncomment the first for an optimized build, or the second for debug.
+-OPTFLAGS= /nologo /Ox /fp:precise /W4 /MD /D_CRT_SECURE_NO_WARNINGS \
++OPTFLAGS= /nologo /fp:precise /W4 $(CL_FLAGS) /D_CRT_SECURE_NO_WARNINGS \
+ /DDLL_EXPORT /DYY_NO_UNISTD_H
+ #OPTFLAGS= /nologo /Zi /MD /Fdspatialite.pdb /DDLL_EXPORT
+
diff --git a/vcpkg/ports/libspatialite/fix-mingw.patch b/vcpkg/ports/libspatialite/fix-mingw.patch
new file mode 100644
index 0000000..abbe352
--- /dev/null
+++ b/vcpkg/ports/libspatialite/fix-mingw.patch
@@ -0,0 +1,11 @@
+diff --color -ur a/configure.ac b/configure.ac
+--- a/configure.ac 2022-07-21 17:23:50.490298108 +0200
++++ b/configure.ac 2022-07-21 17:25:45.671489524 +0200
+@@ -116,7 +116,6 @@
+
+ # Checks for installed libraries
+ # AC_CHECK_LIB(sqlite3,sqlite3_prepare_v2,,AC_MSG_ERROR(['libsqlite3' is required but it doesn't seem to be installed on this system.]),-lm)
+-AC_CHECK_LIB(z,inflateInit_,,AC_MSG_ERROR(['libz' is required but it doesn't seem to be installed on this system.]),-lm)
+
+ AC_CONFIG_FILES([Makefile \
+ src/Makefile \
diff --git a/vcpkg/ports/libspatialite/fix-utf8-source.patch b/vcpkg/ports/libspatialite/fix-utf8-source.patch
new file mode 100644
index 0000000..76dcf77
--- /dev/null
+++ b/vcpkg/ports/libspatialite/fix-utf8-source.patch
@@ -0,0 +1,32 @@
+diff --git a/src/srsinit/epsg_inlined_21.c b/src/srsinit/epsg_inlined_21.c
+index 94aa9d4..457b38a 100644
+--- a/src/srsinit/epsg_inlined_21.c
++++ b/src/srsinit/epsg_inlined_21.c
+@@ -619,9 +619,9 @@ initialize_epsg_21 (int filter, struct epsg_defs **first, struct epsg_defs **las
+ add_srs_wkt (p, 27,
+ "lic, Chad, Chile, China, Christmas Island, Cocos (Keelin");
+ add_srs_wkt (p, 28,
+- "g) Islands, Comoros, Congo, Cook Islands, Costa Rica, CĂ");
++ "g) Islands, Comoros, Congo, Cook Islands, Costa Rica, CĂ´");
+ add_srs_wkt (p, 29,
+- "´te d'Ivoire (Ivory Coast), Croatia, Cuba, Curacao, Cypr");
++ "te d'Ivoire (Ivory Coast), Croatia, Cuba, Curacao, Cypr");
+ add_srs_wkt (p, 30,
+ "us, Czechia, Denmark, Djibouti, Dominica, Dominican Repu");
+ add_srs_wkt (p, 31,
+diff --git a/src/srsinit/epsg_inlined_25.c b/src/srsinit/epsg_inlined_25.c
+index 1071eb1..a09cb8c 100644
+--- a/src/srsinit/epsg_inlined_25.c
++++ b/src/srsinit/epsg_inlined_25.c
+@@ -3180,9 +3180,9 @@ initialize_epsg_25 (int filter, struct epsg_defs **first, struct epsg_defs **las
+ add_srs_wkt (p, 26,
+ "lic, Chad, Chile, China, Christmas Island, Cocos (Keelin");
+ add_srs_wkt (p, 27,
+- "g) Islands, Comoros, Congo, Cook Islands, Costa Rica, CĂ");
++ "g) Islands, Comoros, Congo, Cook Islands, Costa Rica, CĂ´");
+ add_srs_wkt (p, 28,
+- "´te d'Ivoire (Ivory Coast), Croatia, Cuba, Curacao, Cypr");
++ "te d'Ivoire (Ivory Coast), Croatia, Cuba, Curacao, Cypr");
+ add_srs_wkt (p, 29,
+ "us, Czechia, Denmark, Djibouti, Dominica, Dominican Repu");
+ add_srs_wkt (p, 30,
diff --git a/vcpkg/ports/libspatialite/gaiaconfig-msvc.patch b/vcpkg/ports/libspatialite/gaiaconfig-msvc.patch
new file mode 100644
index 0000000..3bf276d
--- /dev/null
+++ b/vcpkg/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/vcpkg/ports/libspatialite/libxml2-no-http.diff b/vcpkg/ports/libspatialite/libxml2-no-http.diff
new file mode 100644
index 0000000..2240275
--- /dev/null
+++ b/vcpkg/ports/libspatialite/libxml2-no-http.diff
@@ -0,0 +1,34 @@
+diff --git a/configure.ac b/configure.ac
+index 3a4f288..d9ba65f 100644
+--- a/configure.ac
++++ b/configure.ac
+@@ -441,6 +441,15 @@ if test x"$enable_libxml2" != "xno"; then
+ AC_SUBST(LIBXML2_CFLAGS)
+ AC_SUBST(LIBXML2_LIBS)
+ AC_DEFINE(ENABLE_LIBXML2)
++ LIBS_SAVE="$LIBS"
++ LIBS="$LIBXML2_LIBS"
++ AC_SEARCH_LIBS(xmlNanoHTTPCleanup, [], [has_nanohttp="yes"], [has_nanohttp="no"])
++ if test "x$has_nanohttp" != "xno"; then
++ CPPFLAGS="$CFLAGS -DLIBXML2_HAS_NANOHTTP"
++ else
++ AC_MSG_WARN([No http support found in 'libxml2'])
++ fi
++ LIBS="$LIBS_SAVE"
+ fi
+
+ #-----------------------------------------------------------------------
+diff --git a/src/wfs/wfs_in.c b/src/wfs/wfs_in.c
+index fe07a0d..93dd778 100644
+--- a/src/wfs/wfs_in.c
++++ b/src/wfs/wfs_in.c
+@@ -4637,7 +4637,9 @@ SPATIALITE_DECLARE void
+ reset_wfs_http_connection (void)
+ {
+ /* Resets the libxml2 "nano HTTP": useful when changing the HTTP_PROXY settings */
++#if defined LIBXML2_HAS_NANOHTTP /* removed in 2.15.0, and optional before */
+ xmlNanoHTTPCleanup ();
++#endif
+ }
+
+ #else /* LIBXML2 isn't enabled */
diff --git a/vcpkg/ports/libspatialite/portfile.cmake b/vcpkg/ports/libspatialite/portfile.cmake
new file mode 100644
index 0000000..2df99f1
--- /dev/null
+++ b/vcpkg/ports/libspatialite/portfile.cmake
@@ -0,0 +1,230 @@
+vcpkg_download_distfile(ARCHIVE
+ URLS "https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-${VERSION}.tar.gz"
+ FILENAME "libspatialite-${VERSION}.tar.gz"
+ SHA512 2745b373e31cea58623224def6090c491b58409803bb71231450dfa2cfdf3aafc3fc6f680585d55d085008f8cf362c3062ae67ffc7d80257775a22eb81ef1e57
+)
+
+vcpkg_extract_source_archive(
+ SOURCE_PATH
+ ARCHIVE "${ARCHIVE}"
+ PATCHES
+ fix-makefiles.patch
+ fix-linux-configure.patch
+ gaiaconfig-msvc.patch
+ fix-mingw.patch
+ fix-utf8-source.patch
+ android-builtin-iconv.diff
+ # https://groups.google.com/g/spatialite-users/c/FLBqJNIDkNQ
+ # https://groups.google.com/g/spatialite-users/c/nyT4iAJbttY
+ libxml2-no-http.diff
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS unused
+ FEATURES
+ freexl ENABLE_FREEXL
+ gcp ENABLE_GCP
+ 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(ENABLE_RTTOPO)
+ string(APPEND CL_FLAGS " /DENABLE_RTTOPO")
+ endif()
+
+ x_vcpkg_pkgconfig_get_modules(
+ PREFIX PKGCONFIG
+ MODULES --msvc-syntax ${pkg_config_modules}
+ LIBS
+ CFLAGS
+ )
+
+ set(CL_FLAGS_RELEASE "${CL_FLAGS} ${PKGCONFIG_CFLAGS_RELEASE}")
+ set(CL_FLAGS_DEBUG "${CL_FLAGS} ${PKGCONFIG_CFLAGS_DEBUG}")
+
+ # vcpkg_build_nmake doesn't supply cmake's implicit link libraries
+ if(PKGCONFIG_LIBS_RELEASE MATCHES "libcrypto")
+ string(APPEND PKGCONFIG_LIBS_RELEASE " user32.lib")
+ string(APPEND PKGCONFIG_LIBS_DEBUG " user32.lib")
+ endif()
+
+ file(TO_NATIVE_PATH "${CURRENT_PACKAGES_DIR}" INST_DIR)
+
+ vcpkg_install_nmake(
+ SOURCE_PATH "${SOURCE_PATH}"
+ PREFER_JOM
+ CL_LANGUAGE C
+ OPTIONS_RELEASE
+ "CL_FLAGS=${CL_FLAGS_RELEASE}"
+ "INST_DIR=${INST_DIR}"
+ "LIBS_ALL=${PKGCONFIG_LIBS_RELEASE} iconv.lib charset.lib"
+ OPTIONS_DEBUG
+ "CL_FLAGS=${CL_FLAGS_DEBUG}"
+ "INST_DIR=${INST_DIR}\\debug"
+ "LIBS_ALL=${PKGCONFIG_LIBS_DEBUG} iconv.lib charset.lib"
+ "LINK_FLAGS=/debug"
+ )
+ vcpkg_copy_pdbs()
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib")
+ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/bin")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib")
+ endif()
+ else()
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/lib/spatialite.lib")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/lib/spatialite_i.lib" "${CURRENT_PACKAGES_DIR}/lib/spatialite.lib")
+ if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib")
+ file(RENAME "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite_i.lib" "${CURRENT_PACKAGES_DIR}/debug/lib/spatialite.lib")
+ endif()
+ endif()
+
+ set(infile "${SOURCE_PATH}/spatialite.pc.in")
+ 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(GCP_OPTION "--disable-gcp")
+ endif()
+ if(ENABLE_GEOCALLBACKS)
+ set(GEOCALLBACKS_OPTION "--enable-geocallbacks")
+ else()
+ set(GEOCALLBACKS_OPTION "--disable-geocallbacks")
+ endif()
+ 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 "")
+ elseif(VCPKG_TARGET_IS_ANDROID)
+ set(SYSTEM_LIBS "\$LIBS -llog")
+ 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_make_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ AUTORECONF
+ OPTIONS
+ ${TARGET_ALIAS}
+ ${FREEXL_OPTION}
+ ${GCP_OPTION}
+ ${RTTOPO_OPTION}
+ "--disable-examples"
+ "--disable-minizip"
+ "cross_compiling=yes" # avoid conftest rpath trouble
+ OPTIONS_DEBUG
+ "LIBS=${PKGCONFIG_LIBS_DEBUG} ${SYSTEM_LIBS}"
+ OPTIONS_RELEASE
+ "LIBS=${PKGCONFIG_LIBS_RELEASE} ${SYSTEM_LIBS}"
+ )
+
+ # automake adds the basedir of the generated config to `DEFAULT_INCLUDES`,
+ # but libspatialite uses `#include <spatialite/gaiaconfig.h>`.
+ file(GLOB_RECURSE makefiles
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/Makefile"
+ "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/Makefile"
+ )
+ foreach(makefile IN LISTS makefiles)
+ vcpkg_replace_string("${makefile}" " -I$(top_builddir)/./src/headers/spatialite" " -I$(top_builddir)/./src/headers" IGNORE_UNCHANGED)
+ endforeach()
+
+ vcpkg_make_install()
+
+ 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
+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/vcpkg/ports/libspatialite/vcpkg.json b/vcpkg/ports/libspatialite/vcpkg.json
new file mode 100644
index 0000000..2a12c83
--- /dev/null
+++ b/vcpkg/ports/libspatialite/vcpkg.json
@@ -0,0 +1,55 @@
+{
+ "name": "libspatialite",
+ "version": "5.1.0",
+ "port-version": 5,
+ "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/fossil/libspatialite/index",
+ "license": null,
+ "supports": "!uwp",
+ "dependencies": [
+ "geos",
+ "libiconv",
+ {
+ "name": "libxml2",
+ "default-features": false
+ },
+ "proj",
+ {
+ "name": "sqlite3",
+ "default-features": false,
+ "features": [
+ "rtree"
+ ]
+ },
+ {
+ "name": "vcpkg-make",
+ "host": true,
+ "platform": "!windows | mingw"
+ },
+ {
+ "name": "vcpkg-pkgconfig-get-modules",
+ "host": true
+ },
+ "zlib"
+ ],
+ "default-features": [
+ "freexl"
+ ],
+ "features": {
+ "freexl": {
+ "description": "FreeXL spreadsheet file support.",
+ "dependencies": [
+ "freexl"
+ ]
+ },
+ "gcp": {
+ "description": "Ground control points support. This feature reduces the license options to GPLv2+."
+ },
+ "rttopo": {
+ "description": "RTTOPO support. This feature reduces the license options to GPLv2+.",
+ "dependencies": [
+ "librttopo"
+ ]
+ }
+ }
+}