Add --download-version flag to ext/wasm/version-info.c and correct dist target's output version format to match.

FossilOrigin-Name: 6f2a40d06dd9a56491d27928ed3785e08308c7dcea2b3f768097fc98ba91a910
This commit is contained in:
stephan 2022-10-26 06:05:44 +00:00
parent e896ba94e3
commit 419e0d3e09
5 changed files with 38 additions and 14 deletions

View File

@ -187,7 +187,7 @@ else
$(info Development build. Use '$(MAKE) release' for a smaller release build.)
endif
bin.version-info := $(dir.wasm)/bin.version-info
bin.version-info := $(dir.wasm)/version-info
# ^^^^ NOT in $(dir.tmp) because we need it to survive the cleanup
# process for the dist build to work properly.
$(bin.version-info): $(dir.wasm)/version-info.c $(sqlite3.h) $(MAKEFILE)

View File

@ -79,7 +79,7 @@ dist: \
@$(bin.stripccomments) -k -k < $(sqlite3.js) \
> $(dist-dir.jswasm)/$(notdir $(sqlite3.js))
@cp -p $(dist.common.extras) $(dist-dir.common)
@vnum=$$($(bin.version-info) --version-number); \
@vnum=$$($(bin.version-info) --download-version); \
vdir=sqlite-wasm-$$vnum; \
arczip=$$vdir.zip; \
echo "Making $$arczip ..."; \

View File

@ -12,15 +12,22 @@
** This file simply outputs sqlite3 version information in JSON form,
** intended for embedding in the sqlite3 JS API build.
*/
#ifdef TEST_VERSION
/*3029003 3039012*/
#define SQLITE_VERSION "X.Y.Z"
#define SQLITE_VERSION_NUMBER TEST_VERSION
#define SQLITE_SOURCE_ID "dummy"
#else
#include "sqlite3.h"
#endif
#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(" --download-version Emit /download.html version number (3XXYYZZ)");
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");
@ -31,6 +38,8 @@ int main(int argc, char const * const * argv){
int fJson = 0;
int fVersion = 0;
int fVersionNumber = 0;
int fDlVersion = 0;
int dlVersion = 0;
int fSourceInfo = 0;
int fQuote = 0;
int nFlags = 0;
@ -43,6 +52,8 @@ int main(int argc, char const * const * argv){
fVersion = 1;
}else if( 0==strcmp("version-number", zArg) ){
fVersionNumber = 1;
}else if( 0==strcmp("download-version", zArg) ){
fDlVersion = 1;
}else if( 0==strcmp("source-id", zArg) ){
fSourceInfo = 1;
}else if( 0==strcmp("json", zArg) ){
@ -59,13 +70,24 @@ int main(int argc, char const * const * argv){
}
if( 0==nFlags ) fJson = 1;
{
const int v = SQLITE_VERSION_NUMBER;
int ver[4] = {0,0,0,0};
ver[0] = (v / 1000000) * 1000000;
ver[1] = v % 1000000 / 100 * 1000;
ver[2] = v % 100 * 100;
dlVersion = ver[0] + ver[1] + ver[2] + ver[3];
}
if( fJson ){
printf("{\"libVersion\": \"%s\", "
"\"libVersionNumber\": %d, "
"\"sourceId\": \"%s\"}"/*missing newline is intentional*/,
"\"sourceId\": \"%s\","
"\"downloadVersion\": %d}"/*missing newline is intentional*/,
SQLITE_VERSION,
SQLITE_VERSION_NUMBER,
SQLITE_SOURCE_ID);
SQLITE_SOURCE_ID,
dlVersion);
}else{
if(fQuote) printf("%c", '"');
if( fVersion ){
@ -74,6 +96,8 @@ int main(int argc, char const * const * argv){
printf("%d", SQLITE_VERSION_NUMBER);
}else if( fSourceInfo ){
printf("%s", SQLITE_SOURCE_ID);
}else if( fDlVersion ){
printf("%d", dlVersion);
}
if(fQuote) printf("%c", '"');
puts("");

View File

@ -1,5 +1,5 @@
C Add\sdoc\spage\slink\sto\sthe\swasm\sdist\sREADME.txt.
D 2022-10-25T16:57:42.914
C Add\s--download-version\sflag\sto\sext/wasm/version-info.c\sand\scorrect\sdist\starget's\soutput\sversion\sformat\sto\smatch.
D 2022-10-26T06:05:44.732
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@ -472,7 +472,7 @@ F ext/userauth/sqlite3userauth.h 7f3ea8c4686db8e40b0a0e7a8e0b00fac13aa7a3
F ext/userauth/user-auth.txt e6641021a9210364665fe625d067617d03f27b04
F ext/userauth/userauth.c 7f00cded7dcaa5d47f54539b290a43d2e59f4b1eb5f447545fa865f002fc80cb
F ext/wasm/EXPORTED_FUNCTIONS.fiddle.in 27450c8b8c70875a260aca55435ec927068b34cef801a96205adb81bdcefc65c
F ext/wasm/GNUmakefile ef0b2ab599c5e2fd89fe7620920319de73df36f1c8fe2ef4e745fa0e30ecc608
F ext/wasm/GNUmakefile 7a8c06f9bdbb791f8ef084ecd47e099da81e5797b9b1d60e33ac9a07eedd5dbd
F ext/wasm/README-dist.txt 2d670b426fc7c613b90a7d2f2b05b433088fe65181abead970980f0a4a75ea20
F ext/wasm/README.md 1e5b28158b74ab3ffc9d54fcbc020f0bbeb82c2ff8bbd904214c86c70e8a3066
F ext/wasm/api/EXPORTED_FUNCTIONS.sqlite3-api 36f413ab4dbb057d2dec938fb366ac0a4c5e85ba14660a8d672f0277602c0fc5
@ -510,7 +510,7 @@ F ext/wasm/demo-worker1-promiser.html 1de7c248c7c2cfd4a5783d2aa154bce62d74c6de98
F ext/wasm/demo-worker1-promiser.js f68ffbbe1c6086e18ce7961b8fc2b40dd88db174f59052e228c06b07484945ca
F ext/wasm/demo-worker1.html 2c178c1890a2beb5a5fecb1453e796d067a4b8d3d2a04d65ca2eb1ab2c68ef5d
F ext/wasm/demo-worker1.js 8ba51d94c4601fa5c313d9e59b63b238f5305b5d5739ad21f4782a0161e6682e
F ext/wasm/dist.make b3b156061ff6a35ce59715632c9446cb58e0fc497021a93c778fed051a04fde1
F ext/wasm/dist.make b687dc07db2dc9669369f126ac42c4ff6539dce2531063a0e75405c74a3cee1d
F ext/wasm/fiddle.make 68abe5dcfdd6fdf8dc1b715b94b96fae771b5b28bc1843997b9b1ec79407f2c9
F ext/wasm/fiddle/emscripten.css 3d253a6fdb8983a2ac983855bfbdd4b6fa1ff267c28d69513dd6ef1f289ada3f
F ext/wasm/fiddle/fiddle-worker.js 7ee53ca846071de5d46bb11a2a269a7990ef9cfd8abfae2a25cc948499783d78
@ -534,7 +534,7 @@ F ext/wasm/test-opfs-vfs.js 48fc59110e8775bb43c9be25b6d634fc07ebadab7da8fbd44889
F ext/wasm/tester1-worker.html d02b9d38876b023854cf8955e77a40912f7e516956b4dbe1ec7f215faac273ee
F ext/wasm/tester1.html c6c47e5a8071eb09cb1301104435c8e44fbb5719c92411f5b2384a461f9793c5
F ext/wasm/tester1.js 12741d4ff6015fc14fa9a397e6f9130bbda699067bbceca23d5a228138271735
F ext/wasm/version-info.c 5fa356d38859d71a0369b5c37e1935def7413fcc8a4e349a39d9052c1d0479f4
F ext/wasm/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd72273503ae7d5
F ext/wasm/wasmfs.make ee0004813e16c283ff633e08b482008d56adf9b7d42f6c5612f7ab002b924f69
F install-sh 9d4de14ab9fb0facae2f48780b874848cbf2f895 x
F ltmain.sh 3ff0879076df340d2e23ae905484d8c15d5fdea8
@ -2037,8 +2037,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 ff4fc29c38b78dfd471e25942304cba352469d6018f1c09158172795dbdd438c
R f599aafebad5f34bada7ffb876eb7b23
P c2380668d9a2ad04f6f27ef052190bda17cdb112895e93b94ae1da70db6983c8
R b38f83a008231bedbea9fc9c1ad80f86
U stephan
Z 2dc58cd7e46ee3c816a1b578eeb79113
Z 6ac73cda6074f1cdcaf9b0a6a58d82e1
# Remove this line to create a well-formed Fossil manifest.

View File

@ -1 +1 @@
c2380668d9a2ad04f6f27ef052190bda17cdb112895e93b94ae1da70db6983c8
6f2a40d06dd9a56491d27928ed3785e08308c7dcea2b3f768097fc98ba91a910