2002-05-27 11:57:12 +00:00
|
|
|
#!/usr/bin/env perl
|
|
|
|
|
|
|
|
$version = $ARGV[0];
|
|
|
|
|
|
|
|
if($version eq "") {
|
|
|
|
print "Enter version number!\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2002-05-29 12:56:35 +00:00
|
|
|
if(!-f "apps/version.h") {
|
|
|
|
print "run this script in the root dir\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2002-05-27 11:57:12 +00:00
|
|
|
@files=`find . -name FILES`;
|
|
|
|
|
|
|
|
my @entries;
|
|
|
|
|
|
|
|
sub dirpart {
|
|
|
|
my ($file)=@_;
|
|
|
|
my @p=split("/", $file);
|
|
|
|
$p[$#p]=""; # blank the last one
|
|
|
|
my $dir=join("/", @p);
|
|
|
|
|
|
|
|
$dir =~ s/^\.\///; # cut off ./ beginnings
|
|
|
|
|
|
|
|
$dir =~ s/\/$//; # off / trailers
|
|
|
|
|
|
|
|
return $dir;
|
|
|
|
}
|
|
|
|
|
|
|
|
sub add {
|
|
|
|
my ($file)=@_;
|
|
|
|
|
|
|
|
my $dir=dirpart($file);
|
|
|
|
|
|
|
|
open(FILE, "<$file");
|
|
|
|
while(<FILE>) {
|
2002-05-29 12:56:35 +00:00
|
|
|
if($_ =~ /^ *\#/) {
|
|
|
|
next;
|
|
|
|
}
|
2002-05-27 11:57:12 +00:00
|
|
|
chomp;
|
|
|
|
push @entries, "$dir/$_";
|
|
|
|
}
|
|
|
|
close(FILE);
|
|
|
|
}
|
|
|
|
|
|
|
|
for(@files) {
|
|
|
|
chomp;
|
|
|
|
add($_);
|
|
|
|
}
|
|
|
|
|
|
|
|
sub mkalldir {
|
|
|
|
my ($dir) = @_;
|
|
|
|
|
|
|
|
my @parts = split("/", $dir);
|
|
|
|
|
|
|
|
#print "IN: $dir\n";
|
|
|
|
|
|
|
|
my $sub="";
|
|
|
|
for(@parts) {
|
|
|
|
#print "PART: $_\n";
|
|
|
|
|
|
|
|
$sub .= "$_";
|
|
|
|
if($_ eq "") {
|
|
|
|
next;
|
|
|
|
}
|
|
|
|
mkdir($sub, 0777);
|
|
|
|
#print "make $sub\n";
|
|
|
|
$sub .= "/";
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#mkalldir("rockbox-1.0/firmware/malloc");
|
|
|
|
#exit;
|
|
|
|
|
|
|
|
for(@entries) {
|
|
|
|
my $dir = dirpart("rockbox-$version/$_");
|
|
|
|
#print "Create $dir\n";
|
|
|
|
mkalldir($dir);
|
|
|
|
#print "Copy $_ to $dir\n";
|
|
|
|
`cp -p $_ $dir`;
|
|
|
|
}
|
|
|
|
|
2002-05-29 12:56:35 +00:00
|
|
|
|
|
|
|
if(!open(VERSION, "<apps/version.h")) {
|
|
|
|
print "Can't read version.h\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
if(!open(THIS, ">rockbox-$version/apps/version.h")) {
|
|
|
|
print "Can't create a new version.h for this version\n";
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
while(<VERSION>) {
|
|
|
|
$_ =~ s/^\#define APPSVERSION .*/\#define APPSVERSION \"$version\"/;
|
|
|
|
print THIS $_;
|
|
|
|
}
|
|
|
|
close(VERSION);
|
|
|
|
close(THIS);
|
|
|
|
|
2002-05-27 11:57:12 +00:00
|
|
|
`tar -cf rockbox-$version.tar rockbox-$version`;
|
2006-03-05 11:46:43 +00:00
|
|
|
`gzip -c9 rockbox-$version.tar > rockbox-$version.tar.gz`;
|
|
|
|
`bzip2 -c9 rockbox-$version.tar > rockbox-$version.tar.bz2`;
|
|
|
|
`rm -rf rockbox-$version rockbox-$version.tar`;
|