From 0831b3a9896d83da9ae7f854ee74bc58d54951a6 Mon Sep 17 00:00:00 2001 From: stephan Date: Mon, 30 Sep 2024 14:33:36 +0000 Subject: [PATCH] Generic build tinkering. FossilOrigin-Name: b6c1772ce0278988ecaea485c4feb8b0919fa1530f0c53b8321d9bd2277b5acd --- Makefile.in | 4 +- auto.def | 13 ++-- autosetup/hwaci-common.tcl | 123 ++++++++++++++++++++++--------------- manifest | 16 ++--- manifest.uuid | 2 +- 5 files changed, 92 insertions(+), 66 deletions(-) diff --git a/Makefile.in b/Makefile.in index aa984a53d5..9894a56ab9 100644 --- a/Makefile.in +++ b/Makefile.in @@ -122,8 +122,8 @@ RELEASE = @RELEASE@ # BEXE = @BUILD_EXEEXT@ TEXE = @TARGET_EXEEXT@ -BDLL = @BDLL@ -TDLL = @TDLL@ +BDLL = @BUILD_DLLEXT@ +TDLL = @TARGET_DLLEXT@ # The following variable is "1" if the configure script was able to locate # the tclConfig.sh file. It is an empty string otherwise. When this diff --git a/auto.def b/auto.def index 2a87e4b711..07476f1c71 100644 --- a/auto.def +++ b/auto.def @@ -164,7 +164,7 @@ proc add-shell-opt {args} { } } -hwaci-check-exeext +hwaci-exe-extension if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_UNIX 0 define SQLITE_OS_WIN 1 @@ -174,8 +174,7 @@ if {".exe" eq [get-define TARGET_EXEEXT]} { define SQLITE_OS_WIN 0 # todo? add -DSQLITE_OS_UNIX=1 to CFLAGS? } -define BDLL [hwaci-dll-extension build] -define TDLL [hwaci-dll-extension host] +hwaci-dll-extension ######### # Programs needed @@ -323,8 +322,6 @@ hwaci-if-opt-truthy with-debug { msg-result no } -hwaci-check-rpath - ######################################################################## # TCL... define HAVE_TCL 0 @@ -477,6 +474,8 @@ if {"" eq [get-define CFLAGS_JIMSH]} { }; # end of tcl +hwaci-check-rpath + ######################################################################## # Thread safety? msg-checking "Support threadsafe operation? " @@ -867,8 +866,8 @@ hwaci-if-opt-truthy dump-defines { global DUMP_DEFINES_FILE msg-result "--dump-defines is creating file: $DUMP_DEFINES_FILE" make-config-header $DUMP_DEFINES_FILE \ - -bare {OPT_FEATURE_FLAGS SQLITE_OS* SQLITE_DEBUG LDFLAGS_* USE_*} \ - -str {BIN_* CC LD AR} \ + -bare {SQLITE_OS* SQLITE_DEBUG USE_*} \ + -str {BIN_* CC LD AR LDFLAG* OPT_*} \ -auto {*} # achtung: ^^^^ whichever SQLITE_OS_foo flag which is set to 0 will # get _undefined_ here unless it's part of the -bare set. diff --git a/autosetup/hwaci-common.tcl b/autosetup/hwaci-common.tcl index b823d57c63..61d2c7d120 100644 --- a/autosetup/hwaci-common.tcl +++ b/autosetup/hwaci-common.tcl @@ -178,12 +178,15 @@ proc hwaci-if-opt-truthy {boolFlag thenScript {elseScript {}}} { } ######################################################################## -# If [hwaci-opt-truthy $flag] then [define $def $iftrue] else -# [define $def $iffalse]. Output [msg-checking $msg] and a -# [msg-results ...] which corresponds to the result. Returns 1 -# if the opt-truthy check passes, else 0. -proc hwaci-define-if-opt-truthy {flag def msg {iftrue 1} {iffalse 0}} { - msg-checking "$msg " +# If [hwaci-opt-truthy $flag] then [define $def $iftrue] else [define +# $def $iffalse]. If $msg is not empty, output [msg-checking $msg] and +# a [msg-results ...] which corresponds to the result. Returns 1 if +# the opt-truthy check passes, else 0. +proc hwaci-define-if-opt-truthy {flag def {msg ""} {iftrue 1} {iffalse 0}} { + if {"" ne $msg} { + msg-checking "$msg " + } + set rcMsg "" set rc 0 if {[hwaci-opt-truthy $flag]} { define $def $iftrue @@ -191,26 +194,27 @@ proc hwaci-define-if-opt-truthy {flag def msg {iftrue 1} {iffalse 0}} { } else { define $def $iffalse } - set msg [get-define $def] - switch -- $msg { - 0 { set msg no } - 1 { set msg yes } + switch -- [hwaci-val-truthy [get-define $def]] { + 0 { set rcMsg no } + 1 { set rcMsg yes } + } + if {"" ne $msg} { + msg-result $rcMsg } - msg-result $msg return $rc } ######################################################################## # Args: [-v] optName defName {descr {}} # -# Checks [hwaci-opt-truthy $optName] and does [define $defName X] where X is 0 -# for false and 1 for true. descr is an optional [msg-checking] -# argument which defaults to $defName. Returns X. +# Checks [hwaci-opt-truthy $optName] and calls [define $defName X] +# where X is 0 for false and 1 for true. descr is an optional +# [msg-checking] argument which defaults to $defName. Returns X. # # If args[0] is -v then the boolean semantics are inverted: if # the option is set, it gets define'd to 0, else 1. Returns the # define'd value. -proc hwaci-set-bool-01 {args} { +proc hwaci-opt-define-bool {args} { set invert 0 if {[lindex $args 0] eq "-v"} { set invert 1 @@ -450,21 +454,19 @@ proc hwaci-looks-like-windows {{key host}} { ######################################################################## # Looks at either the 'host' (==compilation target platform) or -# 'build' (==the being-built-on platform) define value and returns a -# file extension for DLLs on that platform, including the leading ".". +# 'build' (==the being-built-on platform) define value and returns if +# if that value seems to indicate that it represents a Mac platform, +# else returns 0. # # TODO: have someone verify whether this is correct for the # non-Linux/BSD platforms. -proc hwaci-dll-extension {{key host}} { +proc hwaci-looks-like-mac {{key host}} { switch -glob -- [get-define $key] { *apple* { - return ".dylib" - } - *-*-ming* - *-*-cygwin - *-*-msys { - return ".dll" + return 1 } default { - return ".so" + return 0 } } } @@ -475,24 +477,41 @@ proc hwaci-dll-extension {{key host}} { # build environment is then BUILD_EXEEXT is [define]'d to ".exe", else # "". If the target, a.k.a. "host", is then TARGET_EXEEXT is # [define]'d to ".exe", else "". -proc hwaci-check-exeext {} { - msg-checking "Build host is Windows-esque? " - if {[hwaci-looks-like-windows build]} { - define BUILD_EXEEXT ".exe" - msg-result yes - } else { - define BUILD_EXEEXT "" - msg-result no - } - - msg-checking "Build target is Windows-esque? " +proc hwaci-exe-extension {} { + set rH "" + set rB "" if {[hwaci-looks-like-windows host]} { - define TARGET_EXEEXT ".exe" - msg-result yes - } else { - define TARGET_EXEEXT "" - msg-result no + set rH ".exe" } + if {[hwaci-looks-like-windows build]} { + set rB ".exe" + } + define BUILD_EXEEXT $rH + define TARGET_EXEEXT $rB +} + +######################################################################## +# Works like hwaci-exe-extension except that it defines BUILD_DLLEXT +# and TARGET_DLLEXT to one of (.so, ,dll, .dylib). +# +# TODO: have someone verify whether this is correct for the +# non-Linux/BSD platforms. +proc hwaci-dll-extension {} { + proc inner {key} { + switch -glob -- [get-define $key] { + *apple* { + return ".dylib" + } + *-*-ming* - *-*-cygwin - *-*-msys { + return ".dll" + } + default { + return ".so" + } + } + } + define BUILD_DLLEXT [inner host] + define TARGET_DLLEXT [inner build] } ######################################################################## @@ -577,17 +596,25 @@ proc hwaci-check-emsdk {} { # Tries various approaches to handling the -rpath link-time # flag. Defines LDFLAGS_RPATH to that/those flag(s) or an empty # string. Returns 1 if it finds an option, else 0. +# +# Achtung: we have seen platforms which report that a given option +# checked here will work but then fails at build-time, and the current +# order of checks reflects that. proc hwaci-check-rpath {} { - if {[cc-check-flags -Wl,-R/tmp]} { - define LDFLAGS_RPATH "-Wl,-R[get-define libdir]" - return 1 - } elseif {[cc-check-flags -Wl,-rpath -Wl,/tmp]} { - define LDFLAGS_RPATH "-Wl,-rpath -Wl,[get-define libdir]" - return 1 - } else { - define LDFLAGS_RPATH "" - return 0 + set rc 1 + cc-with {} { + if {[cc-check-flags {-rpath /tmp}]} { + define LDFLAGS_RPATH "-rpath [get-define prefix]/lib" + } elseif {[cc-check-flags {-Wl,-rpath -Wl,/tmp}]} { + define LDFLAGS_RPATH "-Wl,-rpath -Wl,[get-define prefix]/lib" + } elseif {[cc-check-flags -Wl,-R/tmp]} { + define LDFLAGS_RPATH "-Wl,-R[get-define prefix]/lib" + } else { + define LDFLAGS_RPATH "" + set rc 0 + } } + return $rc } ######################################################################## diff --git a/manifest b/manifest index aeed538d8d..9fdc001756 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C Get\slibsqlite3.so\sbuilding. -D 2024-09-28T14:51:10.851 +C Generic\sbuild\stinkering. +D 2024-09-30T14:33:36.764 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724 -F Makefile.in 697e01f6bf783c56ccf80c31dcd58165b5a95469e4b5db716ffe70c48fccfbaa +F Makefile.in ce7b7897eddee0804eedae6daf7b5cd1e47d85cf9c01d9d74afc21fe6b2f8f5a 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 62bfff338c701174786e6613c30c2be7b98563dbdd1eaaaa3b4156165ee46d53 +F auto.def 1ea8aca38be00ded65793227d845c1766d2255c03eacb6a20ae6a14e304d5f64 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 bc7611bd7122b0308453bf0353ef81ae4658744f7ef67e5e53f3033551ddcac6 +F autosetup/hwaci-common.tcl 0d8454627c9e8352d9483cbe065a5a42cd885f3c8db3ddcadf4aaae1b5ac81c3 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 b9faebbb543fb3a03f46dd4defe28ffa0c32a9a46ed73912f93b86e41f3db04a -R d30efb2f23fa7708ccc4acb26fa1caa0 +P c65e3679e0d28e980bb555b47f31690b27915d9ff0850f598e3bed528b18ca1d +R bebdd95eae12b76bf27e689681ef2876 U stephan -Z 22dfd7e3022119773556b9c0d01ecb08 +Z ea887720f1ab42cb508d0a1d2d23ebe1 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 635d73158a..dc0f6a5d8c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -c65e3679e0d28e980bb555b47f31690b27915d9ff0850f598e3bed528b18ca1d +b6c1772ce0278988ecaea485c4feb8b0919fa1530f0c53b8321d9bd2277b5acd