From 3dbbf5910ec5acb76deedfaf3fc5b075d3f2ed04 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Thu, 24 Sep 2026 20:44:21 -0500 Subject: [PATCH] Fix guix build --- guix.scm | 135 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 133 insertions(+), 2 deletions(-) diff --git a/guix.scm b/guix.scm index 3e08c9a..b8a347c 100644 --- a/guix.scm +++ b/guix.scm @@ -3,17 +3,144 @@ (guix packages) (guix download) (guix git-download) + (guix gexp) (guix build-system cmake) + (guix build-system gnu) + (guix utils) + (gnu packages) + (gnu packages compression) (gnu packages crypto) + (gnu packages curl) (gnu packages databases) + (gnu packages gcc) (gnu packages libidn) (gnu packages linux) (gnu packages python) - (gnu packages sqlite) + (gnu packages python-xyz) + (gnu packages readline) (gnu packages version-control) (gnu packages xml) + (ice-9 match) (ice-9 rdelim) - (ice-9 popen)) + (ice-9 popen) + (srfi srfi-26)) + +(define (sqlite-uri version year) + (let ((numeric-version + (match (string-split version #\.) + ((first-digit other-digits ...) + (string-append first-digit + (string-pad-right + (string-concatenate + (map (cut string-pad <> 2 #\0) + other-digits)) + 6 #\0)))))) + (string-append "https://sqlite.org/" (number->string year) + "/sqlite-autoconf-" numeric-version ".tar.gz"))) + +(define-public sqlite + (package + (name "sqlite") + (version "3.39.3") + (source (origin + (method url-fetch) + (uri (sqlite-uri version 2022)) + (patches (search-patches "sqlite-hurd.patch")) + (sha256 + (base32 + "1f922kq16g7f4h3gpzim78lvrp5xw9nvlvqw97s2qgxyh8qgns3q")))) + (build-system gnu-build-system) + (inputs (list readline)) + (outputs '("out" "static")) + (arguments + `(#:configure-flags + ;; Add -DSQLITE_SECURE_DELETE, -DSQLITE_ENABLE_FTS3, + ;; -DSQLITE_ENABLE_UNLOCK_NOTIFY and -DSQLITE_ENABLE_DBSTAT_VTAB + ;; to CFLAGS. GNU Icecat will refuse to use the system SQLite + ;; unless these options are enabled. + (list (string-append "CFLAGS=-O2 -g -DSQLITE_SECURE_DELETE " + "-DSQLITE_ENABLE_FTS3 " + "-DSQLITE_ENABLE_UNLOCK_NOTIFY " + "-DSQLITE_ENABLE_DBSTAT_VTAB " + ;; Column metadata is required by GNU Jami and Qt, et.al. + "-DSQLITE_ENABLE_COLUMN_METADATA")) + #:phases (modify-phases %standard-phases + (add-after 'install 'move-static-library + (lambda* (#:key outputs #:allow-other-keys) + (let* ((out (assoc-ref outputs "out")) + (static (assoc-ref outputs "static")) + (source (string-append out "/lib/libsqlite3.a"))) + (mkdir-p (string-append static "/lib")) + (link source (string-append static "/lib/libsqlite3.a")) + (delete-file source) + + ;; 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)))))) + (home-page "https://www.sqlite.org/") + (synopsis "The SQLite database management system") + (description + "SQLite is a software library that implements a self-contained, serverless, +zero-configuration, transactional SQL database engine. SQLite is the most +widely deployed SQL database engine in the world. The source code for SQLite +is in the public domain.") + (license license:public-domain))) + +(define-public botan + (package + (name "botan") + (version "3.9.0") + (source (origin + (method git-fetch) + (uri (git-reference + (url "https://github.com/randombit/botan/") + (commit version))) + (file-name (git-file-name name version)) + (sha256 + (base32 + "1k5dyn39b77bfawly2yms0crbkn6g7msh16q7bxnh7dra4cnkmsn")))) + (build-system gnu-build-system) + (arguments + (list + #:phases + #~(modify-phases %standard-phases + (replace 'configure + (lambda* (#:key inputs outputs #:allow-other-keys) + ;; Upstream tests and benchmarks with -O3. + (setenv "CXXFLAGS" "-O3") + (invoke "python" "./configure.py" + (string-append "--prefix=" #$output) + "--disable-static" + + ;; Otherwise, the `botan` executable cannot find + ;; libbotan. + (string-append "--ldflags=-Wl,-rpath=" #$output "/lib") + + "--with-os-feature=getentropy" + "--with-rst2man" + + ;; Recommended by upstream + "--with-zlib" "--with-bzip2" "--with-sqlite3"))) + (add-before 'check 'library-path-for-tests + (lambda _ (setenv "LD_LIBRARY_PATH" (getcwd)))) + (replace 'check + (lambda* (#:key tests? #:allow-other-keys) + (when tests? + (invoke "./botan-test"))))))) + (native-inputs (list python-wrapper python-docutils gcc-12)) + (inputs (list sqlite bzip2 zlib)) + (synopsis "Cryptographic library in C++11") + (description "Botan is a cryptography library, written in C++11, offering +the tools necessary to implement a range of practical systems, such as TLS/DTLS, +PKIX certificate handling, PKCS#11 and TPM hardware support, password hashing, +and post-quantum crypto schemes. In addition to the C++, botan has a C89 API +specifically designed to be easy to call from other languages. A Python binding +using ctypes is included, and several other language bindings are available.") + (home-page "https://botan.randombit.net") + (license license:bsd-2))) ;;;; @@ -47,9 +174,13 @@ (lambda* (#:key outputs #:allow-other-keys) (substitute* "CMakeLists.txt" ((".etc.biboumi") (string-append (assoc-ref outputs "out") "/etc/biboumi")))))))) + (native-inputs + '(list + gcc-12)) (inputs '(list botan + curl expat git libidn2