Subject: [bug#78212] [PATCH 1/2] gnu: sqlite: Update to 3.49.1.

From: Ashish SHUKLA <[email-masked]>
Date: Fri, 2 May 2025 13:51:02 +0000

* gnu/packages/sqlite.scm (sqlite)[#:phases]<move-static-library>:
Update to check for the existence of file before patching it.

* gnu/packages/sqlite.scm (sqlite-next): Update to 3.49.1. Add
  arguments.

Change-Id: I74f8bb57090a050eb2e0c8cb5a1d4910efa714d5
---
 gnu/packages/sqlite.scm | 34 +++++++++++++++++++++++++++-------
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/gnu/packages/sqlite.scm b/gnu/packages/sqlite.scm
index dd21db0921..5b30865b08 100644
--- a/gnu/packages/sqlite.scm
+++ b/gnu/packages/sqlite.scm
@@ -38,6 +38,7 @@ (define-module (gnu packages sqlite)
   #:use-module (guix packages)
   #:use-module (guix download)
   #:use-module (guix build-system gnu)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix deprecation)
   #:use-module (ice-9 match)
@@ -99,10 +100,10 @@ (define-public sqlite
 
                        ;; Remove reference to the static library from the .la file
                        ;; so that Libtool looks for it in the usual places.
-                       (substitute* (string-append out "/lib/libsqlite3.la")
-                         (("^old_library=.*")
-                          "old_library=''\n"))
-                       #t))))))
+                       (when (file-exists? (string-append out "/lib/libsqlite3.la"))
+                         (substitute* (string-append out "/lib/libsqlite3.la")
+                           (("^old_library=.*")
+                            "old_library=''\n")))))))))
    (home-page "https://www.sqlite.org/")
    (synopsis "The SQLite database management system")
    (description
@@ -116,10 +117,29 @@ (define-public sqlite
 (define-public sqlite-next
   (package
     (inherit sqlite)
-    (version "3.46.0")
+    (version "3.49.1")
+    (arguments
+      (cons*
+        ;; disable tests; no check/test target
+        #:tests? #f
+        (substitute-keyword-arguments (package-arguments sqlite)
+          ((#:configure-flags flags #~(list))
+           #~(map (lambda (flag)
+                    (if (string-prefix? "CFLAGS=" flag)
+                      ;; enable for fossil
+                      (string-append flag " -DSQLITE_ENABLE_FTS4")
+                      flag))
+                  #$flags))
+          ((#:phases phases #~(list))
+           #~(modify-phases #$phases
+               (add-after 'unpack 'patch-unknown-option-check
+                 (lambda _
+                   (substitute* "autosetup/autosetup"
+                     (("user-error \"Unknown option" all)
+                      (string-append "# " all))))))))))
     (source (origin
               (method url-fetch)
-              (uri (sqlite-uri version 2024))
+              (uri (sqlite-uri version 2025))
               (sha256
                (base32
-                "0zbs853s8ly693qdg0l7vs4shwn3plmvdczr2s478wsj6dxnm3kg"))))))
+                "0m4jnnbpypixmkz5pkss470gf6dpx5942kmn4drmyv5krkc44rhh"))))))
-- 
2.49.0