diff options
author | Guillem Jover <guillem@debian.org> | 2018-07-23 12:02:38 +0200 |
---|---|---|
committer | Guillem Jover <guillem@debian.org> | 2018-07-24 14:51:52 +0200 |
commit | 23322f43e80ce0c67a361b3b00c680e170fee58f (patch) | |
tree | 3ec6afd922e78eceffaab863405daed61866f9d4 /scripts/Dpkg/Build/Types.pm | |
parent | ca394f0f03e9ab025a09e4c99ad4ccfc73550f46 (diff) | |
download | dpkg-23322f43e80ce0c67a361b3b00c680e170fee58f.tar.gz |
Dpkg::Build::Types: Add new set_build_type_from_targets() function
Diffstat (limited to 'scripts/Dpkg/Build/Types.pm')
-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. |