From patchwork Wed Dec 29 17:46:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Simon South X-Patchwork-Id: 35759 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 2636627BBE9; Wed, 29 Dec 2021 17:47:30 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.9 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 431C027BBE9 for ; Wed, 29 Dec 2021 17:47:29 +0000 (GMT) Received: from localhost ([::1]:53848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2d2u-0005ny-Dv for patchwork@mira.cbaines.net; Wed, 29 Dec 2021 12:47:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53448) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1n2d2V-0005na-0z for guix-patches@gnu.org; Wed, 29 Dec 2021 12:47:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]:38724) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1n2d2U-0004DY-Nm for guix-patches@gnu.org; Wed, 29 Dec 2021 12:47:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1n2d2U-0002OM-Kt for guix-patches@gnu.org; Wed, 29 Dec 2021 12:47:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#51241] [PATCH 1/1] gnu: ragel: Fix build of knot on aarch64-linux. Resent-From: Simon South Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 29 Dec 2021 17:47:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 51241 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 51241@debbugs.gnu.org Cc: ludo@gnu.org Received: via spool by 51241-submit@debbugs.gnu.org id=B51241.16407999847396 (code B ref 51241); Wed, 29 Dec 2021 17:47:02 +0000 Received: (at 51241) by debbugs.gnu.org; 29 Dec 2021 17:46:24 +0000 Received: from localhost ([127.0.0.1]:50269 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2d1r-0001ub-MD for submit@debbugs.gnu.org; Wed, 29 Dec 2021 12:46:24 -0500 Received: from mailout.easymail.ca ([64.68.200.34]:54484) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1n2d1m-0001l9-Am for 51241@debbugs.gnu.org; Wed, 29 Dec 2021 12:46:19 -0500 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id 0B3D94127E; Wed, 29 Dec 2021 17:46:13 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo02-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo02-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id M8xqjBhkjKhY; Wed, 29 Dec 2021 17:46:11 +0000 (UTC) Received: from mars.simonsouth.net. (23-233-96-244.cpe.pppoe.ca [23.233.96.244]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 2564E414CE; Wed, 29 Dec 2021 17:46:11 +0000 (UTC) From: Simon South Date: Wed, 29 Dec 2021 12:46:07 -0500 Message-Id: <8d836816bdc6015fce6a8d4dba10cac38157364b.1640799363.git.simon@simonsouth.net> X-Mailer: git-send-email 2.34.0 In-Reply-To: References: <877dbyb9tq.fsf@gnu.org> MIME-Version: 1.0 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 Apply a patch backported from Ragel's "ragel-6" branch that allows it to reliably generate usable code on aarch64-linux where the C/C++ "char" type is unsigned by default, fixing the build of Knot on this platform. * gnu/packages/patches/ragel-char-signedness.patch: New file. * gnu/local.mk (dist_patch_DATA): Add it. * gnu/packages/ragel.scm (ragel)[arguments]: Add custom phase for AArch64 that applies the patch. [native-inputs]: Add "patch" and patch file on AArch64. --- gnu/local.mk | 1 + .../patches/ragel-char-signedness.patch | 42 +++++++++++++++++++ gnu/packages/ragel.scm | 29 ++++++++++++- 3 files changed, 71 insertions(+), 1 deletion(-) create mode 100644 gnu/packages/patches/ragel-char-signedness.patch diff --git a/gnu/local.mk b/gnu/local.mk index 21e536a635..ebc5426e81 100644 --- a/gnu/local.mk +++ b/gnu/local.mk @@ -1726,6 +1726,7 @@ dist_patch_DATA = \ %D%/packages/patches/qtwebkit-fix-building-with-python-3.9.patch \ %D%/packages/patches/qtwebkit-fix-building-with-icu-68.patch \ %D%/packages/patches/qtwebkit-fix-building-with-glib-2.68.patch \ + %D%/packages/patches/ragel-char-signedness.patch \ %D%/packages/patches/randomjungle-disable-static-build.patch \ %D%/packages/patches/range-v3-build-with-gcc10.patch \ %D%/packages/patches/rapicorn-isnan.patch \ diff --git a/gnu/packages/patches/ragel-char-signedness.patch b/gnu/packages/patches/ragel-char-signedness.patch new file mode 100644 index 0000000000..b3b2bf958a --- /dev/null +++ b/gnu/packages/patches/ragel-char-signedness.patch @@ -0,0 +1,42 @@ +From 2e638fccd81e96ce09841adc4b295b5ce694ea73 Mon Sep 17 00:00:00 2001 +From: Adrian Thurston +Date: Sat, 6 Nov 2021 12:20:05 -0700 +Subject: [PATCH] C char type: decide signedness of char based on CHAR_MIN + +Previously had char fixed to signed char, this is not useful on ARM as it does +not align with the host type. Instead, decide at runtime (or probably compile +time) if char is signed or not. +--- + ragel/common.cpp | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/ragel/common.cpp b/ragel/common.cpp +index 8e9f8ed0..55875c06 100644 +--- a/ragel/common.cpp ++++ b/ragel/common.cpp +@@ -27,14 +27,14 @@ + + HostType hostTypesC[] = + { +- { "char", 0, "char", true, true, false, CHAR_MIN, CHAR_MAX, 0, 0, sizeof(char) }, +- { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) }, +- { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) }, +- { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) }, +- { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, sizeof(int) }, +- { "unsigned", "int", "uint", false, true, false, 0, 0, 0, UINT_MAX, sizeof(unsigned int) }, +- { "long", 0, "long", true, true, false, LONG_MIN, LONG_MAX, 0, 0, sizeof(long) }, +- { "unsigned", "long", "ulong", false, true, false, 0, 0, 0, ULONG_MAX, sizeof(unsigned long) } ++ { "char", 0, "char", (CHAR_MIN != 0), true, false, SCHAR_MIN, SCHAR_MAX, 0, UCHAR_MAX, sizeof(char) }, ++ { "unsigned", "char", "uchar", false, true, false, 0, 0, 0, UCHAR_MAX, sizeof(unsigned char) }, ++ { "short", 0, "short", true, true, false, SHRT_MIN, SHRT_MAX, 0, 0, sizeof(short) }, ++ { "unsigned", "short", "ushort", false, true, false, 0, 0, 0, USHRT_MAX, sizeof(unsigned short) }, ++ { "int", 0, "int", true, true, false, INT_MIN, INT_MAX, 0, 0, sizeof(int) }, ++ { "unsigned", "int", "uint", false, true, false, 0, 0, 0, UINT_MAX, sizeof(unsigned int) }, ++ { "long", 0, "long", true, true, false, LONG_MIN, LONG_MAX, 0, 0, sizeof(long) }, ++ { "unsigned", "long", "ulong", false, true, false, 0, 0, 0, ULONG_MAX, sizeof(unsigned long) } + }; + + #define S8BIT_MIN -128 +-- +2.33.1 + diff --git a/gnu/packages/ragel.scm b/gnu/packages/ragel.scm index 1d9b67a6e0..d4016ed5ba 100644 --- a/gnu/packages/ragel.scm +++ b/gnu/packages/ragel.scm @@ -1,6 +1,7 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2015 Ricardo Wurmus ;;; Copyright © 2019 Tobias Geerinckx-Rice +;;; Copyright © 2021 Simon South ;;; ;;; This file is part of GNU Guix. ;;; @@ -22,7 +23,9 @@ (define-module (gnu packages ragel) #:use-module (guix packages) #:use-module (guix download) #:use-module (guix build-system gnu) - #:use-module (gnu packages)) + #:use-module (guix utils) + #:use-module (gnu packages) + #:use-module (gnu packages base)) (define-public ragel (package @@ -36,6 +39,30 @@ (define-public ragel (base32 "0gvcsl62gh6sg73nwaxav4a5ja23zcnyxncdcdnqa2yjcpdnw5az")))) (build-system gnu-build-system) + (arguments + (if (target-aarch64?) + '(#:phases + (modify-phases %standard-phases + (add-after 'unpack 'apply-char-signedness-fix + ;; Apply a backported fix for aarch64-linux, where the C/C++ + ;; "char" type is unsigned by default. + ;; + ;; The patch is applied in this custom phase and not via the + ;; "origin" object above to avoid rebuilding a large number of + ;; packages on other platforms. + (lambda _ + (let ((patch + (search-input-file %build-inputs "/bin/patch")) + (char-signedness-patch + (assoc-ref %build-inputs "char-signedness-patch"))) + (invoke patch "-p1" "-i" char-signedness-patch)))))) + '())) + (native-inputs + (if (target-aarch64?) + `(("char-signedness-patch" + ,(search-patch "ragel-char-signedness.patch")) + ("patch" ,patch)) + '())) (home-page "https://www.colm.net/open-source/ragel/") (synopsis "State machine compiler") (description