From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id 2HW4JjOfzGFPGwEAgWs5BA (envelope-from ) for ; Wed, 29 Dec 2021 18:47:31 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id CGaQHzOfzGHifgAAG6o9tA (envelope-from ) for ; Wed, 29 Dec 2021 18:47:31 +0100 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 CC29C3463F for ; Wed, 29 Dec 2021 18:47:30 +0100 (CET) Received: from localhost ([::1]:53848 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1n2d2v-0005ny-Qa for larch@yhetil.org; Wed, 29 Dec 2021 12:47:29 -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 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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1640800051; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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; bh=PTFqHPezEtL4vKDE/kYvt+A5n7C+oHOPzH+lLrutn8I=; b=PX3OFRjhG4t/M0iboU8Z504ixhLUVCiv7lIdIR3LK+65ESrk4qud6Nx5sXKq9TTMaCoofT zmynZtYSVMw5zWiYlumRknsiZXu7ULyKcyaX+h7w9MZ14xvWDONCswk035ulkFV6VzZqTR MelvBVJyISX3byU6roTS1uMhzc2u5SLPuHh1QB2QOHWSNMpylwLwuMz7EGy2bXFeFPO5JR XY+OzpSscmxElChP3YzjSXf61f2FdwO9csQh6Px/kdS/Wexcqk+oxAMewr3wUZYD8q44Xt B+FmwCZiGKOjirUC5Lz4SCF89RKtQefYvOdXvBCrZFozx09vteZTXZvtbvirSg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1640800051; a=rsa-sha256; cv=none; b=LvpUZmh7h+2EI0NDfzrIaTpgDYA2SLxHxQEjYhU9/PdWoWv6kIOFjx2Oj3nau+TEWD+jve LppOypkUtvsaV7V9XX9NWCyj6Sabft90Yhfr69tIgvOYASu2qbj1jeW54+jYrFjJrLlJ/e fcW/L2ZV3s/J2LHEt1PRVSMUNp1VXuqtSYVncmPIWKVOaPHvJc7PWUgWJjJDfQmqWKGV93 m2K/qwT3k2RkMro7jzRJt6NKvrvNhp9LbOJgZ+Gjik3Mrnbd1yN7dkt76QVLbuE76VCdUA 6lmLa6s1h/rqtLvlqQNdD/Ol9tb3IjbPr47cgkbm7hOMm/LFotU9OA8PGylWZA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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" X-Migadu-Spam-Score: -3.37 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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" X-Migadu-Queue-Id: CC29C3463F X-Spam-Score: -3.37 X-Migadu-Scanner: scn0.migadu.com X-TUID: faH3VKzms4u6 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 -- 2.34.0