2010-09-28 13:44:56 +00:00
|
|
|
#!/usr/bin/perl
|
|
|
|
# __________ __ ___.
|
|
|
|
# Open \______ \ ____ ____ | | _\_ |__ _______ ___
|
|
|
|
# Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
|
|
|
|
# Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
|
|
|
|
# Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
|
|
|
|
# \/ \/ \/ \/ \/
|
|
|
|
# $Id$
|
|
|
|
#
|
|
|
|
|
|
|
|
# This program attempts to run configure with the correct build target
|
|
|
|
# and type based on the pwd.
|
|
|
|
# example: ~/rockbox/sansae200 is the build dir, it would run configure
|
|
|
|
# for the sansae200 normal build target.
|
|
|
|
# ~/rockbox/sansae200-sim for the e200 sim build (-boot for bootloader)
|
|
|
|
# ~/rockbox/sim/sansae200 for e200 sim build. (replace sim with boot is also possible)
|
|
|
|
# The full shortname is not required, each target name is checked and the first
|
|
|
|
# possible match is used.
|
|
|
|
|
|
|
|
# This script must be placed in the same directory as configure and builds.pm
|
|
|
|
#
|
|
|
|
|
|
|
|
use File::Basename;
|
|
|
|
my $srcdir = dirname $0;
|
|
|
|
require "$srcdir/builds.pm";
|
|
|
|
|
|
|
|
my $builddir = `pwd`;
|
|
|
|
my @dirs = split(/\//, $builddir);
|
|
|
|
|
|
|
|
my $test = pop(@dirs);
|
|
|
|
|
|
|
|
sub doconfigure {
|
2013-03-16 21:30:46 +00:00
|
|
|
my ($target, $type, $width, $height) = @_;
|
2010-09-28 13:44:56 +00:00
|
|
|
if (!exists($builds{$target})) {
|
|
|
|
for $key (keys(%builds)) {
|
|
|
|
if ($key =~ $target) {
|
|
|
|
$target = $key;
|
|
|
|
last;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$command = "${srcdir}/configure --type=${type} --target=${target}";
|
2013-03-16 21:30:46 +00:00
|
|
|
if (defined $width) {
|
|
|
|
$command .= " --lcdwidth=${width}";
|
|
|
|
}
|
|
|
|
if (defined $height) {
|
|
|
|
$command .= " --lcdheight=${height}";
|
|
|
|
}
|
2010-09-28 13:44:56 +00:00
|
|
|
%typenames = ("n" => "Normal", "s" => "Simulator", "b" => "Bootloader" );
|
2012-05-28 09:32:10 +00:00
|
|
|
unless (@ARGV[0] eq "-y") {
|
2013-03-16 21:30:46 +00:00
|
|
|
$prompt = "Rockbox autoconf: \n\tTarget: $target \n\tType: $typenames{$type} \n";
|
|
|
|
if (defined $width) {
|
|
|
|
$prompt .= "\tLCD width: $width\n";
|
|
|
|
}
|
|
|
|
if (defined $height) {
|
|
|
|
$prompt .= "\tLCD height: $height\n";
|
|
|
|
}
|
|
|
|
print $prompt . "Correct? [Y/n] ";
|
|
|
|
|
2012-05-28 09:32:10 +00:00
|
|
|
chomp($response = <>);
|
|
|
|
if ($response eq "") {
|
|
|
|
$response = "y";
|
|
|
|
}
|
|
|
|
if ($response ne "y" && $response ne "Y") {
|
|
|
|
print "autoconf: Aborting\n";
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
}
|
2010-09-28 13:44:56 +00:00
|
|
|
system($command);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub buildtype {
|
|
|
|
my ($text) = @_;
|
|
|
|
if ($text eq "sim") {
|
|
|
|
$build = "s";
|
|
|
|
} elsif ($text eq "boot") {
|
|
|
|
$build = "b";
|
2012-05-28 09:32:10 +00:00
|
|
|
} elsif ($text eq "build") {
|
2010-09-28 13:44:56 +00:00
|
|
|
$build = "n";
|
2012-05-28 09:32:10 +00:00
|
|
|
} else {
|
|
|
|
$build = "";
|
|
|
|
}
|
2010-09-28 13:44:56 +00:00
|
|
|
return $build;
|
|
|
|
}
|
|
|
|
|
2013-03-16 21:30:46 +00:00
|
|
|
if ($test =~ /(.*)-(.*)-([0-9]+)x([0-9]+)/)
|
|
|
|
{
|
|
|
|
if (buildtype($2)) {
|
|
|
|
doconfigure($1, buildtype($2), $3, $4);
|
|
|
|
} elsif (buildtype($1)) {
|
|
|
|
doconfigure($2, buildtype($1), $3, $4);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
elsif ($test =~ /(.*)-(.*)/)
|
2010-09-28 13:44:56 +00:00
|
|
|
{
|
2012-05-28 09:32:10 +00:00
|
|
|
if (buildtype($2)) {
|
|
|
|
doconfigure($1, buildtype($2));
|
|
|
|
} elsif (buildtype($1)) {
|
|
|
|
doconfigure($2, buildtype($1));
|
|
|
|
}
|
|
|
|
}
|
2010-09-28 13:44:56 +00:00
|
|
|
elsif ($test =~ /(.*)/)
|
|
|
|
{
|
|
|
|
$target = $1;
|
|
|
|
$build = buildtype(pop(@dirs));
|
|
|
|
doconfigure($target, $build);
|
|
|
|
}
|