Control: tags -1 + patch

On Thu, 27 Jul 2023 at 15:43:26 +0100, Simon McVittie wrote:
> [A Meson behaviour change that breaks the build of src:libgit2-glib]
> can be turned off by passing -Dpython.bytecompile=-1 to `meson setup`.

Please consider
<https://salsa.debian.org/debian/debhelper/-/merge_requests/106>.

I included a version check, to avoid needing debhelper to have a versioned
Breaks on meson (>= 1.2.0).

Also attached as a patch since some maintainers require that. If I receive
review feedback on Salsa, I will assume that's the preferred contribution
route and only update that version, unless reminded to send an updated
patch to the bug.

A convenient test-case for both this and #1043136, without any
particularly large packages, is to rebuild libgit2-glib version 1.1.0-1
(in bookworm, and currently also testing and unstable) using the proposed
debhelper: it will FTBFS until both #1042398 and #1043136 are fixed.

    smcv
>From fc2bb90f01d2a09171339178d1cd0a39b1e014bf Mon Sep 17 00:00:00 2001
From: Simon McVittie <s...@debian.org>
Date: Sun, 6 Aug 2023 13:50:13 +0100
Subject: [PATCH] meson: Disable Python byte-compilation if the Meson version
 is new enough

Meson 1.2.0 added support for byte-compilation at build time, and the
default is to do so. In Debian we want byte-compilation to be done at
package install time, so explicitly turn this off. We cannot pass this
option to older Meson versions, because it would make them fail.

Closes: #1042398
Signed-off-by: Simon McVittie <s...@debian.org>
---
 lib/Debian/Debhelper/Buildsystem/meson.pm | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lib/Debian/Debhelper/Buildsystem/meson.pm b/lib/Debian/Debhelper/Buildsystem/meson.pm
index 3cd447de..9e52f74c 100644
--- a/lib/Debian/Debhelper/Buildsystem/meson.pm
+++ b/lib/Debian/Debhelper/Buildsystem/meson.pm
@@ -51,6 +51,13 @@ sub new {
 sub configure {
 	my $this=shift;
 
+	eval { require Dpkg::Version; };
+	error($@) if $@;
+
+	my $output = qx{meson --version};
+	chomp $output;
+	my $version = Dpkg::Version->new($output);
+
 	# Standard set of options for meson.
 	my @opts = (
 		'--wrap-mode=nodownload',
@@ -62,6 +69,11 @@ sub configure {
 	my $multiarch=dpkg_architecture_value("DEB_HOST_MULTIARCH");
 	push @opts, "--libdir=lib/$multiarch";
 	push(@opts, "--libexecdir=lib/$multiarch") if compat(11);
+	# There was a behaviour change in Meson 1.2.0: previously
+	# byte-compilation wasn't supported, but since 1.2.0 it is on by
+	# default. We can only use this option to turn it off in versions
+	# where the option exists.
+	push(@opts, "-Dpython.bytecompile=-1") if $version >= '1.2.0';
 
 	if (is_cross_compiling()) {
 		# http://mesonbuild.com/Cross-compilation.html
-- 
2.40.1

Reply via email to