diff options
Diffstat (limited to 'scripts/Dpkg/Build')
-rw-r--r-- | scripts/Dpkg/Build/Types.pm | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/Dpkg/Build/Types.pm b/scripts/Dpkg/Build/Types.pm index b6c2366f3..9fd0344df 100644 --- a/scripts/Dpkg/Build/Types.pm +++ b/scripts/Dpkg/Build/Types.pm @@ -33,6 +33,7 @@ our @EXPORT = qw( build_is set_build_type set_build_type_from_options + set_build_type_from_targets get_build_options_from_type ); @@ -108,6 +109,15 @@ my %build_types = ( any => BUILD_ARCH_DEP, all => BUILD_ARCH_INDEP, ); +my %build_targets = ( + 'clean' => BUILD_SOURCE, + 'build' => BUILD_BINARY, + 'build-arch' => BUILD_ARCH_DEP, + 'build-indep' => BUILD_ARCH_INDEP, + 'binary' => BUILD_BINARY, + 'binary-arch' => BUILD_ARCH_DEP, + 'binary-indep' => BUILD_ARCH_INDEP, +); =back @@ -217,6 +227,28 @@ sub set_build_type_from_options set_build_type($build_type, $build_option, %opts); } +=item set_build_type_from_targets($build_targets, $build_option, %opts) + +Set the current build type from a list of comma-separated build target +components. + +The function will check and abort on incompatible build type assignments, +this behavior can be disabled by using the boolean option "nocheck". + +=cut + +sub set_build_type_from_targets +{ + my ($build_targets, $build_option, %opts) = @_; + + my $build_type = 0; + foreach my $target (split /,/, $build_targets) { + $build_type |= $build_targets{$target} // BUILD_BINARY; + } + + set_build_type($build_type, $build_option, %opts); +} + =item get_build_options_from_type() Get the current build type as a set of comma-separated string options. |