General consumers of this library don't need to read any further. (The compiled files are available via the release page.)
If you want to compile your own version of SQLite for WebAssembly, or want to contribute to this project, read on.
This project defines a standardized development environment using Docker (and the .devcontainer spec in particular). This allows for anyone on any platform to get up and running quickly. (VSCode is not technically required to make use of this standardized environment, but it makes containerized development so seamless that the non-VSCode path is not currently documented here.)
Standardizing our development environment has numerous benefits:
- Allows anyone on ANY platform (Linux, Mac, and Windows) to contribute or compile their own build.
- It's quicker and easier for any contributor to dive in and fix issues.
- (Practically) eliminates configuration bugs that are difficult for maintainers to reproduce. Also known as "works on my machine" issues.
- Allows us to write our scripts assuming that they're always running in a single known environment of a single, known platform.
- Ensure that all contributors use a known, standardized installation of EMSDK.
- Allows for a more clearly documented process for updating the EMSDK to a new version.
- End-Users that simply want to compile and install their own version of SQLite don't have to bother with EMSDK installation in their particular environment.
To get started:
- Follow the Installation Steps for Containerized Development in VSCode. This includes installing Docker, VSCode, and the Remote Development extension pack for VSCode)
- Clone this repository
- Open the repository folder in VSCode. It will detect the presence of a .devcontainer and prompt you: "Folder contains a Dev Container configuration file. Reopen folder to develop in a container." Click "Reopen in container"
You're now ready to test the dev environment:
- Click on Terminal->New Terminal to be dropped into a terminal inside the dev environment.
- Run
$ npm install
to install the required modules - Run
$ npm test
to ensure all tests pass - Run
$ npm rebuild
to re-compile the project from scratch (using the version of EMSDK installed in the container). - Run
$ npm test
to ensure all tests pass after said rebuild
You're now ready for development!
If you're on a Mac or Linux-based host machine, you can install and use the EMSDK directly to perform a build. Note that if you run into bugs with this configuration, we highly encourage you to use the containerized development environment instead, as detailed above.
Instructions:
- Install the EMSDK
- Clone this repository
- Run
$ npm install
to install the required modules - Run
$ npm test
to ensure all tests pass - Run
$ npm rebuild
to re-compile the project from scratch (using the version of EMSDK installed in the container). - Run
$ npm test
to ensure all tests pass after said rebuild
In order to enable extensions like FTS5, change the CFLAGS in the Makefile and run npm run rebuild
:
CFLAGS = \
-O2 \
-DSQLITE_OMIT_LOAD_EXTENSION \
-DSQLITE_DISABLE_LFS \
-DSQLITE_ENABLE_FTS3 \
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
+ -DSQLITE_ENABLE_FTS5 \
-DSQLITE_THREADSAFE=0