[{"id":24718,"web_url":"https://patchwork.libcamera.org/comment/24718/","msgid":"<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>","date":"2022-08-20T13:29:48","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","submitter":{"id":111,"url":"https://patchwork.libcamera.org/api/people/111/","name":"Christian Rauch","email":"Rauch.Christian@gmx.de"},"content":"Hi Tomi,\n\nWith the recent discussions on \"versioning\", I would actually argue that\nthis should be removed entirely, and we should only rely on the semver\nversioning.\n\nBest,\nChristian\n\n\nAm 20.08.22 um 10:07 schrieb Tomi Valkeinen via libcamera-devel:\n> libcamera builds the git hash version into the libcamera library. This\n> makes ninja create the generated version.cpp on every build, and if the\n> git hash has changed, compilation of version.cpp and linking of\n> libcamera library.\n>\n> This patch adds a meson option to disable this behavior and instead use\n> the meson project-version as the version built into the library, which\n> is only generated at meson configuration time.\n>\n> With this change, ninja will nicely say \"no work to do\" if there's\n> nothing to compile, instead of starting the build and generating\n> version.cpp.\n>\n> But, more importantly, it often reduces build time. For example, this\n> takes a particular git range compilation (~20 py bindings patches) from\n> 43 seconds to 10 seconds. Obviously the improvement depends very much on\n> the patches in question. If every commit changes libcamera itself, there\n> is no difference.\n>\n> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> ---\n>  meson_options.txt         |  5 +++++\n>  src/libcamera/meson.build | 29 +++++++++++++++++++++--------\n>  2 files changed, 26 insertions(+), 8 deletions(-)\n>\n> diff --git a/meson_options.txt b/meson_options.txt\n> index 7a9aecfc..6a0bd0be 100644\n> --- a/meson_options.txt\n> +++ b/meson_options.txt\n> @@ -63,3 +63,8 @@ option('pycamera',\n>          type : 'feature',\n>          value : 'disabled',\n>          description : 'Enable libcamera Python bindings (experimental)')\n> +\n> +option('disable-vcs-versioning',\n> +        type : 'boolean',\n> +        value : false,\n> +        description : 'Disable automatic libcamera library versioning with the git hash')\n> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> index ce1f0f2f..6fd6f084 100644\n> --- a/src/libcamera/meson.build\n> +++ b/src/libcamera/meson.build\n> @@ -121,14 +121,27 @@ endforeach\n>\n>  libcamera_sources += control_sources\n>\n> -gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> -\n> -# Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> -# version gets updated with every ninja build and not just at meson setup time.\n> -version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> -                      input : 'version.cpp.in',\n> -                      output : 'version.cpp',\n> -                      fallback : meson.project_version())\n> +if get_option('disable-vcs-versioning')\n> +    cdata = configuration_data()\n> +    cdata.set('VCS_TAG', meson.project_version())\n> +\n> +    # For some reason using 'version.cpp' as output file works fine for generation\n> +    # but causes meson to delete the file before build. Any other file name\n> +    # seems to work.\n> +    version_cpp = configure_file(input : 'version.cpp.in',\n> +                                 output : 'version_static.cpp',\n> +                                 configuration : cdata)\n> +\n> +else\n> +    gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> +\n> +    # Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> +    # version gets updated with every ninja build and not just at meson setup time.\n> +    version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> +                          input : 'version.cpp.in',\n> +                          output : 'version.cpp',\n> +                          fallback : meson.project_version())\n> +endif\n>\n>  libcamera_sources += version_cpp\n>","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 070A5BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tSat, 20 Aug 2022 13:29:52 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 298B761FBD;\n\tSat, 20 Aug 2022 15:29:51 +0200 (CEST)","from mout.gmx.net (mout.gmx.net [212.227.15.19])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id B2D6B603E2\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tSat, 20 Aug 2022 15:29:49 +0200 (CEST)","from [192.168.0.158] ([88.152.184.103]) by mail.gmx.net (mrgmx004\n\t[212.227.17.190]) with ESMTPSA (Nemesis) id\n\t1M3DO3-1oSyuW0j9h-003hfY for\n\t<libcamera-devel@lists.libcamera.org>; Sat, 20 Aug 2022 15:29:49 +0200"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661002191;\n\tbh=fN7iYUyMnrcyE+RorzqYAwFNhhtpt3w4YGOZ+GOxZQE=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=WskCs5Eg206ujlBQDaYhFs4biu8Z2EplUobyR7IbM8+OnDbQMF2UjAx8/l8fWPUss\n\tg/ok5daYGRW3WvQr6Xof6aayEYxiQygYCwQfGS+z5/gFuavMij/7FUUJrgcLG3bacs\n\t9pd7oThcL80jeBK1xB7tFZSU9KCw/rwYI8/qji8NAGZjQwVv36Y0ng9M+hxeniIIAM\n\t6Nk5RbVXx51XVtXMbqifR/SxnPDUmb+HyH7TDegk8t7uN5uDmmQewFQVNetRNBuc3Z\n\twNi4F+p81WeoL6dgO3PG5RySEHX1c17WwXcRnFjU+dLgScZMvwvtLKCqBPM+iUk9CI\n\tGTLnMXWsd6DRQ==","v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net;\n\ts=badeba3b8450; t=1661002189;\n\tbh=fN7iYUyMnrcyE+RorzqYAwFNhhtpt3w4YGOZ+GOxZQE=;\n\th=X-UI-Sender-Class:Date:Subject:To:References:From:In-Reply-To;\n\tb=Wd9S+Rdo7bSQiG88fy0+yt3EKO+fAvTi5j5MJEgoQhaW6w21SnIM+gsEPl8p6tIWy\n\tvqe6mX4kB4HCtuADvRIvCjOoQY5MYKaq/rl4VgfDLueVXpBK0DjRH2NKkgqI+81BId\n\tauEXFj8IVdYglo+OMfy9UPtnBKxRbam3gSyLFtyE="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=gmx.net header.i=@gmx.net\n\theader.b=\"Wd9S+Rdo\"; dkim-atps=neutral","X-UI-Sender-Class":"01bb95c1-4bf8-414a-932a-4f6e2808ef9c","Message-ID":"<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>","Date":"Sat, 20 Aug 2022 15:29:48 +0200","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.11.0","Content-Language":"en-GB","To":"libcamera-devel@lists.libcamera.org","References":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>","In-Reply-To":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8","Content-Transfer-Encoding":"quoted-printable","X-Provags-ID":"V03:K1:kimVF6+7G8TeeV6z2rxxyiu6biR3yvrAfNjbLL8YR/E05Nf7Ara\n\tBAMS6JFJbJA0WKiYdB/OOsNBRudg+PWPZSY4AjbuLYGPsnTHCTrAZtR1LGGgFtRo62jX62/\n\tA5zfa7fGbLoeZZBPII/UWXxOX2GlvJWffuBCFHvkwqtCw8B6ozy0bR7xn8znbcxu+nwAN/W\n\tIdGjzsDgdPwlLwgTP0rRA==","X-Spam-Flag":"NO","X-UI-Out-Filterresults":"notjunk:1; V03:K0:Q0M7dNMm7bk=:OU+F25G/y5PWTrK5kURj+H\n\t22qmMlDJbSJFQ4bpblGd+MYvw7xBDIGC0wBGkU8Yw0jsfmvB8egM+UWwhPkPQMsl6GC8Yaxjo\n\t7toRM2hREWMsdBZNFSdOIxmBGwiE4ttZ8r3pwPXdbVKhC7ta3IlH5ClsQtcT5qAWvpJqOPQkd\n\t8qq67O3DvG+QPr/uinoRFy9s4WsLvs9LhqXQ91HsNNIriXjEz6GsKkxzzKr7epzFgr9hfTt3O\n\tV3cVY6GN/ZJVZKdzOvKg9OGXwc800UeGGuGZY+SsZexYZs+HCLu5P+J7G6TPCCNw8oG2fHf+I\n\tRR6fg4Aj6Rl/pP4H5HIyJe/dNUnpN/EAq4J/A3xr0XM/3S/JrrZ/geafsAC9bvlsFsQLovd6p\n\ts4Akg6aggbiduPvjQudDvLa1j7AqJAc8KENzCUP2ODlx4z3rAqNFpJtuwa86ineNkO9S9ukCy\n\tKb4xmIDWK8kS/bNBesjiiHEGlthCn7IVv6tv2uSxos/4wqy+zjeBPH6byeGRZFsCNQhRa8c6F\n\tHZpD4h6yqF5iUKp6rX/HEM15soR3pOUenOuc19OO1Y3h0ujykkf1gtXDf8MlZ6st2CYaVBz0G\n\tN716he8b7T0W87IbwXRLSaiqc1IzZMyuojZ+rSjZMj+DfKSioeZe3XEvgOrITOBEPjNHriw6/\n\tEXdJm3xtoRGWyRQByrSZmG29v3Sc78kyqCJWTghKiCA9ZlEwDHxb+3I98Sjm4+5qAn1ntgcc8\n\t0sj6LU+20Th3YoFzOFfLeyvjNOKmm+pu6v/I7tA4osh919kpx2SGqTQngJwSeZLBTwhqv3jIu\n\tPYm6PLFRnhaQnPI3NKUkv2q3l0+X46/BE87YdWXHGv059QdrLISAWogZVt/qIwTsyG7Ypg8fH\n\tJBdBrWz5DDNwfpXbnfOtOmHwVglvf0QlIKyNYV0uxqPKOEfhJzOToZL3u5hFcpBh2Z/f/xxyW\n\tXBVR1riu/9VVlp1ej+yB4hACio40rURdWPcT7sK63AFGiN70x8B3S6bVUMh3i/twCSo9egf8v\n\ttQiihB/8DaS5ANz1H+Bj9HKywZm+JTCINS8ItMjEES8Th7Qd/1HqILNF3v1YQJOFyySQRb4NW\n\tbdIK73By05bjaHia4ccK7f6YqYxgYxfp9qMXbbO522BU0ZwSZyUsAN+zA==","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Christian Rauch via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Christian Rauch <Rauch.Christian@gmx.de>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24723,"web_url":"https://patchwork.libcamera.org/comment/24723/","msgid":"<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>","date":"2022-08-22T14:17:05","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Sat, Aug 20, 2022 at 03:29:48PM +0200, Christian Rauch via libcamera-devel wrote:\n> Hi Tomi,\n> \n> With the recent discussions on \"versioning\", I would actually argue that\n> this should be removed entirely, and we should only rely on the semver\n> versioning.\n\nI'd rather not. It has been proven very useful multiple times to have\nthe exact git commit ID in bug reports. If we were to drop it, it would\nincrease our support burden. I'm fine omitting the commit ID when the\nlibcamera version exactly matches a released version, but not otherwise.\n\n> Am 20.08.22 um 10:07 schrieb Tomi Valkeinen via libcamera-devel:\n> > libcamera builds the git hash version into the libcamera library. This\n> > makes ninja create the generated version.cpp on every build, and if the\n> > git hash has changed, compilation of version.cpp and linking of\n> > libcamera library.\n> >\n> > This patch adds a meson option to disable this behavior and instead use\n> > the meson project-version as the version built into the library, which\n> > is only generated at meson configuration time.\n> >\n> > With this change, ninja will nicely say \"no work to do\" if there's\n> > nothing to compile, instead of starting the build and generating\n> > version.cpp.\n\nI'd prefer a way to skip recompilation (and relinking) if the version\nhasn't changed since the last build.\n\n> > But, more importantly, it often reduces build time. For example, this\n> > takes a particular git range compilation (~20 py bindings patches) from\n> > 43 seconds to 10 seconds. Obviously the improvement depends very much on\n> > the patches in question. If every commit changes libcamera itself, there\n> > is no difference.\n> >\n> > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> > ---\n> >  meson_options.txt         |  5 +++++\n> >  src/libcamera/meson.build | 29 +++++++++++++++++++++--------\n> >  2 files changed, 26 insertions(+), 8 deletions(-)\n> >\n> > diff --git a/meson_options.txt b/meson_options.txt\n> > index 7a9aecfc..6a0bd0be 100644\n> > --- a/meson_options.txt\n> > +++ b/meson_options.txt\n> > @@ -63,3 +63,8 @@ option('pycamera',\n> >          type : 'feature',\n> >          value : 'disabled',\n> >          description : 'Enable libcamera Python bindings (experimental)')\n> > +\n> > +option('disable-vcs-versioning',\n> > +        type : 'boolean',\n> > +        value : false,\n> > +        description : 'Disable automatic libcamera library versioning with the git hash')\n> > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> > index ce1f0f2f..6fd6f084 100644\n> > --- a/src/libcamera/meson.build\n> > +++ b/src/libcamera/meson.build\n> > @@ -121,14 +121,27 @@ endforeach\n> >\n> >  libcamera_sources += control_sources\n> >\n> > -gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> > -\n> > -# Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> > -# version gets updated with every ninja build and not just at meson setup time.\n> > -version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> > -                      input : 'version.cpp.in',\n> > -                      output : 'version.cpp',\n> > -                      fallback : meson.project_version())\n> > +if get_option('disable-vcs-versioning')\n> > +    cdata = configuration_data()\n> > +    cdata.set('VCS_TAG', meson.project_version())\n> > +\n> > +    # For some reason using 'version.cpp' as output file works fine for generation\n> > +    # but causes meson to delete the file before build. Any other file name\n> > +    # seems to work.\n> > +    version_cpp = configure_file(input : 'version.cpp.in',\n> > +                                 output : 'version_static.cpp',\n> > +                                 configuration : cdata)\n> > +\n> > +else\n> > +    gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> > +\n> > +    # Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> > +    # version gets updated with every ninja build and not just at meson setup time.\n> > +    version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> > +                          input : 'version.cpp.in',\n> > +                          output : 'version.cpp',\n> > +                          fallback : meson.project_version())\n> > +endif\n> >\n> >  libcamera_sources += version_cpp\n> >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id B02C5BE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Aug 2022 14:17:11 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id E21F461FBE;\n\tMon, 22 Aug 2022 16:17:10 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 69B2361FA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Aug 2022 16:17:09 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id B78062B3;\n\tMon, 22 Aug 2022 16:17:08 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661177830;\n\tbh=oO1NGSV2SCjN/D/vAtPtwjIrzjV4H/Lq8+KWirFb45Y=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=0iH3raP177fIRXMuF+qWxYKGPpMFDYKVZJihYFVBkQmAYUiqduIfjpEGGS7zv4Gw5\n\tQfStnOb/U0jJezUIG7+qVr1OGlpQH2/qFANcxuCfDKLVVVW+y1jlaiXU8ShI8G0asf\n\tcZDRymzia6HFjSF9H2OjRgtpZMaTraxjMrrxGJ/obK4LGUJ8MQDnOFico4Ddk3kXbU\n\tzt7e3uUkPZRGHTbF3ldaeCM2UoYIeJtViiSu/f13aYCRL2wc8ifSA10XgyfjyeXPil\n\tsBlegtxK3QyjY5AkETaN6FZs1gJwCZUM416P0WN1fKaNQAdEMmHBV5O8qEwzFfv8Vv\n\t+qolmgf/CvQqg==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661177829;\n\tbh=oO1NGSV2SCjN/D/vAtPtwjIrzjV4H/Lq8+KWirFb45Y=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=fwvI0baM3O9t3Hcm4+9SxdGsb+6sQXkuz3o+wfs7J5fPWVa5uLPyHheawkZjcm+YV\n\tYYsqughI/5nvEZ47R1PuMx0QxsTZsYN+4svAFzN1Lb+pokQs055B1Pjdgnof4t32Oi\n\taUgL21bVU0Ka+DAQ8YOc4mwWi9XRSO8hqBTXqJyc="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"fwvI0baM\"; dkim-atps=neutral","Date":"Mon, 22 Aug 2022 17:17:05 +0300","To":"Christian Rauch <Rauch.Christian@gmx.de>","Message-ID":"<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>","References":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>\n\t<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24724,"web_url":"https://patchwork.libcamera.org/comment/24724/","msgid":"<YwOVNC3l3AcU9Yxz@pendragon.ideasonboard.com>","date":"2022-08-22T14:39:48","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Aug 22, 2022 at 05:17:05PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> On Sat, Aug 20, 2022 at 03:29:48PM +0200, Christian Rauch via libcamera-devel wrote:\n> > Hi Tomi,\n> > \n> > With the recent discussions on \"versioning\", I would actually argue that\n> > this should be removed entirely, and we should only rely on the semver\n> > versioning.\n> \n> I'd rather not. It has been proven very useful multiple times to have\n> the exact git commit ID in bug reports. If we were to drop it, it would\n> increase our support burden. I'm fine omitting the commit ID when the\n> libcamera version exactly matches a released version, but not otherwise.\n> \n> > Am 20.08.22 um 10:07 schrieb Tomi Valkeinen via libcamera-devel:\n> > > libcamera builds the git hash version into the libcamera library. This\n> > > makes ninja create the generated version.cpp on every build, and if the\n> > > git hash has changed, compilation of version.cpp and linking of\n> > > libcamera library.\n> > >\n> > > This patch adds a meson option to disable this behavior and instead use\n> > > the meson project-version as the version built into the library, which\n> > > is only generated at meson configuration time.\n> > >\n> > > With this change, ninja will nicely say \"no work to do\" if there's\n> > > nothing to compile, instead of starting the build and generating\n> > > version.cpp.\n> \n> I'd prefer a way to skip recompilation (and relinking) if the version\n> hasn't changed since the last build.\n\nWhich of course doesn't work for Tomi's use case.\n\n/me needs to wake up\n\nHow can we get the best of both worlds ?\n\n> > > But, more importantly, it often reduces build time. For example, this\n> > > takes a particular git range compilation (~20 py bindings patches) from\n> > > 43 seconds to 10 seconds. Obviously the improvement depends very much on\n> > > the patches in question. If every commit changes libcamera itself, there\n> > > is no difference.\n> > >\n> > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> > > ---\n> > >  meson_options.txt         |  5 +++++\n> > >  src/libcamera/meson.build | 29 +++++++++++++++++++++--------\n> > >  2 files changed, 26 insertions(+), 8 deletions(-)\n> > >\n> > > diff --git a/meson_options.txt b/meson_options.txt\n> > > index 7a9aecfc..6a0bd0be 100644\n> > > --- a/meson_options.txt\n> > > +++ b/meson_options.txt\n> > > @@ -63,3 +63,8 @@ option('pycamera',\n> > >          type : 'feature',\n> > >          value : 'disabled',\n> > >          description : 'Enable libcamera Python bindings (experimental)')\n> > > +\n> > > +option('disable-vcs-versioning',\n> > > +        type : 'boolean',\n> > > +        value : false,\n> > > +        description : 'Disable automatic libcamera library versioning with the git hash')\n> > > diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> > > index ce1f0f2f..6fd6f084 100644\n> > > --- a/src/libcamera/meson.build\n> > > +++ b/src/libcamera/meson.build\n> > > @@ -121,14 +121,27 @@ endforeach\n> > >\n> > >  libcamera_sources += control_sources\n> > >\n> > > -gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> > > -\n> > > -# Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> > > -# version gets updated with every ninja build and not just at meson setup time.\n> > > -version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> > > -                      input : 'version.cpp.in',\n> > > -                      output : 'version.cpp',\n> > > -                      fallback : meson.project_version())\n> > > +if get_option('disable-vcs-versioning')\n> > > +    cdata = configuration_data()\n> > > +    cdata.set('VCS_TAG', meson.project_version())\n> > > +\n> > > +    # For some reason using 'version.cpp' as output file works fine for generation\n> > > +    # but causes meson to delete the file before build. Any other file name\n> > > +    # seems to work.\n> > > +    version_cpp = configure_file(input : 'version.cpp.in',\n> > > +                                 output : 'version_static.cpp',\n> > > +                                 configuration : cdata)\n\nDo I understand correctly that this will cause a build failure if you\ndon't first run meson setup with the disable-vcs-versioning option\ndisabled ?\n\n> > > +\n> > > +else\n> > > +    gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> > > +\n> > > +    # Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> > > +    # version gets updated with every ninja build and not just at meson setup time.\n> > > +    version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> > > +                          input : 'version.cpp.in',\n> > > +                          output : 'version.cpp',\n> > > +                          fallback : meson.project_version())\n> > > +endif\n> > >\n> > >  libcamera_sources += version_cpp\n> > >","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id A3B1EC3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Aug 2022 14:39:55 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 0F0F361FBE;\n\tMon, 22 Aug 2022 16:39:55 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 2D69961FA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Aug 2022 16:39:53 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 892422B3;\n\tMon, 22 Aug 2022 16:39:52 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661179195;\n\tbh=d5Qr+3x1rnhicp8rZbCoO/+uQi1yLzoKAOzVpIUpPLk=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=dmi/O8GNoXgcvlgUIf3zhOOQItoei60csqbnODU8XvLfE/7BMpWIV3wkNPILNCzxd\n\t6Q15qnezLsYHyiVfrqMRqIbddRYYAwm498ZT4GrH4pnNL5nL0HY+0MaDivWCw5Iilz\n\ttyWwN9MgUCRyzt18OuZzWvPw57GreXcmiVnX27IzCUaEzj1kUZ2tFOIHZzSpfRjhyu\n\tNsZCPsV5w6NVBXaoo4bGpfiSmH0uztO+eVeajkgMcfLBY2cRMxnQWDQGOov+MNQ+t7\n\t2IHudb3leL3TrfQVGLxaIcf79fjGxgFMhDmvRPyG1AXHOrnRDp4Uf4PUrpNxOXOZsZ\n\tv4sKgcpqyqH1A==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661179192;\n\tbh=d5Qr+3x1rnhicp8rZbCoO/+uQi1yLzoKAOzVpIUpPLk=;\n\th=Date:From:To:Subject:References:In-Reply-To:From;\n\tb=QlCUApqrmB59zVyLYFI2KTKk2t+a8PEPaNkjltpEjsJp22jwRvpQjcR/p1IF6lRTG\n\tpzCHfG+SeUPQow4B0KMz66JYJlsv1PO5d6g8m88LXYNI09+BzFuTtTvIrtGC4JRQfh\n\tt774FRn0KrfE2251g7BITzjOa80swY3pgjMJcvIg="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"QlCUApqr\"; dkim-atps=neutral","Date":"Mon, 22 Aug 2022 17:39:48 +0300","To":"Christian Rauch <Rauch.Christian@gmx.de>,\n\tlibcamera-devel@lists.libcamera.org","Message-ID":"<YwOVNC3l3AcU9Yxz@pendragon.ideasonboard.com>","References":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>\n\t<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>\n\t<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24727,"web_url":"https://patchwork.libcamera.org/comment/24727/","msgid":"<8df97534-04d3-4fa0-8b74-41e4942d8d3c@ideasonboard.com>","date":"2022-08-22T18:44:20","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","submitter":{"id":109,"url":"https://patchwork.libcamera.org/api/people/109/","name":"Tomi Valkeinen","email":"tomi.valkeinen@ideasonboard.com"},"content":"On 22/08/2022 17:39, Laurent Pinchart via libcamera-devel wrote:\n> On Mon, Aug 22, 2022 at 05:17:05PM +0300, Laurent Pinchart via libcamera-devel wrote:\n>> On Sat, Aug 20, 2022 at 03:29:48PM +0200, Christian Rauch via libcamera-devel wrote:\n>>> Hi Tomi,\n>>>\n>>> With the recent discussions on \"versioning\", I would actually argue that\n>>> this should be removed entirely, and we should only rely on the semver\n>>> versioning.\n>>\n>> I'd rather not. It has been proven very useful multiple times to have\n>> the exact git commit ID in bug reports. If we were to drop it, it would\n>> increase our support burden. I'm fine omitting the commit ID when the\n>> libcamera version exactly matches a released version, but not otherwise.\n>>\n>>> Am 20.08.22 um 10:07 schrieb Tomi Valkeinen via libcamera-devel:\n>>>> libcamera builds the git hash version into the libcamera library. This\n>>>> makes ninja create the generated version.cpp on every build, and if the\n>>>> git hash has changed, compilation of version.cpp and linking of\n>>>> libcamera library.\n>>>>\n>>>> This patch adds a meson option to disable this behavior and instead use\n>>>> the meson project-version as the version built into the library, which\n>>>> is only generated at meson configuration time.\n>>>>\n>>>> With this change, ninja will nicely say \"no work to do\" if there's\n>>>> nothing to compile, instead of starting the build and generating\n>>>> version.cpp.\n>>\n>> I'd prefer a way to skip recompilation (and relinking) if the version\n>> hasn't changed since the last build.\n> \n> Which of course doesn't work for Tomi's use case.\n> \n> /me needs to wake up\n> \n> How can we get the best of both worlds ?\n\nI think there are two different build types: for publishing and for your \nown use (development usually). With dev builds I'm fine with omitting \nversioning info, skipping any signing processes, and so forth. I think \nthat can be a meson option. Which one should be the default, that's a \nmore difficult question (maybe publishing).\n\n>>>> But, more importantly, it often reduces build time. For example, this\n>>>> takes a particular git range compilation (~20 py bindings patches) from\n>>>> 43 seconds to 10 seconds. Obviously the improvement depends very much on\n>>>> the patches in question. If every commit changes libcamera itself, there\n>>>> is no difference.\n>>>>\n>>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n>>>> ---\n>>>>   meson_options.txt         |  5 +++++\n>>>>   src/libcamera/meson.build | 29 +++++++++++++++++++++--------\n>>>>   2 files changed, 26 insertions(+), 8 deletions(-)\n>>>>\n>>>> diff --git a/meson_options.txt b/meson_options.txt\n>>>> index 7a9aecfc..6a0bd0be 100644\n>>>> --- a/meson_options.txt\n>>>> +++ b/meson_options.txt\n>>>> @@ -63,3 +63,8 @@ option('pycamera',\n>>>>           type : 'feature',\n>>>>           value : 'disabled',\n>>>>           description : 'Enable libcamera Python bindings (experimental)')\n>>>> +\n>>>> +option('disable-vcs-versioning',\n>>>> +        type : 'boolean',\n>>>> +        value : false,\n>>>> +        description : 'Disable automatic libcamera library versioning with the git hash')\n>>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n>>>> index ce1f0f2f..6fd6f084 100644\n>>>> --- a/src/libcamera/meson.build\n>>>> +++ b/src/libcamera/meson.build\n>>>> @@ -121,14 +121,27 @@ endforeach\n>>>>\n>>>>   libcamera_sources += control_sources\n>>>>\n>>>> -gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n>>>> -\n>>>> -# Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n>>>> -# version gets updated with every ninja build and not just at meson setup time.\n>>>> -version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n>>>> -                      input : 'version.cpp.in',\n>>>> -                      output : 'version.cpp',\n>>>> -                      fallback : meson.project_version())\n>>>> +if get_option('disable-vcs-versioning')\n>>>> +    cdata = configuration_data()\n>>>> +    cdata.set('VCS_TAG', meson.project_version())\n>>>> +\n>>>> +    # For some reason using 'version.cpp' as output file works fine for generation\n>>>> +    # but causes meson to delete the file before build. Any other file name\n>>>> +    # seems to work.\n>>>> +    version_cpp = configure_file(input : 'version.cpp.in',\n>>>> +                                 output : 'version_static.cpp',\n>>>> +                                 configuration : cdata)\n> \n> Do I understand correctly that this will cause a build failure if you\n> don't first run meson setup with the disable-vcs-versioning option\n> disabled ?\n\nIsn't this piece of code always run when you change (enable) the option, \neven if you do it with \"meson configure\" after the initial setup?\n\n  Tomi","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 5F627C3272\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Aug 2022 18:44:26 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 9EB9561FBE;\n\tMon, 22 Aug 2022 20:44:25 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 04D2961FA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Aug 2022 20:44:24 +0200 (CEST)","from [192.168.1.111] (91-158-154-79.elisa-laajakaista.fi\n\t[91.158.154.79])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 5FDF52B3;\n\tMon, 22 Aug 2022 20:44:23 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661193865;\n\tbh=B3SCqfe70koH2rQIZ7yFhcAQFrsw7MnKoOQK2yShEak=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:\n\tFrom;\n\tb=FeC6PEcnsBQP/keA5MbLjAYw2mm+WMTstQqJ4NV+da9nw+PjQ6hKZVbY86mkAgPsF\n\tN1yErgeZlg5hBjXbbi/C81xeGMvA2cE9VTOclHEdrSti6akG1La4piFzOt+Icfk68E\n\thYkt85c9gpmjN5M9v03HB15hNdi17rOF6XQg067MeubmVFHt0bXdtzavrzFDfxhr3q\n\tV5jNZL1b8aRKNesjlaATT2JgqZPYEyLtZW4nk+CCEKVURjR4mpSG9ZpgVEECNlfqgR\n\tyc0bksNhZYuO+czI4fzFiLbKRXSFlR4Gooy4N9q1xBTj8Axav+JqUE0OlTWI9CcFhO\n\tihsRvi0KaNj7g==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661193863;\n\tbh=B3SCqfe70koH2rQIZ7yFhcAQFrsw7MnKoOQK2yShEak=;\n\th=Date:Subject:To:References:From:In-Reply-To:From;\n\tb=HST4D7d7ht0rVVpyUVcCd2a73N+bjbs9LaVLSih2+ePwaG6pk14Dtt7rE4X0tqQ4a\n\tCdwMv7b3UPixri6xQVd3VGAcsBpqP//ySQkCsVKGzQJqNhNv1HVdZdYaV907uxne0e\n\tSMxnkVZ2kyAeAmEln3NEWoymW2sg4eBTz5U0qqog="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"HST4D7d7\"; dkim-atps=neutral","Message-ID":"<8df97534-04d3-4fa0-8b74-41e4942d8d3c@ideasonboard.com>","Date":"Mon, 22 Aug 2022 21:44:20 +0300","MIME-Version":"1.0","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101\n\tThunderbird/91.11.0","Content-Language":"en-US","To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>,\n\tChristian Rauch <Rauch.Christian@gmx.de>,\n\tlibcamera-devel@lists.libcamera.org","References":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>\n\t<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>\n\t<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>\n\t<YwOVNC3l3AcU9Yxz@pendragon.ideasonboard.com>","In-Reply-To":"<YwOVNC3l3AcU9Yxz@pendragon.ideasonboard.com>","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Tomi Valkeinen via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}},{"id":24728,"web_url":"https://patchwork.libcamera.org/comment/24728/","msgid":"<YwPfi8K34Vr53gtv@pendragon.ideasonboard.com>","date":"2022-08-22T19:56:59","subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"content":"On Mon, Aug 22, 2022 at 09:44:20PM +0300, Tomi Valkeinen wrote:\n> On 22/08/2022 17:39, Laurent Pinchart via libcamera-devel wrote:\n> > On Mon, Aug 22, 2022 at 05:17:05PM +0300, Laurent Pinchart via libcamera-devel wrote:\n> >> On Sat, Aug 20, 2022 at 03:29:48PM +0200, Christian Rauch via libcamera-devel wrote:\n> >>> Hi Tomi,\n> >>>\n> >>> With the recent discussions on \"versioning\", I would actually argue that\n> >>> this should be removed entirely, and we should only rely on the semver\n> >>> versioning.\n> >>\n> >> I'd rather not. It has been proven very useful multiple times to have\n> >> the exact git commit ID in bug reports. If we were to drop it, it would\n> >> increase our support burden. I'm fine omitting the commit ID when the\n> >> libcamera version exactly matches a released version, but not otherwise.\n> >>\n> >>> Am 20.08.22 um 10:07 schrieb Tomi Valkeinen via libcamera-devel:\n> >>>> libcamera builds the git hash version into the libcamera library. This\n> >>>> makes ninja create the generated version.cpp on every build, and if the\n> >>>> git hash has changed, compilation of version.cpp and linking of\n> >>>> libcamera library.\n> >>>>\n> >>>> This patch adds a meson option to disable this behavior and instead use\n> >>>> the meson project-version as the version built into the library, which\n> >>>> is only generated at meson configuration time.\n> >>>>\n> >>>> With this change, ninja will nicely say \"no work to do\" if there's\n> >>>> nothing to compile, instead of starting the build and generating\n> >>>> version.cpp.\n> >>\n> >> I'd prefer a way to skip recompilation (and relinking) if the version\n> >> hasn't changed since the last build.\n> > \n> > Which of course doesn't work for Tomi's use case.\n> > \n> > /me needs to wake up\n> > \n> > How can we get the best of both worlds ?\n> \n> I think there are two different build types: for publishing and for your \n> own use (development usually). With dev builds I'm fine with omitting \n> versioning info, skipping any signing processes, and so forth. I think \n> that can be a meson option. Which one should be the default, that's a \n> more difficult question (maybe publishing).\n\nI'd like to make this difficult to enable by mistake, extending the\ndefinition of \"by mistake\" to enabling the option on purpose without\nunderstanding it will hurt bug reports. We should at least print a very\nbig warning in this case, and I wonder if it would be worth it trying to\nhide the option (for instance using an environment variable that\ngen-version.sh would interpret instead of a meson option). I'll be quite\ncross if we start seeing libcamera logs without a proper version number.\n\n> >>>> But, more importantly, it often reduces build time. For example, this\n> >>>> takes a particular git range compilation (~20 py bindings patches) from\n> >>>> 43 seconds to 10 seconds. Obviously the improvement depends very much on\n> >>>> the patches in question. If every commit changes libcamera itself, there\n> >>>> is no difference.\n> >>>>\n> >>>> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>\n> >>>> ---\n> >>>>   meson_options.txt         |  5 +++++\n> >>>>   src/libcamera/meson.build | 29 +++++++++++++++++++++--------\n> >>>>   2 files changed, 26 insertions(+), 8 deletions(-)\n> >>>>\n> >>>> diff --git a/meson_options.txt b/meson_options.txt\n> >>>> index 7a9aecfc..6a0bd0be 100644\n> >>>> --- a/meson_options.txt\n> >>>> +++ b/meson_options.txt\n> >>>> @@ -63,3 +63,8 @@ option('pycamera',\n> >>>>           type : 'feature',\n> >>>>           value : 'disabled',\n> >>>>           description : 'Enable libcamera Python bindings (experimental)')\n> >>>> +\n> >>>> +option('disable-vcs-versioning',\n> >>>> +        type : 'boolean',\n> >>>> +        value : false,\n> >>>> +        description : 'Disable automatic libcamera library versioning with the git hash')\n> >>>> diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build\n> >>>> index ce1f0f2f..6fd6f084 100644\n> >>>> --- a/src/libcamera/meson.build\n> >>>> +++ b/src/libcamera/meson.build\n> >>>> @@ -121,14 +121,27 @@ endforeach\n> >>>>\n> >>>>   libcamera_sources += control_sources\n> >>>>\n> >>>> -gen_version = meson.project_source_root() / 'utils' / 'gen-version.sh'\n> >>>> -\n> >>>> -# Use vcs_tag() and not configure_file() or run_command(), to ensure that the\n> >>>> -# version gets updated with every ninja build and not just at meson setup time.\n> >>>> -version_cpp = vcs_tag(command : [gen_version, meson.project_build_root(), meson.project_source_root()],\n> >>>> -                      input : 'version.cpp.in',\n> >>>> -                      output : 'version.cpp',\n> >>>> -                      fallback : meson.project_version())\n> >>>> +if get_option('disable-vcs-versioning')\n> >>>> +    cdata = configuration_data()\n> >>>> +    cdata.set('VCS_TAG', meson.project_version())\n> >>>> +\n> >>>> +    # For some reason using 'version.cpp' as output file works fine for generation\n> >>>> +    # but causes meson to delete the file before build. Any other file name\n> >>>> +    # seems to work.\n> >>>> +    version_cpp = configure_file(input : 'version.cpp.in',\n> >>>> +                                 output : 'version_static.cpp',\n> >>>> +                                 configuration : cdata)\n> > \n> > Do I understand correctly that this will cause a build failure if you\n> > don't first run meson setup with the disable-vcs-versioning option\n> > disabled ?\n> \n> Isn't this piece of code always run when you change (enable) the option, \n> even if you do it with \"meson configure\" after the initial setup?\n\nWhat happens if you run\n\nmkdir build\ncd build\nmeson setup -Ddisable-vcs-versioning=true ..\nninja","headers":{"Return-Path":"<libcamera-devel-bounces@lists.libcamera.org>","X-Original-To":"parsemail@patchwork.libcamera.org","Delivered-To":"parsemail@patchwork.libcamera.org","Received":["from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 2E03DBE173\n\tfor <parsemail@patchwork.libcamera.org>;\n\tMon, 22 Aug 2022 19:57:06 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 768FD61FBE;\n\tMon, 22 Aug 2022 21:57:05 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 6EE8E61FA1\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tMon, 22 Aug 2022 21:57:04 +0200 (CEST)","from pendragon.ideasonboard.com (62-78-145-57.bb.dnainternet.fi\n\t[62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id BCB902B3;\n\tMon, 22 Aug 2022 21:57:03 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1661198225;\n\tbh=XvHX7hAVHCqf1sM/cY8rHYzA+HtzvWv7IUJ3dRON3Rg=;\n\th=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=I2aX1aEaDPYF3lZplJY822RPBm9raJGVjxExtTkIywJeahkK3sgFeH5NDuo/VlWX1\n\t/5rZWUdqdSZX0Z5BLNsIu+uEfWpBt5ZftlMeeSTz4Zc38bLz4GvJsfNU7imwhaHnU+\n\tpmBayfJKcTqzWKaULaXksUgv5MH4YXfJPDqmZnnBDGtP3v61ZVR5oMCHVFBblNdKz4\n\tdpeTfsiexafQRKAQ5JOXOIJy4aHJXV6TehhND0wY+CYa2+y3JPTA3uS1YjumHt/7Eo\n\tkBC/WDNN+o3YgqANRteAJqhZ9OkpP5me7vaU28IaGOEYoxCMV8laO4eBLbIyw7eroG\n\tOLBDOtfm3kY2Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1661198224;\n\tbh=XvHX7hAVHCqf1sM/cY8rHYzA+HtzvWv7IUJ3dRON3Rg=;\n\th=Date:From:To:Cc:Subject:References:In-Reply-To:From;\n\tb=RBB4FEHKMoEtFeWDGMFR49Sgo7znGKKyxVFo1EnioUpwhGBFMmAc/GPH0AWB1cVtW\n\tyjA3xbkZw0RYqC1Gv31gTp0dlp0ycZ4H3YfmIlLzZafP10u8pWAchHgwZL47qg3xp9\n\tW0r4jO7TNRxif9nA6j/ZfwXMPRAnV9rNhblwr78s="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"RBB4FEHK\"; dkim-atps=neutral","Date":"Mon, 22 Aug 2022 22:56:59 +0300","To":"Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>","Message-ID":"<YwPfi8K34Vr53gtv@pendragon.ideasonboard.com>","References":"<20220820080744.30325-1-tomi.valkeinen@ideasonboard.com>\n\t<6fc37ee8-f698-f3f6-6d27-81f878c12693@gmx.de>\n\t<YwOP4eafVk36Ww6t@pendragon.ideasonboard.com>\n\t<YwOVNC3l3AcU9Yxz@pendragon.ideasonboard.com>\n\t<8df97534-04d3-4fa0-8b74-41e4942d8d3c@ideasonboard.com>","MIME-Version":"1.0","Content-Type":"text/plain; charset=utf-8","Content-Disposition":"inline","In-Reply-To":"<8df97534-04d3-4fa0-8b74-41e4942d8d3c@ideasonboard.com>","Subject":"Re: [libcamera-devel] [RFC PATCH] libcamera: Disable automatic vcs\n\tversioning","X-BeenThere":"libcamera-devel@lists.libcamera.org","X-Mailman-Version":"2.1.29","Precedence":"list","List-Id":"<libcamera-devel.lists.libcamera.org>","List-Unsubscribe":"<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>","List-Archive":"<https://lists.libcamera.org/pipermail/libcamera-devel/>","List-Post":"<mailto:libcamera-devel@lists.libcamera.org>","List-Help":"<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>","List-Subscribe":"<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>","From":"Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>","Reply-To":"Laurent Pinchart <laurent.pinchart@ideasonboard.com>","Cc":"libcamera-devel@lists.libcamera.org","Errors-To":"libcamera-devel-bounces@lists.libcamera.org","Sender":"\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>"}}]