]> git.ipfire.org Git - thirdparty/sqlite.git/commitdiff
More generic build tinkering.
authorstephan <stephan@noemail.net>
Mon, 30 Sep 2024 17:44:41 +0000 (17:44 +0000)
committerstephan <stephan@noemail.net>
Mon, 30 Sep 2024 17:44:41 +0000 (17:44 +0000)
FossilOrigin-Name: 433bfc790258e1d2e7c9ea4839a9edb25dde0b99d1e888d1e2a4cf669825fb79

Makefile.in
auto.def
autosetup/hwaci-common.tcl
manifest
manifest.uuid

index 9894a56ab94b029b86945b56fa9f987643a0c3cc..ed161fe9e037bfeb7ccfe8b27faac55484218aa4 100644 (file)
@@ -21,6 +21,8 @@ TOP = @abs_top_srcdir@
 # abs_top_builddir = @abs_top_builddir@
 LDFLAGS_ZLIB = @LDFLAGS_ZLIB@
 LDFLAGS_MATH = @LDFLAGS_MATH@
+LDFLAGS_RPATH = @LDFLAGS_RPATH@
+LDFLAGS_READLINE = @LDFLAGS_READLINE@
 LD = @LD@
 AR = @AR@
 
@@ -723,10 +725,11 @@ sqlite_cfg.h: $(TOP)/sqlite_cfg.h.in $(AS_AUTO_DEF)
        @touch $@
 
 libsqlite3.DLL = libsqlite3$(TDLL)
+LDFLAGS_libsqlite = $(LDFLAGS_RPATH) $(TLIBS) $(LDFLAGS_MATH)
 $(libsqlite3.DLL):     $(LIBOBJ)
        $(TLINK) -o $@ \
                @SHOBJ_LDFLAGS@  $(LIBOBJ) $(TLIBS) \
-               @LDFLAGS_RPATH@
+               $(LDFLAGS_libsqlite)
 dll: $(libsqlite3.DLL)
 all: dll
 
@@ -740,7 +743,7 @@ all: dll
 sqlite3$(TEXE):        shell.c sqlite3.c
        $(TCC) $(READLINE_FLAGS) $(SHELL_OPT) -o $@ \
                shell.c sqlite3.c \
-               @LDFLAGS_RPATH@ @LDFLAGS_READLINE@ $(TLIBS)
+               $(LDFLAGS_libsqlite) $(LDFLAGS_READLINE)
 cli: sqlite3$(TEXE)
 all: cli
 #XX#
index 07476f1c71d164cdb07b64de5df5d6aed68cfc6f..a351f8f63a0cd152bbc3d0c8700807ecb66ecb37 100644 (file)
--- a/auto.def
+++ b/auto.def
@@ -276,7 +276,7 @@ cc-check-types int8_t int16_t int32_t int64_t intptr_t \
 cc-check-functions gmtime_r isnan localtime_r localtime_s \
   malloc_usable_size strchrnul usleep utime pread pread64 pwrite pwrite64
 
-cc-check-function-in-lib fdatasync rt
+hwaci-check-function-in-lib fdatasync rt
 define LDFLAGS_FDATASYNC [get-define lib_fdatasync]
 undefine lib_fdatasync
 
@@ -291,7 +291,7 @@ cc-check-includes \
 # These are optional for JimTCL:
 cc-check-includes dirent.h sys/time.h
 
-if {[cc-check-includes zlib.h] && [cc-check-function-in-lib deflate z]} {
+if {[cc-check-includes zlib.h] && [hwaci-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 LDFLAGS_ZLIB -lz
@@ -482,8 +482,8 @@ msg-checking "Support threadsafe operation? "
 hwaci-if-opt-truthy threadsafe {
   msg-result yes
   add-feature-flag -DSQLITE_THREADSAFE=1
-  if {![cc-check-function-in-lib pthread_create pthread]
-      || ![cc-check-function-in-lib pthread_mutexattr_init pthread]} {
+  if {![hwaci-check-function-in-lib pthread_create pthread]
+      || ![hwaci-check-function-in-lib pthread_mutexattr_init pthread]} {
     user-error "Missing required pthread bits"
   }
   define LDFLAGS_PTHREAD [get-define lib_pthread_create]
@@ -570,7 +570,7 @@ if {1} {
   # XXX sLIBS=$LIBS
   # XXX LIBS=""
   # XXX TARGET_HAVE_EDITLINE=1
-  if {[cc-check-function-in-lib readline edit]} {
+  if {[hwaci-check-function-in-lib readline edit]} {
     set with_readline no
   } else {
     # XXX TARGET_HAVE_EDITLINE=0
@@ -590,12 +590,12 @@ if {1} {
   # XXX if test "x$with_readline_lib" = xauto; then
   # XXX save_LIBS="$LIBS"
   # XXX LIBS=""
-  if {[cc-check-function-in-lib tgetent readline ncurses curses termcap]} {
+  if {[hwaci-check-function-in-lib tgetent readline ncurses curses termcap]} {
     # XXX term_LIBS="$LIBS"
   } else {
     # XXX term_LIBS=""
   }
-  if {[cc-check-function-in-lib readline readline]} {
+  if {[hwaci-check-function-in-lib readline readline]} {
     # XXX TARGET_READLINE_LIBS="-lreadline"
   } else {
     set found "no"
@@ -668,7 +668,7 @@ if {1} {
 }
 
 hwaci-if-opt-truthy load-extension {
-  if {[cc-check-function-in-lib dlopen dl]} {
+  if {[hwaci-check-function-in-lib dlopen dl]} {
     define LDFLAGS_DLOPEN [get-define lib_dlopen]
     undefine lib_dlopen
   } else {
@@ -681,25 +681,18 @@ hwaci-if-opt-truthy load-extension {
 }
 
 hwaci-if-opt-truthy math {
-  if {![cc-check-function-in-lib ceil m]} {
+  if {![hwaci-check-function-in-lib ceil m]} {
     user-error "Cannot find libm functions. Use --disable-math to bypass this."
   }
   define LDFLAGS_MATH [get-define lib_ceil]
   undefine lib_ceil
   add-feature-flag {-DSQLITE_ENABLE_MATH_FUNCTIONS}
-  msg-result "Enabling math SQL functions"
+  msg-result "Enabling math SQL functions [get-define LDFLAGS_MATH]"
 } {
   define LDFLAGS_MATH ""
   msg-result "Disabling math SQL functions"
 }
 
-hwaci-if-opt-truthy json {
-  msg-result "Enabling JSON SQL functions"
-} {
-  add-feature-flag {-DSQLITE_OMIT_JSON}
-  msg-result "Disabling JSON SQL functions"
-}
-
 if {0} {
   # is this still relevant?
 
@@ -766,7 +759,7 @@ if {[hwaci-check-emsdk]} {
 }
 
 proc affirm-have-math {} {
-  if {![cc-check-function-in-lib log m]} {
+  if {![hwaci-check-function-in-lib log m]} {
     user-error "Missing required math APIs"
   }
   define LDFLAGS_MATH [get-define lib_log ""]
@@ -806,6 +799,22 @@ foreach {boolFlag featureFlag ifSetEvalThis} {
   }
 }
 
+########################################################################
+# Invert the above loop's logic for some explicit
+# SQLITE_OMIT_... cases. If config option $boolFlag is set,
+# [add-feature-flag $featureFlag], where $featureFlag is intended to
+# be -DSQLITE_OMIT_...
+foreach {boolFlag featureFlag} {
+  json        -DSQLITE_OMIT_JSON
+} {
+  if {[hwaci-opt-truthy $boolFlag]} {
+    msg-result "Enabling $boolFlag"
+  } else {
+    add-feature-flag $featureFlag
+    msg-result "Disabling $boolFlag"
+  }
+}
+
 ########################################################################
 # Maybe extend JimTCL a bit. As of this writing (2024-09-27) it only
 # needs -DHAVE_REALPATH or -DHAVE__FULLPATH to be compatible with our
@@ -877,3 +886,7 @@ hwaci-if-opt-truthy dump-defines {
     }
   }
 }
+
+puts {
+Done! Now run "make".
+}
index 61d2c7d120e412061abfdcddcf258cd00582e834..2239525b4c9f38303bdf724fe326e5ea5bfd34f1 100644 (file)
 # project, authored by the same person who ported it here, noted here
 # only as an indication that there are no licensing issue despite this
 # code having at least two near-twins running around in other trees.
+#
+########################################################################
+#
+# Design notes: by and large, autosetup prefers to update global state
+# with the results of feature checks, e.g. whether the compiler
+# supports flag --X.  In this developer's opinion that (A) causes more
+# confusion than it solves[^1] and (B) adds an unnecessary layer of
+# "voodoo" between the autosetup user and its internals. This module,
+# in contrast, instead injects the results of its own tests into
+# well-defined variables and leaves the integration of those values to
+# the caller's discretion.
+#
+# [1]: As an example: testing for the -rpath flag, using
+# cc-check-flags, can break later checks which use
+# [cc-check-function-in-lib ...] because the resulting -rpath flag
+# implicitly becomes part of those tests. In the case of an rpath
+# test, downstream tests may not like the $prefix/lib path added by
+# the rpath test. To avoid such problems, we avoid (intentionally)
+# updating global state via feature tests.
 ########################################################################
 
 array set hwaci-cache- {} ; # used for caching various results.
@@ -602,13 +621,18 @@ proc hwaci-check-emsdk {} {
 # order of checks reflects that.
 proc hwaci-check-rpath {} {
   set rc 1
+  set lp "[get-define prefix]/lib"
+  # If we _don't_ use cc-with {} here (to avoid updating the global
+  # CFLAGS or LIBS or whatever it is that cc-check-flags updates) then
+  # downstream tests may fail because the resulting rpath gets
+  # implicitly injected into them.
   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"
+    if {[cc-check-flags {-rpath $lp}]} {
+      define LDFLAGS_RPATH "-rpath $lp"
+    } elseif {[cc-check-flags {-Wl,-rpath -Wl,$lp}]} {
+      define LDFLAGS_RPATH "-Wl,-rpath -Wl,$lp"
+    } elseif {[cc-check-flags -Wl,-R$lp]} {
+      define LDFLAGS_RPATH "-Wl,-R$lp"
     } else {
       define LDFLAGS_RPATH ""
       set rc 0
@@ -618,7 +642,15 @@ proc hwaci-check-rpath {} {
 }
 
 ########################################################################
-# Under construction - check for libreadline functionality
+# Under construction - check for libreadline functionality.
+# Defines the following vars:
+#
+# - HAVE_READLINE: 0 or 1
+# - LDFLAGS_READLINE: "" or linker flags
+# - CFLAGS_READLINE: "" or c-flags
+# - READLINE_H: "" or "readline/readlin.h" (or similar)
+#
+# Returns the value of HAVE_READLINE.
 proc hwaci-check-readline {} {
   define HAVE_READLINE 0
   define LDFLAGS_READLINE ""
index 9fdc001756e17a3aac69a4cba6195f56e89a7e32..572fb362fea3691e614f29a778e804bc93e00a2e 100644 (file)
--- a/manifest
+++ b/manifest
@@ -1,9 +1,9 @@
-C Generic\sbuild\stinkering.
-D 2024-09-30T14:33:36.764
+C More\sgeneric\sbuild\stinkering.
+D 2024-09-30T17:44:41.299
 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
 F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
-F Makefile.in ce7b7897eddee0804eedae6daf7b5cd1e47d85cf9c01d9d74afc21fe6b2f8f5a
+F Makefile.in b791c6761d7e3b020fe6001cc33f985f99c0d9e3a745e94fe7c25d09dc1d6f45
 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 1ea8aca38be00ded65793227d845c1766d2255c03eacb6a20ae6a14e304d5f64
+F auto.def 82046ac0d90df3b6478bf193610d00254b64a4fbaba4e08bdd9964fda6baa532
 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 0d8454627c9e8352d9483cbe065a5a42cd885f3c8db3ddcadf4aaae1b5ac81c3
+F autosetup/hwaci-common.tcl c92da569c334b6db38c91f99f4ba26a5a5746b955e7fad1ba585bd1064a82d1c
 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 c65e3679e0d28e980bb555b47f31690b27915d9ff0850f598e3bed528b18ca1d
-R bebdd95eae12b76bf27e689681ef2876
+P b6c1772ce0278988ecaea485c4feb8b0919fa1530f0c53b8321d9bd2277b5acd
+R 3f3552467c9f9c5110dce0fc316253de
 U stephan
-Z ea887720f1ab42cb508d0a1d2d23ebe1
+Z 5922ab49dc459c0a84758656bf396042
 # Remove this line to create a well-formed Fossil manifest.
index dc0f6a5d8c998457c6360f568bee4fe359b1bdb3..f8e4e253ee9a728f65cf7ba4d71143ce4b40a826 100644 (file)
@@ -1 +1 @@
-b6c1772ce0278988ecaea485c4feb8b0919fa1530f0c53b8321d9bd2277b5acd
+433bfc790258e1d2e7c9ea4839a9edb25dde0b99d1e888d1e2a4cf669825fb79