From 49bb81844c883b9442cbd3d1092dce84a9edee70 Mon Sep 17 00:00:00 2001 From: stephan Date: Wed, 9 Oct 2024 05:28:29 +0000 Subject: [PATCH] Generic build cleanups. FossilOrigin-Name: 2cd213b38748d93134dc88b25aada4741838eaed683e44d5cc7837a6586fa4cf --- Makefile.in | 35 ++++++++++++++++++--------- auto.def | 48 +++++++++++++++++++++----------------- autosetup/hwaci-common.tcl | 21 ++++++++++++----- manifest | 16 ++++++------- manifest.uuid | 2 +- 5 files changed, 74 insertions(+), 48 deletions(-) diff --git a/Makefile.in b/Makefile.in index 17f4853bbb..3fd42f3ebe 100644 --- a/Makefile.in +++ b/Makefile.in @@ -749,12 +749,17 @@ LDFLAGS_libsqlite = \ # either results in building libsqlite3.so, builds sqlite3.c # directly, links in either of $(LIBOBJSO) or $(LIBOBJS1). +@if ENABLE_SHARED $(libsqlite3.DLL): $(LIBOBJ) $(TLINK) -o $@ \ @SHOBJ_LDFLAGS@ $(LIBOBJ) $(TLIBS) \ $(LDFLAGS_libsqlite) dll: $(libsqlite3.DLL) all: dll +@else +$(libsqlite3.DLL): + @echo "Build of $@ was explicitly disabled."; exit 1 +@endif $(libsqlite3.LIB): $(LIBOBJ) $(AR) crs $@ $(LIBOBJ) @@ -803,7 +808,9 @@ sqlite3$(TEXE): shell.c sqlite3.c shell.c sqlite3.c \ $(LDFLAGS_libsqlite) $(LDFLAGS_READLINE) cli: sqlite3$(TEXE) +@if !HAVE_WASI_SDK all: cli +@endif install-cli: sqlite3$(TEXT) $(install.bindir) $(INSTALL) -s sqlite3$(TEXT) "$(install.bindir)" @@ -848,11 +855,14 @@ srcck1$(BEXE): $(TOP)/tool/srcck1.c $(BCC) -o srcck1$(BEXE) $(TOP)/tool/srcck1.c sourcetest: srcck1$(BEXE) sqlite3.c - ./srcck1 sqlite3.c + ./srcck1$(BEXE) sqlite3.c -src-verify: $(TOP)/tool/src-verify.c +src-verify$(BEXE): $(TOP)/tool/src-verify.c $(BCC) -o src-verify$(BEXE) $(TOP)/tool/src-verify.c +verify-source: ./src-verify$(BEXE) + ./src-verify$(BEXE) $(TOP) + # # JimTCL is part of the autosetup suite and is suitable for all # current in-tree code-generation TCL jobs, but it requires that we @@ -875,9 +885,6 @@ $(JIMSH): $(TOP)/autosetup/jimsh0.c BTCL = @BTCL@ $(BTCL): -#XX# -#XX#verify-source: ./src-verify -#XX# ./src-verify $(TOP) #XX# #XX#fuzzershell$(TEXE): $(TOP)/tool/fuzzershell.c sqlite3.c sqlite3.h #XX# $(TLINK) -o $@ $(FUZZERSHELL_OPT) \ @@ -1839,12 +1846,18 @@ distclean: clean #XX# $(TCC) -shared -o $@ sqlite3.def \ #XX# -Wl,"--strip-all" $(REAL_LIBOBJ) #XX# -#XX## -#XX## Fiddle app -#XX## -#XX#fiddle: sqlite3.c shell.c -#XX# make -C ext/wasm fiddle emcc_opt=-Os -#XX# + +# +# Fiddle app +# +@if EMCC_WRAPPER +fiddle: sqlite3.c shell.c + make -C ext/wasm fiddle emcc_opt=-Os +@else +fiddle: + @echo "Configure script did not find emcc, so fiddle build is not available."; exit 1 +@endif + #XX## #XX## Spell-checking for source comments #XX## The sources checked are either C sources or C source templates. diff --git a/auto.def b/auto.def index 42de230636..ae9499781f 100644 --- a/auto.def +++ b/auto.def @@ -2,14 +2,13 @@ global autosetup use cc cc-db cc-shared cc-lib hwaci-common set DUMP_DEFINES_FILE defines.list -set enable_shared 1 +define ENABLE_SHARED 1 # Are we cross compiling? set cross_compiling 0 if {[get-define host] ne [get-define build]} { set cross_compiling 1 } -define cross_compiling ${cross_compiling} ######################################################################## # A very long story made short, autosetup's --flag handling has @@ -172,7 +171,7 @@ proc add-shell-opt {args} { } } -hwaci-exe-extension +hwaci-file-extensions if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_UNIX 0 define SQLITE_OS_WIN 1 @@ -182,8 +181,6 @@ if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_WIN 0 # todo? add -DSQLITE_OS_UNIX=1 to CFLAGS? } -hwaci-dll-extension -hwaci-lib-extension ######### # Programs needed @@ -219,7 +216,6 @@ define BUILD_CFLAGS [get-env CFLAGS {-g}] # # It's unclear whether we can actually get away with making these # changes to the autosetup environment. -# if {1} { set wasiSdkDir [opt-val with-wasi-sdk] ; # ??? [lindex [opt-val with-wasi-sdk] end] #puts "x wasiSdkDir=$wasiSdkDir foo=[lindex [opt-val with-wasi-sdk] end]" @@ -231,13 +227,13 @@ if {1} { define HAVE_WASI_SDK 1 define WASI_SDK_DIR $wasiSdkDir hwaci-opt-set load-extension 0; # ==> --disable-load-extension - hwaci-opt-set threadsafe 0; # ==> --threadsafe + hwaci-opt-set threadsafe 0; # ==> --threadsafe=0 hwaci-opt-set tcl 0; # ==> --disable-tcl define HAVE_TCL 0 set cross_compiling 1 # libtool is apparently hard-coded to use gcc for linking DLLs, so # we disable the DLL build. - set enable_shared 0 + define ENABLE_SHARED 0 # Changing --host and --target have no effect here except to possibly # cause confusion. autoconf has finished processing them by this @@ -420,6 +416,12 @@ proc hwaci-check-tcl {} { define HAVE_TCL $use_tcl define TCL_CONFIG_SH $cfg + # The historical configure.ac sources tclConfig.sh so that it can + # use the several TCL_... env vars. We obviously cannot do that from + # TCL, so we apply a level of indirection. If the config is not + # available, this generates empty-string entries for the various + # options we're interested in. + eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"] # puts "hwaci-check-tcl: with_tclsh=$with_tclsh" # puts "hwaci-check-tcl: with_tcl=$with_tcl" # puts "hwaci-check-tcl: cfg=$cfg" @@ -428,13 +430,6 @@ proc hwaci-check-tcl {} { hwaci-check-tcl -# The historical configure.ac sources tclConfig.sh so that it can use -# the several TCL_... env vars. We obviously cannot do that from TCL, -# so we apply a level of indirection. Note that if the config is not -# available, this generates empty-string entries for the various -# options we're interested in. -eval [exec "${top_srcdir}/tool/tclConfigShToTcl.sh" "[get-define TCL_CONFIG_SH]"] - ######################################################################## # Check which TCL to use as a code generator. Prefer jimsh simply # because we have it in-tree (it's part of autosetup). @@ -667,6 +662,8 @@ hwaci-if-opt-truthy math { msg-result "Disabling math SQL functions" } +define cross_compiling ${cross_compiling} + ######################################################################## # Emscripten SDK for building the web-based wasm components. # @@ -681,11 +678,18 @@ if {[hwaci-check-emsdk]} { catch {exec rm -f $srcdir/tool/emcc.sh} } -proc affirm-have-math {} { +######################################################################## +# Check for log(3) in libm and die with an error if it is not +# found. $why should be the feature name which requires that function +# (it's used only in error messages). defines LDFLAGS_MATH to the +# required linker flags (which may be empty even if the math APIs are +# found, depending on the OS). +proc affirm-have-math {why} { if {![hwaci-check-function-in-lib log m]} { - user-error "Missing required math APIs" + user-error "Missing math APIs for $why" } define LDFLAGS_MATH [get-define lib_log ""] + undefine lib_log } ######################################################################## @@ -698,8 +702,8 @@ foreach {boolFlag featureFlag ifSetEvalThis} { hwaci-opt-set rtree hwaci-opt-set session } - fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math} - fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math} + fts4 -DSQLITE_ENABLE_FTS4 {affirm-have-math fts4} + fts5 -DSQLITE_ENABLE_FTS5 {affirm-have-math fts5} geopoly -DSQLITE_ENABLE_GEOPOLY {hwaci-opt-set rtree} rtree -DSQLITE_ENABLE_RTREE {} session {-DSQLITE_ENABLE_SESSION -DSQLITE_ENABLE_PREUPDATE_HOOK} {} @@ -715,8 +719,10 @@ foreach {boolFlag featureFlag ifSetEvalThis} { } { hwaci-if-opt-truthy $boolFlag { add-feature-flag $featureFlag - msg-result "Enabling $boolFlag" eval $ifSetEvalThis + if {"all" ne $boolFlag} { + msg-result "Enabling $boolFlag" + } } { msg-result "Not enabling $boolFlag" } @@ -758,8 +764,6 @@ if {0 && "" ne [get-define CFLAGS_JIMSH]} { define-append CFLAGS_JIMSH -DHAVE_LONG_LONG; # SQLite relies on long long, so we know it's available }; # JimTCL -define ENABLE_SHARED $enable_shared - ######################################################################## # Determine proper rpath-handling flags diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index b0d6fec99c..35ba1b3819 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -512,6 +512,9 @@ proc hwaci-exe-extension {} { # Works like hwaci-exe-extension except that it defines BUILD_DLLEXT # and TARGET_DLLEXT to one of (.so, ,dll, .dylib). # +# Trivia: for .dylib files, the linker needs the -dynamiclib flag +# instead of -shared. +# # TODO: have someone verify whether this is correct for the # non-Linux/BSD platforms. proc hwaci-dll-extension {} { @@ -539,9 +542,6 @@ proc hwaci-dll-extension {} { proc hwaci-lib-extension {} { proc inner {key} { switch -glob -- [get-define $key] { - *apple* { - return ".a" - } *-*-ming* - *-*-cygwin - *-*-msys { return ".lib" } @@ -554,6 +554,14 @@ proc hwaci-lib-extension {} { define TARGET_LIBEXT [inner host] } +######################################################################## +# Calls all of the hwaci-*-extension functions. +proc hwaci-file-extensions {} { + hwaci-exe-extension + hwaci-dll-extension + hwaci-lib-extension +} + ######################################################################## # Expects a list of file names. If any one of them does not exist in # the filesystem, it fails fatally with an informative message. @@ -561,7 +569,7 @@ proc hwaci-lib-extension {} { # then it emits msg-checking/msg-result messages for each file. proc hwaci-affirm-files-exist {args} { set rc "" - set verbose 1 + set verbose 0 if {[lindex $args 0] eq "-v"} { set verbose 1 set args [lrange $args 1 end] @@ -589,6 +597,7 @@ proc hwaci-affirm-files-exist {args} { # --with-emsdk=DIR or the $EMSDK environment variable. # - EMSDK_ENV = path to EMSDK_HOME/emsdk_env.sh or "" # - BIN_EMCC = $EMSDK_HOME/upstream/emscripten/emcc or "" +# - HAVE_EMSDK = 0 or 1 (this function's return value) # # Returns 1 if EMSDK_ENV is found, else 0. If EMSDK_HOME is not empty # but BIN_EMCC is then emcc was not found in the EMSDK_HOME, in which @@ -648,9 +657,9 @@ proc hwaci-check-rpath {} { # downstream tests may fail because the resulting rpath gets # implicitly injected into them. cc-with {} { - if {[cc-check-flags {-rpath $lp}]} { + if {[cc-check-flags "-rpath $lp"]} { define LDFLAGS_RPATH "-rpath $lp" - } elseif {[cc-check-flags {-Wl,-rpath -Wl,$lp}]} { + } elseif {[cc-check-flags "-Wl,-rpath -Wl,$lp"]} { define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp" } elseif {[cc-check-flags -Wl,-R$lp]} { define LDFLAGS_RPATH "-Wl,-R$lp" diff --git a/manifest b/manifest index bd34874480..a632b291e5 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C More\swork\son\sthe\s--with-tcl\sbits. -D 2024-10-09T04:27:03.784 +C Generic\sbuild\scleanups. +D 2024-10-09T05:28:29.735 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 660f7cdb7efa0ca81955eeaa923cf2ca4224394b26ad48c6e3827812473d7f35 +F Makefile.in 3d059a8dba41c3134fbf9a9501aee8e70b4ebfaa9e0f258004bf2885e774ba27 F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc 9c6d80d9d103fa42e931f4c464884a5e577fae8563acc7589bff4e43fbe8f864 F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -14,7 +14,7 @@ F art/icon-80x90.gif 65509ce3e5f86a9cd64fe7fca2d23954199f31fe44c1e09e208c80fb83d F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 -F auto.def dbe13ac57def26db322a1f757d56a058b7bdf291a7446d6cbb5ba8a07427e592 +F auto.def 606f65a487c5ef875859a0a8cccbb87c41e6725a8552ec3b0a8b9d9d1519d3d1 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -46,7 +46,7 @@ F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795f F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bde14 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 -F autosetup/hwaci-common.tcl fcb479deea42c54d5486d20b811a00b3880f8dc597afac41145463cc5d58cdae +F autosetup/hwaci-common.tcl 8bb16ac39af463ad58a499a12ab3c813e003d6d7dd8ed90f94375b05ae4cdbd4 F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb @@ -2236,8 +2236,8 @@ F vsixtest/vsixtest.tcl 6195aba1f12a5e10efc2b8c0009532167be5e301abe5b31385638080 F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0 -P 4e4a740369d3edc58d35c660b1ea73ee381503f82a98a4b770fd07cef1704e8b -R 5a4df385433704c071e534c0acd78587 +P 4d4cc49b6a886fef9a7b3af78a7b752c199045904a1bf74912adae2e8fd360ad +R 03792e2dee1fc3db74b33e1210d2352d U stephan -Z f2c20cd58d6329de3edbd05f7dbd96d4 +Z 17a57a3c16f20db47faf261d6adb40b0 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index d0ea55ab84..aae4532baa 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -4d4cc49b6a886fef9a7b3af78a7b752c199045904a1bf74912adae2e8fd360ad +2cd213b38748d93134dc88b25aada4741838eaed683e44d5cc7837a6586fa4cf