From patchwork Sun Jul 11 11:47:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: M X-Patchwork-Id: 31290 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 18BA527BC83; Sun, 11 Jul 2021 12:49:30 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_PASS,T_DKIM_INVALID,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 5122D27BC81 for ; Sun, 11 Jul 2021 12:49:29 +0100 (BST) Received: from localhost ([::1]:50878 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m2Xxg-0005Au-CG for patchwork@mira.cbaines.net; Sun, 11 Jul 2021 07:49:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:57520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m2XxJ-00042a-7n for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:05 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:50775) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1m2XxI-0008Is-WC for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:05 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1m2XxJ-00074I-0B for guix-patches@gnu.org; Sun, 11 Jul 2021 07:49:05 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#49025] [PATCH v5 07/20] libgpg-error: Prevent silent miscompilation some systems. Resent-From: Maxime Devos Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sun, 11 Jul 2021 11:49:04 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 49025 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 49025@debbugs.gnu.org Cc: Maxime Devos Received: via spool by 49025-submit@debbugs.gnu.org id=B49025.162600409326973 (code B ref 49025); Sun, 11 Jul 2021 11:49:04 +0000 Received: (at 49025) by debbugs.gnu.org; 11 Jul 2021 11:48:13 +0000 Received: from localhost ([127.0.0.1]:34056 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2XwT-00070t-9l for submit@debbugs.gnu.org; Sun, 11 Jul 2021 07:48:13 -0400 Received: from xavier.telenet-ops.be ([195.130.132.52]:38290) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1m2XwJ-0006xg-21 for 49025@debbugs.gnu.org; Sun, 11 Jul 2021 07:48:04 -0400 Received: from localhost.localdomain ([213.119.242.127]) by xavier.telenet-ops.be with bizsmtp id Tnno2500V2ldwth01no2rb; Sun, 11 Jul 2021 13:48:02 +0200 From: Maxime Devos Date: Sun, 11 Jul 2021 13:47:10 +0200 Message-Id: <20210711114723.27568-8-maximedevos@telenet.be> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210711114723.27568-1-maximedevos@telenet.be> References: <419215938396207999184dafa43afaed6d7a0715.camel@telenet.be> <20210711114723.27568-1-maximedevos@telenet.be> MIME-Version: 1.0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telenet.be; s=r21; t=1626004082; bh=QFau1FaeK/5b1bWqy9BVr+tMxwUOU/Qw1BH0pUCw/qc=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=by92CKWc6W/OvtNN3hWBc3PEzqoNOZ/EtQ7PnA/FNDLY1yVV0po9meJa7vLp1wdnG hMi2czE89AbUlLXE5/zb2rtqu23B4YHJVsfc1AO6YtLZh+uTVrA6qgFxOXV08QruER H3Cj1zY9n3geDD3OapbAXHifKDGgEmr53ti/DJ1Au5TB8JOxAztEOjhb9lz/N5UXSb 2Z60ihz1cqf/ZILGbyr9k6ezaTOFFQlVfaKqTk6mZ4XxWHkhVX/RT511yk+axrPa/O +50DTcaZtJ/PkiZi8ECH7PuMzHd+eaTa5S6oicTFI1x/vEIRX/E2XG+lcQo0wF3JQ+ BHks6iPUzwW4A== X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * gnu/packages/gpg.scm (libgpgerror)[arguments]<#:phases>{cross-symlinks}: Only link to src/syscfg/lock-obj-pub.linux-gnu.h if the package is being compiled for a Linux target. Do not link either if the architecture is unknown, as the headers vary with the architecture. --- gnu/packages/gnupg.scm | 40 ++++++++++++++++++++++++++-------------- 1 file changed, 26 insertions(+), 14 deletions(-) diff --git a/gnu/packages/gnupg.scm b/gnu/packages/gnupg.scm index 5c0d03927e..1a7c682ad6 100644 --- a/gnu/packages/gnupg.scm +++ b/gnu/packages/gnupg.scm @@ -18,6 +18,7 @@ ;;; Copyright © 2018 Björn Höfling ;;; Copyright © 2019 Mathieu Othacehe ;;; Copyright © 2020 Fredrik Salomonsson +;;; Copyright © 2021 Maxime Devos ;;; ;;; This file is part of GNU Guix. ;;; @@ -77,6 +78,7 @@ #:use-module (guix build-system gnu) #:use-module (guix build-system perl) #:use-module (guix build-system python) + #:use-module (ice-9 match) #:use-module (srfi srfi-1)) (define-public libgpg-error @@ -94,27 +96,37 @@ (build-system gnu-build-system) (arguments (if (%current-target-system) - `(#:modules ((ice-9 match) - (guix build gnu-build-system) + `(#:modules ((guix build gnu-build-system) (guix build utils)) #:phases (modify-phases %standard-phases ;; When cross-compiling, some platform specific properties cannot ;; be detected. Create a symlink to the appropriate platform - ;; file. See Cross-Compiling section at: + ;; file if required. Note that these platform files depend on + ;; both the operating system and architecture! + ;; + ;; See Cross-Compiling section at: ;; https://github.com/gpg/libgpg-error/blob/master/README (add-after 'unpack 'cross-symlinks - (lambda* (#:key target inputs #:allow-other-keys) - (let ((triplet - (match (string-take target - (string-index target #\-)) - ("armhf" "arm-unknown-linux-gnueabi") - ("mips64el" "mips-unknown-linux-gnu") - (x - (string-append x "-unknown-linux-gnu"))))) - (symlink - (string-append "lock-obj-pub." triplet ".h") - "src/syscfg/lock-obj-pub.linux-gnu.h")))))) + (lambda _ + (define (link triplet source) + (symlink (string-append "lock-obj-pub." triplet ".h") + (string-append "src/syscfg/lock-obj-pub." + source ".h"))) + ,(let* ((target (%current-target-system)) + (architecture + (string-take target (string-index target #\-)))) + (cond ((target-linux? target) + (match architecture + ("armhf" + `(link "arm-unknown-linux-gnueabi" "linux-gnu")) + ("mips64el" + `(link "mips-unknown-linux-gnu" "linux-gnu")) + ;; Don't always link to the "linux-gnu" + ;; configuration, as this is not correct for + ;; all architectures. + (_ #t))) + (#t #t))))))) '())) (native-inputs `(("gettext" ,gettext-minimal))) (home-page "https://gnupg.org")