Skip to content

Commit

Permalink
update cr-sqlite to head
Browse files Browse the repository at this point in the history
  • Loading branch information
tantaman committed Oct 26, 2023
1 parent d08eeee commit c4b98a4
Show file tree
Hide file tree
Showing 109 changed files with 4,891 additions and 5,171 deletions.
1 change: 1 addition & 0 deletions libsql-sqlite3/ext/crr/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ dbg/
dist-ios/
dist-ios-sim/
dist-macos/
test_leak_condition
6 changes: 6 additions & 0 deletions libsql-sqlite3/ext/crr/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# @vlcn.io/crsqlite

## 0.15.1

### Patch Changes

- c113d8c: ensure statements are finalized when closing db, allow automigrating fractindex tables, fractindex w/o list columns fix

## 0.15.1-next.0

### Patch Changes
Expand Down
62 changes: 36 additions & 26 deletions libsql-sqlite3/ext/crr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,17 @@ ifdef CONFIG_WINDOWS
LOADABLE_EXTENSION=dll
endif

ifeq ($(CI_MAYBE_TARGET),i686-pc-windows-gnu)
C_TARGET=
LOADABLE_EXTENSION=dll
rs_build_flags = -Zbuild-std
endif
ifeq ($(CI_MAYBE_TARGET),x86_64-pc-windows-gnu)
C_TARGET=
LOADABLE_EXTENSION=dll
rs_build_flags = -Zbuild-std
endif

ifdef IOS_TARGET
CI_MAYBE_TARGET=$(IOS_TARGET)
rs_build_flags = -Zbuild-std
Expand All @@ -56,6 +67,9 @@ endif

prefix=./dist
dbg_prefix=./dbg
bundle=bundle_static
valgrind: bundle = integration_check
test: bundle = integration_check

TARGET_LOADABLE=$(prefix)/crsqlite.$(LOADABLE_EXTENSION)
TARGET_DBG_LOADABLE=$(dbg_prefix)/crsqlite.$(LOADABLE_EXTENSION)
Expand All @@ -70,14 +84,10 @@ TARGET_TEST_ASAN=$(prefix)/test-asan

# js/browser/wa-sqlite/Makefile, deps/sqlite/GNUMakefile, core/binding.gyp, core/Makefile
ext_files=src/crsqlite.c \
src/util.c \
src/tableinfo.c \
src/changes-vtab.c \
src/ext-data.c \
src/get-table.c
src/ext-data.c
ext_headers=src/crsqlite.h \
src/util.h \
src/tableinfo.h \
src/changes-vtab.h \
src/ext-data.h

Expand All @@ -90,7 +100,7 @@ clean:
rm -rf $(prefix)
rm -rf $(dbg_prefix)
cd rs/bundle && cargo clean

cd rs/integration_check && cargo clean

FORMAT_FILES=$(ext_files) $(ext_headers) ./src/core_init.c
format: $(FORMAT_FILES)
Expand Down Expand Up @@ -120,27 +130,27 @@ ubsan: clean $(TARGET_TEST)
fuzz: $(TARGET_FUZZ)
$(prefix)/fuzz

sqlite_src = ../../
sqlite_src = src/sqlite/
shell.c = $(sqlite_src)shell.c
sqlite3.c = $(sqlite_src)sqlite3.c

rs_lib_static = ./rs/bundle/target/release/libcrsql_bundle.a
rs_lib_static_cpy = ./dist/libcrsql_bundle-static.a
rs_lib_static = ./rs/$(bundle)/target/release/libcrsql_$(bundle).a
rs_lib_static_cpy = ./dist/libcrsql_$(bundle)-static.a

rs_lib_dbg_static = ./rs/bundle/target/debug/libcrsql_bundle.a
rs_lib_dbg_static_cpy = ./dbg/libcrsql_bundle-dbg-static.a
rs_lib_dbg_static = ./rs/$(bundle)/target/debug/libcrsql_$(bundle).a
rs_lib_dbg_static_cpy = ./dbg/libcrsql_$(bundle)-dbg-static.a

rs_lib_loadable = ./rs/bundle/target/release/libcrsql_bundle.a
rs_lib_loadable_cpy = ./dist/libcrsql_bundle-loadable.a
rs_lib_loadable = ./rs/$(bundle)/target/release/libcrsql_$(bundle).a
rs_lib_loadable_cpy = ./dist/libcrsql_$(bundle)-loadable.a

rs_lib_dbg_loadable = ./rs/bundle/target/debug/libcrsql_bundle.a
rs_lib_dbg_loadable_cpy = ./dbg/libcrsql_bundle-dbg-loadable.a
rs_lib_dbg_loadable = ./rs/$(bundle)/target/debug/libcrsql_$(bundle).a
rs_lib_dbg_loadable_cpy = ./dbg/libcrsql_$(bundle)-dbg-loadable.a

ifdef CI_MAYBE_TARGET
rs_lib_dbg_static = ./rs/bundle/target/$(CI_MAYBE_TARGET)/debug/libcrsql_bundle.a
rs_lib_loadable = ./rs/bundle/target/$(CI_MAYBE_TARGET)/release/libcrsql_bundle.a
rs_lib_dbg_loadable = ./rs/bundle/target/$(CI_MAYBE_TARGET)/debug/libcrsql_bundle.a
rs_lib_static = ./rs/bundle/target/$(CI_MAYBE_TARGET)/release/libcrsql_bundle.a
rs_lib_dbg_static = ./rs/$(bundle)/target/$(CI_MAYBE_TARGET)/debug/libcrsql_$(bundle).a
rs_lib_loadable = ./rs/$(bundle)/target/$(CI_MAYBE_TARGET)/release/libcrsql_$(bundle).a
rs_lib_dbg_loadable = ./rs/$(bundle)/target/$(CI_MAYBE_TARGET)/debug/libcrsql_$(bundle).a
rs_lib_static = ./rs/$(bundle)/target/$(CI_MAYBE_TARGET)/release/libcrsql_$(bundle).a
RS_TARGET = --target=$(CI_MAYBE_TARGET)
ifndef CI_GCC
# clang has a different target triple than Rust for ios simuators
Expand All @@ -159,19 +169,19 @@ $(sqlite3.c):
cd $(sqlite_src) && make sqlite3.c

$(rs_lib_dbg_static_cpy): FORCE $(dbg_prefix)
cd ./rs/bundle && cargo build $(RS_TARGET) --features static,omit_load_extension $(rs_build_flags)
cd ./rs/$(bundle) && cargo rustc $(RS_TARGET) --features static,omit_load_extension $(rs_build_flags)
cp $(rs_lib_dbg_static) $(rs_lib_dbg_static_cpy)

$(rs_lib_static_cpy): FORCE $(prefix)
cd ./rs/bundle && cargo build $(RS_TARGET) --release --features static,omit_load_extension $(rs_build_flags)
cd ./rs/$(bundle) && cargo rustc $(RS_TARGET) --release --features static,omit_load_extension $(rs_build_flags)
cp $(rs_lib_static) $(rs_lib_static_cpy)

$(rs_lib_loadable_cpy): FORCE $(prefix)
cd ./rs/bundle && cargo $(rs_ndk) build $(RS_TARGET) --release --features loadable_extension $(rs_build_flags)
cd ./rs/$(bundle) && cargo $(rs_ndk) build $(RS_TARGET) --release --features loadable_extension $(rs_build_flags)
cp $(rs_lib_loadable) $(rs_lib_loadable_cpy)

$(rs_lib_dbg_loadable_cpy): FORCE $(dbg_prefix)
cd ./rs/bundle && cargo build $(RS_TARGET) --features loadable_extension $(rs_build_flags)
cd ./rs/$(bundle) && cargo rustc $(RS_TARGET) --features loadable_extension $(rs_build_flags)
cp $(rs_lib_dbg_loadable) $(rs_lib_dbg_loadable_cpy)

# Build the loadable extension.
Expand Down Expand Up @@ -213,20 +223,20 @@ $(TARGET_STATIC): $(prefix) $(ext_files) $(sqlite3.c) $(rs_lib_static_cpy)
mkdir -p $(prefix)/temp
rm -f $(prefix)/temp/*
mv *.o $(prefix)/temp
cd $(prefix)/temp && ar -x ../libcrsql_bundle-static.a && ar -rc crsqlite.a *.o && mv crsqlite.a ../crsqlite-$(CI_MAYBE_TARGET).a
cd $(prefix)/temp && ar -x ../libcrsql_$(bundle)-static.a && ar -rc crsqlite.a *.o && mv crsqlite.a ../crsqlite-$(CI_MAYBE_TARGET).a

# Build a normal SQLite CLI that does not include cr-sqlite.
# cr-sqlite can be laoded in via the `.load` pragma.
# Useful for debugging.
$(TARGET_SQLITE3_VANILLA): $(prefix) $(sqlite3.c) $(shell.c)
$(TARGET_SQLITE3_VANILLA): $(prefix) $(shell.c) $(sqlite3.c)
$(CC) -g \
$(DEFINE_SQLITE_PATH) \
-DSQLITE_THREADSAFE=0 \
-I./src/ -I$(sqlite_src) \
$(sqlite3.c) $(shell.c) \
-o $@

$(TARGET_SQLITE3_EXTRA_C): $(sqlite3.c) src/core_init.c
$(TARGET_SQLITE3_EXTRA_C): $(prefix) $(sqlite3.c) src/core_init.c
cat $(sqlite3.c) src/core_init.c > $@

# run tests
Expand Down
Loading

0 comments on commit c4b98a4

Please sign in to comment.