From cda0d6fd74be85b7b915cda38d1a92bca34eb50a Mon Sep 17 00:00:00 2001 From: stephan Date: Thu, 26 Sep 2024 12:16:46 +0000 Subject: [PATCH] Cleanups of the --with-wasi-sdk bits. Straighten out VERSION vs RELEASE. FossilOrigin-Name: 7638f3ad1588ff16c2980763c6c4c1386a711acd64adb21c465f186a47bc975d --- Makefile.in | 37 +++++++++++++++++------------------ auto.def | 40 +++++++++++++++++++++++--------------- autosetup/hwaci-common.tcl | 25 +++++++++++++++++++++++- manifest | 16 +++++++-------- manifest.uuid | 2 +- 5 files changed, 75 insertions(+), 45 deletions(-) diff --git a/Makefile.in b/Makefile.in index 69e0736801..a230b991df 100644 --- a/Makefile.in +++ b/Makefile.in @@ -27,7 +27,7 @@ AR = @AR@ # C Compiler and options for use in building executables that # will run on the platform that is doing the build. # -BCC = @CC_FOR_BUILD@ +BCC = @BUILD_CC@ @BUILD_CFLAGS@ # TODO: @BUILD_CFLAGS@ # #XX## TCC is the C Compile and options for use in building executables that @@ -37,22 +37,22 @@ BCC = @CC_FOR_BUILD@ #XX## on the "make" command-line. Ex: "make CC=clang CFLAGS=-fsanitize=undefined" #XX## CC = @CC@ -CFLAGS = @CPPFLAGS@ @CFLAGS@ -#TODO: figure out how to get autosetup to do CC_FOR_TARGET. -#XX#TCC = ${CC} ${CFLAGS} -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/icu -#XX#TCC += -I${TOP}/ext/fts3 -I${TOP}/ext/async -I${TOP}/ext/session -#XX#TCC += -I${TOP}/ext/userauth -#XX# -#XX## Define this for the autoconf-based build, so that the code knows it can -#XX## include the generated sqlite_cfg.h -#XX## -#XX#TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite -#XX# -#XX## Define -DNDEBUG to compile without debugging (i.e., for production usage) -#XX## Omitting the define will cause extra debugging code to be inserted and -#XX## includes extra comments when "EXPLAIN stmt" is used. -#XX## -#XX#TCC += @TARGET_DEBUG@ +CFLAGS ?= @CFLAGS@ +CPPFLAGS ?= @CPPFLAGS@ +TCC = ${CC} ${CFLAGS} -I. -I${TOP}/src -I${TOP}/ext/rtree -I${TOP}/ext/icu +TCC += -I${TOP}/ext/fts3 -I${TOP}/ext/async -I${TOP}/ext/session +TCC += -I${TOP}/ext/userauth + +# Define this for the autoconf-based build, so that the code knows it can +# include the generated sqlite_cfg.h +# +TCC += -D_HAVE_SQLITE_CONFIG_H -DBUILD_sqlite + +# Define -DNDEBUG to compile without debugging (i.e., for production usage) +# Omitting the define will cause extra debugging code to be inserted and +# includes extra comments when "EXPLAIN stmt" is used. +# +TCC += @TARGET_DEBUG@ #XX# #XX## Compiler options needed for programs that use the TCL library. #XX## @@ -111,8 +111,7 @@ TCC += @LDFLAGS_ZLIB@ # Version numbers and release number for the SQLite being compiled. # VERSION = @VERSION@ -#XX#VERSION_NUMBER = @VERSION_NUMBER@ -#XX#RELEASE = @RELEASE@ +RELEASE = @RELEASE@ # Filename extensions for binaries # diff --git a/auto.def b/auto.def index 6cac92c5c7..641cfa7807 100644 --- a/auto.def +++ b/auto.def @@ -67,9 +67,12 @@ options { set srcdir $autosetup(srcdir) #puts "srcdir = $srcdir" -set VERSION [readfile $autosetup(srcdir)/VERSION] -puts "VERSION = $VERSION" +set RELEASE [readfile $autosetup(srcdir)/VERSION] +regsub {([0-9]*\.*[0-9]*).*} $RELEASE {\1} VERSION define VERSION $VERSION +define RELEASE $RELEASE +puts "RELEASE = $RELEASE" +puts "VERSION = $VERSION" #puts "with-wasi-sdk? = [opt-val with-wasi-sdk]" #puts "with-debug? = [opt-val with-debug]" @@ -79,6 +82,8 @@ if {![file exists sqlite3.pc.in]} { set outOfTreeBuild 1 } +cc-check-tools ld ar + # # The build process allows for using a cross-compiler. But the default # action is to target the same platform that we are running on. The @@ -185,6 +190,9 @@ if {"" eq [hwaci-bin-define install]} { # XXX fi # XXX AC_SUBST BUILD_CC +define BUILD_CC [get-define CC_FOR_BUILD] +define BUILD_CFLAGS [get-env CFLAGS {-g}] + ########## # Handle --with-wasi-sdk=DIR # @@ -201,15 +209,18 @@ if {1} { define WASI_SDK_DIR "" } else { msg-checking "Checking WASI SDK directory \[$wasiSdkDir]... " - if {![file exists $wasiSdkDir/bin/clang]} { - user-error "--with-wasi-sdk=${wasiSdkDir} directory does not contain bin/clang" - } - msg-result "using wasi-sdk clang, disabling: tcl, CLI shell, DLL, threading" + puts "prefix = [prefix $wasiSdkDir/bin {clang ld}]" + hwaci-affirm-files-exist -v {*}[prefix "$wasiSdkDir/bin/" {clang wasm-ld}] + msg-result "Using wasi-sdk clang, disabling: tcl, CLI shell, DLL, loadable extensions, threading" define HAVE_WASI_SDK 1 define WASI_SDK_DIR $wasiSdkDir - hwaci-opt-set tcl 0 - hwaci-opt-set threadsafe 0 + hwaci-opt-set load-extension 0; # ==> --disable-load-extension + hwaci-opt-set threadsafe 0; # ==> --threadsafe + 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 # Changing --host and --target have no effect here except to possibly @@ -224,13 +235,9 @@ if {1} { # XXX CC="${wasiSdkDir}/bin/clang" # XXX LD="${wasiSdkDir}/bin/wasm-ld" # XXX RANLIB="${wasiSdkDir}/bin/llvm-ranlib" - # set cross_compiling yes - # hwaci-opt-set threadsafe 0 - # set use_tcl no - # hwaci-opt-set tcl 0 - # libtool is apparently hard-coded to use gcc for linking DLLs, so - # we disable the DLL build... - # set enable_shared no + define CC "${wasiSdkDir}/bin/clang" + define LD "${wasiSdkDir}/bin/wasm-ld" + #define STRIP "${wasiSdkDir}/bin/strip" } unset wasiSdkDir }; # --wasi-sdk-dir @@ -737,6 +744,7 @@ foreach {boolFlag featureFlag ifSetEvalThis} { } } +define ENABLE_SHARED $enable_shared ######### # Generate the output files. @@ -775,7 +783,7 @@ hwaci-if-opt-truthy dump-defines { # achtung: ^^^^ whichever SQLITE_OS_foo flag which is set to 0 will # get _undefined_ here unless it's part of the -bare set. if {0} { - foreach x $::define { + foreach x [all-defines] { puts "\t$x" } } diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index ca458b7407..166ea18db2 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -122,7 +122,7 @@ proc hwaci-opt-set {flag {val 1}} { # Returns 1 if $val appears to be a truthy value, else returns # 0. Truthy values are any of {1 on enabled yes} proc hwaci-val-truthy {val} { - return [expr {$val in {1 on enabled yes}}] + expr {$val in {1 on enabled yes}} } ######################################################################## @@ -435,6 +435,29 @@ proc hwaci-check-exeext {} { } } +######################################################################## +# Expects a list of file names. If any one of them does not exist in +# the filesystem, it fails fatally with an informative message. +# Returns the last file name it checks. If the first argument is -v +# then it emits msg-checking/msg-result messages for each file. +proc hwaci-affirm-files-exist {args} { + set rc "" + set verbose 1 + if {[lindex $args 0] eq "-v"} { + set verbose 1 + set args [lrange $args 1 end] + } + foreach f $args { + if {$verbose} { msg-checking "looking for file... " } + if {![file exists $f]} { + user-error "not found: $f" + } + if {$verbose} { msg-result "$f" } + set rc $f + } + return rc +} + ######################################################################## # Emscripten is used for doing in-tree builds of web-based WASM stuff, # as opposed to WASI-based WASM or WASM binaries we import from other diff --git a/manifest b/manifest index 0561850002..84305538bd 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Merge\scurrent\strunk\sinto\sthis\sbranch. -D 2024-09-26T08:53:37.393 +C Cleanups\sof\sthe\s--with-wasi-sdk\sbits.\sStraighten\sout\sVERSION\svs\sRELEASE. +D 2024-09-26T12:16:46.672 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in dee85c233bbfcdf21bc843ecec065c650b0a4c677e87af9bdf50cdf3c3179df7 +F Makefile.in c9d2e625e2f79127e28e1691e4514ae3c2c426af650cb3e1d59737e89f66f7dc F Makefile.linux-gcc f3842a0b1efbfbb74ac0ef60e56b301836d05b4d867d014f714fa750048f1ab6 F Makefile.msc e3c4723c27464acc31da4420b808c8d2690180ba2b915897bece0a9d5d2cecf6 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 caf598afa0fb40cb86bbfa24be170984a16095b36e317c99f3d2521858e89d9c +F auto.def d2d9c2d473a81551ddd29a155c375fa31a068e05b2227862a24a2e84c00a0bdf 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 1b52de228642c1db5a714d54ca974d723ec8b4092e8c3765d348b625850f7311 F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 -F autosetup/hwaci-common.tcl 48465634f1fc73ac30ad747e1d1d1ec897f009ce40edf94092575d9851a61846 +F autosetup/hwaci-common.tcl b2b8b94915baaa68f5355c3753835095da6290e0fccb22b6f5fa024a452400bc F autosetup/jimsh0.c 1b5fe91fffcddbc29f2b16acb80f1650632ea2edbe8336b8155ef7b4c66f6d8d F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb @@ -2233,8 +2233,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 c419168938b009b2cf8a42a01272971497b5329792ccb8cef235f47ab5f142e2 9592b9ba3ad7a842cdd4c4010da278485a6fdec7e811bda01ebe640162a8c3b6 -R af319e126fc6fc33c648f8f6f76c92f2 +P 683a9e1e2f68a5c34fe524867576a4405fa2460880ad0bf4c07799744fea4192 +R ad6080b33e617c2bb00e20e12e921109 U stephan -Z b233c57887cfbb961cc652ff444473d0 +Z 6dde9c36df32e2200ff90b427b0efc9c # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 15e6e68ed7..72d66ab700 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -683a9e1e2f68a5c34fe524867576a4405fa2460880ad0bf4c07799744fea4192 +7638f3ad1588ff16c2980763c6c4c1386a711acd64adb21c465f186a47bc975d