From patchwork Mon Dec 15 09:37:06 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= X-Patchwork-Id: 25555 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 57041C3257 for ; Mon, 15 Dec 2025 09:37:14 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id 38A5561939; Mon, 15 Dec 2025 10:37:13 +0100 (CET) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="v6yu2l5/"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 1F278606D5 for ; Mon, 15 Dec 2025 10:37:11 +0100 (CET) Received: from pb-laptop.local (185.221.143.114.nat.pool.zt.hu [185.221.143.114]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 520A8C6F; Mon, 15 Dec 2025 10:37:05 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1765791425; bh=3EOwIUtnV5WrpQEPg4SIvmTVNU+s9sBtJyNdIPS6oa4=; h=From:To:Subject:Date:From; b=v6yu2l5/jtXDKQoaF+rPwi/UPSYZ3lDKuh+RjJn2rP/69NoouYztY1Nr71a69x/S+ Qa3KG7cIe17qW7UZTTNTC20WLRkmF/R/rCPEgpKSWiWRlKVxjEGhLkxEJyl619s66D RUKZ1nqpwAZaQfv5EUYZJ89cdWJf4rGkCAHYphr0= From: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= To: libcamera-devel@lists.libcamera.org, Bryan O'Donoghue Subject: [PATCH v1] utils: gen-shader-headers: Fix subproject build Date: Mon, 15 Dec 2025 10:37:06 +0100 Message-ID: <20251215093706.573761-1-barnabas.pocze@ideasonboard.com> X-Mailer: git-send-email 2.52.0 MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Meson already takes care of passing the proper absolute or relative paths to commands. There is no need do more path manipulation. So simplify the script by using the paths as-is. This also fixes the path manipulation issue that prevented libcamera from building as a subproject. Fixes: 19371dee4146b7 ("utils: gen-shader-headers: Add a utility to generate headers from shaders") Signed-off-by: Barnabás Pőcze Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/libcamera/meson.build | 2 +- utils/gen-shader-headers.sh | 14 ++++++-------- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 90d434a5a2..575408b2c7 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -188,7 +188,7 @@ libcamera_shader_headers = custom_target( 'gen-shader-headers', input : [shader_files], output : 'glsl_shaders.h', - command : [gen_shader_headers, meson.project_source_root(), meson.project_build_root(), '@OUTPUT@', '@INPUT@'], + command : [gen_shader_headers, meson.project_source_root(), '@OUTPUT@', '@INPUT@'], ) libcamera_internal_headers += libcamera_shader_headers diff --git a/utils/gen-shader-headers.sh b/utils/gen-shader-headers.sh index 81bf1584c9..92f6f81815 100755 --- a/utils/gen-shader-headers.sh +++ b/utils/gen-shader-headers.sh @@ -3,14 +3,13 @@ set -e usage() { - echo "Usage: $0 [shader_file2 ...]" + echo "Usage: $0 [shader_file2 ...]" echo echo "Generates a C header file containing hex-encoded shader data." echo echo "Arguments:" echo " src_dir Path to the base of the source directory" - echo " build_dir Directory where shader files are located and header will be written" - echo " output_header_name Name of the generated header file (relative to build_dir)" + echo " output_header Path to the generated header file" echo " shader_file(s) One or more shader files to embed in the header" exit 1 } @@ -21,8 +20,7 @@ if [ $# -lt 4 ]; then fi src_dir="$1"; shift -build_dir="$1"; shift -build_path=$build_dir/"$1"; shift +build_path="$1"; shift cat < "$build_path" /* SPDX-License-Identifier: LGPL-2.1-or-later */ @@ -40,7 +38,7 @@ cat <> "$build_path" EOF for file in "$@"; do - name=$(basename "$build_dir/$file" | tr '.' '_') + name=$(basename "$file" | tr '.' '_') echo "[SHADER-GEN] $name" echo " * unsigned char $name;" >> "$build_path" done @@ -49,7 +47,7 @@ echo "*/" >> "$build_path" echo "/* Hex encoded shader data */" >> "$build_path" for file in "$@"; do - name=$(basename "$build_dir/$file") - "$src_dir/utils/gen-shader-header.py" "$name" "$build_dir/$file" >> "$build_path" + name=$(basename "$file") + "$src_dir/utils/gen-shader-header.py" "$name" "$file" >> "$build_path" echo >> "$build_path" done