Simon Josefsson writes:

Hello Simon,

> Thanks!  Is there any simple way to test your usage mode in CI?  I
> looked into getting a MinGW build environment suitable for guile-gnutls
> up but didn't have the required amount of patience to get all
> dependencies in a usable form...  are there any supported container
> images with a MinGW environment available?

If you pull the latest guix (I resurrected the MinGW build for Guile)
you can use something like the attached patch to build Guile-GnuTLS for
MinGW.

For cross-build CI you might get inspirationn from Guile
<https://git.savannah.gnu.org/cgit/guile.git/tree/.guix/manifest.scm>,
if so needed.

> I think there were some resistance to increase gnulib usage before, but
> maybe this increase is possible to justify...

Well, guile-websocket is using it now and I believe it was rumoured that
might even be included Guile proper some time so you never know :)

Greetings,
Janneke

>From 64b0b2b3495447063d66c2a04ee1429297164f61 Mon Sep 17 00:00:00 2001
From: Janneke Nieuwenhuizen <jann...@gnu.org>
Date: Fri, 16 May 2025 23:43:32 +0200
Subject: [PATCH] maint: Add guile-gnutls-mingw recipe.

---
 guix/packages/guile-gnutls.scm | 139 +++++++++++++++++++++++++++++++++
 1 file changed, 139 insertions(+)
 create mode 100644 guix/packages/guile-gnutls.scm

diff --git a/guix/packages/guile-gnutls.scm b/guix/packages/guile-gnutls.scm
new file mode 100644
index 0000000..cfd57d7
--- /dev/null
+++ b/guix/packages/guile-gnutls.scm
@@ -0,0 +1,139 @@
+;;; GnuTLS --- Guile bindings for GnuTLS.
+;;; Copyright (C) 2025 Free Software Foundation, Inc.
+;;;
+;;; GnuTLS is free software; you can redistribute it and/or
+;;; modify it under the terms of the GNU Lesser General Public
+;;; License as published by the Free Software Foundation; either
+;;; version 2.1 of the License, or (at your option) any later version.
+;;;
+;;; GnuTLS is distributed in the hope that it will be useful,
+;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+;;; Lesser General Public License for more details.
+;;;
+;;; You should have received a copy of the GNU Lesser General Public
+;;; License along with GnuTLS; if not, write to the Free Software
+;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
+
+;;; Commentary:
+;;;
+;;; Recipe for a MinGW build of Guile-GnuTLS, do something like
+;;;
+;;;     GUIX_PACKAGE_PATH=guix guix build --target=i686-w64-mingw32 guile-gnutls-mingw
+;;;
+;;; Code:
+
+(define-module (packages guile-gnutls)
+  #:use-module (guix gexp)
+  #:use-module (guix git-download)
+  #:use-module (guix packages)
+  #:use-module (guix utils)
+
+  #:use-module (gnu packages autotools)
+  #:use-module (gnu packages guile)
+  #:use-module (gnu packages tls))
+
+(define-public gnutls-minimal
+  (package
+    (inherit gnutls)
+    (name "gnutls-minimal")
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs gnutls)
+       (delete
+        "libtasn1" "libidn2"
+        ;; "nettle" ;FIXME: --with-nettle-mini still wants nettle?
+        "p11-kit")))
+    (arguments
+     (substitute-keyword-arguments (package-arguments gnutls)
+       ((#:configure-flags flags #~'())
+        #~(cons*
+           #$(string-append "CFLAGS=-g -O2"
+                            " -Wno-error=implicit-function-declaration"
+                            " -Wno-error=incompatible-pointer-types")
+           ;;"--with-nettle-mini"
+           "--disable-silent-rules"     ;for debugging
+           "--disable-doc"      ;avoids attempting to build doc/examples
+           "--with-included-libtasn1"
+           ;; ordering of configure --help
+           "--without-p11-kit"
+           "--without-tpm2"
+           "--without-tpm"
+           "--without-zlib"
+           "--without-brotli"
+           "--without-zstd"
+           #$flags))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (delete 'move-doc)))))))
+
+(define-public gnutls-minimal
+  (package
+    (inherit gnutls)
+    (name "gnutls-minimal")
+    (propagated-inputs
+     (modify-inputs (package-propagated-inputs gnutls)
+       (delete
+        "libtasn1" "libidn2"
+        ;; "nettle" ;FIXMUE: --with-nettle-mini still wants nettle?
+        "p11-kit")))
+    (arguments
+     (substitute-keyword-arguments (package-arguments gnutls)
+       ((#:configure-flags flags #~'())
+        #~(cons*
+           #$(string-append "CFLAGS=-g -O2"
+                            " -Wno-error=implicit-function-declaration"
+                            " -Wno-error=incompatible-pointer-types")
+           ;;"--with-nettle-mini"
+           "--disable-silent-rules"     ;for debugging
+           "--disable-doc"      ;avoids attempting to build doc/examples
+           "--with-included-libtasn1"
+           ;; ordering of configure --help
+           "--without-p11-kit"
+           "--without-tpm2"
+           "--without-tpm"
+           "--without-zlib"
+           "--without-brotli"
+           "--without-zstd"
+           #$flags))
+       ((#:phases phases #~%standard-phases)
+        #~(modify-phases #$phases
+            (delete 'move-doc)))))))
+
+(define-public guile-gnutls-mingw
+  (let ((vcs-file? (or (git-predicate
+                        (string-append (or (current-source-directory)
+                                           (dirname (current-filename)))
+                                       "/../.."))
+                       (const #t)))
+        (revision "0"))
+    (package
+      (inherit guile-gnutls)
+      (name "guile-gnutls-mingw")
+      (version "4.0.1.git")
+      (source (local-file "." "guile-gnutls-checkout"
+                          #:recursive? #t
+                          #:select? vcs-file?))
+      (native-inputs
+       (modify-inputs (package-native-inputs guile-gnutls)
+         (prepend autoconf automake)))
+      (inputs
+       (modify-inputs (package-inputs guile-gnutls)
+         (replace "gnutls" gnutls-minimal)
+         (replace "guile" guile-3.0)))
+      (arguments
+       (substitute-keyword-arguments (package-arguments guile-gnutls)
+         ((#:phases phases #~%standard-phases)
+          #~(modify-phases #$phases
+              (add-before 'bootstrap 'prepare-bootstrap
+                (lambda _
+                  ;; FIXME: Submodules don't get patch-shebang'ed?
+                  (patch-shebang "gnulib/gnulib-tool")
+                  (patch-shebang "gnulib/gnulib-tool.sh")
+                  (patch-shebang "gnulib/build-aux/bootstrap")
+                  (patch-shebang "gnulib/build-aux/git-version-gen")
+                  (patch-shebang "gnulib/build-aux/prefix-gnulib-mk")
+                  (patch-shebang "gnulib/modules/git-version-gen")))))
+         ((#:configure-flags flags #~'())
+          #~(cons*
+             "--disable-silent-rules"   ;for debugging
+             #$flags)))))))
-- 
2.49.0

-- 
Janneke Nieuwenhuizen <jann...@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | AvatarĀ® https://AvatarAcademy.com

Reply via email to