@@ -35,7 +35,7 @@ TCC += -I${TOP}/ext/fts3 -I${TOP}/ext/async -I${TOP}/ext/session
35
35
TCC += -I${TOP}/ext/userauth
36
36
37
37
# Define this for the autoconf-based build, so that the code knows it can
38
- # include the generated config .h
38
+ # include the generated sqlite_cfg .h
39
39
#
40
40
TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite
41
41
@@ -184,7 +184,7 @@ LIBOBJS0 = alter.lo analyze.lo attach.lo auth.lo \
184
184
main.lo malloc.lo mem0.lo mem1.lo mem2.lo mem3.lo mem5.lo \
185
185
memdb.lo memjournal.lo \
186
186
mutex.lo mutex_noop.lo mutex_unix.lo mutex_w32.lo \
187
- notify.lo opcodes.lo os.lo os_unix.lo os_win.lo \
187
+ notify.lo opcodes.lo os.lo os_kv.lo os_unix.lo os_win.lo \
188
188
pager.lo parse.lo pcache.lo pcache1.lo pragma.lo prepare.lo printf.lo \
189
189
random.lo resolve.lo rowset.lo rtree.lo \
190
190
sqlite3session.lo select.lo sqlite3rbu.lo status.lo stmt.lo \
@@ -257,6 +257,7 @@ SRC = \
257
257
$(TOP ) /src/os.h \
258
258
$(TOP ) /src/os_common.h \
259
259
$(TOP ) /src/os_setup.h \
260
+ $(TOP ) /src/os_kv.c \
260
261
$(TOP ) /src/os_unix.c \
261
262
$(TOP ) /src/os_win.c \
262
263
$(TOP ) /src/os_win.h \
@@ -377,7 +378,7 @@ SRC += \
377
378
opcodes.h \
378
379
parse.c \
379
380
parse.h \
380
- config .h \
381
+ sqlite_cfg .h \
381
382
shell.c \
382
383
sqlite3.h
383
384
@@ -433,6 +434,9 @@ TESTSRC = \
433
434
$(TOP ) /ext/fts3/fts3_term.c \
434
435
$(TOP ) /ext/fts3/fts3_test.c \
435
436
$(TOP ) /ext/session/test_session.c \
437
+ $(TOP ) /ext/recover/sqlite3recover.c \
438
+ $(TOP ) /ext/recover/dbdata.c \
439
+ $(TOP ) /ext/recover/test_recover.c \
436
440
$(TOP ) /ext/rbu/test_rbu.c
437
441
438
442
# Statically linked extensions
@@ -492,6 +496,7 @@ TESTSRC2 = \
492
496
$(TOP ) /src/main.c \
493
497
$(TOP ) /src/mem5.c \
494
498
$(TOP ) /src/os.c \
499
+ $(TOP ) /src/os_kv.c \
495
500
$(TOP ) /src/os_unix.c \
496
501
$(TOP ) /src/os_win.c \
497
502
$(TOP ) /src/pager.c \
@@ -555,7 +560,7 @@ HDR = \
555
560
$(TOP ) /src/vdbeInt.h \
556
561
$(TOP ) /src/vxworks.h \
557
562
$(TOP ) /src/whereInt.h \
558
- config .h
563
+ sqlite_cfg .h
559
564
560
565
# Header files used by extensions
561
566
#
@@ -621,7 +626,10 @@ SHELL_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
621
626
SHELL_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
622
627
SHELL_OPT += -DSQLITE_ENABLE_OFFSET_SQL_FUNC
623
628
FUZZERSHELL_OPT =
624
- FUZZCHECK_OPT = -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
629
+ FUZZCHECK_OPT += -I$(TOP ) /test
630
+ FUZZCHECK_OPT += -I$(TOP ) /ext/recover
631
+ FUZZCHECK_OPT += -DSQLITE_OMIT_LOAD_EXTENSION
632
+ FUZZCHECK_OPT += -DSQLITE_ENABLE_MEMSYS5 -DSQLITE_OSS_FUZZ
625
633
FUZZCHECK_OPT += -DSQLITE_MAX_MEMORY=50000000
626
634
FUZZCHECK_OPT += -DSQLITE_PRINTF_PRECISION_LIMIT=1000
627
635
FUZZCHECK_OPT += -DSQLITE_ENABLE_FTS4
@@ -631,8 +639,14 @@ FUZZCHECK_OPT += -DSQLITE_ENABLE_RTREE
631
639
FUZZCHECK_OPT += -DSQLITE_ENABLE_GEOPOLY
632
640
FUZZCHECK_OPT += -DSQLITE_ENABLE_DBSTAT_VTAB
633
641
FUZZCHECK_OPT += -DSQLITE_ENABLE_BYTECODE_VTAB
634
- FUZZCHECK_SRC = $(TOP ) /test/fuzzcheck.c $(TOP ) /test/ossfuzz.c $(TOP ) /test/fuzzinvariants.c
642
+ FUZZCHECK_SRC += $(TOP ) /test/fuzzcheck.c
643
+ FUZZCHECK_SRC += $(TOP ) /test/ossfuzz.c
644
+ FUZZCHECK_SRC += $(TOP ) /test/fuzzinvariants.c
645
+ FUZZCHECK_SRC += $(TOP ) /ext/recover/dbdata.c
646
+ FUZZCHECK_SRC += $(TOP ) /ext/recover/sqlite3recover.c
647
+ FUZZCHECK_SRC += $(TOP ) /test/vt02.c
635
648
DBFUZZ_OPT =
649
+ ST_OPT = -DSQLITE_OS_KV_OPTIONAL
636
650
637
651
# This is the default Makefile target. The objects listed here
638
652
# are what get build when you type just "make" with no arguments.
@@ -681,7 +695,7 @@ fuzzershell$(TEXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h
681
695
$(LTLINK ) -o $@ $(FUZZERSHELL_OPT ) \
682
696
$(TOP ) /tool/fuzzershell.c sqlite3.c $(TLIBS )
683
697
684
- fuzzcheck$(TEXE ) : $(FUZZCHECK_SRC ) sqlite3.c sqlite3.h
698
+ fuzzcheck$(TEXE ) : $(FUZZCHECK_SRC ) sqlite3.c sqlite3.h $( FUZZCHECK_DEP )
685
699
$(LTLINK ) -o $@ $(FUZZCHECK_OPT ) $(FUZZCHECK_SRC ) sqlite3.c $(TLIBS )
686
700
687
701
ossshell$(TEXE ) : $(TOP ) /test/ossfuzz.c $(TOP ) /test/ossshell.c sqlite3.c sqlite3.h
@@ -938,6 +952,9 @@ pcache1.lo: $(TOP)/src/pcache1.c $(HDR) $(TOP)/src/pcache.h
938
952
os.lo : $(TOP ) /src/os.c $(HDR )
939
953
$(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/os.c
940
954
955
+ os_kv.lo : $(TOP ) /src/os_kv.c $(HDR )
956
+ $(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/os_kv.c
957
+
941
958
os_unix.lo : $(TOP ) /src/os_unix.c $(HDR )
942
959
$(LTCOMPILE ) $(TEMP_STORE ) -c $(TOP ) /src/os_unix.c
943
960
@@ -1102,6 +1119,9 @@ SHELL_SRC = \
1102
1119
$(TOP ) /ext/expert/sqlite3expert.h \
1103
1120
$(TOP ) /ext/misc/zipfile.c \
1104
1121
$(TOP ) /ext/misc/memtrace.c \
1122
+ $(TOP ) /ext/recover/dbdata.c \
1123
+ $(TOP ) /ext/recover/sqlite3recover.c \
1124
+ $(TOP ) /ext/recover/sqlite3recover.h \
1105
1125
$(TOP ) /src/test_windirent.c
1106
1126
1107
1127
shell.c : $(SHELL_SRC ) $(TOP ) /tool/mkshellc.tcl
@@ -1281,6 +1301,12 @@ valgrindfuzz: fuzzcheck$(TEXT) $(FUZZDATA) sessionfuzz$(TEXE) $(TOP)/test/sessio
1281
1301
tcltest : ./testfixture$(TEXE )
1282
1302
./testfixture$(TEXE ) $(TOP ) /test/veryquick.test $(TESTOPTS )
1283
1303
1304
+ # Runs all the same tests cases as the "tcltest" target but uses
1305
+ # the testrunner.tcl script to run them in multiple cores
1306
+ # concurrently.
1307
+ testrunner : testfixture$(TEXE )
1308
+ ./testfixture$(TEXE ) $(TOP ) /test/testrunner.tcl
1309
+
1284
1310
# Minimal testing that runs in less than 3 minutes
1285
1311
#
1286
1312
quicktest : ./testfixture$(TEXE )
@@ -1381,7 +1407,7 @@ LogEst$(TEXE): $(TOP)/tool/logest.c sqlite3.h
1381
1407
wordcount$(TEXE ) : $(TOP ) /test/wordcount.c sqlite3.lo
1382
1408
$(LTLINK ) -o $@ $(TOP ) /test/wordcount.c sqlite3.lo $(TLIBS )
1383
1409
1384
- speedtest1$(TEXE ) : $(TOP ) /test/speedtest1.c sqlite3.c
1410
+ speedtest1$(TEXE ) : $(TOP ) /test/speedtest1.c sqlite3.c Makefile
1385
1411
$(LTLINK ) $(ST_OPT ) -o $@ $(TOP ) /test/speedtest1.c sqlite3.c $(TLIBS )
1386
1412
1387
1413
startup$(TEXE ) : $(TOP ) /test/startup.c sqlite3.c
@@ -1470,6 +1496,7 @@ clean:
1470
1496
rm -rf .libs .deps
1471
1497
rm -f lemon$(BEXE ) lempar.c parse.* sqlite* .tar.gz
1472
1498
rm -f mkkeywordhash$(BEXE ) keywordhash.h
1499
+ rm -f mksourceid$(BEXE )
1473
1500
rm -f * .da * .bb * .bbg gmon.out
1474
1501
rm -rf tsrc .target_source
1475
1502
rm -f tclsqlite3$(TEXE )
@@ -1494,7 +1521,8 @@ clean:
1494
1521
rm -f threadtest5
1495
1522
1496
1523
distclean : clean
1497
- rm -f config.h config.log config.status libtool Makefile sqlite3.pc
1524
+ rm -f sqlite_cfg.h config.log config.status libtool Makefile sqlite3.pc \
1525
+ $(TESTPROGS )
1498
1526
1499
1527
#
1500
1528
# Windows section
@@ -1514,133 +1542,8 @@ sqlite3.dll: $(REAL_LIBOBJ) sqlite3.def
1514
1542
$(TCC ) -shared -o $@ sqlite3.def \
1515
1543
-Wl," --strip-all" $(REAL_LIBOBJ )
1516
1544
1517
-
1518
1545
#
1519
- # fiddle/wasm section
1520
- #
1521
- fiddle_dir = ext/fiddle
1522
- fiddle_dir_abs = $(TOP ) /$(fiddle_dir )
1523
- # ^^^ some emcc opts require absolute paths
1524
- fiddle_html = $(fiddle_dir ) /fiddle.html
1525
- fiddle_module_js = $(fiddle_dir ) /fiddle-module.js
1526
- sqlite3_wasm_js = $(fiddle_dir ) /sqlite3.js
1527
- sqlite3_wasm = $(fiddle_dir ) /sqlite3.wasm
1528
- # emcc_opt = -O0
1529
- # emcc_opt = -O1
1530
- # emcc_opt = -O2
1531
- # emcc_opt = -O3
1532
- emcc_opt = -Oz
1533
- emcc_flags = $(emcc_opt ) -sALLOW_TABLE_GROWTH -sSTRICT_JS \
1534
- -sENVIRONMENT=web -sMODULARIZE \
1535
- -sEXPORTED_RUNTIME_METHODS=@$(fiddle_dir_abs ) /EXPORTED_RUNTIME_METHODS \
1536
- -sDYNAMIC_EXECUTION=0 \
1537
- -I. $(SHELL_OPT )
1538
- $(fiddle_module_js ) : Makefile sqlite3.c shell.c \
1539
- $(fiddle_dir)/EXPORTED_RUNTIME_METHODS \
1540
- $(fiddle_dir)/EXPORTED_FUNCTIONS.fiddle
1541
- emcc -o $@ $(emcc_flags) \
1542
- -sEXPORT_NAME =initFiddleModule \
1543
- -sEXPORTED_FUNCTIONS=@$(fiddle_dir_abs ) /EXPORTED_FUNCTIONS.fiddle \
1544
- sqlite3.c shell.c
1545
- gzip < $@ > $@.gz
1546
- gzip < $(fiddle_dir)/fiddle-module.wasm > $(fiddle_dir)/fiddle-module.wasm.gz
1547
- $(sqlite3_wasm_js ) : Makefile sqlite3.c \
1548
- $(fiddle_dir)/sqlite3-api.js \
1549
- $(fiddle_dir)/EXPORTED_RUNTIME_METHODS \
1550
- $(fiddle_dir)/EXPORTED_FUNCTIONS.sqlite3-api
1551
- emcc -o $@ $(emcc_flags) \
1552
- -sEXPORT_NAME =initSqlite3Module \
1553
- -sEXPORTED_FUNCTIONS=@$(fiddle_dir_abs ) /EXPORTED_FUNCTIONS.sqlite3-api \
1554
- --post-js=$(fiddle_dir ) /sqlite3-api.js \
1555
- --no-entry \
1556
- sqlite3.c
1557
- gzip < $@ > $@.gz
1558
- gzip < $(sqlite3_wasm) > $(sqlite3_wasm).gz
1559
- gzip < $(fiddle_dir)/sqlite3-api.js > $(fiddle_dir)/sqlite3-api.js.gz
1560
- $(fiddle_dir ) /fiddle.js.gz : $(fiddle_dir ) /fiddle.js
1561
- gzip < $< > $@
1562
- $(fiddle_dir ) /sqlite3-api.js.gz : $(fiddle_dir ) /sqlite3-api.js
1563
- gzip < $< > $@
1564
-
1565
- fiddle_generated = $(fiddle_module_js ) $(fiddle_module_js ) .gz \
1566
- $(fiddle_dir ) /fiddle-module.wasm \
1567
- $(fiddle_dir ) /fiddle-module.wasm.gz \
1568
- $(fiddle_dir ) /fiddle.js.gz
1569
- sqlite3_wasm_generated = \
1570
- $(sqlite3_wasm ) $(sqlite3_wasm ) .gz \
1571
- $(sqlite3_wasm_js ) $(sqlite3_wasm_js ) .gz \
1572
- $(fiddle_dir ) /sqlite3.js.gz \
1573
- $(fiddle_dir ) /sqlite3-api.js.gz
1574
-
1575
- clean-wasm :
1576
- rm -f $(fiddle_generated ) $(sqlite3_wasm_generated )
1577
- clean : clean-wasm
1578
- fiddle : $(fiddle_module_js ) $(fiddle_dir ) /fiddle.js.gz
1579
- sqlite3-wasm : $(sqlite3_wasm_js )
1580
- wasm : fiddle sqlite3-wasm
1581
- # #######################################################################
1582
- # Explanation of the emcc build flags follows. Full docs for these can
1583
- # be found at:
1584
- #
1585
- # https://github.com/emscripten-core/emscripten/blob/main/src/settings.js
1586
- #
1587
- # -sENVIRONMENT=web: elides bootstrap code related to non-web JS
1588
- # environments like node.js. Removing this makes the output a tiny
1589
- # tick larger but hypothetically makes it more portable to
1590
- # non-browser JS environments.
1591
- #
1592
- # -sMODULARIZE: changes how the generated code is structured to avoid
1593
- # declaring a global Module object and instead installing a function
1594
- # which loads and initialized the module. The function is named...
1595
- #
1596
- # -sEXPORT_NAME=jsFunctionName (see -sMODULARIZE)
1597
- #
1598
- # -sEXPORTED_RUNTIME_METHODS=@/absolute/path/to/file: a file
1599
- # containing a list of emscripten-supplied APIs, one per line, which
1600
- # must be exported into the generated JS. Must be an absolute path!
1601
- #
1602
- # -sEXPORTED_FUNCTIONS=@/absolute/path/to/file: a file containing a
1603
- # list of C functions, one per line, which must be exported via wasm
1604
- # so they're visible to JS. C symbols names in that file must all
1605
- # start with an underscore for reasons known only to the emcc
1606
- # developers. e.g., _sqlite3_open_v2 and _sqlite3_finalize. Must be
1607
- # an absolute path!
1608
- #
1609
- # -sSTRICT_JS ensures that the emitted JS code includes the 'use
1610
- # strict' option. Note that -sSTRICT is more broadly-scoped and
1611
- # results in build errors.
1612
- #
1613
- # -sALLOW_TABLE_GROWTH is required for (at a minimum) the UDF-binding
1614
- # feature.
1615
- #
1616
- # -sDYNAMIC_EXECUTION=0 disables eval() and the Function constructor.
1617
- # If the build runs without these, it's preferable to use this flag
1618
- # because certain execution environments disallow those constructs.
1619
- # This flag is not strictly necessary, however.
1620
- #
1621
- # -sWASM_BIGINT is UNTESTED but "should" allow the int64-using C APIs
1622
- # to work with JS/wasm, insofar as the JS environment supports the
1623
- # BigInt type. That support requires an extremely recent browser:
1624
- # Safari didn't get that support until late 2020.
1625
- #
1626
- # --no-entry: for compiling library code with no main(). If this is
1627
- # not supplied and the code has a main(), it is called as part of the
1628
- # module init process. Note that main() is #if'd out of shell.c
1629
- # (renamed) when building in wasm mode.
1630
- #
1631
- # --pre-js/--post-js=FILE relative or absolute paths to JS files to
1632
- # prepend/append to the emcc-generated bootstrapping JS. It's
1633
- # easier/faster to develop with separate JS files (reduces rebuilding
1634
- # requirements) but certain configurations, namely -sMODULARIZE, may
1635
- # require using at least a --pre-js file. They can be used
1636
- # individually and need not be paired.
1637
- #
1638
- # -O0..-O3 and -Oz: optimization levels affect not only C-style
1639
- # optimization but whether or not the resulting generated JS code
1640
- # gets minified. -O0 compiles _much_ more quickly than -O3 or -Oz,
1641
- # and doesn't minimize any JS code, so is recommended for
1642
- # development. -O3 or -Oz are recommended for deployment, but
1643
- # primarily because -Oz will shrink the wasm file notably. JS-side
1644
- # minification makes little difference in terms of overall
1645
- # distributable size.
1646
- # #######################################################################
1546
+ # Fiddle app
1547
+ #
1548
+ fiddle : sqlite3.c shell.c
1549
+ make -C ext/wasm fiddle emcc_opt=-Os
0 commit comments