summaryrefslogtreecommitdiffstats
path: root/tools/release
blob: bd107c6a0e9ee55e7feba07ad88810a8f9d4cecd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#!/usr/bin/env perl

$version = $ARGV[0];

if($version eq "") {
    print "Enter version number!\n";
    exit;
}

if(!-f "apps/version.h") {
    print "run this script in the root dir\n";
    exit;
}

@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>) {
        if($_ =~ /^ *\#/) {
            next;
        }
        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`;
}


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);

`tar -cf rockbox-$version.tar rockbox-$version`;
`gzip -9 rockbox-$version.tar`;
`rm -rf rockbox-$version`;