+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";
+}
+
+init(options => {
+ "until=s" => \$dh{UNTIL},
+ "after=s" => \$dh{AFTER},
+ "before=s" => \$dh{BEFORE},
+ "remaining" => \$dh{REMAINING},
+ "with=s" => sub {
+ my ($option,$value)=@_;
+ push @{$dh{WITH}},split(",", $value);
+ },
+ "without=s" => sub {
+ my ($option,$value)=@_;
+ @{$dh{WITH}} = grep { $_ ne $value } @{$dh{WITH}};
+ },
+ "l" => \&list_addons,
+ "list" => \&list_addons,
+ },
+ # Disable complaints about unknown options; they are passed on to
+ # the debhelper commands.
+ ignore_unknown_options => 1,
+ # Bundling does not work well since there are unknown options.
+ bundling => 0,
+);
+inhibit_log();
+set_buildflags();
+warn_deprecated();
+
+# If make is using a jobserver, but it is not available
+# to this process, clean out MAKEFLAGS. This avoids
+# ugly warnings when calling make.
+if (is_make_jobserver_unavailable()) {
+ clean_jobserver_makeflags();
+}
+
+# Process the sequence parameter.
+my $sequence;
+if (! compat(7)) {
+ # From v8, the sequence is the very first parameter.
+ $sequence=shift @ARGV_orig;
+ if (defined $sequence && $sequence=~/^-/) {
+ error "Unknown sequence $sequence (options should not come before the sequence)";
+ }
+}
+else {
+ # Before v8, the sequence could be at any position in the parameters,
+ # so was what was left after parsing.
+ $sequence=shift;
+ if (defined $sequence) {
+ @ARGV_orig=grep { $_ ne $sequence } @ARGV_orig;
+ }
+}
+if (! defined $sequence) {
+ error "specify a sequence to run";
+}
+# make -B causes the rules file to be run as a target.
+# Also support completly 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";
+if ($sequence eq 'debian/rules' ||
+ $sequence =~ /^override_dh_/ ||
+ $sequence eq $dummy_target) {
+ exit 0;
+}
+