blob: bd107c6a0e9ee55e7feba07ad88810a8f9d4cecd [file] [log] [blame]
Daniel Stenberg93a14e22002-05-27 11:57:12 +00001#!/usr/bin/env perl
2
3$version = $ARGV[0];
4
5if($version eq "") {
6 print "Enter version number!\n";
7 exit;
8}
9
Daniel Stenbergbdf24902002-05-29 12:56:35 +000010if(!-f "apps/version.h") {
11 print "run this script in the root dir\n";
12 exit;
13}
14
Daniel Stenberg93a14e22002-05-27 11:57:12 +000015@files=`find . -name FILES`;
16
17my @entries;
18
19sub 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
32sub add {
33 my ($file)=@_;
34
35 my $dir=dirpart($file);
36
37 open(FILE, "<$file");
38 while(<FILE>) {
Daniel Stenbergbdf24902002-05-29 12:56:35 +000039 if($_ =~ /^ *\#/) {
40 next;
41 }
Daniel Stenberg93a14e22002-05-27 11:57:12 +000042 chomp;
43 push @entries, "$dir/$_";
44 }
45 close(FILE);
46}
47
48for(@files) {
49 chomp;
50 add($_);
51}
52
53sub 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
78for(@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 Stenbergbdf24902002-05-29 12:56:35 +000086
87if(!open(VERSION, "<apps/version.h")) {
88 print "Can't read version.h\n";
89 exit;
90}
91
92if(!open(THIS, ">rockbox-$version/apps/version.h")) {
93 print "Can't create a new version.h for this version\n";
94 exit;
95}
96while(<VERSION>) {
97 $_ =~ s/^\#define APPSVERSION .*/\#define APPSVERSION \"$version\"/;
98 print THIS $_;
99}
100close(VERSION);
101close(THIS);
102
Daniel Stenberg93a14e22002-05-27 11:57:12 +0000103`tar -cf rockbox-$version.tar rockbox-$version`;
104`gzip -9 rockbox-$version.tar`;
105`rm -rf rockbox-$version`;