From patchwork Tue Oct 12 15:24:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Naushir Patuck X-Patchwork-Id: 14494 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by patchwork.libcamera.org (Postfix) with ESMTPS id 875C0BDB1C for ; Tue, 9 Nov 2021 17:41:34 +0000 (UTC) Received: from pendragon.ideasonboard.com (cpc89244-aztw30-2-0-cust3082.18-1.cable.virginm.net [86.31.172.11]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 15BB3501 for ; Tue, 9 Nov 2021 18:41:34 +0100 (CET) Authentication-Results: perceval.ideasonboard.com; dkim=pass (2048-bit key; unprotected) header.d=raspberrypi.com header.i=@raspberrypi.com header.b="LpaRqYxk"; dkim-atps=neutral Delivered-To: kbingham@ideasonboard.com Received: from perceval.ideasonboard.com by perceval.ideasonboard.com with LMTP id ODQgHq2oZWFYVgAA4E0KoQ (envelope-from ) for ; Tue, 12 Oct 2021 17:24:29 +0200 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by perceval.ideasonboard.com (Postfix) with ESMTPS id 6BFABF1 for ; Tue, 12 Oct 2021 17:24:29 +0200 (CEST) Received: by mail-wr1-x435.google.com with SMTP id e3so34423451wrc.11 for ; Tue, 12 Oct 2021 08:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V75kjcsLywmMW/LLmyT1n9vuBzmEicER1Wde/5MtUvI=; b=LpaRqYxkWMdCIQBlZgwHO2IAP8C3Mvf+Y//SwgOX80Rhp9zvblScgHQgYQ2Fzc/lcG LOC62hezRSf8gdUlIbg88vqakRk4iXuXbwJsmWdJgUiymomdxBIytCfjyIXiNVqB1Y4J 9DmCaNL1R37yLuC2tJGHJgQBDJ9EkvydeqUlrv6NWPTi/oyt9ZFEyqKdKWLnDNNSwIRH 7pVyv0gbybmj3Se75DU+EOxYm8DUCxs/D/K2/xqUJg5dbYN9o9zl8Ks4wT828nkHOwmm D1HnqehyPKJF6mqWaVNMmQaDtmW8cGk5Yt4NxSzrWK2PiS75TV1VzQ53LiOGGjHNLRrw 1hbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V75kjcsLywmMW/LLmyT1n9vuBzmEicER1Wde/5MtUvI=; b=lNEav0Z29pS9GW8ZitjwDhxEd6RdKeivgAhbW7jIaP11f4oSYt2r5Z2tzXe3ECE/rA i41/62RzUbya4/t2qsijBfG2z7vsucI5N+WGJ8axUe7wlUJGtuRocZ/4E/P8g6BHcYBZ pN0lb7SZ0cHJKe3bzfT4MVkC0aVzXxvQT1kVXVtw47Dy+iuh3ywc7NBjv6F1UOSLL6wk q8jurmk4fWyhrijk+5EunR4xIWCMKgUbfw+ewjeHcafpQbk0HBPO4S+hdLfj6TwOyEmO nkSJJZPrrVDpvFw0LFItE+e3mVmt1HGpWbhcAKH6hKsdmxsG3U/UxGsHLLIWNQKZ3tbM epyQ== X-Gm-Message-State: AOAM533en5TItUrj3+zCNe7QwsCrRMGSD6ZXR9Zih3NJ345VtslBfPfl wqDGIR/YCZEsOioPFYEiNjEs3A== X-Google-Smtp-Source: =?utf-8?q?ABdhPJzHu6qDT69tJ5wu131nKYkarqVUeg89Cn+Ug?= =?utf-8?q?0RR4P08IadY9RY9xOl5GI+KYaYG815hhPJQ5Q=3D=3D?= X-Received: by 2002:a05:600c:4ed3:: with SMTP id g19mr6325005wmq.16.1634052269019; Tue, 12 Oct 2021 08:24:29 -0700 (PDT) Received: from naush-laptop.pitowers.org ([2a00:1098:3142:14:26ae:314c:5c3f:f0df]) by smtp.gmail.com with ESMTPSA id s14sm10683449wro.76.2021.10.12.08.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Oct 2021 08:24:27 -0700 (PDT) From: Naushir Patuck To: libcamera-devel@lists.libcamera.org Cc: Kieran Bingham , Naushir Patuck Subject: [RFC 2/2] build: Add a "version_sha" meson build option Date: Tue, 12 Oct 2021 16:24:10 +0100 Message-Id: <20211012152410.978077-3-naush@raspberrypi.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211012152410.978077-1-naush@raspberrypi.com> References: <20211012152410.978077-1-naush@raspberrypi.com> MIME-Version: 1.0 X-TUID: ExgVzqdk8IW0 Resent-From: Kieran Bingham Resent-To: parsemail@patchwork.libcamera.org This build option can be used to override the SHA value in the version string generated by utils/gen-version.sh. An override is needed if distributions make libcamera builds outside of the upstream git tree. In these cases, the user can then use the correct SHA value of the upstream tree instead of the local downstream build tree. Signed-off-by: Naushir Patuck --- meson.build | 4 +++- meson_options.txt | 5 +++++ src/libcamera/meson.build | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/meson.build b/meson.build index a49c484fe64e..cea6ca78cfa0 100644 --- a/meson.build +++ b/meson.build @@ -16,8 +16,10 @@ project('libcamera', 'c', 'cpp', # only. If the source tree isn't under git control, or if it matches the last # git version tag, the build metadata (e.g. +211-c94a24f4) is omitted from # libcamera_git_version. +version_sha_override = get_option('version_sha') libcamera_git_version = run_command('utils/gen-version.sh', - meson.build_root()).stdout().strip() + meson.build_root(), + version_sha_override).stdout().strip() if libcamera_git_version == '' libcamera_git_version = meson.project_version() endif diff --git a/meson_options.txt b/meson_options.txt index 2c80ad8b5e0b..96db8de4cdeb 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -58,3 +58,8 @@ option('v4l2', type : 'boolean', value : false, description : 'Compile the V4L2 compatibility layer') + +option('version_sha', + type : 'string', + value : '', + description : 'Custom version sha string to use') diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index 243dd3c180eb..94cded2ce6c3 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -93,9 +93,10 @@ endforeach libcamera_sources += control_sources +version_sha_override = get_option('version_sha') gen_version = meson.source_root() / 'utils' / 'gen-version.sh' -version_cpp = vcs_tag(command : [gen_version, meson.build_root()], +version_cpp = vcs_tag(command : [gen_version, meson.build_root(), version_sha_override], input : 'version.cpp.in', output : 'version.cpp', fallback : meson.project_version())