• repo
  • readme
  • stackblitz

react-native-spatialite-artifacts

View on Github
.

Prebuilt SpatiaLite loadable extension for Android and iOS, ready to drop into React Native apps using op-sqlite.

react-native-spatialite-artifacts
.
B

react-native-spatialite-artifacts readme

react-native-spatialite-artifacts

Prebuilt SpatiaLite loadable extension for Android and iOS, ready to drop into React Native apps using op-sqlite.

Quick Start (App Developers)

You don't need to build anything. Download the prebuilt binaries from GitHub Releases and follow the usage instructions below.

Android

  1. Download spatialite-android-<version>.zip from the latest release
  2. Extract and copy the ABI folders into your app's android/app/src/main/jniLibs/:
hljs jniLibs/
├── arm64-v8a/libspatialite.so
├── armeabi-v7a/libspatialite.so
├── x86/libspatialite.so
└── x86_64/libspatialite.so
  1. Load the extension in your code:
import { open } from "@op-engineering/op-sqlite";

const db = open({ name: "myDB" });
db.loadExtension("libspatialite", "sqlite3_modspatialite_init");

iOS

  1. Download spatialite-ios-<version>.zip from the latest release
  2. Add the static libraries and headers to your Xcode project
  3. Load the extension via filesystem path (see op-sqlite extension loading docs)

Note: iOS requires op-sqlite to be built with extension loading enabled. The embedded iOS SQLite does not support runtime extensions by default.


For Maintainers

This repo contains build recipes only — no vendored source trees or prebuilt binaries in git. Dependencies are downloaded on demand when you run a build.

Prerequisites

  • mise (task runner — optional but recommended)
  • jq (for parsing deps.json)
  • curl, tar, unzip
  • Android: NDK r28+ (for 16KB page alignment compliance)
  • iOS: macOS with Xcode + Command Line Tools

Repository Structure

hljs react-native-spatialite-artifacts/
├── deps.json                   # Pinned dependency versions and download URLs
├── mise.toml                   # Task definitions (fetch, build, verify, release)
├── scripts/
│   ├── fetch-sources.sh        # Downloads deps → vendor/, symlinks to android/jni/
│   ├── build-android.sh        # ndk-build wrapper with NDK auto-detection
│   ├── build-ios.sh            # Xcode/clang cross-compile for device + simulator
│   ├── verify-android.sh       # Checks entry point symbol + 16KB ELF alignment
│   └── release.sh              # Packages zips and creates GitHub release via gh CLI
├── android/
│   └── jni/                    # Android.mk + per-library .mk files (symlinks to vendor/)
├── ios/                        # iOS build output (lib/, include/) — gitignored
├── vendor/                     # Downloaded source trees — gitignored
└── dist/                       # Release zips — gitignored

Workflow

1. Fetch dependencies

mise run fetch
# or: bash scripts/fetch-sources.sh

Downloads all source tarballs (~20 MB compressed) into vendor/ and creates symlinks in android/jni/ so the existing .mk files work without modification.

2. Build

# Android (requires ANDROID_NDK_HOME or NDK in ~/Android/Sdk/ndk/)
mise run build:android

# iOS (requires macOS + Xcode)
mise run build:ios

Android output: android/libs/{arm64-v8a,armeabi-v7a,x86,x86_64}/libspatialite.so
iOS output: ios/lib/*.a + ios/include/

3. Verify (Android)

mise run verify:android

Checks that:

  • sqlite3_modspatialite_init symbol is exported in each .so
  • ELF LOAD segments are 16KB aligned (Play Store requirement since Nov 2025)

4. Package & release

Install GitHub CLI (one of):

bash scripts/install-gh.sh          # installs to ~/.local/bin
mise install                        # gh + jq via mise.toml (needs GitHub API quota)
sudo apt install gh jq zip          # Debian/Ubuntu

Authenticate:

gh auth login
# or export GITHUB_TOKEN=ghp_...   # fine-grained token with Contents: Read and write

Package only (no upload):

mise run package
# or: bash scripts/package-artifacts.sh 5.0.0

Publish a GitHub release (local):

mise run release -- 5.0.0
# or: bash scripts/release.sh --yes 5.0.0

This will:

  1. Zip Android .so files and iOS static libs (if built) into dist/
  2. Write SHA256SUMS
  3. Create tag/release v5.0.0 on GitHub with attached assets

CI / automated release (after pushing this repo to GitHub):

Trigger Workflow Result
Push to main / PR ci.yml Build Android, verify, upload dist/ artifact
Push tag v* release.yml Full build + GitHub Release
Manual Actions → Release → Run workflow Same as tag release (optional draft)
git tag v5.0.0 && git push origin v5.0.0

16KB Page Alignment (Android)

Starting November 2025, Google Play requires all native libraries to support 16KB page sizes on Android 15+ devices. This repo uses:

  • NDK r28+ which enables 16KB alignment by default
  • APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true in Application.mk
  • APP_PLATFORM := android-35

The verify:android task checks the alignment of the output .so files.

Dependencies

All versions are pinned in deps.json:

Library Version Purpose
SpatiaLite 5.0.0 Spatial SQL extension for SQLite
GEOS 3.7.2 Geometry engine
PROJ 6.1.1 Coordinate transformation
SQLite 3.28.0 Database engine (amalgamation)
libiconv 1.16 Character encoding
libxml2 2.9.2 XML parsing
JSON-C 0.12 JSON support
librttopo 20180125 RT Topology
XZ/LZMA 5.2.4 Compression

Available mise Tasks

Task Description
mise run fetch Download all dependency sources
mise run build:android Build for Android (all ABIs)
mise run build:ios Build for iOS (device + simulator)
mise run build:all Build for both platforms
mise run verify:android Verify Android binaries
mise run package Zip libs to dist/ + checksums
mise run release -- <ver> Package and create a GitHub release
mise run release:package -- <ver> Package only (no gh)
mise run release:draft -- <ver> Draft GitHub release (CI-friendly with --yes)
mise run clean:android Remove Android build output
mise run clean:ios Remove iOS build output
mise run clean:vendor Remove downloaded sources
mise run clean:all Remove everything generated
mise run info Show dependency versions and build status

License

SpatiaLite is licensed under the MPL tri-license (MPL 1.1, GPL 2.0+, LGPL 2.1+). GEOS, PROJ, and other dependencies have their own open-source licenses. See each library's source for details.

Languages

  • .
  • .
  • .
  • .
  • Makefile67.5%
  • Shell28.4%
  • C3.5%
  • C++0.6%