From: stephan Date: Tue, 25 Feb 2025 16:17:57 +0000 (+0000) Subject: Diverse configure tweaks to better support package maintainers on the unix-on-windows... X-Git-Tag: version-3.49.2~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=335c54bdf1ef24dcc4e9beebaf720f3c72f9e047;p=thirdparty%2Fsqlite.git Diverse configure tweaks to better support package maintainers on the unix-on-windows environments like msys2, cygwin, and mingw, based largely on feedback in forum posts [forum:e6cf2bbb70da2922|e6cf2bbb70da2922] and [forum:828fdfe9041fd725|828fdfe9041fd725]. FossilOrigin-Name: 144aacfdf76d89d30f0f6f4dfccd686d3a219f778f98487264b6ef69331ae722 --- diff --git a/Makefile.in b/Makefile.in index 1ff791c8ab..7926aa84dd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -79,7 +79,7 @@ libdir = @libdir@ INSTALL = @BIN_INSTALL@ AR = @AR@ -AR.flags = cr # TODO? Add a configure test to determine this? +AR.flags = cr CC = @CC@ B.cc = @CC_FOR_BUILD@ @BUILD_CFLAGS@ T.cc = $(CC) @@ -126,9 +126,14 @@ LDFLAGS.libsqlite3.os-specific = @LDFLAGS_MAC_CVERSION@ @LDFLAGS_OUT_IMPLIB@ # os-specific: see # - https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7 # - https://sqlite.org/forum/forumpost/0c7fc097b2 -ENABLE_SHARED = @ENABLE_SHARED@ -ENABLE_STATIC = @ENABLE_STATIC@ +libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@ +# DLL.basename: see https://sqlite.org/forum/forumpost/828fdfe904 +libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@ +# libsqlite3.out.implib => the output filename part of LDFLAGS_OUT_IMPLIB. +ENABLE_LIB_SHARED = @ENABLE_LIB_SHARED@ +ENABLE_LIB_STATIC = @ENABLE_LIB_STATIC@ HAVE_WASI_SDK = @HAVE_WASI_SDK@ +libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@ T.cc.sqlite = $(T.cc) @TARGET_DEBUG@ diff --git a/auto.def b/auto.def index 9df87f579a..8ed5996373 100644 --- a/auto.def +++ b/auto.def @@ -4,70 +4,44 @@ # This is the main autosetup-compatible configure script for the # SQLite project. # -# This script should be kept compatible with JimTCL, a copy of which -# is included in this source tree as ./autosetup/jimsh0.c. The number -# of incompatibilities between canonical TCL and JimTCL is very low -# and alternative formulations of incompatible constructs have, so -# far, been easy to find. +# This script and all of its dependencies must be kept compatible with +# JimTCL, a copy of which is included in this source tree as +# ./autosetup/jimsh0.c. The number of incompatibilities between +# canonical TCL and JimTCL is very low and alternative formulations of +# incompatible constructs have, so far, been easy to find. # # JimTCL: https://jim.tcl.tk # use sqlite-config -sqlite-config-bootstrap canonical -sqlite-setup-default-cflags -proj-if-opt-truthy dev { - # --enable-dev needs to come early so that the downstream tests - # which check for the following flags use their updated state. - proj-opt-set all 1 - proj-opt-set debug 1 - proj-opt-set amalgamation 0 - define CFLAGS [get-env CFLAGS {-O0 -g}] - # -------------^^^^^^^ intentionally using [get-env] instead of - # [proj-get-env] here because [sqlite-setup-default-cflags] uses - # [proj-get-env] and we want this to supercede that. +sqlite-configure canonical { + proj-if-opt-truthy dev { + # --enable-dev needs to come early so that the downstream tests + # which check for the following flags use their updated state. + proj-opt-set all 1 + proj-opt-set debug 1 + proj-opt-set amalgamation 0 + define CFLAGS [get-env CFLAGS {-O0 -g}] + # -------------^^^^^^^ intentionally using [get-env] instead of + # [proj-get-env] here because [sqlite-setup-default-cflags] uses + # [proj-get-env] and we want this to supercede that. + } + sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk] + sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment + sqlite-check-common-system-deps + + proj-define-for-opt amalgamation USE_AMALGAMATION "Use amalgamation for builds?" + + proj-define-for-opt gcov USE_GCOV "Use gcov?" + + proj-define-for-opt test-status TSTRNNR_OPTS \ + "test-runner flags:" {--status} {} + + proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \ + "Use #line macros in the amalgamation:" + + define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] + + sqlite-handle-tcl + sqlite-handle-emsdk } - -sqlite-check-common-bins ;# must come before [sqlite-handle-wasi-sdk] -sqlite-handle-wasi-sdk ;# must run relatively early, as it changes the environment -sqlite-check-common-system-deps - -# -# Enable large file support (if special flags are necessary) -# -define HAVE_LFS 0 -if {[opt-bool largefile]} { - cc-check-lfs -} - -proj-define-for-opt shared ENABLE_SHARED "Build shared library?" - -if {![proj-define-for-opt static ENABLE_STATIC \ - "Build static library?"]} { - proj-warn "Static lib build may be implicitly re-activated by other components, e.g. some test apps." -} - -proj-define-for-opt amalgamation USE_AMALGAMATION "Use amalgamation for builds?" - -proj-define-for-opt gcov USE_GCOV "Use gcov?" - -proj-define-for-opt test-status TSTRNNR_OPTS \ - "test-runner flags:" {--status} {} - -proj-define-for-opt linemacros AMALGAMATION_LINE_MACROS \ - "Use #line macros in the amalgamation:" - -define LINK_TOOLS_DYNAMICALLY [proj-opt-was-provided dynlink-tools] - -proj-check-rpath -sqlite-handle-soname -sqlite-handle-debug -sqlite-handle-tcl -sqlite-handle-threadsafe -sqlite-handle-tempstore -sqlite-handle-line-editing -sqlite-handle-load-extension -sqlite-handle-math -sqlite-handle-icu -sqlite-handle-emsdk -sqlite-config-finalize diff --git a/autoconf/Makefile.in b/autoconf/Makefile.in index 8a9c2c7b3f..f74c71d674 100644 --- a/autoconf/Makefile.in +++ b/autoconf/Makefile.in @@ -143,15 +143,18 @@ sqlite3.o: $(TOP)/sqlite3.h $(TOP)/sqlite3.c $(CC) -c $(TOP)/sqlite3.c -o $@ $(CFLAGS) $(CFLAGS.libsqlite3) libsqlite3.LIB = libsqlite3$(T.lib) -libsqlite3.SO = libsqlite3$(T.dll) +libsqlite3.DLL.basename = @SQLITE_DLL_BASENAME@ +libsqlite3.out.implib = @SQLITE_OUT_IMPLIB@ +libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) +libsqlite3.DLL.install-rules = @SQLITE_DLL_INSTALL_RULES@ -$(libsqlite3.SO): sqlite3.o +$(libsqlite3.DLL): sqlite3.o $(CC) -o $@ sqlite3.o $(LDFLAGS.shlib) \ $(LDFLAGS) $(LDFLAGS.libsqlite3) \ $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) -$(libsqlite3.SO)-1: $(libsqlite3.SO) -$(libsqlite3.SO)-0: -all: $(libsqlite3.SO)-$(ENABLE_LIB_SHARED) +$(libsqlite3.DLL)-1: $(libsqlite3.DLL) +$(libsqlite3.DLL)-0: +all: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED) $(libsqlite3.LIB): sqlite3.o $(AR) $(AR.flags) $@ sqlite3.o @@ -159,45 +162,57 @@ $(libsqlite3.LIB)-1: $(libsqlite3.LIB) $(libsqlite3.LIB)-0: all: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) -install-so-1: $(install-dir.lib) $(libsqlite3.SO) - $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @if [ -f $(libsqlite3.SO).a ]; then \ - $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ +# +# Maintenance reminder: the install-dll-... rules must be kept in sync +# with the main copies rom /main.mk. +# +install-dll-out-implib: $(install-dir.lib) $(libsqlite3.DLL) + if [ x != "x$(libsqlite3.out.implib)" ] && [ -f "$(libsqlite3.out.implib)" ]; then \ + $(INSTALL) $(libsqlite3.out.implib) "$(install-dir.lib)"; \ fi - @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - if [ x.dll = x$(T.dll) ]; then \ - echo "No library symlinks needed on this platform"; \ - elif [ x.dylib = x$(T.dll) ]; then \ - cd "$(install-dir.lib)" || exit $$?; \ - rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ - dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ - mv $(libsqlite3.SO) $$dllname || exit $$?; \ - ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ - ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ - ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ - else \ - cd "$(install-dir.lib)" || exit $$?; \ - rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ - if [ -e $(libsqlite3.SO).0.8.6 ]; then \ - echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ - elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ - echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ - fi; \ + +install-dll-unix-generic: install-dll-out-implib + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ + ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ + if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ + echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ + elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ + echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ fi -install-so-0 install-so-: -install-so: install-so-$(ENABLE_LIB_SHARED) -install: install-so +install-dll-msys: install-dll-out-implib $(install-dir.bin) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.bin)" +# ----------------------------------------------^^^ yes, bin +install-dll-mingw: install-dll-msys +install-dll-cygwin: install-dll-msys + +install-dll-darwin: $(install-dir.lib) $(libsqlite3.DLL) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ + dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ + mv $(libsqlite3.DLL) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ + ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ + ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll) + +install-dll-1: install-dll-$(libsqlite3.DLL.install-rules) +install-dll-0 install-dll-: +install-dll: install-dll-$(ENABLE_LIB_SHARED) +install: install-dll install-lib-1: $(install-dir.lib) $(libsqlite3.LIB) $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)" @@ -213,7 +228,7 @@ ENABLE_STATIC_SHELL = @ENABLE_STATIC_SHELL@ sqlite3-shell-link-flags.1 = $(TOP)/sqlite3.c $(LDFLAGS.libsqlite3) sqlite3-shell-link-flags.0 = -L. -lsqlite3 $(LDFLAGS.zlib) sqlite3-shell-deps.1 = $(TOP)/sqlite3.c -sqlite3-shell-deps.0 = $(libsqlite3.SO) +sqlite3-shell-deps.0 = $(libsqlite3.DLL) sqlite3$(T.exe): $(TOP)/shell.c $(sqlite3-shell-deps.$(ENABLE_STATIC_SHELL)) $(CC) -o $@ \ $(TOP)/shell.c $(sqlite3-shell-link-flags.$(ENABLE_STATIC_SHELL)) \ @@ -241,7 +256,7 @@ install: install-man1 clean: rm -f *.o sqlite3$(T.exe) - rm -f $(libsqlite3.LIB) $(libsqlite3.SO) $(libsqlite3.SO).a + rm -f $(libsqlite3.LIB) $(libsqlite3.DLL) libsqlite3$(T.dll).a distclean: clean rm -f jimsh0$(T.exe) config.* sqlite3.pc sqlite_cfg.h Makefile diff --git a/autoconf/auto.def b/autoconf/auto.def index 099b52aff7..3ba900d957 100644 --- a/autoconf/auto.def +++ b/autoconf/auto.def @@ -3,27 +3,8 @@ # # This is the main autosetup-compatible configure script for the # "autoconf" bundle of the SQLite project. -# -# This script must be kept compatible with JimTCL, a copy of which is -# included in this source tree as ./autosetup/jimsh0.c. -# use sqlite-config -sqlite-config-bootstrap autoconf -sqlite-check-common-bins -sqlite-check-common-system-deps -proj-check-rpath -sqlite-handle-soname -sqlite-setup-default-cflags -sqlite-handle-debug -sqlite-handle-threadsafe -sqlite-handle-tempstore -sqlite-handle-line-editing -sqlite-handle-load-extension -sqlite-handle-math -sqlite-handle-icu - -define ENABLE_STATIC_SHELL [opt-bool static-shell] -define ENABLE_LIB_SHARED [opt-bool shared] -define ENABLE_LIB_STATIC [opt-bool static] - -sqlite-config-finalize +sqlite-configure autoconf { + sqlite-check-common-bins + sqlite-check-common-system-deps +} diff --git a/autosetup/jimsh0.c b/autosetup/jimsh0.c index 0526b9a446..1a6453d0c8 100644 --- a/autosetup/jimsh0.c +++ b/autosetup/jimsh0.c @@ -1252,6 +1252,14 @@ int Jim_OpenForRead(const char *filename); #endif +# ifndef MAXPATHLEN +# ifdef PATH_MAX +# define MAXPATHLEN PATH_MAX +# else +# define MAXPATHLEN JIM_PATH_LEN +# endif +# endif + int Jim_FileStoreStatData(Jim_Interp *interp, Jim_Obj *varName, const jim_stat_t *sb); @@ -2088,10 +2096,6 @@ enum wbuftype { #define UNIX_SOCKETS 0 #endif -#ifndef MAXPATHLEN -#define MAXPATHLEN JIM_PATH_LEN -#endif - @@ -4173,14 +4177,6 @@ int Jim_regexpInit(Jim_Interp *interp) #define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR) #endif -# ifndef MAXPATHLEN -# ifdef PATH_MAX -# define MAXPATHLEN PATH_MAX -# else -# define MAXPATHLEN JIM_PATH_LEN -# endif -# endif - #if defined(__MINGW32__) || defined(__MSYS__) || defined(_MSC_VER) #define ISWINDOWS 1 diff --git a/autosetup/proj.tcl b/autosetup/proj.tcl index b8f925c0eb..4be268da6a 100644 --- a/autosetup/proj.tcl +++ b/autosetup/proj.tcl @@ -353,7 +353,6 @@ proc proj-opt-was-provided {key} { # # Returns $val. proc proj-opt-set {flag {val 1}} { - global autosetup if {$flag ni $::autosetup(options)} { # We have to add this to autosetup(options) or else future calls # to [opt-bool $flag] will fail validation of $flag. @@ -363,6 +362,15 @@ proc proj-opt-set {flag {val 1}} { return $val } +######################################################################## +# @proj-opt-exists flag +# +# Returns 1 if the given flag has been defined as a legal configure +# option, else returns 0. +proc proj-opt-exists {flag} { + expr {$flag in $::autosetup(options)}; +} + ######################################################################## # @proj-val-truthy val # @@ -907,6 +915,35 @@ proc proj-check-emsdk {} { return $rc } +######################################################################## +# @proj-cc-check-Wl-flag ?flag ?args?? +# +# Checks whether the given linker flag (and optional arguments) can be +# passed from the compiler to the linker using one of these formats: +# +# - -Wl,flag[,arg1[,...argN]] +# - -Wl,flag -Wl,arg1 ...-Wl,argN +# +# If so, that flag string is returned, else an empty string is +# returned. +proc proj-cc-check-Wl-flag {args} { + cc-with {-link 1} { + # Try -Wl,flag,...args + set fli "-Wl" + foreach f $args { append fli ",$f" } + if {[cc-check-flags $fli]} { + return $fli + } + # Try -Wl,flag -Wl,arg1 ...-Wl,argN + set fli "" + foreach f $args { append fli "-Wl,$f " } + if {[cc-check-flags $fli]} { + return [string trim $fli] + } + return "" + } +} + ######################################################################## # @proj-check-rpath # @@ -932,14 +969,12 @@ proc proj-check-rpath {} { cc-with {-link 1} { if {[cc-check-flags "-rpath $lp"]} { define LDFLAGS_RPATH "-rpath $lp" - } elseif {[cc-check-flags "-Wl,-rpath,$lp"]} { - define LDFLAGS_RPATH "-Wl,-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 wl [proj-cc-check-Wl-flag -rpath $lp] + if {"" eq $wl} { + set wl [proj-cc-check-Wl-flag -R$lp] + } + define LDFLAGS_RPATH $wl } } expr {"" ne [get-define LDFLAGS_RPATH]} @@ -1132,7 +1167,7 @@ proc proj-xfer-options-aliases {mapping} { ######################################################################## # Arguable/debatable... # -# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explcitely +# When _not_ cross-compiling and CC_FOR_BUILD is _not_ explicitly # specified, force CC_FOR_BUILD to be the same as CC, so that: # # ./configure CC=clang @@ -1140,7 +1175,7 @@ proc proj-xfer-options-aliases {mapping} { # will use CC_FOR_BUILD=clang, instead of cc, for building in-tree # tools. This is based off of an email discussion and is thought to # be likely to cause less confusion than seeing 'cc' invocations -# will when the user passes CC=clang. +# when when the user passes CC=clang. # # Sidebar: if we do this before the cc package is installed, it gets # reverted by that package. Ergo, the cc package init will tell the @@ -1185,11 +1220,11 @@ proc proj-which-linenoise {dotH} { # # In that make invocation, $(libdir) would, at make-time, normally be # hard-coded to /foo/lib, rather than /blah/lib. That happens because -# the autosetup exports conventional $prefix-based values for the -# numerous autoconfig-compatible XYZdir vars at configure-time. What -# we would normally want, however, is that --libdir derives from the -# make-time $(prefix). The distinction between configure-time and -# make-time is the significant factor there. +# autosetup exports conventional $prefix-based values for the numerous +# autoconfig-compatible XYZdir vars at configure-time. What we would +# normally want, however, is that --libdir derives from the make-time +# $(prefix). The distinction between configure-time and make-time is +# the significant factor there. # # This function attempts to reconcile those vars in such a way that # they will derive, at make-time, from $(prefix) in a conventional diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl index 856be4cabc..8cfa7ff68e 100644 --- a/autosetup/sqlite-config.tcl +++ b/autosetup/sqlite-config.tcl @@ -12,7 +12,24 @@ if {[string first " " $autosetup(builddir)] != -1} { may not contain space characters" } -use cc cc-db cc-shared cc-lib pkg-config proj +use proj +######################################################################## +# Set up PACKAGE_NAME and related defines and emit some useful +# bootstrapping info to the user. +proc sqlite-setup-package-info {} { + set srcdir $::autosetup(srcdir) + set PACKAGE_VERSION [proj-file-content -trim $srcdir/VERSION] + define PACKAGE_NAME "sqlite" + define PACKAGE_URL {https://sqlite.org} + define PACKAGE_VERSION $PACKAGE_VERSION + define PACKAGE_STRING "[get-define PACKAGE_NAME] $PACKAGE_VERSION" + define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum + msg-result "Configuring SQLite version $PACKAGE_VERSION" + msg-result "Source dir = $srcdir" + msg-result "Build dir = $::autosetup(builddir)" +} +sqlite-setup-package-info +use cc cc-db cc-shared cc-lib pkg-config # # Object for communicating config-time state across various @@ -49,11 +66,17 @@ set sqliteConfig(is-cross-compiling) [proj-is-cross-compiling] ######################################################################## # Processes all configure --flags for this build $buildMode must be # either "canonical" or "autoconf", and others may be added in the -# future. -proc sqlite-config-bootstrap {buildMode} { - if {$buildMode ni {canonical autoconf}} { - user-error "Invalid build mode: $buildMode. Expecting one of: canonical, autoconf" +# future. After bootstrapping, $configScript is eval'd in the caller's +# scope, then post-configuration finalization is run. $configScript is +# intended to hold configure code which is specific to the given +# $buildMode, with the caveat that _some_ build-specific code is +# encapsulated in the configuration finalization step. +proc sqlite-configure {buildMode configScript} { + set allBuildModes {canonical autoconf} + if {$buildMode ni $allBuildModes} { + user-error "Invalid build mode: $buildMode. Expecting one of: $allBuildModes" } + set ::sqliteConfig(build-mode) $buildMode ######################################################################## # A gentle introduction to flags handling in autosetup # @@ -132,7 +155,7 @@ proc sqlite-config-bootstrap {buildMode} { build-modes { {*} { shared=1 => {Disable build of shared libary} - static=1 => {Disable build of static library (mostly)} + static=1 => {Disable build of static library} } {canonical} { amalgamation=1 => {Disable the amalgamation and instead build all files separately} @@ -144,7 +167,9 @@ proc sqlite-config-bootstrap {buildMode} { {*} { threadsafe=1 => {Disable mutexing} with-tempstore:=no => {Use an in-RAM database for temporary tables: never,no,yes,always} - largefile=1 => {Disable large file support} + largefile=1 + => {This legacy flag has no effect on the library but may influence + the contents of the generated sqlite_cfg.h} # ^^^ It's not clear that this actually does anything, as # HAVE_LFS is not checked anywhere in the .c/.h/.in files. load-extension=1 => {Disable loading of external extensions} @@ -229,11 +254,14 @@ proc sqlite-config-bootstrap {buildMode} { # Options for exotic/alternative build modes alternative-builds { {canonical} { + # Potential TODO: add --with-wasi-sdk support to the autoconf + # build with-wasi-sdk:=/opt/wasi-sdk => {Top-most dir of the wasi-sdk for a WASI build} + with-emsdk:=auto => {Top-most dir of the Emscripten SDK installation. - Default = EMSDK env var.} + Needed only by ext/wasm build. Default=EMSDK env var.} } } @@ -241,9 +269,12 @@ proc sqlite-config-bootstrap {buildMode} { packaging { {autoconf} { # --disable-static-shell: https://sqlite.org/forum/forumpost/cc219ee704 - static-shell=1 => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} + static-shell=1 + => {Link the sqlite3 shell app against the DLL instead of embedding sqlite3.c} } {*} { + # A potential TODO without a current use case: + #rpath=1 => {Disable use of the rpath linker flag} # soname: https://sqlite.org/src/forumpost/5a3b44f510df8ded soname:=legacy => {SONAME for libsqlite3.so. "none", or not using this flag, sets no @@ -252,10 +283,21 @@ proc sqlite-config-bootstrap {buildMode} { it to that literal value. Any other value is assumed to be a suffix which gets applied to "libsqlite3.so.", e.g. --soname=9.10 equates to "libsqlite3.so.9.10".} + # dll-basename: https://sqlite.org/forum/forumpost/828fdfe904 + dll-basename:=auto + => {Specifies the base name of the resulting DLL file. + If not provided, libsqlite3 is usually assumed but on some platforms + a platform-dependent default is used. On some platforms this flag + gets automatically enabled if it is not provided. Use "default" to + explicitly disable platform-dependent activation on such systems.} # out-implib: https://sqlite.org/forum/forumpost/0c7fc097b2 - out-implib=0 + out-implib:=auto => {Enable use of --out-implib linker flag to generate an - "import library" for the DLL} + "import library" for the DLL. The output's base name name is + specified by the value, with "auto" meaning to figure out a + name automatically. On some platforms this flag gets + automatically enabled if it is not provided. Use "none" to + explicitly disable this feature on such platforms.} } } @@ -263,8 +305,9 @@ proc sqlite-config-bootstrap {buildMode} { developer { {*} { # Note that using the --debug/--enable-debug flag here - # requires patching autosetup/autosetup to rename the --debug - # to --autosetup-debug. + # requires patching autosetup/autosetup to rename its builtin + # --debug to --autosetup-debug. See details in + # autosetup/README.md#patching. with-debug=0 debug=0 => {Enable debug build flags. This option will impact performance by @@ -275,14 +318,21 @@ proc sqlite-config-bootstrap {buildMode} { => {Enable the SQLITE_ENABLE_STMT_SCANSTATUS feature flag} } {canonical} { - dev => {Enable dev-mode build: automatically enables certain other flags} - test-status => {Enable status of tests} - gcov=0 => {Enable coverage testing using gcov} - linemacros => {Enable #line macros in the amalgamation} - dynlink-tools => {Dynamically link libsqlite3 to certain tools which normally statically embed it} + dev + => {Enable dev-mode build: automatically enables certain other flags} + test-status + => {Enable status of tests} + gcov=0 + => {Enable coverage testing using gcov} + linemacros + => {Enable #line macros in the amalgamation} + dynlink-tools + => {Dynamically link libsqlite3 to certain tools which normally statically embed it} } {*} { - dump-defines=0 => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) (for build debugging)} + dump-defines=0 + => {Dump autosetup defines to $::sqliteConfig(dump-defines-txt) + (for build debugging)} } } }; # $allOpts @@ -300,14 +350,75 @@ proc sqlite-config-bootstrap {buildMode} { } } #lappend opts "soname:=duplicateEntry => {x}"; #just testing - if {[catch {options $opts}]} { + if {[catch {options $opts} msg opts]} { # Workaround for # where [options] behaves oddly on _some_ TCL builds when it's # called from deeper than the global scope. - return -code break + dict incr opts -level + return {*}$opts $msg } sqlite-post-options-init -}; # sqlite-config-bootstrap + uplevel 1 $configScript + sqlite-configure-finalize +}; # sqlite-configure + +######################################################################## +# Performs late-stage config steps common to both the canonical and +# autoconf bundle builds. +proc sqlite-configure-finalize {} { + set buildMode $::sqliteConfig(build-mode) + set isCanonical [expr {$buildMode eq "canonical"}] + set isAutoconf [expr {$buildMode eq "autoconf"}] + + define HAVE_LFS 0 + if {[opt-bool largefile]} { + # + # Insofar as we can determine HAVE_LFS has no effect on the + # library. Perhaps it did back in the early 2000's. The + # --enable/disable-largefile flag is retained because it's + # harmless, but it doesn't do anything useful. It does have + # visible side-effects, though: the generated sqlite_cfg.h may (or + # may not) define HAVE_LFS. + # + cc-check-lfs + } + + if {$isCanonical} { + if {![opt-bool static]} { + proj-indented-notice { + NOTICE: static lib build may be implicitly re-activated by + other components, e.g. some test apps. + } + } + } else { + proj-assert { $isAutoconf } "Invalid build mode" + proj-define-for-opt static-shell ENABLE_STATIC_SHELL \ + "Link library statically into the CLI shell?" + if {![opt-bool shared] && ![opt-bool static-shell]} { + proj-opt-set shared 1 + proj-indented-notice { + NOTICE: ignoring --disable-shared because --disable-static-shell + was specified. + } + } + } + proj-define-for-opt shared ENABLE_LIB_SHARED "Build shared library?" + proj-define-for-opt static ENABLE_LIB_STATIC "Build static library?" + + sqlite-handle-debug + sqlite-handle-rpath + sqlite-handle-soname + sqlite-handle-threadsafe + sqlite-handle-tempstore + sqlite-handle-line-editing + sqlite-handle-load-extension + sqlite-handle-math + sqlite-handle-icu + sqlite-handle-env-quirks + sqlite-process-dot-in-files + sqlite-post-config-validation + sqlite-dump-defines +}; # sqlite-configure-finalize ######################################################################## # Runs some common initialization which must happen immediately after @@ -336,23 +447,7 @@ proc sqlite-post-options-init {} { define SQLITE_OS_WIN 0 } set ::sqliteConfig(msg-debug-enabled) [proj-val-truthy [get-env msg-debug 0]] - sqlite-setup-package-info -} - -######################################################################## -# Called by [sqlite-post-options-init] to set up PACKAGE_NAME and -# related defines. -proc sqlite-setup-package-info {} { - set srcdir $::autosetup(srcdir) - set PACKAGE_VERSION [proj-file-content -trim $srcdir/VERSION] - define PACKAGE_NAME "sqlite" - define PACKAGE_URL {https://sqlite.org} - define PACKAGE_VERSION $PACKAGE_VERSION - define PACKAGE_STRING "[get-define PACKAGE_NAME] $PACKAGE_VERSION" - define PACKAGE_BUGREPORT [get-define PACKAGE_URL]/forum - msg-result "Source dir = $srcdir" - msg-result "Build dir = $::autosetup(builddir)" - msg-result "Configuring SQLite version $PACKAGE_VERSION" + sqlite-setup-default-cflags } ######################################################################## @@ -970,7 +1065,7 @@ proc sqlite-check-line-editing {} { set rlLib "" if {"" ne $rlInc} { set rlLib [opt-val with-readline-ldflags] - if {"" eq $rlLib || "auto" eq $rlLib} { + if {$rlLib eq "auto" || $rlLib eq ""} { set rlLib "" set libTerm "" if {[proj-check-function-in-lib tgetent "$editLibName ncurses curses termcap"]} { @@ -1222,7 +1317,7 @@ proc sqlite-handle-math {} { # libtool applied only on Mac platforms. # # Based on https://sqlite.org/forum/forumpost/9dfd5b8fd525a5d7. -proc sqlite-check-mac-cversion {} { +proc sqlite-handle-mac-cversion {} { define LDFLAGS_MAC_CVERSION "" set rc 0 if {[proj-looks-like-mac]} { @@ -1244,10 +1339,36 @@ proc sqlite-check-mac-cversion {} { } ######################################################################## -# Define LDFLAGS_OUT_IMPLIB to either an empty string or to a +# Handles the --dll-basename configure flag. [define]'s +# SQLITE_DLL_BASENAME to the DLL's preferred base name (minus +# extension). If --dll-basename is not provided then this is always +# "libsqlite3", otherwise it may use a different value based on the +# value of [get-define host]. +proc sqlite-handle-dll-basename {} { + if {[proj-opt-was-provided dll-basename]} { + set dn [join [opt-val dll-basename] ""] + if {$dn in {none default}} { set dn libsqlite3 } + } else { + set dn libsqlite3 + } + if {$dn in {auto ""}} { + switch -glob -- [get-define host] { + *-*-cygwin { set dn cygsqlite3-0 } + *-*-ming* { set dn libsqlite3-0 } + *-*-msys { set dn msys-sqlite3-0 } + default { set dn libsqlite3 } + } + } + define SQLITE_DLL_BASENAME $dn +} + +######################################################################## +# [define]s LDFLAGS_OUT_IMPLIB to either an empty string or to a # -Wl,... flag for the platform-specific --out-implib flag, which is # used for building an "import library .dll.a" file on some platforms -# (e.g. mingw). Returns 1 if supported, else 0. +# (e.g. msys2, mingw). Returns 1 if supported, else 0. +# +# The name of the import library is [define]d in SQLITE_OUT_IMPLIB. # # If the configure flag --out-implib is not used then this is a no-op. # If that flag is used but the capability is not available, a fatal @@ -1258,34 +1379,133 @@ proc sqlite-check-mac-cversion {} { # of libsqlite3.so.a files which are unnecessary in most environments. # # Added in response to: https://sqlite.org/forum/forumpost/0c7fc097b2 -proc sqlite-check-out-implib {} { +# +# Platform notes: +# +# - cygwin sqlite packages historically install no .dll.a file. +# +# - msys2 and mingw sqlite packages historically install +# /usr/lib/libsqlite3.dll.a despite the DLL being in +# /usr/bin/msys-sqlite3-0.dll. +proc sqlite-handle-out-implib {} { define LDFLAGS_OUT_IMPLIB "" + define SQLITE_OUT_IMPLIB "" set rc 0 if {[proj-opt-was-provided out-implib]} { - cc-with {-link 1} { - set dll "libsqlite3[get-define TARGET_DLLEXT]" - set flags "-Wl,--out-implib,${dll}.a" - if {[cc-check-flags $flags]} { - define LDFLAGS_OUT_IMPLIB $flags - set rc 1 - } + set olBaseName [join [opt-val out-implib] ""] + if {$olBaseName in {auto ""}} { + set olBaseName "libsqlite3" ;# [get-define SQLITE_DLL_BASENAME] + # Based on discussions with mingw/msys users, the import lib + # should always be called libsqlite3.dll.a even on platforms + # which rename libsqlite3.dll to something else. } - if {!$rc} { - user-error "--out-implib is not supported on this platform" + if {$olBaseName ne "none"} { + cc-with {-link 1} { + set dll "${olBaseName}[get-define TARGET_DLLEXT]" + set flags [proj-cc-check-Wl-flag --out-implib ${dll}.a] + if {"" ne $flags} { + define LDFLAGS_OUT_IMPLIB $flags + define SQLITE_OUT_IMPLIB ${dll}.a + set rc 1 + } + } + if {!$rc} { + user-error "--out-implib is not supported on this platform" + } } } return $rc } ######################################################################## -# Performs late-stage config steps common to both the canonical and -# autoconf bundle builds. -proc sqlite-config-finalize {} { - sqlite-check-mac-cversion - sqlite-check-out-implib - sqlite-process-dot-in-files - sqlite-post-config-validation - sqlite-dump-defines +# If the given platform identifier (defaulting to [get-define host]) +# appears to be one of the Unix-on-Windows environments, returns a +# brief symbolic name for that environment, else returns an empty +# string. +# +# It does not distinguish between msys and msys2, returning msys for +# both. The build does not, as of this writing, specifically support +# msys v1. +proc sqlite-env-is-unix-on-windows {{envTuple ""}} { + if {"" eq $envTuple} { + set envTuple [get-define host] + } + set name "" + switch -glob -- $envTuple { + *-*-cygwin { set name cygwin } + *-*-ming* { set name mingw } + *-*-msys { set name msys } + } + return $name; +} + +######################################################################## +# Performs various tweaks to the build which are only relevant on +# certain platforms, e.g. Mac and "Unix on Windows" platforms (msys2, +# cygwin, ...). +# +# 1) DLL installation: +# +# [define]s SQLITE_DLL_INSTALL_RULES to a symbolic name suffix for a +# set of "make install" rules to use for installation of the DLL +# deliverable. The makefile is tasked with with providing rules named +# install-dll-NAME which runs the installation for that set, as well +# as providing a rule named install-dll which resolves to +# install-dll-NAME (perhaps indirectly, depending on whether the DLL +# is (de)activated). +# +# The default value is "unix-generic". +# +# 2) --out-implib: +# +# On platforms where an "import library" is conventionally used but +# --out-implib was not explicitly used, automatically add that flag. +# This conventionally applies to the "Unix on Windows" environments +# like msys and cygwin. +# +# 3) --dll-basename: +# +# On the same platforms addressed by --out-implib, if --dll-basename +# is not specified, --dll-basename=auto is implied. +proc sqlite-handle-env-quirks {} { + set instName unix-generic; # name of installation rules set + set autoDll 0; # true if --out-implib/--dll-basename should be implied + set host [get-define host] + switch -glob -- $host { + *apple* - + *darwin* { set instName darwin } + default { + set x [sqlite-env-is-unix-on-windows $host] + if {"" ne $x} { + set instName $x + set autoDll 1 + } + } + } + define SQLITE_DLL_INSTALL_RULES $instName + if {$autoDll} { + if {![proj-opt-was-provided out-implib]} { + # Imply --out-implib=auto + proj-indented-notice [subst -nocommands -nobackslashes { + NOTICE: auto-enabling --out-implib for environment [$host]. + Use --out-implib=none to disable this special case + or --out-implib=auto to squelch this notice. + }] + proj-opt-set out-implib auto + } + if {![proj-opt-was-provided dll-basename]} { + # Imply --dll-basename=auto + proj-indented-notice [subst -nocommands -nobackslashes { + NOTICE: auto-enabling --dll-basename for environment [$host]. + Use --dll-basename=default to disable this special case + or --dll-basename=auto to squelch this notice. + }] + proj-opt-set dll-basename auto + } + } + sqlite-handle-dll-basename + sqlite-handle-out-implib + sqlite-handle-mac-cversion } ######################################################################## @@ -1539,9 +1759,9 @@ proc sqlite-check-tcl {} { proj-fatal "No tclConfig.sh found under ${with_tcl}" } } else { - # If we have not yet found a tclConfig.sh file, look in - # $libdir which is set automatically by autosetup or by the - # --prefix command-line option. See + # If we have not yet found a tclConfig.sh file, look in $libdir + # which is set automatically by autosetup or via the --prefix + # command-line option. See # https://sqlite.org/forum/forumpost/e04e693439a22457 set libdir [get-define libdir] if {[file readable "${libdir}/tclConfig.sh"]} { @@ -1727,7 +1947,7 @@ proc sqlite-determine-codegen-tcl {} { } define BTCLSH "\$(TCLSH_CMD)" } - }; # CC swap-out + }; # /define-push $flagsToRestore return $cgtcl }; # sqlite-determine-codegen-tcl @@ -1738,6 +1958,26 @@ proc sqlite-handle-tcl {} { msg-result "TCL for code generation: [sqlite-determine-codegen-tcl]" } +######################################################################## +# Handle the --enable/disable-rpath flag. +proc sqlite-handle-rpath {} { + proj-check-rpath + # autosetup/cc-chared.tcl sets the rpath flag definition in + # [get-define SH_LINKRPATH], but it does so on a per-platform basis + # rather than as a compiler check. Though we should do a proper + # compiler check (as proj-check-rpath does), we may want to consider + # adopting its approach of clearing the rpath flags for environments + # for which sqlite-env-is-unix-on-windows returns a non-empty + # string. + +# if {[proj-opt-truthy rpath]} { +# proj-check-rpath +# } else { +# msg-result "Disabling use of rpath." +# define LDFLAGS_RPATH "" +# } +} + ######################################################################## # If the --dump-defines configure flag is provided then emit a list of # all [define] values to config.defines.txt, else do nothing. diff --git a/main.mk b/main.mk index 808f925469..b40b9f9687 100644 --- a/main.mk +++ b/main.mk @@ -189,19 +189,19 @@ CFLAGS.readline ?= -I$(prefix)/include # INSTALL ?= install # -# $(ENABLE_SHARED) = +# $(ENABLE_LIB_SHARED) = # -# 1 if libsqlite3.$(T.dll) should be built. +# 1 if libsqlite3$(T.dll) should be built. # -ENABLE_SHARED ?= 1 +ENABLE_LIB_SHARED ?= 1 # -# $(ENABLE_STATIC) = +# $(ENABLE_LIB_STATIC) = # -# 1 if libsqlite3.$(T.lib) should be built. Some components, +# 1 if libsqlite3$(T.lib) should be built. Some components, # e.g. libtclsqlite3 and some test apps, implicitly require the static # library and will ignore this preference. # -ENABLE_STATIC ?= 1 +ENABLE_LIB_STATIC ?= 1 # # $(USE_AMALGAMATION) # @@ -220,7 +220,7 @@ USE_AMALGAMATION ?= 1 # may require that the user specifically prepend "." to their # $LD_LIBRARY_PATH so that the dynamic linker does not pick up a # libsqlite3.so from outside the source tree. Alternately, symlinking -# the in-build-tree $(libsqlite3.SO) to some dir in the system's +# the in-build-tree $(libsqlite3.DLL) to some dir in the system's # library path will work for giving the apps access to the in-tree # DLL. # @@ -1052,8 +1052,35 @@ T.link.tcl = $(T.tcl.env.source); $(T.link) cp fts5.c fts5.h tsrc touch .target_source +# +# libsqlite3.DLL.basename = the base name of the resulting DLL. This +# is typically libsqlite3 but varies wildly on Unix-like Windows +# environments (msys, cygwin, and friends). Conversely, the base name +# of the static library ($(libsqlite3.LIB)) is constant on all tested +# platforms. +# +libsqlite3.DLL.basename ?= libsqlite3 +# +# libsqlite3.DLL => the DLL library +# +libsqlite3.DLL = $(libsqlite3.DLL.basename)$(T.dll) +# +# libsqlite3.out.implib => "import library" file generated by the +# --out-implib linker flag. Not commonly used on Unix systems but is +# on the Windows-side Unix-esque environments and typically as a value +# of "libsqlite3.dll.a". It is expected to match the filename, if any, +# provided by the -Wl,--out-implib,FILENAME flag. +# +libsqlite3.out.implib ?= +# +# libsqlite3.LIB => the static library +# libsqlite3.LIB = libsqlite3$(T.lib) -libsqlite3.SO = libsqlite3$(T.dll) + +# +# libsqlite3.DLL.install-rules => the suffix of the symoblic name of +# the makefile rules for installing the DLL. +libsqlite3.DLL.install-rules ?= unix-generic # Rules to build the LEMON compiler generator # @@ -1357,9 +1384,9 @@ tclsqlite-shell.o: $(T.tcl.env.sh) $(TOP)/src/tclsqlite.c $(DEPS_OBJ_COMMON) tclsqlite-stubs.o: $(T.tcl.env.sh) $(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): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.SO) +tclsqlite3$(T.exe): $(T.tcl.env.sh) tclsqlite-shell.o $(libsqlite3.DLL) $(T.link.tcl) -o $@ tclsqlite-shell.o \ - $(libsqlite3.SO) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \ + $(libsqlite3.DLL) $$TCL_INCLUDE_SPEC $$TCL_LIB_SPEC \ $(LDFLAGS.libsqlite3) tclsqlite3$(T.exe)-1: tclsqlite3$(T.exe) tclsqlite3$(T.exe)-0 tclsqlite3$(T.exe)-: @@ -1406,32 +1433,33 @@ $(libsqlite3.LIB): $(LIBOBJ) $(AR) $(AR.flags) $@ $(LIBOBJ) $(libsqlite3.LIB)-1: $(libsqlite3.LIB) $(libsqlite3.LIB)-0 $(libsqlite3.LIB)-: -lib: $(libsqlite3.LIB)-$(ENABLE_STATIC) +lib: $(libsqlite3.LIB)-$(ENABLE_LIB_STATIC) all: lib # # Dynamic libsqlite3 # -$(libsqlite3.SO): $(LIBOBJ) +$(libsqlite3.DLL): $(LIBOBJ) $(T.link.shared) -o $@ $(LIBOBJ) $(LDFLAGS.libsqlite3) \ $(LDFLAGS.libsqlite3.os-specific) $(LDFLAGS.libsqlite3.soname) -$(libsqlite3.SO)-1: $(libsqlite3.SO) -$(libsqlite3.SO)-0 $(libsqlite3.SO)-: -so: $(libsqlite3.SO)-$(ENABLE_SHARED) +$(libsqlite3.DLL)-1: $(libsqlite3.DLL) +$(libsqlite3.DLL)-0 $(libsqlite3.DLL)-: +so: $(libsqlite3.DLL)-$(ENABLE_LIB_SHARED) all: so # -# On most Unix-like platforms, install the $(libsqlite3.SO) as -# $(libsqlite3.SO).$(PACKAGE_VERSION) and create symlinks which point +# DLL installation... +# +# On most Unix-like platforms, install the $(libsqlite3.DLL) as +# $(libsqlite3.DLL).$(PACKAGE_VERSION) and create symlinks which point # to it: # # - libsqlite3.so.$(PACKAGE_VERSION) # - libsqlite3.so.0 =symlink-> libsqlite3.so.$(PACKAGE_VERSION) (see below) # - libsqlite3.so =symlink-> libsqlite3.so.3 # -# The symlinks are not added on platforms where $(T.dll) is ".dll", -# and different transformations take place on platforms where $(T.dll) -# is ".dylib". +# Different rules apply for platforms where $(T.dll)==.dylib and for +# the "Unix on Windows" environments. # # The link named libsqlite3.so.0 is provided in an attempt to reduce # downstream disruption when performing upgrades from pre-3.48 to a @@ -1453,7 +1481,7 @@ all: so # 1) If libsqlite3.so.0.8.6 is found in the target installation # directory then it is re-linked to point to the newer-style # names. We cannot retain both the old and new installation because -# they both share the high-level name $(libsqlite3.SO). The +# they both share the high-level name $(libsqlite3.DLL). The # down-side of this is that it may upset packaging tools when we # replace libsqlite3.so (from a legacy package) with a new symlink. # @@ -1467,45 +1495,54 @@ all: so # In either case, libsqlite3.la, if found, is deleted because it would # contain stale state, refering to non-libtool-generated libraries. # -install-so-1: $(install-dir.lib) $(libsqlite3.SO) - $(INSTALL) $(libsqlite3.SO) "$(install-dir.lib)" - @if [ -f $(libsqlite3.SO).a ]; then \ - $(INSTALL) $(libsqlite3.SO).a "$(install-dir.lib)"; \ + +install-dll-out-implib: $(install-dir.lib) $(libsqlite3.DLL) + if [ x != "x$(libsqlite3.out.implib)" ] && [ -f "$(libsqlite3.out.implib)" ]; then \ + $(INSTALL) $(libsqlite3.out.implib) "$(install-dir.lib)"; \ fi - @echo "Setting up $(libsqlite3.SO) version symlinks..."; \ - if [ x.dll = x$(T.dll) ]; then \ - echo "No library symlinks needed on this platform"; \ - elif [ x.dylib = x$(T.dll) ]; then \ - cd "$(install-dir.lib)" || exit $$?; \ - rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ - dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ - mv $(libsqlite3.SO) $$dllname || exit $$?; \ - ln -s $$dllname $(libsqlite3.SO) || exit $$?; \ - ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ - ls -la $$dllname $(libsqlite3.SO) libsqlite3.0$(T.dll); \ - else \ - cd "$(install-dir.lib)" || exit $$?; \ - rm -f $(libsqlite3.SO).0 $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - mv $(libsqlite3.SO) $(libsqlite3.SO).$(PACKAGE_VERSION) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO) || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0 || exit $$?; \ - ls -la $(libsqlite3.SO) $(libsqlite3.SO).[a03]*; \ - if [ -e $(libsqlite3.SO).0.8.6 ]; then \ - echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ - elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ - echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ - rm -f libsqlite3.la $(libsqlite3.SO).0.8.6 || exit $$?; \ - ln -s $(libsqlite3.SO).$(PACKAGE_VERSION) $(libsqlite3.SO).0.8.6 || exit $$?; \ - ls -la $(libsqlite3.SO).0.8.6; \ - fi; \ + +install-dll-unix-generic: install-dll-out-implib + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + rm -f $(libsqlite3.DLL).0 $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + mv $(libsqlite3.DLL) $(libsqlite3.DLL).$(PACKAGE_VERSION) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL) || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0 || exit $$?; \ + ls -la $(libsqlite3.DLL) $(libsqlite3.DLL).[a03]*; \ + if [ -e $(libsqlite3.DLL).0.8.6 ]; then \ + echo "ACHTUNG: legacy libtool-compatible install found. Re-linking it..."; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ + elif [ x1 = "x$(INSTALL_SO_086_LINK)" ]; then \ + echo "ACHTUNG: installing legacy libtool-style links because INSTALL_SO_086_LINK=1"; \ + rm -f libsqlite3.la $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ln -s $(libsqlite3.DLL).$(PACKAGE_VERSION) $(libsqlite3.DLL).0.8.6 || exit $$?; \ + ls -la $(libsqlite3.DLL).0.8.6; \ fi -install-so-0 install-so-: -install-so: install-so-$(ENABLE_SHARED) -install: install-so +install-dll-msys: install-dll-out-implib $(install-dir.bin) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.bin)" +# ----------------------------------------------^^^ yes, bin +install-dll-mingw: install-dll-msys +install-dll-cygwin: install-dll-msys + +install-dll-darwin: $(install-dir.lib) $(libsqlite3.DLL) + $(INSTALL) $(libsqlite3.DLL) "$(install-dir.lib)" + @echo "Setting up $(libsqlite3.DLL) version symlinks..."; \ + cd "$(install-dir.lib)" || exit $$?; \ + rm -f libsqlite3.0$(T.dll) libsqlite3.$(PACKAGE_VERSION)$(T.dll) || exit $$?; \ + dllname=libsqlite3.$(PACKAGE_VERSION)$(T.dll); \ + mv $(libsqlite3.DLL) $$dllname || exit $$?; \ + ln -s $$dllname $(libsqlite3.DLL) || exit $$?; \ + ln -s $$dllname libsqlite3.0$(T.dll) || exit $$?; \ + ls -la $$dllname $(libsqlite3.DLL) libsqlite3.0$(T.dll) + +install-dll-1: install-dll-$(libsqlite3.DLL.install-rules) +install-dll-0 install-dll-: +install-dll: install-dll-$(ENABLE_LIB_SHARED) +install: install-dll # # Install $(libsqlite3.LIB) @@ -1513,7 +1550,7 @@ install: install-so install-lib-1: $(install-dir.lib) $(libsqlite3.LIB) $(INSTALL.noexec) $(libsqlite3.LIB) "$(install-dir.lib)" install-lib-0 install-lib-: -install-lib: install-lib-$(ENABLE_STATIC) +install-lib: install-lib-$(ENABLE_LIB_STATIC) install: install-lib # @@ -1798,7 +1835,7 @@ sqlite3_analyzer.c: sqlite3.c $(TOP)/src/tclsqlite.c $(TOP)/tool/spaceanal.tcl \ # sqlite3_analyzer.flags.1 = -L. -lsqlite3 sqlite3_analyzer.flags.0 = $(LDFLAGS.libsqlite3) -sqlite3_analyzer.deps.1 = $(libsqlite3.SO) +sqlite3_analyzer.deps.1 = $(libsqlite3.DLL) sqlite3_analyzer.deps.0 = sqlite3_analyzer$(T.exe): $(T.tcl.env.sh) sqlite3_analyzer.c \ $(sqlite3_analyzer.deps.$(LINK_TOOLS_DYNAMICALLY)) @@ -2045,7 +2082,7 @@ install: install-shell-$(HAVE_WASI_SDK) # sqldiff.0.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h sqlite3.o sqlite3.h sqldiff.0.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c sqlite3.o $(LDFLAGS.libsqlite3) -sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.SO) +sqldiff.1.deps = $(TOP)/tool/sqldiff.c $(TOP)/ext/misc/sqlite3_stdio.h $(libsqlite3.DLL) sqldiff.1.rules = $(T.link) -o $@ $(TOP)/tool/sqldiff.c -L. -lsqlite3 $(LDFLAGS.configure) sqldiff$(T.exe): $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).deps) $(sqldiff.$(LINK_TOOLS_DYNAMICALLY).rules) @@ -2338,7 +2375,7 @@ tidy: tidy-. rm -f lemon$(B.exe) sqlite*.tar.gz rm -f mkkeywordhash$(B.exe) mksourceid$(B.exe) rm -f parse.* fts5parse.* - rm -f $(libsqlite3.SO) $(libsqlite3.LIB) $(libtclsqlite3.SO) $(libsqlite3.SO).a + rm -f $(libsqlite3.DLL) $(libsqlite3.LIB) $(libtclsqlite3.SO) libsqlite3$(T.dll).a rm -f tclsqlite3$(T.exe) $(TESTPROGS) rm -f LogEst$(T.exe) fts3view$(T.exe) rollback-test$(T.exe) showdb$(T.exe) rm -f showjournal$(T.exe) showstat4$(T.exe) showwal$(T.exe) speedtest1$(T.exe) diff --git a/manifest b/manifest index 74da19924f..3343ea13aa 100644 --- a/manifest +++ b/manifest @@ -1,9 +1,9 @@ -C configure:\sin\sseveral\splaces\swhere\ssupport\sfor\s-Wl,...\slinker\sflags\sare\schecked,\sensure\sthat\sthe\scheck\sinvokes\sthe\slinker\s(not\sjust\sthe\scompiler)\sto\savoid\sfalse\spositives.\sThis\sallows\sus\sto\sremove\sthe\sAIX-specific\shandling\sand\s--disable-rpath\sbits\sadded\sin\s[a15e0f680],\sas\swell\sas\smake\sseveral\ssimilar\schecks\smore\srobust. -D 2025-02-21T03:22:57.333 +C Diverse\sconfigure\stweaks\sto\sbetter\ssupport\spackage\smaintainers\son\sthe\sunix-on-windows\senvironments\slike\smsys2,\scygwin,\sand\smingw,\sbased\slargely\son\sfeedback\sin\sforum\sposts\s[forum:e6cf2bbb70da2922|e6cf2bbb70da2922]\sand\s[forum:828fdfe9041fd725|828fdfe9041fd725]. +D 2025-02-25T16:17:57.126 F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1 F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea F LICENSE.md e108e1e69ae8e8a59e93c455654b8ac9356a11720d3345df2a4743e9590fb20d -F Makefile.in 80be2e281d4647ac15a5bac15d5d20fc76d1cfb3f3f6dc01d1a26e3346a5042a +F Makefile.in 4ff9b301b59c66ef9d11c8d133cc62e09173bad4abc7d5eb801e45d5527f8fe6 F Makefile.linux-generic bd3e3cacd369821a6241d4ea1967395c962dfe3057e38cb0a435cee0e8b789d0 F Makefile.msc a9b95ae9807e17f9b0734ebe97d68032141c3f95286bb64593cb73b206f043cf F README.md c3c0f19532ce28f6297a71870f3c7b424729f0e6d9ab889616d3587dd2332159 @@ -14,13 +14,13 @@ F art/sqlite370.eps aa97a671332b432a54e1d74ff5e8775be34200c2 F art/sqlite370.ico af56c1d00fee7cd4753e8631ed60703ed0fc6e90 F art/sqlite370.jpg d512473dae7e378a67e28ff96a34da7cb331def2 F art/sqlite370.svg 40b7e2fe8aac3add5d56dd86ab8d427a4eca5bcb3fe4f8946cb3794e1821d531 -F auto.def eddf6aef976e2c1a56c0accc3244945e0b22ec6799074c40be160e5a9a5662b0 +F auto.def a8c935b5c3c0b27c6a8b1b788bb47b06cc0ca3e9e92dc1b87e4b02659ba95ff6 F autoconf/Makefile.fallback 22fe523eb36dfce31e0f6349f782eb084e86a5620b2b0b4f84a2d6133f53f5ac -F autoconf/Makefile.in ed042ba44540e67e17b1e7bd787e8118a9d14664ba8049966ec9bc54a10676ce +F autoconf/Makefile.in c9a7007181df2a07d08bd63c6ba395ed38705aa218789726951aabebec32ee27 F autoconf/Makefile.msc 0a071367537dc395285a5d624ac4f99f3a387b27cc5e89752423c0499e15aec4 F autoconf/README.first f1d3876e9a7852c22f275a6f06814e64934cecbc0b5b9617d64849094c1fd136 F autoconf/README.txt 7f01dc3915e2d68f329011073662369e62a0938a2c69398807823c57591cb288 -F autoconf/auto.def 3a318c4898024b35ed61a4876a42e3dcc313f93bd8486874d1ad498b88643d1a +F autoconf/auto.def 8d81c1d728d8462a9b6c1ca0714013bbb097aee0ae5e79309d7939cead98e295 F autoconf/tea/Makefile.in ba0556fee8da09c066bad85a4457904e46ee2c2eabaa309c0e83a78f2f151a8e F autoconf/tea/README.txt 61e62e519579e4a112791354d6d440f8b51ea6db3b0bab58d59f29df42d2dfe3 F autoconf/tea/aclocal.m4 52c47aac44ce0ddb1f918b6993e8beb8eee88f43 @@ -47,10 +47,10 @@ F autosetup/cc-db.tcl 6e0ed90146197a5a05b245e649975c07c548e30926b218ca3e1d4dc034 F autosetup/cc-lib.tcl 493c5935b5dd3bf9bd4eca89b07c8b1b1a9356d61783035144e21795facf7360 F autosetup/cc-shared.tcl 4f024e94a47f427ba61de1739f6381ef0080210f9fae89112d5c1de1e5460d78 F autosetup/cc.tcl c0fcc50ca91deff8741e449ddad05bcd08268bc31177e613a6343bbd1fd3e45f -F autosetup/jimsh0.c 6573f6bc6ff204de0139692648d7037ca0b6c067bac83a7b4e087f20a86866a4 +F autosetup/jimsh0.c a57c16e65dcffc9c76e496757cb3f7fb47e01ecbd1631a0a5e01751fc856f049 F autosetup/pkg-config.tcl 4e635bf39022ff65e0d5434339dd41503ea48fc53822c9c5bde88b02d3d952ba -F autosetup/proj.tcl 60dd10f1b1df183281a59b63df07a23bef48722c3d922a73aa5582d845cfa9fc -F autosetup/sqlite-config.tcl 9d1e3bbc561af5f8705f96c0f48252112d3e2d3356383f5529f7f9f7b51afb65 +F autosetup/proj.tcl 187d82550cfa55df00e285542e88278c51876d7813d63eaffb2fc5af40566d9f +F autosetup/sqlite-config.tcl f0f65115fc1102b6c07c92b068c880f53609979f42997c875cd26b41ded18ee4 F autosetup/system.tcl 51d4be76cd9a9074704b584e5c9cbba616202c8468cf9ba8a4f8294a7ab1dba9 F configure 9a00b21dfd13757bbfb8d89b30660a89ec1f8f3a79402b8f9f9b6fc475c3303a x F contrib/sqlitecon.tcl 210a913ad63f9f991070821e599d600bd913e0ad @@ -702,7 +702,7 @@ F ext/wasm/tests/opfs/concurrency/test.js d08889a5bb6e61937d0b8cbb78c9efbefbf65a F ext/wasm/tests/opfs/concurrency/worker.js 0a8c1a3e6ebb38aabbee24f122693f1fb29d599948915c76906681bb7da1d3d2 F ext/wasm/wasmfs.make 68999f5bd8c489239592d59a420f8c627c99169bbd6fa16a404751f757b9f702 F magic.txt 5ade0bc977aa135e79e3faaea894d5671b26107cc91e70783aa7dc83f22f3ba0 -F main.mk 44392e87994fd3595f64c8973784112b5ae570d9474deaab166218c600953f09 +F main.mk ae183c31bef504b89d1bbcc5b59a07e5eedfcc55bb543b4aa254808f4dd85149 F mptest/config01.test 3c6adcbc50b991866855f1977ff172eb6d901271 F mptest/config02.test 4415dfe36c48785f751e16e32c20b077c28ae504 F mptest/crash01.test 61e61469e257df0850df4293d7d4d6c2af301421 @@ -2158,7 +2158,7 @@ F tool/mksourceid.c 36aa8020014aed0836fd13c51d6dc9219b0df1761d6b5f58ff5b616211b0 F tool/mkspeedsql.tcl a1a334d288f7adfe6e996f2e712becf076745c97 F tool/mksqlite3c-noext.tcl 351c55256213154cabb051a3c870ef9f4487de905015141ae50dc7578a901b84 F tool/mksqlite3c.tcl ba13086555b3cb835eba5e47a9250300ab85304d23fd1081abd3f29d8ab71a2b -F tool/mksqlite3h.tcl b05b85c32295bad3fe64807729693d1f19faed3c464c5faac6c53bb6b972ac2f +F tool/mksqlite3h.tcl 989948c6a26e188e673d7c2f2f093ea3acd816ad6ac65bab596280075c8f3a45 F tool/mksqlite3internalh.tcl eb994013e833359137eb53a55acdad0b5ae1049b F tool/mksrczip.tcl 81efd9974dbb36005383f2cd655520057a2ae5aa85ac2441a80c7c28f803ac52 F tool/mktoolzip.tcl 34b4e92be544f820e2cc26f143f7d5aec511e826ec394cc82969a5dcf7c7a27c @@ -2209,9 +2209,11 @@ F tool/version-info.c 3b36468a90faf1bbd59c65fd0eb66522d9f941eedd364fabccd7227350 F tool/warnings-clang.sh bbf6a1e685e534c92ec2bfba5b1745f34fb6f0bc2a362850723a9ee87c1b31a7 F tool/warnings.sh 49a486c5069de041aedcbde4de178293e0463ae9918ecad7539eedf0ec77a139 F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P eaa2503ef699d03686beb5a3866e2a16c9de5f617a179aee2e77b98820065cca -Q +4e81e2c707a954dcda6219dc94e2b96dd0c9907bd4beab28adad51d488b7d739 -R a677713118c0578b1552c99509e07fbb +P 47c43fcb5109ae660d5b56c536d8c23bdc99727648f4dd8b336ff98f9ef07d6c +Q +85b56fb0cce4b628f80b26a67b43236ef1557282775739bdbe7cc4d65948d66f +Q +d284230f68616b78a527d34df777b0220376ba6a00e9e927d4ffb4cbddab900c +Q +ebf41fc90aa9fb1bb96239145c0cdd06eced391499975c71734610996d088641 +R 47f095ce4b16bff16826d907f3f25a33 U stephan -Z b27b42c6ae4c903936b7966303ab3b7f +Z cd454a6ad0ada97faeba9fbc8f924284 # Remove this line to create a well-formed Fossil manifest. diff --git a/manifest.uuid b/manifest.uuid index 0401d2f4ac..8c6592449c 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -47c43fcb5109ae660d5b56c536d8c23bdc99727648f4dd8b336ff98f9ef07d6c +144aacfdf76d89d30f0f6f4dfccd686d3a219f778f98487264b6ef69331ae722 diff --git a/tool/mksqlite3h.tcl b/tool/mksqlite3h.tcl index b1d5ecdcd3..6bbfa8c8bc 100644 --- a/tool/mksqlite3h.tcl +++ b/tool/mksqlite3h.tcl @@ -82,7 +82,13 @@ set nVersion [eval format "%d%03d%03d" [split $zVersion .]] set PWD [pwd] cd $TOP set tmpfile $PWD/tmp-[clock millisec]-[expr {int(rand()*100000000000)}].txt -exec $PWD/mksourceid manifest > $tmpfile +set mksourceid $PWD/mksourceid +if {![file exists $mksourceid] && [file exists ${mksourceid}.exe]} { + # Workaround for Windows-based Unix-like environments + # https://sqlite.org/forum/forumpost/41ba710dd9943453 + set mksourceid ${mksourceid}.exe +} +exec $mksourceid manifest > $tmpfile set fd [open $tmpfile rb] set zSourceId [string trim [read $fd]] close $fd