From patchwork Tue Jan 24 18:00:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Alex_Benn=C3=A9e?= X-Patchwork-Id: 646035 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp339554pvb; Tue, 24 Jan 2023 10:04:51 -0800 (PST) X-Google-Smtp-Source: AMrXdXuChe10QFOsAn91+YXR08UMy5NWB4HjVARRL7rP4LOYGqM4Ly9UId+sza9JbCkPwxDIgy8V X-Received: by 2002:a05:7500:4587:b0:f1:f815:1647 with SMTP id gh7-20020a057500458700b000f1f8151647mr2400556gab.1.1674583491648; Tue, 24 Jan 2023 10:04:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674583491; cv=none; d=google.com; s=arc-20160816; b=ydRAg2Srb06z/L3wpEvKoU56Edyy9uPFi+pskh90c8u47LVMbf+FmRsMlKMXG16K+W nJH11jUaXvAZkeE6ApBjjVQNlipJOpHkIxRrcI/sHuckYH1L/q1hqKQt6wC6oqTgScXu YWJyJ7KCZopnc61n7KTFi+T9ntxbXk6Ob5ej822rcHMNGcymctHe5ce6DIbBf4LEFWPd rwCjoAVxWZp1P7O+DV4RrUMWgClQ4grdRxJzsGQSRmbOZXjcuxk2DCHwuoPBEUOTvP3a F46la8em4KMxhfItVKKL3p+ILK6xSAqUggI58bn1m6WchqNzTV62Vt/rpmYq1EXPfT+M P24Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=8rj1XFqYdBP8bTzv2NNI3bgWaWA6QH00/sFnhqecn/4=; b=Mm9QzeHaUo0vUsfn6d0edEwNdaZ/Tb8Q2bQXl4xCA62bPfaBVMFoCxgt9hCXwg4Sl/ 7xt3/nVhVZaVWNyZTBDJ43jx5pH7ugZ636pmZqKbf4dUJA2uVUtT3IDZM2+bfWAoqJgk ZksHMDhp840YB+HEjbM1Jx3jZZXa6c72XsJO5YvGqKIga3iEnIKr+oeTxec0TH6TRJIY 5hiBR9kSzxkcDkWxS731qTTjBH+wmATmNZs0kyKYbDZOFP3LXLcrKA4SL2ssW+rVqm11 OTMxkszKaZIp41crBh54iT4l7J85kETzlD/ytMJOstQCehl8TXXVt613qc2mSk0kptvr swYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IpTOz+qq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id y74-20020a37644d000000b007062150a88csi2217826qkb.714.2023.01.24.10.04.51 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Jan 2023 10:04:51 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=IpTOz+qq; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pKNc5-0001UA-R0; Tue, 24 Jan 2023 13:01:41 -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 ) id 1pKNc2-0001T3-Gw for qemu-devel@nongnu.org; Tue, 24 Jan 2023 13:01:38 -0500 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pKNbw-00064T-QN for qemu-devel@nongnu.org; Tue, 24 Jan 2023 13:01:37 -0500 Received: by mail-wr1-x434.google.com with SMTP id z5so14702442wrt.6 for ; Tue, 24 Jan 2023 10:01:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8rj1XFqYdBP8bTzv2NNI3bgWaWA6QH00/sFnhqecn/4=; b=IpTOz+qqzfoULxKhBIlCVdAtbqFdY6P2iJHLPS+ED1A3qKYgTAkrgx5qV2PrCGdzXl LqqXJC8LlO3SOu3XJJ+ZpXg9lEirmxA3p7hIEqhSoSqJiF0zPDBq8LjqW6DItlVuXgt+ CNG+t2qXQoMgFs9WJkYbRr0mJrPA8v8K6BoYTOHFtSzjexgLc90W4kIR43Vok8IxvKDu zRNub2+trPGdpq+I0iMbAuQxa0BcLj/C6Ft7sTjXLXFWHb4HwqJoEz7eipqd0zuEvLRz q2dO+GxtPZlzvmLGw458q/QWGtnfElZbPyurgtigpF8VqyV1g0weW/aT+mBTU5BEcmnG BjRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=8rj1XFqYdBP8bTzv2NNI3bgWaWA6QH00/sFnhqecn/4=; b=PaMC/ey1tz+A5irUz2q3hUYjZVE8The9KnKJk3dcLZbsvdosavfi4Ja1SkaP0X1zUp OVXv46gp6/vIsgLoz/gebxw3lwl7xuK4W3fmrk8rPO8dCO7N+tq+nT6sbatfz/XQqcU4 nlE4N263FLKEN5ApU17M+xzYc2fjwOHo1LUARkP6bwncCY1r7FkPj6qVvF6dGA1XrsDZ YQZVJC7Kd7XvheEtOSw/YE5qXUpj2H4n/Toq4kK1gpIVkP7Z28D80JHTR0MOGT9dkD7W TPoQTLglOmVL5N5RevWtX2XJwRsIPaYiF7cSrayi7WYPm1nXG8JDryANuwBFo/c5Rp00 HBdA== X-Gm-Message-State: AFqh2kq2PFVOzYSaAWp37mnG5byRWo73yzrxKDsYixd3o1rkKMRcRw4f 4XxOIhCtkUC0fmJltwQGcX/8Ww== X-Received: by 2002:adf:e98b:0:b0:2bc:804a:d1bb with SMTP id h11-20020adfe98b000000b002bc804ad1bbmr25115947wrm.49.1674583289843; Tue, 24 Jan 2023 10:01:29 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id m15-20020adffa0f000000b0024cb961b6aesm2333179wrr.104.2023.01.24.10.01.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Jan 2023 10:01:29 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 23B0B1FFBD; Tue, 24 Jan 2023 18:01:28 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Ed Maste , Thomas Huth , Alexandre Iooss , Markus Armbruster , Jagannathan Raman , John G Johnson , Mahmoud Mandour , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , Bandan Das , Elena Ufimtseva , Michael Roth , Eduardo Habkost , Beraldo Leal , =?utf-8?q?Alex_Benn=C3=A9e?= , =?utf-8?q?Marc-Andr?= =?utf-8?q?=C3=A9_Lureau?= , Qiuhao Li , Stefan Hajnoczi , Alexander Bulekov , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , John Snow , Paolo Bonzini , Darren Kenny , qemu-arm@nongnu.org, Yanan Wang , Cleber Rosa , Wainer dos Santos Moschetta , Marcel Apfelbaum , Li-Wen Hsu , Peter Maydell Subject: [PATCH v2 05/35] build-sys: fix crlf-ending C code Date: Tue, 24 Jan 2023 18:00:57 +0000 Message-Id: <20230124180127.1881110-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230124180127.1881110-1-alex.bennee@linaro.org> References: <20230124180127.1881110-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::434; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x434.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Marc-André Lureau On msys2, the shader-to-C script produces bad C: ./ui/shader/texture-blit-vert.h:2:5: error: missing terminating " character [-Werror] Fix it by changing the line ending from crlf to lf, and convert the script to Python (qemu build seems perl-free after that). Signed-off-by: Marc-André Lureau Acked-by: Thomas Huth Message-Id: <20230110132700.833690-2-marcandre.lureau@redhat.com> Signed-off-by: Alex Bennée --- meson.build | 2 +- scripts/shaderinclude.pl | 16 ---------------- scripts/shaderinclude.py | 26 ++++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 17 deletions(-) delete mode 100644 scripts/shaderinclude.pl create mode 100644 scripts/shaderinclude.py diff --git a/meson.build b/meson.build index 6d3b665629..56320ae717 100644 --- a/meson.build +++ b/meson.build @@ -2779,7 +2779,7 @@ config_host_data.set('CONFIG_SLIRP', slirp.found()) genh += configure_file(output: 'config-host.h', configuration: config_host_data) hxtool = find_program('scripts/hxtool') -shaderinclude = find_program('scripts/shaderinclude.pl') +shaderinclude = find_program('scripts/shaderinclude.py') qapi_gen = find_program('scripts/qapi-gen.py') qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py', meson.current_source_dir() / 'scripts/qapi/commands.py', diff --git a/scripts/shaderinclude.pl b/scripts/shaderinclude.pl deleted file mode 100644 index cd3bb40b12..0000000000 --- a/scripts/shaderinclude.pl +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env perl -use strict; -use warnings; - -my $file = shift; -open FILE, "<", $file or die "open $file: $!"; -my $name = $file; -$name =~ s|.*/||; -$name =~ s/[-.]/_/g; -print "static GLchar ${name}_src[] =\n"; -while () { - chomp; - printf " \"%s\\n\"\n", $_; -} -print " \"\\n\";\n"; -close FILE; diff --git a/scripts/shaderinclude.py b/scripts/shaderinclude.py new file mode 100644 index 0000000000..ab2aade2cd --- /dev/null +++ b/scripts/shaderinclude.py @@ -0,0 +1,26 @@ +#!/usr/bin/env python3 +# +# Copyright (C) 2023 Red Hat, Inc. +# +# SPDX-License-Identifier: GPL-2.0-or-later + +import sys +import os + + +def main(args): + file_path = args[1] + basename = os.path.basename(file_path) + varname = basename.replace('-', '_').replace('.', '_') + + with os.fdopen(sys.stdout.fileno(), "wt", closefd=False, newline='\n') as stdout: + with open(file_path, "r", encoding='utf-8') as file: + print(f'static GLchar {varname}_src[] =', file=stdout) + for line in file: + line = line.rstrip() + print(f' "{line}\\n"', file=stdout) + print(' "\\n";', file=stdout) + + +if __name__ == '__main__': + sys.exit(main(sys.argv))