diff --git a/auto.def b/auto.def index 5dab1f8555..a11560fb56 100644 --- a/auto.def +++ b/auto.def @@ -313,13 +313,8 @@ if {"" eq [proj-bin-define install]} { # compiling binaries for the target system (CC a.k.a. $(T.cc)). # Normally they're the same, but they will differ when # cross-compiling. -set defaultCFlags {-g -O2} -if {[file exists .default-CFLAGS]} { - set defaultCFlags [proj-file-content -trim .default-CFLAGS] -} -define CFLAGS [get-env CFLAGS $defaultCFlags] -unset defaultCFlags -define BUILD_CFLAGS [get-env BUILD_CFLAGS {-g}] +define CFLAGS [proj-get-env CFLAGS {-g -O2}] +define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}] ######################################################################## # Handle --with-wasi-sdk=DIR @@ -652,8 +647,8 @@ sqlite-check-tcl # in-tree (it's part of autosetup) unless --with-tclsh=X is used, in # which case prefix X. # -# Returns the name of the TCL it selects. Fails fatally if it cannot -# detect a TCL appropriate for code generation. +# Returns the human-readable name of the TCL it selects. Fails fatally +# if it cannot detect a TCL appropriate for code generation. # # Defines: # @@ -661,13 +656,11 @@ sqlite-check-tcl # to an unexpanded makefile var name. # # - CFLAGS_JIMSH = any flags needed for buildng a BTCLSH-compatible -# jimsh. +# jimsh. The defaults may be pass on to configure as +# CFLAGS_JIMSH=... proc sqlite-determine-codegen-tcl {} { msg-result "Checking for TCL to use for code generation... " - define CFLAGS_JIMSH {-O1} ; # Re. -O# flag: jimsh runs much faster when built - # with with -O2 but it takes ages to compile. -O1 - # provides a fair compromise between build and run - # speeds. + define CFLAGS_JIMSH [proj-get-env CFLAGS_JIMSH {-O1}] set cgtcl [opt-val with-tclsh jimsh] set flagsToRestore {CC CFLAGS CPPFLAGS LDFLAGS LINKFLAGS LIBS CROSS} define-push $flagsToRestore { diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index d386d4d499..a1e77a482a 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -1090,3 +1090,29 @@ proc proj-redirect-autoconf-dir-vars {} { #puts "$x $makeVar = [get-define $makeVar]" } } + +######################################################################## +# If a file named .env-$flag exists, this function returns a +# trimmed copy of its contents, else it returns $dflt. The intended +# usage is that things like developer-specific CFLAGS preferences can +# be stored in .env-CFLAGS. +proc proj-default-flags {flag {dflt ""}} { + set fn ".env-${flag}" + if {[file readable $fn]} { + return [proj-file-content -trim $fn] + } + return $dflt +} + +######################################################################## +# Extracts the value of "environment" variable $var from the first of +# the following places where it's defined: +# +# - Passed to configure as $var=... +# - A file named .env-$var (see [proj-default-flags]) +# - Exists as an environment variable +# +# If none of those are set, $dflt is returned. +proc proj-get-env {var {dflt ""}} { + return [get-env $var [proj-default-flags $var $dflt]] +} diff --git a/manifest b/manifest index 2c2ee4fbb4..7d5859740b 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\sa\sCFLAGS.jimsh\stypo\sin\sMakefile.in.\sChange\sdefault\sjimsh\sflags\sto\sinclude\s-O1,\swhich\sslows\sdown\sits\sbuild\sbut\sspeeds\sup\sits\sruntime\sconsiderably. -D 2024-11-03T20:15:38.645 +C Move\sthe\s.default-CFLAGS\shandling\sinto\sa\sutility\sfunction,\srename\sthe\scorresponding\sfile\sto\s.env-VAR,\sand\sapply\sthat\slookup\sto\sa\scouple\smore\splaces. +D 2024-11-03T21:32:24.526 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md c5b4009dca54d127d2d6033c22fd9cc34f53bedb6ef12c7cbaa468381c74ab28 @@ -13,7 +13,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 b69dd467437cf572cb084cd9e515b30e35cfc866f80d5dd778cbed409aaf71e5 +F auto.def 19b5df445fab703133f430b1169968d702cf421d752199ee77d11626062f7755 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac @@ -49,7 +49,7 @@ F autosetup/cc.tcl 7e2fe943ae9d45cf39e9f5b05b6230df8e719415edea5af06c30eb68680bd F autosetup/default.auto 5cdf016de2140e50f1db190a02039dc42fb390af1dda4cc4853e3042a9ef0e82 F autosetup/jimsh0.c 9860c2bd7825cb9d21616237e59a2dfa29acbd98c00da5f842e5abe222e69288 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl d0008015b481ed5a4e952b72e703a905ba232f979a3740614d2ea716a19f6718 +F autosetup/proj.tcl 8f81f61b427b91b30983f0b2a9c169b453099ed4a209f526d0843df5ad1610e9 F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9 @@ -2198,8 +2198,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 832abe8a8a347718e47f73a1f9be1fb084a1c28cac6b1c70f6c9a9cabeb0fb53 -R 5e0f5bfa6d8e8c09888bb4531f17a3c6 +P a912c169152623f261fb5469a49f00aca1d8a273d8f7187744de12a26aede7cf +R a550a6f064acac325701eee77b42038f U stephan -Z 192b376f24b23f1b797dc7a2c01813b1 +Z 180f9d1639b03db412606e42d092a67a # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 26c6506ad0..637b15dc31 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -a912c169152623f261fb5469a49f00aca1d8a273d8f7187744de12a26aede7cf +f01b61f21d105706e78eb1e3e7971e9ccb7a68250f8cda96ce285f0fd6b2f7f2