Daniel Stenberg | 93a14e2 | 2002-05-27 11:57:12 +0000 | [diff] [blame] | 1 | #!/usr/bin/env perl |
| 2 | |
| 3 | $version = $ARGV[0]; |
| 4 | |
| 5 | if($version eq "") { |
| 6 | print "Enter version number!\n"; |
| 7 | exit; |
| 8 | } |
| 9 | |
Daniel Stenberg | bdf2490 | 2002-05-29 12:56:35 +0000 | [diff] [blame] | 10 | if(!-f "apps/version.h") { |
| 11 | print "run this script in the root dir\n"; |
| 12 | exit; |
| 13 | } |
| 14 | |
Daniel Stenberg | 93a14e2 | 2002-05-27 11:57:12 +0000 | [diff] [blame] | 15 | @files=`find . -name FILES`; |
| 16 | |
| 17 | my @entries; |
| 18 | |
| 19 | sub dirpart { |
| 20 | my ($file)=@_; |
| 21 | my @p=split("/", $file); |
| 22 | $p[$#p]=""; # blank the last one |
| 23 | my $dir=join("/", @p); |
| 24 | |
| 25 | $dir =~ s/^\.\///; # cut off ./ beginnings |
| 26 | |
| 27 | $dir =~ s/\/$//; # off / trailers |
| 28 | |
| 29 | return $dir; |
| 30 | } |
| 31 | |
| 32 | sub add { |
| 33 | my ($file)=@_; |
| 34 | |
| 35 | my $dir=dirpart($file); |
| 36 | |
| 37 | open(FILE, "<$file"); |
| 38 | while(<FILE>) { |
Daniel Stenberg | bdf2490 | 2002-05-29 12:56:35 +0000 | [diff] [blame] | 39 | if($_ =~ /^ *\#/) { |
| 40 | next; |
| 41 | } |
Daniel Stenberg | 93a14e2 | 2002-05-27 11:57:12 +0000 | [diff] [blame] | 42 | chomp; |
| 43 | push @entries, "$dir/$_"; |
| 44 | } |
| 45 | close(FILE); |
| 46 | } |
| 47 | |
| 48 | for(@files) { |
| 49 | chomp; |
| 50 | add($_); |
| 51 | } |
| 52 | |
| 53 | sub mkalldir { |
| 54 | my ($dir) = @_; |
| 55 | |
| 56 | my @parts = split("/", $dir); |
| 57 | |
| 58 | #print "IN: $dir\n"; |
| 59 | |
| 60 | my $sub=""; |
| 61 | for(@parts) { |
| 62 | #print "PART: $_\n"; |
| 63 | |
| 64 | $sub .= "$_"; |
| 65 | if($_ eq "") { |
| 66 | next; |
| 67 | } |
| 68 | mkdir($sub, 0777); |
| 69 | #print "make $sub\n"; |
| 70 | $sub .= "/"; |
| 71 | } |
| 72 | |
| 73 | } |
| 74 | |
| 75 | #mkalldir("rockbox-1.0/firmware/malloc"); |
| 76 | #exit; |
| 77 | |
| 78 | for(@entries) { |
| 79 | my $dir = dirpart("rockbox-$version/$_"); |
| 80 | #print "Create $dir\n"; |
| 81 | mkalldir($dir); |
| 82 | #print "Copy $_ to $dir\n"; |
| 83 | `cp -p $_ $dir`; |
| 84 | } |
| 85 | |
Daniel Stenberg | bdf2490 | 2002-05-29 12:56:35 +0000 | [diff] [blame] | 86 | |
| 87 | if(!open(VERSION, "<apps/version.h")) { |
| 88 | print "Can't read version.h\n"; |
| 89 | exit; |
| 90 | } |
| 91 | |
| 92 | if(!open(THIS, ">rockbox-$version/apps/version.h")) { |
| 93 | print "Can't create a new version.h for this version\n"; |
| 94 | exit; |
| 95 | } |
| 96 | while(<VERSION>) { |
| 97 | $_ =~ s/^\#define APPSVERSION .*/\#define APPSVERSION \"$version\"/; |
| 98 | print THIS $_; |
| 99 | } |
| 100 | close(VERSION); |
| 101 | close(THIS); |
| 102 | |
Daniel Stenberg | 93a14e2 | 2002-05-27 11:57:12 +0000 | [diff] [blame] | 103 | `tar -cf rockbox-$version.tar rockbox-$version`; |
| 104 | `gzip -9 rockbox-$version.tar`; |
| 105 | `rm -rf rockbox-$version`; |