Want more features on Pastebin? Sign Up, it's FREE!
Guest

Untitled

By: a guest on Sep 28th, 2010  |  syntax: None  |  size: 1.07 KB  |  views: 211  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #!/usr/bin/perl
  2. use File::Basename;
  3. my $srcdir = dirname $0;
  4. require "$srcdir/builds.pm";
  5.  
  6. my $builddir = `pwd`;
  7. @dirs = split(/\//, $builddir);
  8.  
  9. $test = pop(@dirs);
  10.  
  11. sub doconfigure {
  12.         my ($target, $type) = @_;
  13.         if (!exists($builds{$target})) {
  14.                 for $key (keys(%builds)) {
  15.                         if ($key =~ $target) {
  16.                                 $target = $key;
  17.                                 last;
  18.                         }
  19.                 }
  20.         }
  21.         $command = "${srcdir}/configure --type=${type} --target=${target}";
  22.         print "autoconf: \n\tTarget: $target \n\tType: $type \nCorrect? [Y/n] ";
  23.         chomp($response = <>);
  24.         if ($response eq "") {
  25.                 $response = "y";
  26.         }
  27.         if ($response ne "y" && $response ne "Y") {
  28.                 print "autoconf: Aborting\n";
  29.                 exit(0);
  30.         }
  31.         system($command);
  32. }
  33.  
  34. sub buildtype {
  35.         my ($text) = @_;
  36.         if ($text eq "sim") {
  37.                 $build = "s";
  38.         } elsif ($text eq "boot") {
  39.                 $build = "b";
  40.         } else {
  41.                 $build = "n";
  42.         }
  43.         return $build;
  44. }
  45.  
  46. if ($test =~ /(.*)-(.*)/)
  47. {
  48.         $target = $1;
  49.         $build = buildtype($2);
  50.         doconfigure($target, $build);
  51. }
  52. elsif ($test =~ /(.*)/)
  53. {
  54.         $target = $1;
  55.         $build = buildtype(pop(@dirs));
  56.         doconfigure($target, $build);
  57. }
clone this paste RAW Paste Data