]> git.donarmstrong.com Git - debhelper.git/blobdiff - Debian/Debhelper/Dh_Buildsystems.pm
New short switches for buildsystem stuff, drop envvars
[debhelper.git] / Debian / Debhelper / Dh_Buildsystems.pm
index 179d6334914330d6c2333c1b4c37fffff1682cc3..d33b6f2cebb04ecf2ceb52054c6d30ba90f9db67 100644 (file)
@@ -49,17 +49,21 @@ sub create_buildsystem_instance {
        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;
                        }
                }
@@ -106,25 +110,19 @@ sub buildsystems_init {
 
        # 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);
 }
 
@@ -133,7 +131,7 @@ sub buildsystems_list {
 
        # 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()) {
@@ -170,11 +168,11 @@ sub buildsystems_do {
                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;
 }