Repair version-info.c after a local mishap caused all of the intended edits from [36e197cb3d0c]/[e9b407a4d0a0] to get deleted before checkin. Simplify version-info build (only requires sqlite3.h, not the library).

FossilOrigin-Name: 6e511df500c63e27f932be9d601b641144562614dead99371477eca4594fb3fd
This commit is contained in:
stephan 2022-10-17 16:47:59 +00:00
parent 8be8924901
commit 1b8c246799
4 changed files with 80 additions and 23 deletions

View File

@ -125,9 +125,10 @@ else
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
endif
version-info: version-info.c $(sqlite3.c) $(MAKEFILE)
$(CC) -O0 -I$(dir.top) -o $@ $(SQLITE_OPT) $< $(sqlite3.c)
CLEAN_FILES := version-info
version-info := $(dir.wasm)/version-info
$(version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE)
$(CC) -O0 -I$(dir.top) -o $@ $<
CLEAN_FILES := $(version-info)
EXPORTED_FUNCTIONS.api.in := $(dir.api)/EXPORTED_FUNCTIONS.sqlite3-api
@ -161,12 +162,12 @@ $(sqlite3-api.js): $(sqlite3-api.jses) $(MAKEFILE)
echo "/* END FILE: $$i */"; \
done > $@
$(sqlite3-api-build-version.js): version-info
$(sqlite3-api-build-version.js): $(version-info)
@echo "Making $@..."
@{ \
echo 'self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){'; \
echo -n ' sqlite3.version = '; \
./version-info --json; \
$(version-info) --json; \
echo ';'; \
echo '});'; \
} > $@
@ -344,7 +345,7 @@ $(sqlite3.js): $(MAKEFILE) $(sqlite3.wasm.obj) \
chmod -x $(sqlite3.wasm)
$(maybe-wasm-strip) $(sqlite3.wasm)
@ls -la $@ $(sqlite3.wasm)
$(sqlite3.wasm): $(sqlite3.js)
CLEAN_FILES += $(sqlite3.js) $(sqlite3.wasm)
all: $(sqlite3.js)
wasm: $(sqlite3.js)

View File

@ -12,15 +12,71 @@
** This file simply outputs sqlite3 version information in JSON form,
** intended for embedding in the sqlite3 JS API build.
*/
#include <stdio.h>
#include "sqlite3.h"
#include <stdio.h>
#include <string.h>
static void usage(const char *zAppName){
puts("Emits version info about the sqlite3 it is built against.");
printf("Usage: %s [--quote] --INFO-FLAG:\n\n", zAppName);
puts(" --version Emit SQLITE_VERSION (3.X.Y)");
puts(" --version-number Emit SQLITE_VERSION_NUMBER (30XXYYZZ)");
puts(" --source-id Emit SQLITE_SOURCE_ID");
puts(" --json Emit all info in JSON form");
puts("\nThe non-JSON formats may be modified by:\n");
puts(" --quote Add double quotes around output.");
}
int main(int argc, char const * const * argv){
if(argc || argv){/*unused*/}
printf("{\"libVersion\": \"%s\", "
"\"libVersionNumber\": %d, "
"\"sourceId\": \"%s\"}"/*missing newline is intentional*/,
SQLITE_VERSION,
SQLITE_VERSION_NUMBER,
SQLITE_SOURCE_ID);
int fJson = 0;
int fVersion = 0;
int fVersionNumber = 0;
int fSourceInfo = 0;
int fQuote = 0;
int nFlags = 0;
int i;
for( i = 1; i < argc; ++i ){
const char * zArg = argv[i];
while('-'==*zArg) ++zArg;
if( 0==strcmp("version", zArg) ){
fVersion = 1;
}else if( 0==strcmp("version-number", zArg) ){
fVersionNumber = 1;
}else if( 0==strcmp("source-id", zArg) ){
fSourceInfo = 1;
}else if( 0==strcmp("json", zArg) ){
fJson = 1;
}else if( 0==strcmp("quote", zArg) ){
fQuote = 1;
--nFlags;
}else{
printf("Unhandled flag: %s\n", argv[i]);
usage(argv[0]);
return 1;
}
++nFlags;
}
if( 0==nFlags ) fJson = 1;
if( fJson ){
printf("{\"libVersion\": \"%s\", "
"\"libVersionNumber\": %d, "
"\"sourceId\": \"%s\"}"/*missing newline is intentional*/,
SQLITE_VERSION,
SQLITE_VERSION_NUMBER,
SQLITE_SOURCE_ID);
}else{
if(fQuote) printf("%c", '"');
if( fVersion ){
printf("%s", SQLITE_VERSION);
}else if( fVersionNumber ){
printf("%d", SQLITE_VERSION_NUMBER);
}else if( fSourceInfo ){
printf("%s", SQLITE_SOURCE_ID);
}
if(fQuote) printf("%c", '"');
puts("");
}
return 0;
}

View File

@ -1,5 +1,5 @@
C Fix\sa\spotential\scall\sto\sstrlen()\swith\sa\snull\sargument\sin\sthe\scommand-line\sshell\nfollowing\san\sOOM\serror.\s[forum:/forumpost/9c4f2ebe22|forum\spost\s9c4f2ebe22].
D 2022-10-17T16:09:33.721
C Repair\sversion-info.c\safter\sa\slocal\smishap\scaused\sall\sof\sthe\sintended\sedits\sfrom\s[36e197cb3d0c]/[e9b407a4d0a0]\sto\sget\sdeleted\sbefore\scheckin.\sSimplify\sversion-info\sbuild\s(only\srequires\ssqlite3.h,\snot\sthe\slibrary).
D 2022-10-17T16:47:59.012
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -473,7 +473,7 @@ F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/EXPORTED_RUNTIME_METHODS.fiddle 0e88c8cfc3719e4b7e74980d9da664c709e68acf863e48386cda376edfd3bfb0
F ext/wasm/GNUmakefile 0fd09868726368d849c2cf03e6ac9884a07d236855c7802a89f0f8a16c034d10
F ext/wasm/GNUmakefile a483eb1baec9bf997261908ed56f34a1dfc44eb2353e438ec9b1d2a7045c1d50
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 89983a8d122c35a90c65ec667844b95a78bcd04f3198a99c1e0c8368c1a0b03a
F ext/wasm/api/EXPORTED_RUNTIME_METHODS.sqlite3-api 1ec3c73e7d66e95529c3c64ac3de2470b0e9e7fbf7a5b41261c367cf4f1b7287
@ -533,7 +533,7 @@ F ext/wasm/testing-worker1-promiser.js bd788e33c1807e0a6dda9c9a9d784bd3350ca49c9
F ext/wasm/testing1.html 50575755e43232dbe4c2f97c9086b3118eb91ec2ee1fae931e6d7669fb17fcae
F ext/wasm/testing2.html a66951c38137ff1d687df79466351f3c734fa9c6d9cce71d3cf97c291b2167e3
F ext/wasm/testing2.js 88f40ef3cd8201bdadd120a711c36bbf0ce56cc0eab1d5e7debb71fed7822494
F ext/wasm/version-info.c 03c6fb4efefd7c5b14f618b36648e71da741e39059ea5059c39495fdceaed144
F ext/wasm/version-info.c 5fa356d38859d71a0369b5c37e1935def7413fcc8a4e349a39d9052c1d0479f4
F ext/wasm/wasmfs.make 3cce1820006196de140f90f2da4b4ea657083fb5bfee7d125be43f7a85748c8f
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
@ -2033,8 +2033,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
P e9b407a4d0a0fcd9f26d457beede19d41141327befe84be621681952be5d1e69
R fd5bd78c383b3a5ac313c836d503f5ef
U drh
Z 6ca21d53ba6df71519b0f06bf84205e6
P b6413a6dff8ac9b7088b1381afbbbf799e376455d11786530cc5fc825747ab53
R 178294a2ffbab5bdb66a3de75a26d638
U stephan
Z 39b6a8dbd3ac1d229c47b7711c3bc156
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
b6413a6dff8ac9b7088b1381afbbbf799e376455d11786530cc5fc825747ab53
6e511df500c63e27f932be9d601b641144562614dead99371477eca4594fb3fd