From 2a5694910ab9f4f7be34decd340156ad336cab4e Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 3 Apr 2025 13:24:38 +0000 Subject: [PATCH] Add the --static-cli-shell configure flag to the canonical build, which works like --static-tclsqlite3 but applies to the CLI shell (statically linking it, which only works if all requisite libs are available in static form). It is not called --static-shell because that flag has a completely different legacy meaning in the autoconf build and this flight might eventually be added to that build, so would collide there. FossilOrigin-Name: fd2c1638ecc38617f5de0380ad23f233d1159be0712ae2ca4cae5c99e841f1b1 --- Makefile.in | 1 + auto.def | 9 +++++++-- autosetup/sqlite-config.tcl | 19 ++++++++++++++++++- main.mk | 15 ++++++++++++++- manifest | 19 +++++++++---------- manifest.uuid | 2 +- 6 files changed, 50 insertions(+), 15 deletions(-) diff --git a/Makefile.in b/Makefile.in index 3a43cc50a4..9f33492b2d 100644 --- a/Makefile.in +++ b/Makefile.in @@ -260,6 +260,7 @@ LINK_TOOLS_DYNAMICALLY ?= @LINK_TOOLS_DYNAMICALLY@ AMALGAMATION_GEN_FLAGS ?= --linemacros=@AMALGAMATION_LINE_MACROS@ EXTRA_SRC ?= @AMALGAMATION_EXTRA_SRC@ STATIC_TCLSQLITE3 = @STATIC_TCLSQLITE3@ +STATIC_CLI_SHELL = @STATIC_CLI_SHELL@ # # CFLAGS for sqlite3$(T.exe) diff --git a/auto.def b/auto.def index df6f067bf0..8281888cc7 100644 --- a/auto.def +++ b/auto.def @@ -46,8 +46,6 @@ sqlite-configure canonical { define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] - proj-define-for-opt static-tclsqlite3 STATIC_TCLSQLITE3 "Statically link tclsqlite3?" - if {[set fsan [join [opt-val asan-fsanitize] ","]] in {auto ""}} { set fsan address,bounds-strict } @@ -56,4 +54,11 @@ sqlite-configure canonical { sqlite-handle-tcl sqlite-handle-emsdk + proj-if-opt-truthy static-shells { + proj-opt-set static-tclsqlite3 1 + proj-opt-set static-cli-shell 1 + } + proj-define-for-opt static-tclsqlite3 STATIC_TCLSQLITE3 "Statically link tclsqlite3?" + proj-define-for-opt static-cli-shell STATIC_CLI_SHELL "Statically link CLI shell?" + } diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 23c7d6fcfd..4d144e5626 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -224,7 +224,7 @@ proc sqlite-configure {buildMode configScript} { {canonical} { static-tclsqlite3=0 => {Statically-link tclsqlite3. This only works if TCL support is - enabled and the libs tclsqlite3 needs are all available in + enabled and all requisite libraries are available in static form. Note that glibc is unable to fully statically link certain libraries required by tclsqlite3, so this won't work on most Linux environments.} @@ -281,6 +281,21 @@ proc sqlite-configure {buildMode configScript} { } {canonical} { + # Note that --static-cli-shell has a completely different + # meaning from --static-shell in the autoconf build! + # --[disable-]static-shell is a legacy flag which we can't + # remove without breaking downstream builds. We _could_ + # recycle the name --static-shell here, as this flag is + # (currently) independent of the one in the autoconf build, + # but that would likely lead to confusion. + static-cli-shell=0 + => {Statically-link the sqlite3 CLI shell. + This only works if the requisite libraries are all available in + static form.} + + static-shells=0 + => {Shorthand for --static-cli-shell --static-tclsqlite3} + with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. Needed only by ext/wasm. Default=EMSDK env var.} @@ -295,6 +310,8 @@ proc sqlite-configure {buildMode configScript} { packaging { {autoconf} { # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 + # Note that this has a different meaning from --static-cli-shell in the + # canonical build! static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} } diff --git a/main.mk b/main.mk index 26314b3db8..47c61653ed 100644 --- a/main.mk +++ b/main.mk @@ -1431,7 +1431,7 @@ tclsqlite-stubs.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON) # STATIC_TCLSQLITE3 = 1 to statically link tclsqlite3, else # 0. Requires static versions of all requisite libraries. Primarily # intended for use with static-friendly environments like Alpine -# Linux. +# Linux. It won't work on glibc-based systems. # STATIC_TCLSQLITE3 ?= 0 # @@ -2104,6 +2104,18 @@ threadtest5: sqlite3.c $(TOP)/test/threadtest5.c $(T.link) $(TOP)/test/threadtest5.c sqlite3.c -o $@ $(LDFLAGS.libsqlite3) xbin: threadtest5 +# +# STATIC_CLI_SHELL = 1 to statically link sqlite3$(T.exe), else +# 0. Requires static versions of all requisite libraries. Primarily +# intended for use with static-friendly environments like Alpine +# Linux. +# +STATIC_CLI_SHELL ?= 0 +# +# sqlite3shell.flags.N = N is $(STATIC_CLI_SHELL) +# +sqlite3shell.flags.1 = -static +sqlite3shell.flags.0 = # # When building sqlite3$(T.exe) we specifically embed a copy of # sqlite3.c, and not link to libsqlite3.so or libsqlite3.a, because @@ -2116,6 +2128,7 @@ xbin: threadtest5 sqlite3$(T.exe): shell.c sqlite3.c $(T.link) -o $@ \ shell.c sqlite3.c \ + $(sqlite3shell.flags.$(STATIC_CLI_SHELL)) \ $(CFLAGS.readline) $(SHELL_OPT) $(CFLAGS.icu) \ $(LDFLAGS.libsqlite3) $(LDFLAGS.readline) # diff --git a/manifest b/manifest index feea4bbd4d..c58b0309c5 100644 --- a/manifest +++ b/manifest @@ -1,10 +1,10 @@ -C Add\sthe\s--static-tclsqlite3\sconfigure\sflag\s(canonical\sbuild\sonly)\sto\sbuild\stclsqlite3\sas\sa\sstatic\sbinary.\sThis\swill\sonly\swork\son\ssystems\swhich\shave\sstatic\sversions\sof\sall\srequisite\slibraries. -D 2025-04-03T00:46:34.141 +C Add\sthe\s--static-cli-shell\sconfigure\sflag\sto\sthe\scanonical\sbuild,\swhich\sworks\slike\s--static-tclsqlite3\sbut\sapplies\sto\sthe\sCLI\sshell\s(statically\slinking\sit,\swhich\sonly\sworks\sif\sall\srequisite\slibs\sare\savailable\sin\sstatic\sform).\sIt\sis\snot\scalled\s--static-shell\sbecause\sthat\sflag\shas\sa\scompletely\sdifferent\slegacy\smeaning\sin\sthe\sautoconf\sbuild\sand\sthis\sflight\smight\seventually\sbe\sadded\sto\sthat\sbuild,\sso\swould\scollide\sthere. +D 2025-04-03T13:24:38.684 F .fossil-settings/binary-glob 61195414528fb3ea9693577e1980230d78a1f8b0a54c78cf1b9b24d0a409ed6a x F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 57de35a9052fe38caa88ee8d81c884c37383160518daec42ffce12b44d848402 +F Makefile.in 6fabbdf631cae9fb53a9926130da019f8e3b8838fcc561a4a37e7f4ba5b14812 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc bb2cc6f75bbcb2d690fbdd1489914a2febd5e99bad9c77538cb3330d304694c6 F README.md a953c0cffd6e4f2501a306c00ee2b6e1e6630c25031e094629307fe99dd003d1 @@ -15,7 +15,7 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def 05e0308a9c2adcd13059f5956f1568e7fa05dbc9cd5109436bfa19bd4dcfc020 +F auto.def 30d67e36e62a5db6a4faa0594d81386046a988ad2c20c76d8c9fa426b4106911 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac F autoconf/Makefile.in 66d98d473556c4e2daf7252355f4b5db129091800027f280082804eb4c45784f F autoconf/Makefile.msc 5bc67d3912444c40c6f96d003e5c90663e51abb83d204a520110b1b2038dcd8b @@ -52,7 +52,7 @@ F autosetup/find_tclconfig.tcl e64886ffe3b982d4df42cd28ed91fe0b5940c2c5785e126c1 F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/proj.tcl b3c30cd29f16fdf76196c11391038d7fee32e1cfac2a47546dc058df1c0e075a -F autosetup/sqlite-config.tcl 286524d08fa4f4d1d024a8398559499bc83516480c50259d07e51444b6d2f5c7 +F autosetup/sqlite-config.tcl e098453e03d13bd1cff3c7f48db98c74f4ff0ab3c1ce6a5e40871a1e74315249 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl eb4c6578e08dd353263958da0dc620f8400b869a50d06e271ab0be85a51a08d3 @@ -709,7 +709,7 @@ F ext/wasm/tests/opfs/sahpool/sahpool-pausing.js f264925cfc82155de38cecb3d204c36 F ext/wasm/tests/opfs/sahpool/sahpool-worker.js bd25a43fc2ab2d1bafd8f2854ad3943ef673f7c3be03e95ecf1612ff6e8e2a61 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 13da3ab171667064178b4a364100d03cdb34ff3048e3705df61a96088f1127a5 +F main.mk 6a5fb65a70b6de957ab21e3cbfc0c1c9483fa3360201d85eecb082345f6412eb F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2216,9 +2216,8 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P 9e903953ba986df98435da40e94fdb645f6f72279552cba63ef50cec1fe3b486 06f1143870280d335daf4e7027fe8771e34415aa1234fe72c0c450c347b8146c -R f0791f372d19a167ec2ab11f3ba8dad4 -T +closed 06f1143870280d335daf4e7027fe8771e34415aa1234fe72c0c450c347b8146c +P 61836324369e3213841295911aed4f8439a4b2b0f24820c2cf45bb68a0e2cd04 +R 8cb72016593f661ec1b70664fca522d9 U stephan -Z 7aefb2f5ec601c89d2a0e909a620b105 +Z 1ce8105ce198761cc8609ef51909976a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 4d06d0051a..13897d9287 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -61836324369e3213841295911aed4f8439a4b2b0f24820c2cf45bb68a0e2cd04 +fd2c1638ecc38617f5de0380ad23f233d1159be0712ae2ca4cae5c99e841f1b1 -- 2.47.2