From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <guix-patches-bounces+larch=yhetil.org@gnu.org>
Received: from mp2.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by ms13.migadu.com with LMTPS
	id MH64Kqg3PGdTdAEAe85BDQ:P1
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 19 Nov 2024 07:00:56 +0000
Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	by mp2.migadu.com with LMTPS
	id MH64Kqg3PGdTdAEAe85BDQ
	(envelope-from <guix-patches-bounces+larch=yhetil.org@gnu.org>)
	for <larch@yhetil.org>; Tue, 19 Nov 2024 08:00:56 +0100
X-Envelope-To: larch@yhetil.org
Authentication-Results: aspmx1.migadu.com;
	dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=bSCWrf95;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GYi2xCZ2;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=gnu.org
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org;
	s=key1; t=1731999655;
	h=from:from:sender:sender:reply-to:subject:subject:date:date:
	 message-id:message-id:to:to:cc:mime-version:mime-version:
	 content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:resent-cc:
	 resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to:
	 references:references:list-id:list-help:list-unsubscribe:
	 list-subscribe:list-post:dkim-signature;
	bh=GoAeMddNyBDVybPTmya05BStkXK1mIySOPuk2z++aLw=;
	b=eeBeKp7nAoN5TGaL4HOKOhDhAu04EZH9XjPvEXVPxYJDIXDMG+mlz+fDJSJndcCSt53rbw
	K1GNWFebHsNjvdEXcxHtVnmBiqXJ56UFpBlDXs7Au0Gj4SWObRXl844QKCxORVeexgLZLT
	p2Q32YNmOjaYKnz21SKvNvyDTooza9+YUM/8f0Sllk1kqpMhbTLLPY+cMvL6yrHYvLuQoY
	B4ee7Iz/Wh0C+rBwD1fiTlDyQcCueA1LjsxAYMsEWC/LjiM789zJhNEKH9pCRepqdizxpW
	OG8CfWOhtEynGwUFWlIvAcORqdcdzrKEJe/cdBNRpO6CNaIdil1zUr4wYAHBdA==
ARC-Authentication-Results: i=1;
	aspmx1.migadu.com;
	dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b=bSCWrf95;
	dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=GYi2xCZ2;
	spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org";
	dmarc=pass (policy=none) header.from=gnu.org
ARC-Seal: i=1; s=key1; d=yhetil.org; t=1731999655; a=rsa-sha256; cv=none;
	b=hubpMmWsyzZGE2khLWw0VjG9qETqjaL4KtVLTO+ytTT6379n5dLTGmuts4QcWvLFlhbLyq
	VGsHBwUezP6LJGQF0liaMoI8ZNw0Z5x3dsESEs8guYfg9MlXkeHPGcvfQ4ljaoy08LDlLL
	U3jpCXXFM7sFncH+uIeHtsnmLGIRUnX/f9zAGDGc7lm3svw201BFFuvwxSo6Yn4UiEk/fd
	hOEAp4J8D2uvP3wolPp04g0fpLxAso/HTRLCV6s9OHyWK00yvhEGH18KypikIilA7K62of
	cLSC7Vi9mbUKJncf2eqdbiXSRZFrJbJIVIrI1UoTV/VQOaFUOkcof31n9jEkDw==
Received: from lists.gnu.org (lists.gnu.org [209.51.188.17])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by aspmx1.migadu.com (Postfix) with ESMTPS id 798F343995
	for <larch@yhetil.org>; Tue, 19 Nov 2024 08:00:55 +0100 (CET)
Received: from localhost ([::1] helo=lists1p.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.90_1)
	(envelope-from <guix-patches-bounces@gnu.org>)
	id 1tDID2-0000Bo-B6; Tue, 19 Nov 2024 01:59:36 -0500
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1tDICo-0008Ry-Kd
 for guix-patches@gnu.org; Tue, 19 Nov 2024 01:59:22 -0500
Received: from debbugs.gnu.org ([2001:470:142:5::43])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <Debian-debbugs@debbugs.gnu.org>)
 id 1tDICo-0004Lj-Bp
 for guix-patches@gnu.org; Tue, 19 Nov 2024 01:59:22 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed;
 d=debbugs.gnu.org; s=debbugs-gnu-org; 
 h=MIME-Version:References:In-Reply-To:Date:From:To:Subject;
 bh=GoAeMddNyBDVybPTmya05BStkXK1mIySOPuk2z++aLw=; 
 b=bSCWrf95n+tPLxCDUIHRrsMS3eDr1AKXVMYl7k0oEdoETCudN9H58SbAXj5uflq5cWd5vKG9RYy1A+8kfQPDxfMpaBqF4UdJJSG2kwVl5cdzBMbdlHDR/6iA+hD6/XHrZ4GI2rXOmu2R96Zvl8iI6XS2pnaCiya+BJOI2rPCS/9MA+Aw3jOWw33WPBicEP+CedhkCgWx2rDwKcvtpcEsxFprp9r0MNgZwsxJHFEmgD4vUBIE1y6jzhEg6Q66dC4In9tidA/qAp4I5t6pZQCZYz5FPUkKbWnxRarmjwo3bdQr3nK5VN7jrtXvQuXG+AuNQa4/evy7Mb/ozn2RRoveng==;
Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2)
 (envelope-from <Debian-debbugs@debbugs.gnu.org>) id 1tDICo-0005Jf-7K
 for guix-patches@gnu.org; Tue, 19 Nov 2024 01:59:22 -0500
X-Loop: help-debbugs@gnu.org
Subject: [bug#74290] [PATCH v3 29/51] gnu: openssl-3.0: Support the 64bit Hurd.
Resent-From: Janneke Nieuwenhuizen <janneke@gnu.org>
Original-Sender: "Debbugs-submit" <debbugs-submit-bounces@debbugs.gnu.org>
Resent-CC: guix-patches@gnu.org
Resent-Date: Tue, 19 Nov 2024 06:59:22 +0000
Resent-Message-ID: <handler.74290.B74290.173199954920217@debbugs.gnu.org>
Resent-Sender: help-debbugs@gnu.org
X-GNU-PR-Message: followup 74290
X-GNU-PR-Package: guix-patches
X-GNU-PR-Keywords: patch
To: 74290@debbugs.gnu.org
Received: via spool by 74290-submit@debbugs.gnu.org id=B74290.173199954920217
 (code B ref 74290); Tue, 19 Nov 2024 06:59:22 +0000
Received: (at 74290) by debbugs.gnu.org; 19 Nov 2024 06:59:09 +0000
Received: from localhost ([127.0.0.1]:40587 helo=debbugs.gnu.org)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <debbugs-submit-bounces@debbugs.gnu.org>)
 id 1tDICa-0005Fk-Q5
 for submit@debbugs.gnu.org; Tue, 19 Nov 2024 01:59:09 -0500
Received: from eggs.gnu.org ([209.51.188.92]:49950)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <janneke@gnu.org>) id 1tDIC3-0005AC-Ps
 for 74290@debbugs.gnu.org; Tue, 19 Nov 2024 01:58:36 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <janneke@gnu.org>)
 id 1tDI9r-00041b-1s; Tue, 19 Nov 2024 01:56:19 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To:
 From; bh=GoAeMddNyBDVybPTmya05BStkXK1mIySOPuk2z++aLw=; b=GYi2xCZ2g/iqINWyIuDy
 1vR3g5+CzHjMiOJCNAdqPIeUKL2G/a4T+lZw0JwQWXjeRY7SA7V48E5DWfxrGk7aUsaKw+DMJOFTN
 o6BTRUxlz0OCDjvwNF5cvmZVpR0/7f+KRrt3ccOdkBe55yDDeLE7xIl50NbSG2S+vnXB29Yh3dNe6
 r5QIXbTjGJ3ucuZT+imLmj0fVIyk4L9lWdJZDp/tjM2S7NZ94nDvfbHu+z7h1RNyF+465zkPDvCVY
 9aSg7w7pCr1coUXQ/rIoHM25Ig5dAdsh3JQF+Zk91qbChuSENnOAf3tVPa72JjhLes8/NmAnEdcNF
 OLU9zEWgHA4mtA==;
From: Janneke Nieuwenhuizen <janneke@gnu.org>
Date: Tue, 19 Nov 2024 07:54:59 +0100
Message-ID: <061a58f90f9a5f7f43b148bc8d71f6322e9a3cec.1731999203.git.janneke@gnu.org>
X-Mailer: git-send-email 2.46.0
In-Reply-To: <cover.1731999202.git.janneke@gnu.org>
References: <cover.1731999202.git.janneke@gnu.org>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: debbugs-submit@debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
X-BeenThere: guix-patches@gnu.org
List-Id: <guix-patches.gnu.org>
List-Unsubscribe: <https://lists.gnu.org/mailman/options/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=unsubscribe>
List-Archive: <https://lists.gnu.org/archive/html/guix-patches>
List-Post: <mailto:guix-patches@gnu.org>
List-Help: <mailto:guix-patches-request@gnu.org?subject=help>
List-Subscribe: <https://lists.gnu.org/mailman/listinfo/guix-patches>,
 <mailto:guix-patches-request@gnu.org?subject=subscribe>
Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org
Sender: guix-patches-bounces+larch=yhetil.org@gnu.org
X-Migadu-Country: US
X-Migadu-Flow: FLOW_IN
X-Migadu-Scanner: mx11.migadu.com
X-Migadu-Spam-Score: -3.72
X-Spam-Score: -3.72
X-Migadu-Queue-Id: 798F343995
X-TUID: IBrn18/IMnKC

* gnu/packages/patches/openssl-hurd64.patch: New file.
* gnu/local.mk (dist_patch_DATA): Register it.
* gnu/packages/tls.scm (openssl-3.0)[arguments]: When building for
the 64bit Hurd, use it in new "apply-hurd-patch" phase.

Change-Id: I8936377da726681b748cc010e1fbae3fb19dee05
---
 gnu/local.mk                              |  1 +
 gnu/packages/patches/openssl-hurd64.patch | 99 +++++++++++++++++++++++
 gnu/packages/tls.scm                      |  9 +++
 3 files changed, 109 insertions(+)
 create mode 100644 gnu/packages/patches/openssl-hurd64.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 147f8d8709..a0408d20f2 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -1901,6 +1901,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/opensles-add-license-file.patch			\
   %D%/packages/patches/openssl-1.1-c-rehash-in.patch		\
   %D%/packages/patches/openssl-3.0-c-rehash-in.patch		\
+  %D%/packages/patches/openssl-hurd64.patch			\
   %D%/packages/patches/opentaxsolver-file-browser-fix.patch     \
   %D%/packages/patches/open-zwave-hidapi.patch			\
   %D%/packages/patches/orangeduck-mpc-fix-pkg-config.patch	\
diff --git a/gnu/packages/patches/openssl-hurd64.patch b/gnu/packages/patches/openssl-hurd64.patch
new file mode 100644
index 0000000000..372fda834a
--- /dev/null
+++ b/gnu/packages/patches/openssl-hurd64.patch
@@ -0,0 +1,99 @@
+Upstream-status: Taken from upstream:
+
+<https://github.com/openssl/openssl/commit/7c729851d169f30d9e0c0ad6e7c1cf6cefb37935>.
+
+From 795699363be8f717e36802c3ac503011b74ad752 Mon Sep 17 00:00:00 2001
+From: Janneke Nieuwenhuizen <janneke@gnu.org>
+Date: Thu, 7 Nov 2024 14:08:05 +0100
+Subject: [PATCH] Add support for the 64bit Hurd.
+Content-Transfer-Encoding: 8bit
+Content-Type: text/plain; charset=UTF-8
+
+Taken from <https://salsa.debian.org/debian/openssl>.
+---
+ Configurations/10-main.conf | 45 ++++++++++++++++++++++++++++++++-----
+ util/perl/OpenSSL/config.pm |  3 ++-
+ 2 files changed, 41 insertions(+), 7 deletions(-)
+
+diff --git a/Configurations/10-main.conf b/Configurations/10-main.conf
+index b578a3c2a8..740460ebd3 100644
+--- a/Configurations/10-main.conf
++++ b/Configurations/10-main.conf
+@@ -1685,20 +1685,53 @@ my %targets = (
+     },
+ 
+ ##### GNU Hurd
+-    "hurd-x86" => {
++    "hurd-generic32" => {
+         inherit_from     => [ "BASE_unix" ],
+         CC               => "gcc",
+-        CFLAGS           => "-O3 -fomit-frame-pointer -Wall",
++        CXX              => "g++",
++        CFLAGS           => picker(default => "-Wall",
++                                   debug   => "-O0 -g",
++                                   release => "-O3"),
++        CXXFLAGS         => picker(default => "-Wall",
++                                   debug   => "-O0 -g",
++                                   release => "-O3"),
+         cflags           => threads("-pthread"),
+-        lib_cppflags     => "-DL_ENDIAN",
++        cxxflags         => combine("-std=c++11", threads("-pthread")),
+         ex_libs          => add("-ldl", threads("-pthread")),
+-        bn_ops           => "BN_LLONG",
+-        asm_arch         => 'x86',
+-        perlasm_scheme   => 'elf',
++        bn_ops           => "BN_LLONG RC4_CHAR",
+         thread_scheme    => "pthreads",
+         dso_scheme       => "dlfcn",
+         shared_target    => "linux-shared",
+         shared_cflag     => "-fPIC",
++        shared_ldflag    => sub { $disabled{pinshared} ? () : "-Wl,-znodelete" },
++    },
++
++    "hurd-generic64" => {
++        inherit_from     => [ "hurd-generic32" ],
++        bn_ops           => "SIXTY_FOUR_BIT_LONG RC4_CHAR",
++    },
++
++    #### X86 / X86_64 targets
++    "hurd-x86" => {
++        inherit_from     => [ "hurd-generic32" ],
++        CFLAGS           => add(picker(release => "-fomit-frame-pointer")),
++        cflags           => add("-m32"),
++        cxxflags         => add("-m32"),
++        lib_cppflags     => add("-DL_ENDIAN"),
++        bn_ops           => "BN_LLONG",
++        asm_arch         => 'x86',
++        perlasm_scheme   => 'elf',
++    },
++
++    "hurd-x86_64" => {
++        inherit_from     => [ "hurd-generic64" ],
++        cflags           => add("-m64"),
++        cxxflags         => add("-m64"),
++        lib_cppflags     => add("-DL_ENDIAN"),
++        bn_ops           => "SIXTY_FOUR_BIT_LONG",
++        asm_arch         => 'x86_64',
++        perlasm_scheme   => 'elf',
++        multilib         => "64",
+     },
+ 
+ ##### VxWorks for various targets
+diff --git a/util/perl/OpenSSL/config.pm b/util/perl/OpenSSL/config.pm
+index 2f1edcafb6..707db71537 100755
+--- a/util/perl/OpenSSL/config.pm
++++ b/util/perl/OpenSSL/config.pm
+@@ -92,7 +92,8 @@ my $guess_patterns = [
+     [ 'IRIX64:.*',                  'mips4-sgi-irix64' ],
+     [ 'Linux:[2-9]\..*',            '${MACHINE}-whatever-linux2' ],
+     [ 'Linux:1\..*',                '${MACHINE}-whatever-linux1' ],
+-    [ 'GNU.*',                      'hurd-x86' ],
++    [ 'GNU:.*86-AT386',             'hurd-x86' ],
++    [ 'GNU:.*86_64-AT386',          'hurd-x86_64' ],
+     [ 'LynxOS:.*',                  '${MACHINE}-lynx-lynxos' ],
+     # BSD/OS always says 386
+     [ 'BSD\/OS:4\..*',              'i486-whatever-bsdi4' ],
+-- 
+Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
+Freelance IT https://www.JoyOfSource.com | AvatarĀ® https://AvatarAcademy.com
+
diff --git a/gnu/packages/tls.scm b/gnu/packages/tls.scm
index 43806e24da..fab88518ce 100644
--- a/gnu/packages/tls.scm
+++ b/gnu/packages/tls.scm
@@ -589,6 +589,15 @@ (define-public openssl-3.0
                                            "/bin/perl"))))
             #$@(if (target-hurd?)
                    #~((delete 'patch-configure))
+                   #~())
+            #$@(if (target-hurd64?)
+                   #~((add-after 'unpack 'apply-hurd-patch
+                        (lambda _
+                          (let ((patch-file
+                                 #$(local-file
+                                    (search-patch "openssl-hurd64.patch"))))
+                            (invoke "patch" "--force" "-p1" "-i"
+                                    patch-file)))))
                    #~())))
        ((#:configure-flags flags #~'())
         (if (system-hurd?)
-- 
2.46.0