=item B<--without> I<addon>
-The inverse of B<--with>, disables using the given addon.
+The inverse of B<--with>, disables using the given addon. This option
+can be repeated more than once, or multiple addons to disable can be
+listed, separated by commas.
=item B<--list>, B<-l>
Often you'll want to pass an option to a specific debhelper command. The
easy way to do with is by adding an override target for that command.
-
+
#!/usr/bin/make -f
%:
dh $@
-
+
override_dh_strip:
dh_strip -Xfoo
-
- override_dh_installdocs:
- dh_installdocs README TODO
+
+ override_dh_auto_configure:
+ dh_auto_configure -- --with-foo --disable-bar
Sometimes the automated L<dh_auto_configure(1)> and L<dh_auto_build(1)>
can't guess what to do for a strange package. Here's how to avoid running
dh $@ --with autotools_dev
Python tools are not run by dh by default, due to the continual change
-in that area. (Before compatability level v9, dh does run B<dh_pysupport>.)
+in that area. (Before compatibility level v9, dh does run B<dh_pysupport>.)
Here is how to use B<dh_python2>.
#!/usr/bin/make -f
# Stash this away before init modifies it.
my @ARGV_orig=@ARGV;
-if (compat(8)) {
+if (compat(8, 1)) {
# python-support was enabled by default before v9.
# (and comes first so python-central loads later and can disable it).
unshift @ARGV, "--with=python-support";
},
"without=s" => sub {
my ($option,$value)=@_;
- @{$dh{WITH}} = grep { $_ ne $value } @{$dh{WITH}};
+ my %without = map { $_ => 1 } split(",", $value);
+ @{$dh{WITH}} = grep { ! $without{$_} } @{$dh{WITH}};
},
"l" => \&list_addons,
"list" => \&list_addons,
error "specify a sequence to run";
}
# make -B causes the rules file to be run as a target.
-# Also support completly empty override targets.
+# Also support completely empty override targets.
# Note: it's not safe to use rules_explicit_target before this check,
# since it causes dh to be run.
my $dummy_target="debhelper-fail-me";
$sequences{build} = [@bd_minimal, rules("build-arch"), rules("build-indep")];
$sequences{'install-indep'} = [rules("build-indep"), @i];
$sequences{'install-arch'} = [rules("build-arch"), @i];
- $sequences{'install'} = [rules("build"), rules("install-arch"), rules("install-indep"), @i];
+ $sequences{'install'} = [rules("build"), rules("install-arch"), rules("install-indep")];
$sequences{'binary-indep'} = [rules("install-indep"), @b];
$sequences{'binary-arch'} = [rules("install-arch"), @ba, @b];
$sequences{binary} = [rules("install"), rules("binary-arch"), rules("binary-indep")];
# the usual command. (The non-arch-specific override is tried first,
# for simplest semantics; mixing it with arch-specific overrides
# makes little sense.)
+ my @oldtodo=@todo;
foreach my $override_type (undef, "arch", "indep") {
@todo = run_override($override_type, $command, \@todo, @opts);
}
next unless @todo;
+ # No need to run the command for any packages handled by the
+ # override targets.
+ my %todo=map { $_ => 1 } @todo;
+ foreach my $package (@oldtodo) {
+ if (! $todo{$package}) {
+ push @opts, "-N$package";
+ }
+ }
+
run($command, @opts);
}
return @rest if ! $has_explicit_target; # has empty override
return @rest unless @todo; # has override, but no packages to act on
+ if (defined $override_type) {
+ # Ensure appropriate -a or -i option is passed when running
+ # an arch-specific override target.
+ my $opt=$override_type eq "arch" ? "-a" : "-i";
+ push @options, $opt unless grep { $_ eq $opt } @options;
+ }
+
# This passes the options through to commands called
# inside the target.
$ENV{DH_INTERNAL_OPTIONS}=join("\x1e", @options);
}
else {
if (!$not_a_target && /^([^#:]+)::?\s*(.*)$/) {
- # Target is defined. NOTE: if it is a depenency of
+ # Target is defined. NOTE: if it is a dependency of
# .PHONY it will be defined too but that's ok.
# $2 contains target dependencies if any.
$current_target = $1;