89.10. libspatialite-5.1.0
SpatiaLite — spatial SQL for SQLite, as a library and as mod_spatialite
| Version | 5.1.0, release 2 |
| Shelf | database — Database engines, embedded key-value stores, database servers, clients and full-text indexes |
| Phase | 41_system (System), 346 of 1047 in build order |
| Licence | MPL-1.1 OR GPL-2.0-or-later OR LGPL-2.1-or-later |
| Homepage | https://www.gaia-gis.it/fossil/libspatialite/index |
| Build time | 3.8 SBU |
| Installed size | 16.9 MiB in 37 files |
| Recipe | ports/core/database/libspatialite/kpkgbuild |
About
SpatiaLite adds spatial SQL to SQLite: geometry types, spatial indexes, coordinate transformations and the OGC Simple Features functions, so an SQLite file can hold and query maps. It comes as a library, libspatialite, and as mod_spatialite, the module any SQLite program loads with SELECT load_extension('mod_spatialite'). gdal and qgis are built on it.
Sources
libspatialite-5.1.0.tar.gz(6.2 MiB)
sha25643be2dd349daffe016dd1400c5d11285828c22fea35ca5109f21f3ed50605080
upstream: https://www.gaia-gis.it/gaia-sins/libspatialite-sources/libspatialite-5.1.0.tar.gz
archive copy: sources-1/database--libspatialite-5.1.0.tar.gz
Dependencies
Depends on: sqlite, proj, geos, librttopo, libxml2, minizip, zlib, freexl.
Patches
build.sh applies these; kpkg applies nothing by itself.
libxml2-no-http.patch— Compiles the call toxmlNanoHTTPCleanup()inreset_wfs_http_connection()only when libxml2 definesLIBXML_HTTP_STUBS_ENABLED. The tree’s libxml2 does not defineLIBXML_HTTP_STUBS_ENABLED, and itsnanohttp.hthen declares none of thexmlNanoHTTP*functions, so the unguarded call does not compile; with the patch the function does nothing there.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install libspatialite'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/database/libspatialite.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/database/libspatialite
echo '43be2dd349daffe016dd1400c5d11285828c22fea35ca5109f21f3ed50605080 libspatialite-5.1.0.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/libspatialite
SRC=$SRC_ROOT/libspatialite-5.1.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libspatialite-5.1.0.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/libxml2-no-http.patch"
./configure --prefix=/usr --libdir=/usr/lib --disable-static \
--enable-mathsql \
--enable-proj \
--enable-iconv \
--enable-freexl=yes \
--enable-epsg \
--enable-geos \
--enable-gcp \
--enable-geosadvanced \
--enable-geosreentrant \
--enable-rttopo \
--enable-libxml2 \
--enable-minizip \
--enable-geopackage \
--enable-examples=no
make
make DESTDIR=$PKG install
test -e "$PKG"/usr/lib/mod_spatialite.so
The switches, and why each is set:
--enable-mathsql,--enable-proj,--enable-iconv,--enable-freexl=yes,--enable-epsg,--enable-geos,--enable-gcp,--enable-geosadvanced,--enable-geosreentrant,--enable-rttopo,--enable-libxml2,--enable-minizip,--enable-geopackage— Features that are on by upstream’s default, written out: SQL math functions, coordinate transformations with proj, character set conversion, reading spreadsheets with freexl, the full EPSG dataset of coordinate systems, geometry operations with geos, with its advanced functions and its thread-safe interface, ground control points from GRASS GIS, topology with librttopo, XML documents with libxml2, zip archives with minizip, and GeoPackage support. Each library is required once its feature is on: configure stops when it is missing.--enable-examples=no— Build none of the example programs.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/libspatialite, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf libspatialite-5.1.0-2.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/libspatialite, and runs the triggers its paths call for.
Contents
Installed libraries: libspatialite.so.
Installed directories: /usr/include/spatialite, /usr/share/licenses/libspatialite.
Short descriptions
spatialite.pc |
Spatial SQL database engine based on SQLite |
Notes
build.sh ends by checking that mod_spatialite.so is in the package, and fails the build when it is not, so the port never ships the library without the loadable module.