]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Tweak build to fall back to system-side tclsh if we cannot find realpath() or _fullpa...
authorstephan <stephan@noemail.net>
Fri, 27 Sep 2024 02:35:41 +0000 (02:35 +0000)
committerstephan <stephan@noemail.net>
Fri, 27 Sep 2024 02:35:41 +0000 (02:35 +0000)
FossilOrigin-Name: b31dbb9945d0ac5e22d146565443bcdc0dd1a1c83034cfb5867b2303ada2bdea

Makefile.in
auto.def
manifest
manifest.uuid

index abe06b63cc0fa43712e9a65cbf76ae14a38e4a6d..0b76e01e3fb211f915684c00b920f1cb45eaf639 100644 (file)
@@ -128,8 +128,7 @@ HAVE_TCL = @HAVE_TCL@
 # This is the command to use for tclsh - normally just "tclsh", but we may
 # know the specific version we want to use
 #
-# TCLSH_CMD = @TCLSH_CMD@
-TCLSH_CMD = exit 1
+TCLSH_CMD = @TCLSH_CMD@
 
 # Additional options when running tests using testrunner.tcl
 # This is usually either blank, or else --status
@@ -692,7 +691,7 @@ libtclsqlite3.la_1 = libtclsqlite3.la
 # are what get build when you type just "make" with no arguments.
 #
 
-all:   sqlite3.h
+all:   sqlite3.h sqlite3.c shell.c
 #all:  libsqlite3.la $(SQLITE3_SHELL_TARGET) \
 #XX#  $(libtclsqlite3.la_$(HAVE_TCL))
 
@@ -768,8 +767,13 @@ src-verify:        $(TOP)/tool/src-verify.c
 # flags.
 #
 JIMSH = @srcdir@/jimsh
+@if CFLAGS_JIMSH
 $(JIMSH): $(TOP)/autosetup/jimsh0.c Makefile
-       $(BCC) -o $(JIMSH) -DHAVE_REALPATH $<
+       $(BCC) -o $(JIMSH) @CFLAGS_JIMSH@ $<
+@endif
+
+TCL_GENERATOR = @TCL_GENERATOR@
+$(TCL_GENERATOR):
 
 #XX#
 #XX#verify-source:     ./src-verify
@@ -881,30 +885,30 @@ has_tclsh85:
 # files are automatically generated.  This target takes care of
 # all that automatic generation.
 #
-.target_source:        $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c $(JIMSH) # has_tclsh84
+.target_source:        $(SRC) $(TOP)/tool/vdbe-compress.tcl fts5.c $(TCL_GENERATOR) # has_tclsh84
        rm -rf tsrc
        mkdir tsrc
        cp -f $(SRC) tsrc
        rm tsrc/sqlite.h.in tsrc/parse.y
-       $(JIMSH) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
+       $(TCL_GENERATOR) $(TOP)/tool/vdbe-compress.tcl $(OPTS) <tsrc/vdbe.c >vdbe.new
        mv vdbe.new tsrc/vdbe.c
        cp fts5.c fts5.h tsrc
        touch .target_source
 
 sqlite3.c:     .target_source $(TOP)/tool/mksqlite3c.tcl src-verify \
-               $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) $(EXTRA_SRC)
+               $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/tool/mksqlite3c.tcl $(AMALGAMATION_LINE_MACROS) $(EXTRA_SRC)
        cp tsrc/sqlite3ext.h .
        cp $(TOP)/ext/session/sqlite3session.h .
 
-sqlite3r.h: sqlite3.h $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h
+sqlite3r.h: sqlite3.h $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/tool/mksqlite3h.tcl $(TOP) --enable-recover >sqlite3r.h
 
-sqlite3r.c: sqlite3.c sqlite3r.h $(JIMSH) # has_tclsh84
+sqlite3r.c: sqlite3.c sqlite3r.h $(TCL_GENERATOR) # has_tclsh84
        cp $(TOP)/ext/recover/sqlite3recover.c tsrc/
        cp $(TOP)/ext/recover/sqlite3recover.h tsrc/
        cp $(TOP)/ext/recover/dbdata.c tsrc/
-       $(JIMSH) $(TOP)/tool/mksqlite3c.tcl --enable-recover $(AMALGAMATION_LINE_MACROS) $(EXTRA_SRC)
+       $(TCL_GENERATOR) $(TOP)/tool/mksqlite3c.tcl --enable-recover $(AMALGAMATION_LINE_MACROS) $(EXTRA_SRC)
 
 sqlite3ext.h:  .target_source
        cp tsrc/sqlite3ext.h .
@@ -1203,12 +1207,12 @@ mksourceid$(BEXE):      $(TOP)/tool/mksourceid.c
 
 # Rules to build opcodes.c and opcodes.h
 #
-opcodes.c:     opcodes.h $(TOP)/tool/mkopcodec.tcl $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
+opcodes.c:     opcodes.h $(TOP)/tool/mkopcodec.tcl $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/tool/mkopcodec.tcl opcodes.h >opcodes.c
 
 opcodes.h:     parse.h $(TOP)/src/vdbe.c \
-               $(TOP)/tool/mkopcodeh.tcl $(JIMSH) # has_tclsh84
-       cat parse.h $(TOP)/src/vdbe.c | $(JIMSH) $(TOP)/tool/mkopcodeh.tcl >opcodes.h
+               $(TOP)/tool/mkopcodeh.tcl $(TCL_GENERATOR) # has_tclsh84
+       cat parse.h $(TOP)/src/vdbe.c | $(TCL_GENERATOR) $(TOP)/tool/mkopcodeh.tcl >opcodes.h
 
 # Rules to build parse.c and parse.h - the outputs of lemon.
 #
@@ -1219,8 +1223,8 @@ parse.c:  $(TOP)/src/parse.y lemon$(BEXE)
        ./lemon$(BEXE) $(OPT_FEATURE_FLAGS) $(OPTS) -S parse.y
 
 sqlite3.h:     $(TOP)/src/sqlite.h.in $(TOP)/manifest mksourceid$(BEXE) \
-               $(TOP)/VERSION $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
+               $(TOP)/VERSION $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/tool/mksqlite3h.tcl $(TOP) >sqlite3.h
 
 #XX#sqlite3rc.h:       $(TOP)/src/sqlite3.rc $(TOP)/VERSION has_tclsh84
 #XX#   echo '#ifndef SQLITE_RESOURCE_VERSION' >$@
@@ -1265,8 +1269,8 @@ SHELL_DEP = \
     $(TOP)/src/test_windirent.c \
     $(TOP)/src/test_windirent.h
 
-shell.c:       $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/tool/mkshellc.tcl >shell.c
+shell.c:       $(SHELL_DEP) $(TOP)/tool/mkshellc.tcl $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/tool/mkshellc.tcl >shell.c
 #XX#
 #XX#
 #XX#
@@ -1353,8 +1357,8 @@ fts5parse.c:      $(TOP)/ext/fts5/fts5parse.y lemon$(BEXE)
 
 fts5parse.h: fts5parse.c
 
-fts5.c: $(FTS5_SRC) $(JIMSH) # has_tclsh84
-       $(JIMSH) $(TOP)/ext/fts5/tool/mkfts5c.tcl
+fts5.c: $(FTS5_SRC) $(TCL_GENERATOR) # has_tclsh84
+       $(TCL_GENERATOR) $(TOP)/ext/fts5/tool/mkfts5c.tcl
        cp $(TOP)/ext/fts5/fts5.h .
 
 #XX#fts5.lo:   fts5.c $(HDR) $(EXTHDR)
@@ -1715,7 +1719,7 @@ clean:    tidy
 # Clean up everything.  No exceptions.
 #
 distclean:     clean
-       rm -f sqlite_cfg.h config.log config.status $(JIMSH) Makefile $(LIBTOOL)
+       rm -f sqlite_cfg.h config.log config.status $(TCL_GENERATOR) Makefile $(LIBTOOL)
 
 #XX##
 #XX## Windows section
index 4b81ce9f16081cff8a2c41a69dd78f4fcdbf44bf..4d96682408f3c423a60d907c27d0a6293d2204a6 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -87,7 +87,6 @@ if {![file exists sqlite3.pc.in]} {
 
 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
 # configure script needs to discover the following properties of the
@@ -245,6 +244,20 @@ if {1} {
   unset wasiSdkDir
 }; # --wasi-sdk-dir
 
+########
+# Check which TCL to use as a code generator
+define CFLAGS_JIMSH {}
+puts "Looking for path-resolution function for JimTCL... "
+define TCL_GENERATOR "\$(JIMSH)"
+if {[cc-check-functions realpath]} {
+  define-append CFLAGS_JIMSH -DHAVE_REALPATH
+} elseif {[cc-check-functions _fullpath]} {
+  # _fullpath() is a Windows API
+  define-append CFLAGS_JIMSH -DHAVE__FULLPATH
+} else {
+  puts "Cannot find realpath() or _fullpath(). Falling back to system's TCL for code generation."
+}
+
 #########
 # Enable large file support (if special flags are necessary)
 cc-check-lfs
@@ -295,18 +308,19 @@ hwaci-if-opt-truthy with-debug {
   msg-result no
 }
 
-if {1} {
-  # Temporary quick hack for finding "a" tclsh. TODO is port the
-  # full-featured check which lives in the elseif part of this block.
+define HAVE_TCL 0
+define TCLSH_CMD {exit 1}
+if {"" eq [get-define CFLAGS_JIMSH]} {
+  # We can't use JimTCL for in-tree generation on this system, so...
   #
-  # Also TODO is figure out whether we can use jimtcl for our internal
-  # build-tool uses (as opposed to testing purposes, which requires
-  # the tcl SQLite module).
+  # Temporary solution for finding "a" tclsh. TODO is port the
+  # full-featured check which lives in the elseif part of this block.
   set tclsh [hwaci-first-bin-of tclsh8.6 tclsh tclsh9.0]
   if {"" eq $tclsh} {
     user-error "Cannot find tclsh, which is required to build certain files."
   }
   define TCLSH_CMD $tclsh
+  define TCL_GENERATOR $tclsh
   define HAVE_TCL 0 ; # until the following elseif block is ported
 } elseif {0} {
   # Porting this section of configure.ac is going to be a bit of a slog...
index 4641f3848dbb828333d115c53d097e3e2abb1b75..a38775c4c1e09ec0d365155df7e8e99240c5434c 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C Run\sall\sof\sthe\sTCL-based\scode\sgenerators\susing\sJimTCL.
-D 2024-09-27T01:42:52.890
+C Tweak\sbuild\sto\sfall\sback\sto\ssystem-side\stclsh\sif\swe\scannot\sfind\srealpath()\sor\s_fullpath()\sfor\sJimTCL\s(needed\sfor\ssome\sof\sthe\scode\sgenerator\sscripts\sto\swork).
+D 2024-09-27T02:35:41.157
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
-F Makefile.in ab329ecf862e1fca897c944c638ab7e4501ce963e68bc36189409f2da0fa805d
+F Makefile.in 9bdbffc3a2c1b609d855b6b6daa7769b8a12cd56d156f99420a2a9243831bd0c
 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 dfd9fca19386af90ef9a32b3e6428e9c868fe5b98bec2a5d46bf397617d86b5d
+F auto.def 73d6e09e94dbe2a11c26524d2448c81a7bc5fdb52c2378396138d57ddbf058bb
 F autoconf/INSTALL 83e4a25da9fd053c7b3665eaaaf7919707915903
 F autoconf/Makefile.am adedc1324b6a87fdd1265ddd336d2fb7d4f36a0e77b86ea553ae7cc4ea239347
 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac
@@ -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 c365d8e1f7aa19e424f60f976db683c3ccb489900124811541e02d47f9a1cbe3
-R 6deba968ac63d8a58c958b1d9fa280a1
+P 3193b86a91d8096be68cb83133c7665129694521d7da81bf725e285c229271f7
+R c9ebfe69a4af214d35d57aa4421c3f6e
 U stephan
-Z 4c81e3416eed085f7fee6ec13899f0d9
+Z 2d082ca6d901dc26c8447cb73e030ab8
 # Remove this line to create a well-formed Fossil manifest.
index 3bb145c9c548c55c12f2af5ed244566c1b49be1d..67187e8b4059ad4487cf761750a056a85e168b3a 100644 (file)
@@ -1 +1 @@
-3193b86a91d8096be68cb83133c7665129694521d7da81bf725e285c229271f7
+b31dbb9945d0ac5e22d146565443bcdc0dd1a1c83034cfb5867b2303ada2bdea