]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
Remove some dead auto.def code. Link tclsqlite3 shell against the .so instead of...
authorstephan <stephan@noemail.net>
Tue, 29 Oct 2024 03:29:45 +0000 (03:29 +0000)
committerstephan <stephan@noemail.net>
Tue, 29 Oct 2024 03:29:45 +0000 (03:29 +0000)
FossilOrigin-Name: 9a259026ae2dce5d60b80bd7d662a6e73734e51056f4a4226c3fa5ac636b5e3a

auto.def
autosetup/proj.tcl
main.mk
manifest
manifest.uuid

index d246a840869787a18c148d62a7f9aa63b671fb71..97a3179ae18f8c9b56c2fe45b9aa819ca6442987 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -231,7 +231,6 @@ foreach arg $::autosetup(argv) {
   define-append SQLITE_AUTORECONFIG '$arg'
 }
 
-
 # Are we cross-compiling?
 set cross_compiling [proj-is-cross-compiling]
 if {![file exists sqlite3.pc.in]} {
@@ -246,7 +245,7 @@ define OPT_SHELL {}         ; # CFLAGS for the sqlite3 CLI app
 # Adds $args, if not empty, to OPT_FEATURE_FLAGS.
 # If the first arg is -shell then it strips that arg
 # and passes the remaining args th sqlite-add-shell-opt
-# before adding them to OPF_FEATURE_FLAGS.
+# in addition to adding them to OPT_FEATURE_FLAGS.
 proc sqlite-add-feature-flag {args} {
   set shell ""
   if {"-shell" eq [lindex $args 0]} {
@@ -379,38 +378,23 @@ cc-check-includes \
   string.h strings.h \
   inttypes.h
 
-# These are optional for JimTCL but necessary if we want to use it for
-# code generation:
-cc-check-includes dirent.h sys/time.h
-
 if {[cc-check-includes zlib.h] && [proj-check-function-in-lib deflate z]} {
   # TODO: port over the more sophisticated zlib search from the fossil auto.def
-  define HAVE_ZLIB 1; # "-DSQLITE_HAVE_ZLIB=1"
+  define HAVE_ZLIB 1
   define LDFLAGS_ZLIB -lz
-  # Note that -DSQLITE_HAVE_ZLIB=1 is handled separately from the
-  # other feature flags in the autotools build. Do we need to emulate
-  # that?
   sqlite-add-shell-opt -DSQLITE_HAVE_ZLIB=1
 } else {
   define HAVE_ZLIB 0
   define LDFLAGS_ZLIB ""
 }
 
-#
-# Determine proper rpath-handling flags.
-#
-proj-check-rpath
+proj-check-rpath; # Determine proper rpath-handling flags.
 
-proj-define-if-opt-truthy shared ENABLE_SHARED \
-  "Build shared library?"
+proj-define-if-opt-truthy shared ENABLE_SHARED "Build shared library?"
 
-if {![proj-define-if-opt-truthy static ENABLE_STATIC \
-        "Build static library?"]} {
-  proj-warn "static lib build may be implicitly re-activated by other components, e.g. libtclsqlite3."
-}
+proj-define-if-opt-truthy static ENABLE_STATIC "Build static library?"
 
-proj-define-if-opt-truthy amalgamation USE_AMALGAMATION \
-  "Use amalgamation for builds?"
+proj-define-if-opt-truthy amalgamation USE_AMALGAMATION "Use amalgamation for builds?"
 
 proj-define-if-opt-truthy gcov USE_GCOV "Use gcov?"
 
@@ -420,8 +404,7 @@ proj-define-if-opt-truthy test-status TSTRNNR_OPTS \
 proj-define-if-opt-truthy linemacros AMALGAMATION_LINE_MACROS \
   "Use #line macros in the amalgamation:"
 
-msg-checking "Debug build? "
-
+msg-checking "SQLITE_DEBUG build? "
 proj-if-opt-truthy with-debug {
   define SQLITE_DEBUG 1
   define TARGET_DEBUG {-g -DSQLITE_DEBUG=1 -DSQLITE_ENABLE_SELECTTRACE -DSQLITE_ENABLE_WHERETRACE -O0 -Wall}
@@ -633,57 +616,59 @@ sqlite-check-tcl
 
 ########################################################################
 # Check which TCL to use as a code generator. Prefer jimsh simply
-# because we have it in-tree (it's part of autosetup).
-#
-# Building jimsh0.c with -DJIM_COMPAT changes certain behavior to be
-# compatible with canonical TCL. Specifically: jim's [expr] only
-# accepts one arg unless JIM_COMPAT is defined. As of 2024-10-23,
-# jimsh0.c defines JIM_COMPAT automatically (prior to that it intended
-# to but a typo of JIM_TCL_COMPAT made it a no-op).
-define CFLAGS_JIMSH {}
-msg-result "Which TCL to use for code generation... "
-set cgtcl [opt-val with-tclsh jimsh]
-if {"jimsh" ne $cgtcl} {
-  # When --with-tclsh=X is used, use that for all TCL purposes,
-  # including in-tree code generation, per developer request.
-  define BTCLSH "\$(TCLSH_CMD)"
-} else {
-  if {[cc-check-functions realpath]} {
-    define-append CFLAGS_JIMSH -DHAVE_REALPATH
-    define BTCLSH "\$(JIMSH)"
-  } elseif {[cc-check-functions _fullpath]} {
-    # _fullpath() is a Windows API
-    define-append CFLAGS_JIMSH -DHAVE__FULLPATH
-    define BTCLSH "\$(JIMSH)"
-  } elseif {[file exists [get-define TCLSH_CMD]]} {
-    set cgtcl [get-define TCLSH_CMD]
+# because we have it 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.
+proc sqlite-check-which-tcl {} {
+  msg-result "Checking for TCL to use for code generation... "
+  define CFLAGS_JIMSH {}
+  set cgtcl [opt-val with-tclsh jimsh]
+  if {"jimsh" ne $cgtcl} {
+    # When --with-tclsh=X is used, use that for all TCL purposes,
+    # including in-tree code generation, per developer request.
     define BTCLSH "\$(TCLSH_CMD)"
   } else {
-    # One last-ditch effort to find TCLSH_CMD: use info from
-    # tclConfig.sh to try to find a tclsh
-    if {"" eq [get-define TCLSH_CMD]} {
-      set tpre [get-define TCL_EXEC_PREFIX]
-      if {"" ne $tpre} {
-        set tv [get-define TCL_VERSION]
-        if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
-          define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
-        } elseif {[file-isexec "${tpre}/bin/tclsh"]} {
-          define TCLSH_CMD "${tpre}/bin/tclsh"
+    # These headers are technically optional for JimTCL but necessary if
+    # we want to use it for code generation:
+    set sysh [cc-check-includes dirent.h sys/time.h]
+    if {$sysh && [cc-check-functions realpath]} {
+      define-append CFLAGS_JIMSH -DHAVE_REALPATH
+      define BTCLSH "\$(JIMSH)"
+    } elseif {$sysh && [cc-check-functions _fullpath]} {
+      # _fullpath() is a Windows API
+      define-append CFLAGS_JIMSH -DHAVE__FULLPATH
+      define BTCLSH "\$(JIMSH)"
+    } elseif {[file exists [get-define TCLSH_CMD]]} {
+      set cgtcl [get-define TCLSH_CMD]
+      define BTCLSH "\$(TCLSH_CMD)"
+    } else {
+      # One last-ditch effort to find TCLSH_CMD: use info from
+      # tclConfig.sh to try to find a tclsh
+      if {"" eq [get-define TCLSH_CMD]} {
+        set tpre [get-define TCL_EXEC_PREFIX]
+        if {"" ne $tpre} {
+          set tv [get-define TCL_VERSION]
+          if {[file-isexec "${tpre}/bin/tclsh${tv}"]} {
+            define TCLSH_CMD "${tpre}/bin/tclsh${tv}"
+          } elseif {[file-isexec "${tpre}/bin/tclsh"]} {
+            define TCLSH_CMD "${tpre}/bin/tclsh"
+          }
+          unset tv
         }
-        unset tv
+        unset tpre
       }
-      unset tpre
-    }
-    set cgtcl [get-define TCLSH_CMD]
-    if {![file exists $cgtcl]} {
-      proj-fatal "Cannot find a tclsh to use for code generation."
+      set cgtcl [get-define TCLSH_CMD]
+      if {![file exists $cgtcl]} {
+        proj-fatal "Cannot find a tclsh to use for code generation."
+      }
+      define BTCLSH "\$(TCLSH_CMD)"
     }
-    define BTCLSH "\$(TCLSH_CMD)"
   }
-}
-msg-result "TCL for code generation: $cgtcl"
-unset cgtcl
-#define CFLAGS_JIMSH {-DJUST_TESTING}
+  return $cgtcl
+}; # sqlite-check-which-tcl
+msg-result "TCL for code generation: [sqlite-check-which-tcl]"
 
 # /TCL
 ########################################################################
@@ -739,7 +724,7 @@ if {1} {
 #
 #   - LDFLAGS_READLINE = linker flags or empty string
 #
-#   - CFLAGS_READLINE = compilation flags for clients or empty string
+#   - CFLAGS_READLINE = compilation flags for clients or empty string.
 #
 # Note that LDFLAGS_READLINE and CFLAGS_READLINE may refer to
 # linenoise or editline, not necessarily libreadline.
index 0b1613430c19194b7046fc3eb0a0e2b0fbab5793..e966b872e90f4cf689fd3a9d6da0004d952ced56 100644 (file)
@@ -15,7 +15,7 @@
 # This file was initially derived from one used in the libfossil
 # project, authored by the same person who ported it here, and this is
 # noted here only as an indication that there are no licensing issues
-# despite this code having at least two near-twins running around a
+# despite this code having a handful of near-twins running around a
 # handful of third-party source trees.
 #
 ########################################################################
@@ -80,8 +80,8 @@ proc proj-bold {str} {
 # immediately and then exits.
 proc proj-indented-notice {args} {
   set fErr ""
-  switch -exact -- [lindex $args 0] {
-    -error     { set args [lassign $args fErr] }
+  if {"-error" eq [lindex $args 0]} {
+    set args [lassign $args fErr]
   }
   set lines [split [join $args] \n]
   foreach line $lines {
@@ -177,14 +177,6 @@ proc proj-search-for-header-dir {header args} {
   return ""
 }
 
-########################################################################
-# If $v is true, [puts $msg] is called, else puts is not called.
-#proc proj-maybe-verbose {v msg} {
-#  if {$v} {
-#    puts $msg
-#  }
-#}
-
 ########################################################################
 # Usage: proj-find-executable-path ?-v? binaryName
 #
@@ -241,31 +233,19 @@ proc proj-bin-define {binName {defName {}}} {
 # caller has no sensible way of knowing which result it was unless
 # they pass only a single argument).
 proc proj-first-bin-of {args} {
+  set rc ""
   foreach b $args {
+    set u [string toupper $b]
+    # Note that cc-path-progs defines $u to false if it finds no match.
     if {[cc-path-progs $b]} {
-      set u [string toupper $b]
-      set x [get-define $u]
-      undefine $u
-      return $x
+      set rc [get-define $u]
     }
+    undefine $u
+    if {"" ne $rc} break
   }
   return ""
 }
 
-########################################################################
-# Looks for `bash` binary and dies if not found. On success, defines
-# BIN_BASH to the full path to bash and returns that value.
-#
-# TODO: move this out of this file and back into the 1 or 2 downstream
-# trees which use it.
-proc proj-require-bash {} {
-  set bash [proj-bin-define bash]
-  if {"" eq $bash} {
-    user-error "Cannot find required bash shell"
-  }
-  return $bash
-}
-
 ########################################################################
 # Returns 1 if the user specifically provided the given configure
 # flag, else 0. This can be used to distinguish between options which
@@ -818,114 +798,6 @@ proc proj-check-rpath {} {
   return $rc
 }
 
-########################################################################
-# Check for availability of libreadline.  Linking in readline varies
-# wildly by platform and this check does not cover all known options.
-# This detection is known to fail under the following conditions:
-#
-# - (pkg-config readline) info is either unavailable for libreadline or
-#   simply misbehaves.
-#
-# - Either of readline.h or libreadline are in an exotic place.
-#
-# Defines the following vars:
-#
-# - HAVE_READLINE: 0 or 1
-# - LDFLAGS_READLINE: "" or linker flags
-# - CFLAGS_READLINE: "" or c-flags
-#
-# Quirks:
-#
-# - If readline.h is found in a directory name matching *line then the
-#   resulting -I... flag points one directory _up_ from that, under
-#   the assumption that client-side code will #include
-#   <readline/readline.h>.
-#
-# Returns the value of HAVE_READLINE.
-proc proj-check-readline {} {
-  define HAVE_READLINE 0
-  define LDFLAGS_READLINE ""
-  define CFLAGS_READLINE ""
-  if {![opt-bool readline]} {
-    msg-result "libreadline disabled via --disable-readline."
-    return 0
-  }
-
-  if {[pkg-config-init 0] && [pkg-config readline]} {
-    define HAVE_READLINE 1
-    define LDFLAGS_READLINE [get-define PKG_READLINE_LDFLAGS]
-    define-append LDFLAGS_READLINE [get-define PKG_READLINE_LIBS]
-    define CFLAGS_READLINE [get-define PKG_READLINE_CFLAGS]
-    return 1
-  }
-
-  # On OpenBSD on a Raspberry pi 4:
-  #
-  # $ pkg-config readline; echo $?
-  # 0
-  # $ pkg-config --cflags readline
-  # Package termcap was not found in the pkg-config search path
-  # $ echo $?
-  # 1
-  # $ pkg-config --print-requires readline; echo $?
-  # 1
-  #
-  # i.e. there's apparently no way to find out that readline requires
-  # termcap beyond parsing the error message.  It turns out it doesn't
-  # want termcap, it wants -lcurses, but we don't get that info from
-  # pkg-config either.
-
-  # Look for readline.h
-  set rlInc ""
-  if {![proj-is-cross-compiling]} {
-    # ^^^ this check is derived from SQLite's legacy configure script
-    set rlInc [proj-search-for-header-dir readline.h \
-                 -subdirs {include/readline include}]
-    if {"" ne $rlInc} {
-      if {[string match */*line $rlInc]} {
-        # Special case: if the path includes .../*line/readline.h", set
-        # the -I to one dir up from that because our sources include
-        # <readline/readline.h> or <editline/readline.h>. Reminder: if
-        # auto.def is being run by jimsh0 then [file normalize] will not
-        # work!
-        set rlInc [file dirname $v]
-      }
-      set rlInc "-I${rlInc}"
-    }
-  }
-
-  # If readline.h was found/specified, look for libreadline...
-  set rlLib ""
-  if {"" ne $rlInc} {
-    set libTerm ""
-    if {[proj-check-function-in-lib tgetent {readline ncurses curses termcap}]} {
-      # ^^^ check extracted from an ancient autotools configure script.
-      set libTerm [get-define lib_tgetent]
-      undefine lib_tgetent
-    }
-    if {"readline" eq $libTerm} {
-      set rlLib $libTerm
-    } elseif {[proj-check-function-in-lib readline readline $libTerm]} {
-      set rlLib [get-define lib_readline]
-      lappend rlLib $libTerm
-      undefine lib_readline
-    }
-  }
-
-  if {"" ne $rlLib} {
-    set rlLib [join $rlLib]
-    define LDFLAGS_READLINE $rlLib
-    define CFLAGS_READLINE $rlInc
-    define HAVE_READLINE 1
-    msg-result "Using readline with flags: $rlInc $rlLib"
-    return 1
-  }
-
-  msg-result "libreadline not found."
-  return 0
-}
-
-
 ########################################################################
 # Internal helper for proj-dump-defs-json. Expects to be passed a
 # [define] name and the variadic $args which are passed to
diff --git a/main.mk b/main.mk
index f1b2941dfbd71b1e95b41c46733dd5647504e40a..75dbd7e7284a431001728ae6243aebcb44430628 100644 (file)
--- a/main.mk
+++ b/main.mk
@@ -1274,9 +1274,9 @@ tclsqlite-shell.o:        has_tclconfig $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
 tclsqlite-stubs.o:     has_tclconfig $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON)
        $(T.compile.tcl) -DUSE_TCL_STUBS=1 -o $@ -c $(TOP)/src/tclsqlite.c $$TCL_INCLUDE_SPEC
 
-tclsqlite3$(T.exe):    has_tclconfig tclsqlite-shell.o $(libsqlite3.LIB)
+tclsqlite3$(T.exe):    has_tclconfig tclsqlite-shell.o $(libsqlite3.SO)
        $(T.link.tcl) -o $@ tclsqlite-shell.o \
-                $(libsqlite3.LIB) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
+                $(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC $(LDFLAGS.libsqlite3)
 
 # Rules to build opcodes.c and opcodes.h
 #
index 89e996686caf31c25da5a9f9710ae39fa985b934..88d0db9088158c909e89b342e2919689fd610aa0 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,5 +1,5 @@
-C Enclose\sthe\sgenerated\s"sqlite3.c"\sand\s"sqlite3.h"\sin\sa\ssingle\sbig\s#ifdef\sso\nthat\sif\sthey\sget\struncated\sby\smore\sthan\sa\slittle\swhitespace,\sthey\swill\snot\ncompile\sand\sthe\struncation\scan\sbe\seasily\sdetected.
-D 2024-10-28T22:35:32.189
+C Remove\ssome\sdead\sauto.def\scode.\sLink\stclsqlite3\sshell\sagainst\sthe\s.so\sinstead\sof\s.a,\sanalog\sto\s[45315f8f275d].\sMove\ssome\sheader\sfile\stests\swhich\sare\sonly\sneeded\sfor\sjimsh\sinto\sthe\sjimsh\scompilability\scheck\sblock.
+D 2024-10-29T03:29:45.408
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md b6e6c1baf38e4339bd3f1e0e5e5bfd0a9a93d133360691b2785c2d4b2f2dcec2
@@ -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 cf550c649ffa1d6ed383e627b3f5cdbd98e04708cf3b27632483caccd6b55cab
+F auto.def 30e263662f55d045994aae89b9e8d2afd3476edba679165dec776d96ed5d7e21
 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 27ea5f221359ef6c58780fc6c185aadbf8d3bee9a021331a3e5de0eba0dc6de6
 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba
-F autosetup/proj.tcl 8167786ff3c20d6a14e9b0b747996e91cabfe85ac49dcc5d0a0aa35d4167dd91
+F autosetup/proj.tcl 986cad77e63672eb910aa2a040185f0ecf3590b5c4ff4d2a033cb791edb9445f
 F autosetup/system.tcl 3a39d6e0b3bfba526fd39afe07c1d0d325e5a31925013a1ba7c671e1128e31bb
 F autosetup/tmake.auto eaebc74ad538dfdd3c817c27eefc31930c20510c4f3a3704071f6cb0629ed71f
 F autosetup/tmake.tcl a275793ec1b6f8708179af0acef1f6f10d46c2920739743f7a8720c6d700c7a9
@@ -697,7 +697,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a
 F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2
 F ext/wasm/wasmfs.make bc8bb227f35d5bd3863a7bd2233437c37472a0d81585979f058f9b9b503bef35
 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0
-F main.mk 380707675b0912eecfc3961af468be8d9f4410c889e55bc12711f43f1fa88141
+F main.mk f1a7ddc6e41c08bc3d61fe7ec50a669ca5688bfab7e8b747e1150b54bccaf8cb
 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271
 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504
 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421
@@ -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 3acb6d789eecd05010e6949b77b58f71cd39446ddf1a66ab89fae6757ccacd31
-R f66773bb544e46054d9e87ac9724855e
-U drh
-Z 723f18082ce3d486045ce4be59f235ec
+P c3b624e2a903f0c975bc8b7288b98616a4a22b2a574738d1f578bfad1d6d8b91
+R 1fbe3bfca5dee7f1b439640106ed2db7
+U stephan
+Z 39268a9790bf3e3d8cfe8a98d615a386
 # Remove this line to create a well-formed Fossil manifest.
index af7eafeb8cfb12ae4839522dc4a96cd172289a54..b5a800f0ab5f238f031cc02d542668f072fb42f9 100644 (file)
@@ -1 +1 @@
-c3b624e2a903f0c975bc8b7288b98616a4a22b2a574738d1f578bfad1d6d8b91
+9a259026ae2dce5d60b80bd7d662a6e73734e51056f4a4226c3fa5ac636b5e3a