summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <smcv@debian.org>2023-08-06 13:50:13 +0100
committerNiels Thykier <niels@thykier.net>2023-08-09 12:05:22 +0000
commit788611c330661359d7f1e60d89638f6c70c45c70 (patch)
treead3c7d2d95d30808b254a21f640ab309e45ed864
parent667572485ee3f19bfd9da5463bc7e599cdf01fda (diff)
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 <smcv@debian.org>
-rw-r--r--lib/Debian/Debhelper/Buildsystem/meson.pm14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/Debian/Debhelper/Buildsystem/meson.pm b/lib/Debian/Debhelper/Buildsystem/meson.pm
index 066216a7..b14fb243 100644
--- a/lib/Debian/Debhelper/Buildsystem/meson.pm
+++ b/lib/Debian/Debhelper/Buildsystem/meson.pm
@@ -7,7 +7,7 @@ package Debian::Debhelper::Buildsystem::meson;
use strict;
use warnings;
-use Debian::Debhelper::Dh_Lib qw(compat dpkg_architecture_value is_cross_compiling doit warning error generated_file);
+use Debian::Debhelper::Dh_Lib qw(compat dpkg_architecture_value is_cross_compiling doit warning error generated_file qx_cmd);
use parent qw(Debian::Debhelper::Buildsystem);
sub DESCRIPTION {
@@ -59,6 +59,13 @@ sub _get_meson_env {
sub configure {
my $this=shift;
+ eval { require Dpkg::Version; };
+ error($@) if $@;
+
+ my $output = qx_cmd('meson', '--version');
+ chomp $output;
+ my $version = Dpkg::Version->new($output);
+
# Standard set of options for meson.
my @opts = (
'--wrap-mode=nodownload',
@@ -70,6 +77,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