From patchwork Tue Jan 10 17:39:01 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: 640863 Delivered-To: patch@linaro.org Received: by 2002:a17:522:f3c4:b0:4b4:3859:abed with SMTP id in4csp2849385pvb; Tue, 10 Jan 2023 10:15:15 -0800 (PST) X-Google-Smtp-Source: AMrXdXv4UB67t+qro3QGiJvGGshTIWDvQbuCSZPNE7oMoL4hVUqjQrY0napd2OLxRgnbLMlEJ09/ X-Received: by 2002:a1f:28cd:0:b0:3bd:5d06:70cc with SMTP id o196-20020a1f28cd000000b003bd5d0670ccmr33909128vko.6.1673374514935; Tue, 10 Jan 2023 10:15:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673374514; cv=none; d=google.com; s=arc-20160816; b=ZjmbZO6qSVxtd591c8XV8P8lyYztHqpOh4pfCeVNfjAHqyIQ5fWAhnMzDuuAA//nge pPI0QoJAqVaOeevYYexxQ127Q5WDnaAD12Xv5afxi1+QquL2yudBr6ourfas0Ln3SRcV M/brov5wGywpUohW1ZIIeDthM24FFnqgKSxOSzZe/kTvlM7I6vxlt9SBixfdEA0uXzQX oAi9svxxgZIfxkH0W/x1P/0hFRP+/rdubKo2oklv49kybJLsQyUjfAhR8R8LYdzRTnEC ufHI55SK3lLsC/GOnwP+86W38kyzR6DGUA6/uYy0cZhUV8+0vVljrSeuRPFlTEOvat38 H6zg== 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=aSooXar7HpN3Wg9/9ZGVkzt9+EmW4klxjSnXakXRJjM=; b=oKDFO/cnL1cv6TMiFNHeeecAmnEd/ww/BgUjMhYT8QR9onHDrRf+sJixApv3WleyCU LBI2MFvYkINlHdTsCMZBJAZTVyoFjNs3Cg7KCXG84Nhmd6EE1u/6Rbu6RkT8OVe+NBWu 87fzG3v1dC9KjwOEXj/MrcLO7Xon8P93Q6qQask0PSvLBrXwY+a25uAtEvFnAgMe1Rez CbWOPvaI0eT7h/qwmBOEaXKzeGLyVhm5U3dVI97mTVnXdZye0YEicrgRel45v8gKRdbH Ukm9NChOSWzBRAUf6jxH7qK6KMm1IMJIonpyzgVliLhGaHWlSurJ97AVyDjuKz7ySVom yOVA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="R/kK5xrf"; 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 s11-20020a05620a0bcb00b006fa09b601basi6865512qki.528.2023.01.10.10.15.14 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 10 Jan 2023 10:15:14 -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="R/kK5xrf"; 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 1pFIb1-0003Pn-V5; Tue, 10 Jan 2023 12:39:35 -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 1pFIay-0003LB-3n for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:39:32 -0500 Received: from mail-wr1-x436.google.com ([2a00:1450:4864:20::436]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pFIav-0001Do-Bt for qemu-devel@nongnu.org; Tue, 10 Jan 2023 12:39:31 -0500 Received: by mail-wr1-x436.google.com with SMTP id co23so12596632wrb.4 for ; Tue, 10 Jan 2023 09:39:28 -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=aSooXar7HpN3Wg9/9ZGVkzt9+EmW4klxjSnXakXRJjM=; b=R/kK5xrfBtRf/FxzNct8OW+Ct8EtfkNKN9MVPkBmsUcYSdqu6ziqQlw1/Z9Wd3IsTL fouN9mOtm6Q6CKMogZ3qJvTKCg18EZfY4nWs46FJXTysQxPxbnAw3oYHgmZ/KIEC804o nu6eNPMdgnHNB9++e9yU7DE/vlJwGv+AoGbY4EsUhLpoBKm01nKgOc9pPTpOP9e96ieE 8+L4PUfN7gqsahm37q6HmZUdQo0ryh+TLl5nvreFKBZ6MVQv8aAllVaTgmRRbnWGexd1 xFR8lnX04kUD0PCtywjnhGRb0ClkDXdmD5R11I3bev091ftG27vx49URubDBFRrk8Nu5 IaJg== 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=aSooXar7HpN3Wg9/9ZGVkzt9+EmW4klxjSnXakXRJjM=; b=PI//TRq9MWMCjoKhdLp3BJ8ABVtSh8ZmADm/mSrLLlN0VtKnMYqOteEWQ/EXQF3/4A e9Nwj3jfCcuHX3OVc8lNab8Pojzy40fmanb3TQ9XtxQOh7qdJ2RhQ7Rsk1PHSQHHhOYP QVv29XIfR9nfa2DzkehQUMLR0nTA05dNE0TuNTqYtFsBTPvQGEaHP4ZOWMpjolunMAmV Jw9uUiAeY32r4PRl7BMmjNVyDpRFbDFVm0Lr3dS6jB/wlqa2kp+1PqubK4h6Zow8eB8q YfbGPlry4D7vMsNxgIGuuLN6iat3ZXi6oF9D7DPhP1D74dk3SxVqOLcapmkB20cQSSBc YK6w== X-Gm-Message-State: AFqh2krVh/++amDX8+4bf2MxAi9LNMv8D+FVU+VcgydMLltx+liFYxph e9XTfegFypYJogv8hIrb3Lv1og== X-Received: by 2002:a5d:56c1:0:b0:288:d139:3690 with SMTP id m1-20020a5d56c1000000b00288d1393690mr30091172wrw.67.1673372368039; Tue, 10 Jan 2023 09:39:28 -0800 (PST) Received: from zen.linaroharston ([185.81.254.11]) by smtp.gmail.com with ESMTPSA id k9-20020a5d6d49000000b002bc8130cca7sm3712663wri.23.2023.01.10.09.39.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 09:39:27 -0800 (PST) Received: from zen.lan (localhost [127.0.0.1]) by zen.linaroharston (Postfix) with ESMTP id 4ED601FFBD; Tue, 10 Jan 2023 17:39:23 +0000 (GMT) From: =?utf-8?q?Alex_Benn=C3=A9e?= To: qemu-devel@nongnu.org Cc: Richard Henderson , Alexandre Iooss , Beraldo Leal , Thomas Huth , John Snow , Eduardo Habkost , Elena Ufimtseva , Ed Maste , Yanan Wang , Cleber Rosa , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Li-Wen Hsu , Markus Armbruster , Jagannathan Raman , =?utf-8?q?Daniel_P=2E_Berrang?= =?utf-8?q?=C3=A9?= , =?utf-8?q?Philippe_Mathieu-Daud?= =?utf-8?q?=C3=A9?= , Michael Roth , Wainer dos Santos Moschetta , =?utf-8?q?Alex_Benn?= =?utf-8?q?=C3=A9e?= , qemu-arm@nongnu.org, Marcel Apfelbaum , Peter Maydell , Paolo Bonzini , Mahmoud Mandour , John G Johnson Subject: [PATCH 05/26] build-sys: fix crlf-ending C code Date: Tue, 10 Jan 2023 17:39:01 +0000 Message-Id: <20230110173922.265055-6-alex.bennee@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110173922.265055-1-alex.bennee@linaro.org> References: <20230110173922.265055-1-alex.bennee@linaro.org> MIME-Version: 1.0 Received-SPF: pass client-ip=2a00:1450:4864:20::436; envelope-from=alex.bennee@linaro.org; helo=mail-wr1-x436.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 175517eafd..b3c6db8343 100644 --- a/meson.build +++ b/meson.build @@ -2781,7 +2781,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))