Skip to content
Snippets Groups Projects
Commit c5e6822d authored by Guillem Jover's avatar Guillem Jover
Browse files

Dpkg::Vendor::Ubuntu: Fix lto feature to honor DEB_BUILD_OPTIONS

The recently added lto handling for Ubuntu, did not take into account
that the DEB_BUILD_OPTIONS and DEB_BUILD_MAINT_OPTIONS environment
variables are parsed and their options applied just after setting the
defaults, and before applying any arch-specific mask.

We add a new init_build_features() internal method, which sits between
these two actions, so that the Ubuntu vendor module can modify the
defaults before any user or maintainer override are applied.

Fixes: commit df7627ac
Fixes: https://bugs.launchpad.net/bugs/2002582
parent e895de05
No related branches found
No related tags found
1 merge request!4Update crimson to version from bookworm
......@@ -94,6 +94,10 @@ sub run_hook {
}
}
sub init_build_features {
my ($self, $use_feature, $builtin_feature) = @_;
}
sub set_build_features {
my ($self, $flags) = @_;
......@@ -139,6 +143,8 @@ sub set_build_features {
},
);
$self->init_build_features(\%use_feature, \%builtin_feature);
## Setup
require Dpkg::BuildOptions;
......
......@@ -109,17 +109,26 @@ sub run_hook {
}
# Override Debian default features.
sub set_build_features {
my ($self, $flags) = @_;
sub init_build_features {
my ($self, $use_feature, $builtin_feature) = @_;
$self->SUPER::set_build_features($flags);
$self->SUPER::init_build_features($use_feature, $builtin_feature);
require Dpkg::Arch;
my $arch = Dpkg::Arch::get_host_arch();
if (any { $_ eq $arch } qw(amd64 arm64 ppc64el s390x)) {
$flags->set_feature('optimize', 'lto', 1);
$use_feature->{optimize}{lto} = 1;
}
}
sub set_build_features {
my ($self, $flags) = @_;
$self->SUPER::set_build_features($flags);
require Dpkg::Arch;
my $arch = Dpkg::Arch::get_host_arch();
if ($arch eq 'ppc64el' && $flags->get_option_value('optimize-level') != 0) {
$flags->set_option_value('optimize-level', 3);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment