MINGW-packages/mingw-w64-sqlite3/0005-dont-require-dlopen-on-windows.patch
Christoph Reiter 82c354a840 sqlite3: Update to 3.50.4
0005-dont-require-dlopen-on-windows.patch: replace with upstream change
2025-08-07 00:09:22 +02:00

92 lines
3.6 KiB
Diff

From 11ba513fe5fb8313748fed3490bcb4b4d34375cc Mon Sep 17 00:00:00 2001
From: stephan <stephan@noemail.net>
Date: Wed, 6 Aug 2025 19:16:16 +0000
Subject: [PATCH] Skip checking for dlopen() on mingw builds and those which
include "windows" in their host tuple, as suggested in [forum:2436c8ffed |
forum post 2436c8ffed]. Those environments identify as Windows for SQLite's
purposes so use LoadLibrary().
FossilOrigin-Name: 69b87d4fa8089ef6101e976131dfd5c47dbc3d8c01a7e7d90a444b7a4794f78b
---
autosetup/sqlite-config.tcl | 53 ++++++++++++++++++++++---------------
manifest | 14 +++++-----
manifest.uuid | 2 +-
3 files changed, 40 insertions(+), 29 deletions(-)
diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index 4dd065095e..f58c691250 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -1412,39 +1412,50 @@ proc sqlite-handle-icu {} {
# Makes the following environment changes:
#
# - defines LDFLAGS_DLOPEN to any linker flags needed for this
-# feature. It may legally be empty on some systems where dlopen()
-# is in libc.
+# feature. It may legally be empty on (A) some systems where
+# dlopen() is in libc and (B) certain Unix-esque Windows
+# environments which identify as Windows for SQLite's purposes so
+# use LoadLibrary().
#
# - If the feature is not available, adds
# -DSQLITE_OMIT_LOAD_EXTENSION=1 to the feature flags list.
proc sqlite-handle-load-extension {} {
define LDFLAGS_DLOPEN ""
set found 0
+ set suffix ""
proj-if-opt-truthy load-extension {
- set found [proj-check-function-in-lib dlopen dl]
- if {$found} {
- define LDFLAGS_DLOPEN [get-define lib_dlopen]
- undefine lib_dlopen
- } else {
- if {[proj-opt-was-provided load-extension]} {
- # Explicit --enable-load-extension: fail if not found
- proj-indented-notice -error {
- --enable-load-extension was provided but dlopen()
- not found. Use --disable-load-extension to bypass this
- check.
- }
- } else {
- # It was implicitly enabled: warn if not found
- proj-indented-notice {
- WARNING: dlopen() not found, so loadable module support will
- be disabled. Use --disable-load-extension to bypass this
- check.
+ switch -glob -- [get-define host] {
+ *-*-mingw* - *windows* {
+ incr found
+ set suffix "Using LoadLibrary()"
+ }
+ default {
+ set found [proj-check-function-in-lib dlopen dl]
+ if {$found} {
+ set suffix [define LDFLAGS_DLOPEN [get-define lib_dlopen]]
+ undefine lib_dlopen
+ } else {
+ if {[proj-opt-was-provided load-extension]} {
+ # Explicit --enable-load-extension: fail if not found
+ proj-indented-notice -error {
+ --enable-load-extension was provided but dlopen()
+ not found. Use --disable-load-extension to bypass this
+ check.
+ }
+ } else {
+ # It was implicitly enabled: warn if not found
+ proj-indented-notice {
+ WARNING: dlopen() not found, so loadable module support will
+ be disabled. Use --disable-load-extension to bypass this
+ check.
+ }
+ }
}
}
}
}
if {$found} {
- msg-result "Loadable extension support enabled."
+ msg-result "Loadable extension support enabled. $suffix"
} else {
msg-result "Disabling loadable extension support. Use --enable-load-extension to enable them."
sqlite-add-feature-flag -DSQLITE_OMIT_LOAD_EXTENSION=1