summaryrefslogtreecommitdiff
path: root/dev-db/sqlite/files/sqlite-3.49.0-cppflags.patch
blob: 13c6eafc390f529b2aa6078dfa2034b2ecf6d091 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
From 3e06f2d79b15754999892a4ded6a7585520294a6 Mon Sep 17 00:00:00 2001
From: stephan <stephan@noemail.net>
Date: Sun, 9 Feb 2025 01:25:00 +0000
Subject: [PATCH] configure: when transfering ENABLE/OMIT flags from CFLAGS to
 OPT_FEATURE_FLAGS, also do the same for CPPFLAGS and remove those ENABLE/OMIT
 flags from CFLAGS/CPPFLAGS to mimic legacy build behavior. Strip ENABLE/OMIT
 flags from BUILD_CFLAGS but do not transfer those to OPT_FEATURE_FLAGS, also
 to mimic legacy behavior. This is the second part of a fix discussed at
 [forum:9801e54665afd728|forum post 9801e54665afd728].

FossilOrigin-Name: 16d307cc6c1e203900e7a2dc0730fc0e453946622a2114a07d64ebb99045cfbf
---
 autosetup/sqlite-config.tcl | 36 ++++++++++++++++++++++++++++++------
 manifest                    | 14 +++++++-------
 manifest.uuid               |  2 +-
 3 files changed, 38 insertions(+), 14 deletions(-)

diff --git a/autosetup/sqlite-config.tcl b/autosetup/sqlite-config.tcl
index cabb32aac0..2a73548662 100644
--- a/autosetup/sqlite-config.tcl
+++ b/autosetup/sqlite-config.tcl
@@ -230,23 +230,47 @@ proc sqlite-setup-default-cflags {} {
   # BUILD_CFLAGS is the CFLAGS for CC_FOR_BUILD.
   define BUILD_CFLAGS [proj-get-env BUILD_CFLAGS {-g}]
 
-  # Copy all CFLAGS entries matching -DSQLITE_OMIT* and
+  # Copy all CFLAGS and CPPFLAGS entries matching -DSQLITE_OMIT* and
   # -DSQLITE_ENABLE* to OPT_FEATURE_FLAGS. This behavior is derived
   # from the legacy build and was missing the 3.48.0 release (the
   # initial Autosetup port).
   # https://sqlite.org/forum/forumpost/9801e54665afd728
   #
+  # Handling of CPPFLAGS, as well as removing ENABLE/OMIT from
+  # CFLAGS/CPPFLAGS, was missing in the 3.49.0 release as well.
+  #
   # If any configure flags for features are in conflict with
-  # CFLAGS-specified feature flags, all bets are off.  There are no
-  # guarantees about which one will take precedence.
-  foreach cf [get-define CFLAGS ""] {
+  # CFLAGS/CPPFLAGS-specified feature flags, all bets are off.  There
+  # are no guarantees about which one will take precedence.
+  foreach flagDef {CFLAGS CPPFLAGS} {
+    set tmp ""
+    foreach cf [get-define $flagDef ""] {
+      switch -glob -- $cf {
+        -DSQLITE_OMIT* -
+        -DSQLITE_ENABLE* {
+          sqlite-add-feature-flag $cf
+        }
+        default {
+          lappend tmp $cf
+        }
+      }
+    }
+    define $flagDef $tmp
+  }
+
+  # Strip all SQLITE_ENABLE/OMIT flags from BUILD_CFLAGS,
+  # for compatibility with the legacy build.
+  set tmp ""
+  foreach cf [get-define BUILD_CFLAGS ""] {
     switch -glob -- $cf {
       -DSQLITE_OMIT* -
-      -DSQLITE_ENABLE* {
-        sqlite-add-feature-flag $cf
+      -DSQLITE_ENABLE* {}
+      default {
+        lappend tmp $cf
       }
     }
   }
+  define BUILD_CFLAGS $tmp
 }
 
 ########################################################################