diff options
author | Jonathan Gordon <rockbox@jdgordon.info> | 2010-09-28 13:44:56 +0000 |
---|---|---|
committer | Jonathan Gordon <rockbox@jdgordon.info> | 2010-09-28 13:44:56 +0000 |
commit | 4c385e6cb343f820f6b084bf6a8e43b63a41e179 (patch) | |
tree | c2776c605c47504eca2075aea0a1ed6ec1ff332c /tools | |
parent | 7b52f979124f81aa685135e24be2e11ebcac833b (diff) | |
download | rockbox-4c385e6cb343f820f6b084bf6a8e43b63a41e179.tar.gz rockbox-4c385e6cb343f820f6b084bf6a8e43b63a41e179.zip |
Add a simple script to try to run configure with the correct target name/type based on the build directory name.
~/rockbox/.../e200 -> e200, normal
~/rockbox/.../e200-sim -> e200, sim build
~/rockbox/.../sim/e200 -> e200, sim build
replace sim with "boot" for bootloader, falls back on normal if neither is given.
Run this from inside the build dir just like you would tools/configure
using the full shortname guarentees the correct match, as above e200 will work for sansae200.... asks for confirmation before doing anything.
Add your folder structure if this doesnt work for your way of doing things
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28180 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-x | tools/autoconf.pl | 79 |
1 files changed, 79 insertions, 0 deletions
diff --git a/tools/autoconf.pl b/tools/autoconf.pl new file mode 100755 index 0000000000..3dae96502f --- /dev/null +++ b/tools/autoconf.pl | |||
@@ -0,0 +1,79 @@ | |||
1 | #!/usr/bin/perl | ||
2 | # __________ __ ___. | ||
3 | # Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | # Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | # Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | # Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | # \/ \/ \/ \/ \/ | ||
8 | # $Id$ | ||
9 | # | ||
10 | |||
11 | # This program attempts to run configure with the correct build target | ||
12 | # and type based on the pwd. | ||
13 | # example: ~/rockbox/sansae200 is the build dir, it would run configure | ||
14 | # for the sansae200 normal build target. | ||
15 | # ~/rockbox/sansae200-sim for the e200 sim build (-boot for bootloader) | ||
16 | # ~/rockbox/sim/sansae200 for e200 sim build. (replace sim with boot is also possible) | ||
17 | # The full shortname is not required, each target name is checked and the first | ||
18 | # possible match is used. | ||
19 | |||
20 | # This script must be placed in the same directory as configure and builds.pm | ||
21 | # | ||
22 | |||
23 | use File::Basename; | ||
24 | my $srcdir = dirname $0; | ||
25 | require "$srcdir/builds.pm"; | ||
26 | |||
27 | my $builddir = `pwd`; | ||
28 | my @dirs = split(/\//, $builddir); | ||
29 | |||
30 | my $test = pop(@dirs); | ||
31 | |||
32 | sub doconfigure { | ||
33 | my ($target, $type) = @_; | ||
34 | if (!exists($builds{$target})) { | ||
35 | for $key (keys(%builds)) { | ||
36 | if ($key =~ $target) { | ||
37 | $target = $key; | ||
38 | last; | ||
39 | } | ||
40 | } | ||
41 | } | ||
42 | $command = "${srcdir}/configure --type=${type} --target=${target}"; | ||
43 | %typenames = ("n" => "Normal", "s" => "Simulator", "b" => "Bootloader" ); | ||
44 | print "Rockbox autoconf: \n\tTarget: $target \n\tType: $typenames{$type} \nCorrect? [Y/n] "; | ||
45 | chomp($response = <>); | ||
46 | if ($response eq "") { | ||
47 | $response = "y"; | ||
48 | } | ||
49 | if ($response ne "y" && $response ne "Y") { | ||
50 | print "autoconf: Aborting\n"; | ||
51 | exit(0); | ||
52 | } | ||
53 | system($command); | ||
54 | } | ||
55 | |||
56 | sub buildtype { | ||
57 | my ($text) = @_; | ||
58 | if ($text eq "sim") { | ||
59 | $build = "s"; | ||
60 | } elsif ($text eq "boot") { | ||
61 | $build = "b"; | ||
62 | } else { | ||
63 | $build = "n"; | ||
64 | } | ||
65 | return $build; | ||
66 | } | ||
67 | |||
68 | if ($test =~ /(.*)-(.*)/) | ||
69 | { | ||
70 | $target = $1; | ||
71 | $build = buildtype($2); | ||
72 | doconfigure($target, $build); | ||
73 | } | ||
74 | elsif ($test =~ /(.*)/) | ||
75 | { | ||
76 | $target = $1; | ||
77 | $build = buildtype(pop(@dirs)); | ||
78 | doconfigure($target, $build); | ||
79 | } | ||