return $module->new(%bsopts);
}
+# Similar to create_buildsystem_instance(), but it attempts to autoselect
+# a buildsystem if none was specified. In case autoselection fails, undef
+# is returned.
sub load_buildsystem {
- my ($step, $system)=@_;
+ my $system=shift;
+ my $step=shift;
if (defined $system) {
- my $inst = create_buildsystem_instance($system);
+ my $inst = create_buildsystem_instance($system, @_);
return $inst;
}
else {
# Try to determine build system automatically
for $system (@BUILDSYSTEMS) {
- my $inst = create_buildsystem_instance($system, build_step=>$step);
- if ($inst->is_buildable()) {
+ my $inst = create_buildsystem_instance($system, @_);
+ if ($inst->check_auto_buildable($step)) {
return $inst;
}
}
# Available command line options
my %options = (
- "d" => undef, # cancel default D_FLAG option spec
- "d=s" => \$opt_sourcedir,
+ "D=s" => \$opt_sourcedir,
"sourcedirectory=s" => \$opt_sourcedir,
- "b:s" => \$opt_builddir,
+ "B:s" => \$opt_builddir,
"builddirectory:s" => \$opt_builddir,
- "c=s" => \$opt_buildsys,
+ "S=s" => \$opt_buildsys,
"buildsystem=s" => \$opt_buildsys,
"l" => \$opt_list,
"--list" => \$opt_list,
);
$args{options}{$_} = $options{$_} foreach keys(%options);
-
- # Pass options from the DH_AUTO_OPTIONS environment variable
- if (defined $ENV{DH_AUTO_OPTIONS}) {
- $args{extra_args} = $ENV{DH_AUTO_OPTIONS};
- }
Debian::Debhelper::Dh_Lib::init(%args);
}
# List buildsystems (including auto and specified status)
my ($auto, $specified);
- my @buildsystems = load_all_buildsystems(undef, build_step => undef);
+ my @buildsystems = load_all_buildsystems();
for my $inst (@buildsystems) {
my $is_specified = defined $opt_buildsys && $opt_buildsys eq $inst->NAME();
if (! defined $specified && defined $opt_buildsys && $opt_buildsys eq $inst->NAME()) {
exit 0;
}
- my $buildsystem = load_buildsystem($step, $opt_buildsys);
+ my $buildsystem = load_buildsystem($opt_buildsys, $step);
if (defined $buildsystem) {
- $buildsystem->pre_step($step);
+ $buildsystem->pre_building_step($step);
$buildsystem->$step(@_, @{$dh{U_PARAMS}});
- $buildsystem->post_step($step);
+ $buildsystem->post_building_step($step);
}
return 0;
}