Skip to content

Commit 2b12cd8

Browse files
committed
Update SQLite and core extension
1 parent 33d34cd commit 2b12cd8

File tree

3 files changed

+36
-11
lines changed

3 files changed

+36
-11
lines changed

.changeset/evil-planets-add.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@powersync/sql-js": minor
3+
---
4+
5+
Update SQLite to 3.50.4, PowerSync extension to 0.4.4

build.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#!/bin/sh
22
set -e
33

4-
SQLITE_VERSION="2.7.6"
5-
POWERSYNC_CORE_VERSION="0.4.2"
4+
POWERSYNC_CORE_VERSION="0.4.4"
65
SQLITE_PATH="sql.js"
76

87
if [ -d "$SQLITE_PATH" ]; then

patches/powersync.patch

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,27 @@
11
diff --git a/Makefile b/Makefile
2-
index 4530653..5ac01a0 100644
2+
index 4530653..8c40a26 100644
33
--- a/Makefile
44
+++ b/Makefile
5-
@@ -14,6 +14,8 @@ SQLITE_AMALGAMATION_ZIP_SHA3 = e7eb4cfb2d95626e782cfa748f534c74482f2c3c93f13ee82
5+
@@ -6,14 +6,15 @@
6+
7+
# I got this handy makefile syntax from : https://github.com/mandel59/sqlite-wasm (MIT License) Credited in LICENSE
8+
# To use another version of Sqlite, visit https://www.sqlite.org/download.html and copy the appropriate values here:
9+
-SQLITE_AMALGAMATION = sqlite-amalgamation-3490100
10+
-SQLITE_AMALGAMATION_ZIP_URL = https://sqlite.org/2025/sqlite-amalgamation-3490100.zip
11+
-SQLITE_AMALGAMATION_ZIP_SHA3 = e7eb4cfb2d95626e782cfa748f534c74482f2c3c93f13ee828b9187ce05b2da7
12+
+SQLITE_AMALGAMATION = sqlite-amalgamation-3500400
13+
+SQLITE_AMALGAMATION_ZIP_URL = https://sqlite.org/2025/sqlite-amalgamation-3500400.zip
14+
+SQLITE_AMALGAMATION_ZIP_SHA256 = 1d3049dd0f830a025a53105fc79fd2ab9431aea99e137809d064d8ee8356b032
15+
16+
# Note that extension-functions.c hasn't been updated since 2010-02-06, so likely doesn't need to be updated
617
EXTENSION_FUNCTIONS = extension-functions.c
718
EXTENSION_FUNCTIONS_URL = https://www.sqlite.org/contrib/download/extension-functions.c?get=25
819
EXTENSION_FUNCTIONS_SHA1 = c68fa706d6d9ff98608044c00212473f9c14892f
920
+POWERSYNC_STATIC_FILES = powersync-libs/libpowersync-wasm.a
10-
+
1121

1222
EMCC=emcc
1323

14-
@@ -24,7 +26,8 @@ SQLITE_COMPILATION_FLAGS = \
24+
@@ -24,7 +25,8 @@ SQLITE_COMPILATION_FLAGS = \
1525
-DSQLITE_ENABLE_FTS3 \
1626
-DSQLITE_ENABLE_FTS3_PARENTHESIS \
1727
-DSQLITE_THREADSAFE=0 \
@@ -21,7 +31,7 @@ index 4530653..5ac01a0 100644
2131

2232
# When compiling to WASM, enabling memory-growth is not expected to make much of an impact, so we enable it for all builds
2333
# Since tihs is a library and not a standalone executable, we don't want to catch unhandled Node process exceptions
24-
@@ -59,7 +62,7 @@ EMFLAGS_DEBUG = \
34+
@@ -59,7 +61,7 @@ EMFLAGS_DEBUG = \
2535
-s ASSERTIONS=2 \
2636
-O1
2737

@@ -30,7 +40,7 @@ index 4530653..5ac01a0 100644
3040

3141
OUTPUT_WRAPPER_FILES = src/shell-pre.js src/shell-post.js
3242

33-
@@ -76,13 +79,13 @@ all: optimized debug worker
43+
@@ -76,13 +78,13 @@ all: optimized debug worker
3444
debug: dist/sql-asm-debug.js dist/sql-wasm-debug.js
3545

3646
dist/sql-asm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FILES) $(EXPORTED_METHODS_JSON_FILES)
@@ -46,7 +56,7 @@ index 4530653..5ac01a0 100644
4656
mv $@ out/tmp-raw.js
4757
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
4858
rm out/tmp-raw.js
49-
@@ -91,19 +94,19 @@ dist/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FI
59+
@@ -91,19 +93,19 @@ dist/sql-wasm-debug.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FI
5060
optimized: dist/sql-asm.js dist/sql-wasm.js dist/sql-asm-memory-growth.js
5161

5262
dist/sql-asm.js: $(BITCODE_FILES) $(OUTPUT_WRAPPER_FILES) $(SOURCE_API_FILES) $(EXPORTED_METHODS_JSON_FILES)
@@ -69,7 +79,7 @@ index 4530653..5ac01a0 100644
6979
mv $@ out/tmp-raw.js
7080
cat src/shell-pre.js out/tmp-raw.js src/shell-post.js > $@
7181
rm out/tmp-raw.js
72-
@@ -153,6 +156,9 @@ out/extension-functions.o: sqlite-src/$(SQLITE_AMALGAMATION)
82+
@@ -153,6 +155,9 @@ out/extension-functions.o: sqlite-src/$(SQLITE_AMALGAMATION)
7383
# Generate llvm bitcode
7484
$(EMCC) $(SQLITE_COMPILATION_FLAGS) -c sqlite-src/$(SQLITE_AMALGAMATION)/extension-functions.c -o $@
7585

@@ -79,7 +89,18 @@ index 4530653..5ac01a0 100644
7989
# TODO: This target appears to be unused. If we re-instatate it, we'll need to add more files inside of the JS folder
8090
# module.tar.gz: test package.json AUTHORS README.md dist/sql-asm.js
8191
# tar --create --gzip $^ > $@
82-
@@ -182,11 +188,15 @@ sqlite-src/$(SQLITE_AMALGAMATION): cache/$(SQLITE_AMALGAMATION).zip sqlite-src/$
92+
@@ -172,8 +177,8 @@ sqlite-src: sqlite-src/$(SQLITE_AMALGAMATION) sqlite-src/$(SQLITE_AMALGAMATION)/
93+
94+
sqlite-src/$(SQLITE_AMALGAMATION): cache/$(SQLITE_AMALGAMATION).zip sqlite-src/$(SQLITE_AMALGAMATION)/$(EXTENSION_FUNCTIONS)
95+
mkdir -p sqlite-src/$(SQLITE_AMALGAMATION)
96+
- echo '$(SQLITE_AMALGAMATION_ZIP_SHA3) ./cache/$(SQLITE_AMALGAMATION).zip' > cache/check.txt
97+
- sha3sum -a 256 -c cache/check.txt
98+
+ echo '$(SQLITE_AMALGAMATION_ZIP_SHA256) ./cache/$(SQLITE_AMALGAMATION).zip' > cache/check.txt
99+
+ sha256sum -c cache/check.txt
100+
# We don't delete the sqlite_amalgamation folder. That's a job for clean
101+
# Also, the extension functions get copied here, and if we get the order of these steps wrong,
102+
# this step could remove the extension functions, and that's not what we want
103+
@@ -182,11 +187,15 @@ sqlite-src/$(SQLITE_AMALGAMATION): cache/$(SQLITE_AMALGAMATION).zip sqlite-src/$
83104

84105
sqlite-src/$(SQLITE_AMALGAMATION)/$(EXTENSION_FUNCTIONS): cache/$(EXTENSION_FUNCTIONS)
85106
mkdir -p sqlite-src/$(SQLITE_AMALGAMATION)

0 commit comments

Comments
 (0)