1
0
Fork 0
forked from len0rd/rockbox
foxbox/tools/release/voices.pl
Solomon Peachy af1eddb6e9 release/voices: Update script to check for global POOL
...If it's already defined, don't override it.

And don't wipe its contents!

Change-Id: I83ca2ffbd443c1d9766f4a5662a5da5fccbaf3c5
2024-07-07 09:02:27 -04:00

91 lines
2.2 KiB
Perl
Executable file

#!/usr/bin/perl -w
require "./tools/builds.pm";
my $verbose;
if($ARGV[0] eq "-v") {
$verbose =1;
shift @ARGV;
}
my $tag = $ARGV[0];
my $version = $ARGV[1];
my $outdir = "output/voices";
# made once for all targets
sub runone {
my ($target, $name, $lang, $engine, $voice, $engine_opts)=@_;
my $a;
print "*** LANGUAGE: $lang\n";
print "Build in buildv-$target-$lang\n" if($verbose);
mkdir "buildv-$target-$lang";
chdir "buildv-$target-$lang";
# build the voice(s)
$a = buildit($target, $lang, $engine, $voice, $engine_opts);
my $o="$lang.voice";
if (-f $o) {
my $newo="../$outdir/$target/voice-$target-$version-$name.zip";
system("mkdir -p ../$outdir/$target");
system("mkdir -p .rockbox/langs");
system("mkdir -p output/$target");
system("mkdir -p .rockbox/langs");
system("cp $o .rockbox/langs");
system("zip -q -r $newo .rockbox");
system("rm -rf .rockbox");
`chmod a+r $newo`;
print "moved $o to $newo\n" if($verbose);
}
chdir "..";
print "remove all contents in buildv-$target-$lang\n" if($verbose);
system("rm -rf buildv-$target-$lang");
return $a;
};
sub buildit {
my ($target, $lang, $engine, $voice, $engine_opts)=@_;
`rm -rf * >/dev/null 2>&1`;
my $c = "../tools/configure --no-ccache --type=av --target=$target --ram=-1 --language=$lang --tts=$engine --voice=$voice --ttsopts='$engine_opts'";
print "C: $c\n" if($verbose);
system($c);
print "Run 'make voice'\n" if($verbose);
`make voice`;
}
`git checkout $tag`;
# run make in tools first to make sure they're up-to-date
`(cd tools && make ) >/dev/null 2>&1`;
if (!defined($ENV{'POOL'}) {
my $home=$ENV{'HOME'};
my $pool="$home/tmp/rockbox-voices-$version/voice-pool";
`mkdir -p $pool`;
$ENV{'POOL'}="$pool";
}
# `rm -f $pool/*`;
`mkdir -p $outdir`;
for my $b (&usablebuilds) {
next if ($builds{$b}{voice}); # no variants
for my $v (&allvoices) {
my %voice = $voices{$v};
# print " runone $b $v ($voices{$v}->{lang} via $voices{$v}->{defengine})\n";
runone($b, $v, $voices{$v}->{lang}, $voices{$v}->{defengine},
"-1", $voices{$v}->{engines}->{$voices{$v}->{defengine}});
}
}