From patchwork Thu Jan 19 18:04:06 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: 644103 Delivered-To: patch@linaro.org Received: by 2002:a17:522:b9de:b0:4b9:b062:db3b with SMTP id fj30csp359740pvb; Thu, 19 Jan 2023 10:06:06 -0800 (PST) X-Google-Smtp-Source: AMrXdXsRx6rT+IpPOL2C/adlAwxIs3U1B1UWov9MuoZ7bEMgZymrCl81otiN3+ehZFaxVvJsBQwE X-Received: by 2002:a05:7500:2c0c:b0:f1:d72a:cc35 with SMTP id ep12-20020a0575002c0c00b000f1d72acc35mr961342gab.47.1674151566552; Thu, 19 Jan 2023 10:06:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674151566; cv=none; d=google.com; s=arc-20160816; b=hG+Jv3aJUscFsbAZWI6RbqqpDKiPVVjmpiFfBV4uMyPM4CyVA1ATjNXqZWLXfMwHnX QUsQD8deqICAWw+7sT+b+OnthkkcsRyecgz5esIzoeGClvfRFeuQMP8Rg+qOduSqSRLQ WLsl++rY1/PGA1+lZjKrG1g3avSp/xo22cjf/Sw4dg83JzMju4uwjLFMobBNLd8jVVsL IJZuODBkkYZHgathMq9XRM/i5w0sqyf48eF2HuZL8V1gTi7lAxKLyJH4WvZuLrkiJgFT iTGMZ/y2AvlorQvbSW77PSTa2wkgahCLi9EQC+zBP+3huCgczy1MwR0UlJ6SQEUSGhkX ArCg== 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=TseWXLLVLdaVHAb6N/tVCJv6wFOZdD280J8VfGZpAXE=; b=SyN+qDGG0TkhaJIIqIm8Oq6sMz+iYLBVlZb5uWl8F9RTAP5A3+X2XzQ6crOelnKBoA PK9NLoypccLDX+2l43+Y4lVUziUSClPxcMHUYMgeiv2PRPrdc+s3K3TPhmEGx87AJ9bq JQH5UQ847ciEdOpTlm6sdnrD+UeW3CfVZC2rR/dfYETSB2wHUik47n3m7A08JHQD3t+E uj5QKeRkso9linzge6qxaLCPNPA5hZtd+RtxLYdKPGiyvfuaYQHSG7wHKKc7ItuKCidc Q93JlpoZJ1z2QNnjQNttPMjVT5FrW0IVwQDKc+AkzJ1u/zZYQcMlKxSaPp5T/8/b8p+C mlUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=eSJw+hJB; 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 o7-20020ab01507000000b00418f19faaabsi10294338uae.3.2023.01.19.10.06.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Thu, 19 Jan 2023 10:06:06 -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=eSJw+hJB; 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 1pIZHC-0003MV-PR; Thu, 19 Jan 2023 13:04:38 -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 1pIZH3-0003I7-4s for qemu-devel@nongnu.org; Thu, 19 Jan 2023 13:04:29 -0500 Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pIZH0-00011E-5L for qemu-devel@nongnu.org; Thu, 19 Jan 2023 13:04:28 -0500 Received: by mail-wm1-x334.google.com with SMTP id l41-20020a05600c1d2900b003daf986faaeso1876001wms.3 for ; Thu, 19 Jan 2023 10:04:23 -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=TseWXLLVLdaVHAb6N/tVCJv6wFOZdD280J8VfGZpAXE=; b=eSJw+hJBHtPSGXVQ7/8jLjhoY0ZN2iPx/CAg8+10YbXk9Ftffk2mSbK9kuLJPThUlM ZzAb62vmdtn2ySG+CQo/gFPEN6K2CIWq6HjZW7EVUELjINUqzZLIsTbuCOcvEZbKjp2d 5WnitmLOrz3ocHWEdx814De3FK70DyB0H+v4r7FSpvVRpH2HoNUFIbK1TFDLAEjP0Emj 3Si3BPHqnyPJOIOLIRPGVXFZ0SNfse/Gba8rPN7qivE4/JZ2xTGhYYUtPXLgYEJPP6Gu WiqiPbfcszp9rjZVRBfW0aMNKD/qJIM/hJcLIW1CGZSm204k2Ink2bvFDuvAQEWDuL7/ b/8A== 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=TseWXLLVLdaVHAb6N/tVCJv6wFOZdD280J8VfGZpAXE=; b=dJQ2SMNhKwzaMcEQA1lM9Eg2aR5vW6kiR9X3bUjGU88j1Xq0J3DS60vK+oREHAeiHI wVhvs3n/0p+OxalQuFJZ5RbGB+EVanf/vPwJ8NIP+rcnI4hcFMum+8vVEwC8M+wagaYe dWZ67TBqaFiBXwxmFoWcZQs8NsqaoqZ4netqNASYZb8ppVmKwStpAZqltmfUDsFtwesr T6ukZedIQOHpGDlumLQY+RxYKcxy3MNI4h7SFqjk5ZLempG77M4EaZ8yx6THoadtNQsQ hrjKV1beyOLdkkcV/mO/0WFWLFD4eudu/Ids28a2ON71hU8D9lUcIVTDtGDQBCvcV5EW JQ2g== X-Gm-Message-State: AFqh2krlwtNyJ3dZsWt5xjXkLoltcf0sSzP8jK32H4d3kMyugvYOZI/5 49LITZprnE/mC6MmX9zHC/B5+g== X-Received: by 2002:a05:600c:3ca6:b0:3d1:caf1:3f56 with SMTP id bg38-20020a05600c3ca600b003d1caf13f56mr19809041wmb.9.1674151462788; Thu, 19 Jan 2023 10:04:22 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id n37-20020a05600c502500b003db03725e86sm5840059wmr.8.2023.01.19.10.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 19 Jan 2023 10:04:20 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id F26BF1FFBD; Thu, 19 Jan 2023 18:04:19 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Beraldo Leal , Peter Maydell , Bandan Das , Qiuhao Li , =?utf-8?q?D?= =?utf-8?q?aniel_P=2E_Berrang=C3=A9?= , Michael Roth , Cleber Rosa , Alexander Bulekov , Darren Kenny , Stefan Hajnoczi , Markus Armbruster , John Snow , Ed Maste , Wainer dos Santos Moschetta , =?utf-8?q?Philippe_Mathi?= =?utf-8?q?eu-Daud=C3=A9?= , Paolo Bonzini , Li-Wen Hsu , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Alex_Benn=C3=A9e?= , Thomas Huth Subject: [PATCH 05/18] build-sys: fix crlf-ending C code Date: Thu, 19 Jan 2023 18:04:06 +0000 Message-Id: <20230119180419.30304-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230119180419.30304-1-alex.bennee@linaro.org> References: <20230119180419.30304-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=alex.bennee@linaro.org; helo=mail-wm1-x334.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 58d8cd68a6..ac8c8f2cc9 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))