summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjörn Stenberg <bjorn@haxx.se>2008-11-24 22:16:07 +0000
committerBjörn Stenberg <bjorn@haxx.se>2008-11-24 22:16:07 +0000
commitad8d6031c18d131a4f63bc12110a49efb482dafe (patch)
treec9159d712bf857a98751def6b773d1ed6323f046
parent4c43f7be0aa634904f0da2eca3d51876419aa36d (diff)
downloadrockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.zip
rockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.tar.gz
rockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.tar.bz2
rockbox-ad8d6031c18d131a4f63bc12110a49efb482dafe.tar.xz
Added support for configurable rockbox directory. FS#9567 by Alex Bennee.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19208 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/wps_parser.c2
-rw-r--r--apps/settings.h9
-rw-r--r--firmware/common/unicode.c2
-rw-r--r--firmware/export/font.h2
-rw-r--r--firmware/include/dircache.h3
-rwxr-xr-xtools/buildzip.pl163
-rwxr-xr-xtools/configure20
-rw-r--r--tools/root.make14
-rwxr-xr-xwps/wpsbuild.pl108
9 files changed, 198 insertions, 125 deletions
diff --git a/apps/gui/wps_parser.c b/apps/gui/wps_parser.c
index ca15348..88601fd 100644
--- a/apps/gui/wps_parser.c
+++ b/apps/gui/wps_parser.c
@@ -443,7 +443,7 @@ static char *get_image_filename(const char *start, const char* bmpdir,
{
const char *end = strchr(start, '|');
- if ( !end || (end - start) >= (buf_size - ROCKBOX_DIR_LEN - 2) )
+ if ( !end || (end - start) >= (buf_size - (int)ROCKBOX_DIR_LEN - 2) )
{
buf = "\0";
return NULL;
diff --git a/apps/settings.h b/apps/settings.h
index 8448059..c5658aa 100644
--- a/apps/settings.h
+++ b/apps/settings.h
@@ -57,10 +57,15 @@ struct opt_items {
#define ROCKBOX_DIR "."
#define ROCKBOX_DIR_LEN 1
#else
-#define ROCKBOX_DIR "/.rockbox"
-#define ROCKBOX_DIR_LEN 9
+
+/* ROCKBOX_DIR is now defined in autoconf.h for flexible build types */
+#ifndef ROCKBOX_DIR
+#error ROCKBOX_DIR not defined (should be in autoconf.h)
+#endif
+#define ROCKBOX_DIR_LEN sizeof(ROCKBOX_DIR)
#endif
+
#define FONT_DIR ROCKBOX_DIR "/fonts"
#define LANG_DIR ROCKBOX_DIR "/langs"
#define WPS_DIR ROCKBOX_DIR "/wps"
diff --git a/firmware/common/unicode.c b/firmware/common/unicode.c
index 2d11a38..6c954a5 100644
--- a/firmware/common/unicode.c
+++ b/firmware/common/unicode.c
@@ -18,7 +18,7 @@
#define O_BINARY 0
#endif
-#define CODEPAGE_DIR "/.rockbox/codepages"
+#define CODEPAGE_DIR ROCKBOX_DIR"/codepages"
static int default_codepage = 0;
static int loaded_cp_table = 0;
diff --git a/firmware/export/font.h b/firmware/export/font.h
index e3455f9..75b012d 100644
--- a/firmware/export/font.h
+++ b/firmware/export/font.h
@@ -50,7 +50,7 @@
#define FONT_HEADER_SIZE 36
#endif
-#define GLYPH_CACHE_FILE "/.rockbox/.glyphcache"
+#define GLYPH_CACHE_FILE ROCKBOX_DIR"/.glyphcache"
/*
* Fonts are specified by number, and used for display
diff --git a/firmware/include/dircache.h b/firmware/include/dircache.h
index 75fc4a2..b5b1b72 100644
--- a/firmware/include/dircache.h
+++ b/firmware/include/dircache.h
@@ -27,8 +27,7 @@
#define DIRCACHE_RESERVE (1024*64)
#define DIRCACHE_LIMIT (1024*1024*6)
-/* FIXME: We should use ROCKBOX_DIR here but it's defined in apps/ */
-#define DIRCACHE_FILE "/.rockbox/dircache.dat"
+#define DIRCACHE_FILE ROCKBOX_DIR"/dircache.dat"
#define DIRCACHE_APPFLAG_TAGCACHE 0x0001
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 7390254..06bcf3b 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -14,11 +14,26 @@ use File::Copy; # For move() and copy()
use File::Find; # For find()
use File::Path; # For rmtree()
use Cwd 'abs_path';
-use Getopt::Long qw(:config pass_through); # pass_through so not
- # confused by -DTYPE_STUFF
+use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
+
+my $ROOT="..";
+
+my $ziptool="zip -r9";
+my $output="rockbox.zip";
+my $verbose;
+my $sim;
+my $exe;
+my $target;
+my $archos;
+my $incfonts;
+my $target_id; # passed in, not currently used
+my $rbdir=".rockbox"; # can be changed for special builds
+
+
sub glob_copy {
my ($pattern, $destination) = @_;
+ print "glob_copy: $pattern -> $destination\n" if $verbose;
foreach my $path (glob($pattern)) {
copy($path, $destination);
}
@@ -26,6 +41,7 @@ sub glob_copy {
sub glob_move {
my ($pattern, $destination) = @_;
+ print "glob_move: $pattern -> $destination\n" if $verbose;
foreach my $path (glob($pattern)) {
move($path, $destination);
}
@@ -33,6 +49,7 @@ sub glob_move {
sub glob_unlink {
my ($pattern) = @_;
+ print "glob_unlink: $pattern\n" if $verbose;
foreach my $path (glob($pattern)) {
unlink($path);
}
@@ -40,27 +57,16 @@ sub glob_unlink {
sub find_copyfile {
my ($pattern, $destination) = @_;
+ print "find_copyfile: $pattern -> $destination\n" if $verbose;
return sub {
my $path = $_;
- if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /\.rockbox/)) {
+ if ($path =~ $pattern && filesize($path) > 0 && !($path =~ /$rbdir/)) {
copy($path, $destination);
chmod(0755, $destination.'/'.$path);
}
}
}
-my $ROOT="..";
-
-my $ziptool="zip -r9";
-my $output="rockbox.zip";
-my $verbose;
-my $sim;
-my $exe;
-my $target;
-my $archos;
-my $incfonts;
-my $target_id; # passed in, not currently used
-
# Get options
GetOptions ( 'r|root=s' => \$ROOT,
'z|ziptool=s' => \$ziptool,
@@ -69,7 +75,9 @@ GetOptions ( 'r|root=s' => \$ROOT,
'o|output=s' => \$output,
'f|fonts=s' => \$incfonts, # 0 - no fonts, 1 - fonts only 2 - fonts and package
'v|verbose' => \$verbose,
- 's|sim' => \$sim );
+ 's|sim' => \$sim,
+ 'rbdir=s' => \$rbdir, # If we want to put in a different directory
+ );
($target, $exe) = @ARGV;
@@ -167,23 +175,25 @@ sub filesize {
sub buildzip {
my ($image, $fonts)=@_;
+ print "buildzip: image=$image fonts=$fonts\n" if $verbose;
+
my ($bitmap, $depth, $icon_w, $icon_h, $recording, $swcodec,
$remote_depth, $remote_icon_w, $remote_icon_h) = &gettargetinfo();
# print "Bitmap: $bitmap\nDepth: $depth\nSwcodec: $swcodec\n";
# remove old traces
- rmtree('.rockbox');
+ rmtree($rbdir);
- mkdir ".rockbox", 0777;
+ mkdir $rbdir, 0777;
if(!$bitmap) {
# always disable fonts on non-bitmap targets
$fonts = 0;
}
if($fonts) {
- mkdir ".rockbox/fonts", 0777;
- chdir(".rockbox/fonts");
+ mkdir "$rbdir/fonts", 0777;
+ chdir "$rbdir/fonts";
my $cmd = "$ROOT/tools/convbdf -f $ROOT/fonts/*bdf >/dev/null 2>&1";
print($cmd."\n") if $verbose;
system($cmd);
@@ -196,46 +206,46 @@ sub buildzip {
}
# create the file so the database does not try indexing a folder
- open(IGNORE, ">.rockbox/database.ignore") || die "can't open database.ignore";
+ open(IGNORE, ">$rbdir/database.ignore") || die "can't open database.ignore";
close(IGNORE);
- mkdir ".rockbox/langs", 0777;
- mkdir ".rockbox/rocks", 0777;
- mkdir ".rockbox/rocks/games", 0777;
- mkdir ".rockbox/rocks/apps", 0777;
- mkdir ".rockbox/rocks/demos", 0777;
- mkdir ".rockbox/rocks/viewers", 0777;
+ mkdir "$rbdir/langs", 0777;
+ mkdir "$rbdir/rocks", 0777;
+ mkdir "$rbdir/rocks/games", 0777;
+ mkdir "$rbdir/rocks/apps", 0777;
+ mkdir "$rbdir/rocks/demos", 0777;
+ mkdir "$rbdir/rocks/viewers", 0777;
if ($recording) {
- mkdir ".rockbox/recpresets", 0777;
+ mkdir "$rbdir/recpresets", 0777;
}
if($swcodec) {
- mkdir ".rockbox/eqs", 0777;
+ mkdir "$rbdir/eqs", 0777;
- glob_copy("$ROOT/apps/eqs/*.cfg", '.rockbox/eqs/'); # equalizer presets
+ glob_copy("$ROOT/apps/eqs/*.cfg", "$rbdir/eqs/"); # equalizer presets
}
- mkdir ".rockbox/wps", 0777;
- mkdir ".rockbox/themes", 0777;
+ mkdir "$rbdir/wps", 0777;
+ mkdir "$rbdir/themes", 0777;
if ($bitmap) {
- open(THEME, ">.rockbox/themes/rockbox_default_icons.cfg");
+ open(THEME, ">$rbdir/themes/rockbox_default_icons.cfg");
print THEME <<STOP
# this config file was auto-generated to make it
# easy to reset the icons back to default
iconset: -
# taken from apps/gui/icon.c
-viewers iconset: /.rockbox/icons/viewers.bmp
+viewers iconset: /$rbdir/icons/viewers.bmp
remote iconset: -
# taken from apps/gui/icon.c
-remote viewers iconset: /.rockbox/icons/remote_viewers.bmp
+remote viewers iconset: /$rbdir/icons/remote_viewers.bmp
STOP
;
close(THEME);
}
- mkdir ".rockbox/codepages", 0777;
+ mkdir "$rbdir/codepages", 0777;
if($bitmap) {
system("$ROOT/tools/codepages");
@@ -244,29 +254,29 @@ STOP
system("$ROOT/tools/codepages -m");
}
- glob_move('*.cp', '.rockbox/codepages/');
+ glob_move('*.cp', "$rbdir/codepages/");
if($bitmap) {
- mkdir ".rockbox/codecs", 0777;
+ mkdir "$rbdir/codecs", 0777;
if($depth > 1) {
- mkdir ".rockbox/backdrops", 0777;
+ mkdir "$rbdir/backdrops", 0777;
}
- find(find_copyfile(qr/.*\.codec/, abs_path('.rockbox/codecs/')), 'apps/codecs');
+ find(find_copyfile(qr/.*\.codec/, abs_path("$rbdir/codecs/")), 'apps/codecs');
# remove directory again if no codec was copied
- rmdir(".rockbox/codecs");
+ rmdir("$rbdir/codecs");
}
- find(find_copyfile(qr/\.(rock|ovl)/, abs_path('.rockbox/rocks/')), 'apps/plugins');
+ find(find_copyfile(qr/\.(rock|ovl)/, abs_path("$rbdir/rocks/")), 'apps/plugins');
open VIEWERS, "$ROOT/apps/plugins/viewers.config" or
die "can't open viewers.config";
my @viewers = <VIEWERS>;
close VIEWERS;
- open VIEWERS, ">.rockbox/viewers.config" or
- die "can't create .rockbox/viewers.config";
+ open VIEWERS, ">$rbdir/viewers.config" or
+ die "can't create $rbdir/viewers.config";
foreach my $line (@viewers) {
if ($line =~ /([^,]*),([^,]*),/) {
@@ -288,24 +298,24 @@ STOP
# print STDERR "$ext $plugin $dir $name $r\n";
- if(-e ".rockbox/rocks/$name") {
+ if(-e "$rbdir/rocks/$name") {
if($dir ne "rocks") {
# target is not 'rocks' but the plugins are always in that
# dir at first!
- move(".rockbox/rocks/$name", ".rockbox/rocks/$r");
+ move("$rbdir/rocks/$name", "$rbdir/rocks/$r");
}
print VIEWERS $line;
}
- elsif(-e ".rockbox/rocks/$r") {
+ elsif(-e "$rbdir/rocks/$r") {
# in case the same plugin works for multiple extensions, it
# was already moved to the viewers dir
print VIEWERS $line;
}
- if(-e ".rockbox/rocks/$oname") {
+ if(-e "$rbdir/rocks/$oname") {
# if there's an "overlay" file for the .rock, move that as
# well
- move(".rockbox/rocks/$oname", ".rockbox/rocks/$dir");
+ move("$rbdir/rocks/$oname", "$rbdir/rocks/$dir");
}
}
}
@@ -318,33 +328,33 @@ STOP
foreach my $line (@rock_targetdirs) {
if ($line =~ /([^,]*),(.*)/) {
my ($plugin, $dir)=($1, $2);
- move(".rockbox/rocks/${plugin}.rock", ".rockbox/rocks/$dir/${plugin}.rock");
+ move("$rbdir/rocks/${plugin}.rock", "$rbdir/rocks/$dir/${plugin}.rock");
}
}
if ($bitmap) {
- mkdir ".rockbox/icons", 0777;
- copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", ".rockbox/icons/viewers.bmp");
+ mkdir "$rbdir/icons", 0777;
+ copy("$viewer_bmpdir/viewers.${icon_w}x${icon_h}x$depth.bmp", "$rbdir/icons/viewers.bmp");
if ($remote_depth) {
- copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", ".rockbox/icons/remote_viewers.bmp");
+ copy("$viewer_bmpdir/remote_viewers.${remote_icon_w}x${remote_icon_h}x$remote_depth.bmp", "$rbdir/icons/remote_viewers.bmp");
}
}
- copy("$ROOT/apps/tagnavi.config", ".rockbox/");
- copy("$ROOT/apps/plugins/disktidy.config", ".rockbox/rocks/apps/");
+ copy("$ROOT/apps/tagnavi.config", "$rbdir/");
+ copy("$ROOT/apps/plugins/disktidy.config", "$rbdir/rocks/apps/");
if($bitmap) {
- copy("$ROOT/apps/plugins/sokoban.levels", ".rockbox/rocks/games/sokoban.levels"); # sokoban levels
- copy("$ROOT/apps/plugins/snake2.levels", ".rockbox/rocks/games/snake2.levels"); # snake2 levels
+ copy("$ROOT/apps/plugins/sokoban.levels", "$rbdir/rocks/games/sokoban.levels"); # sokoban levels
+ copy("$ROOT/apps/plugins/snake2.levels", "$rbdir/rocks/games/snake2.levels"); # snake2 levels
}
if($image) {
# image is blank when this is a simulator
if( filesize("rockbox.ucl") > 1000 ) {
- copy("rockbox.ucl", ".rockbox/rockbox.ucl"); # UCL for flashing
+ copy("rockbox.ucl", "$rbdir/rockbox.ucl"); # UCL for flashing
}
if( filesize("rombox.ucl") > 1000) {
- copy("rombox.ucl", ".rockbox/rombox.ucl"); # UCL for flashing
+ copy("rombox.ucl", "$rbdir/rombox.ucl"); # UCL for flashing
}
# Check for rombox.target
@@ -353,40 +363,45 @@ STOP
my $romfile = "rombox.$2";
if (filesize($romfile) > 1000)
{
- copy($romfile, ".rockbox/$romfile");
+ copy($romfile, "$rbdir/$romfile");
}
}
}
- mkdir ".rockbox/docs", 0777;
+ mkdir "$rbdir/docs", 0777;
for(("COPYING",
"LICENSES",
"KNOWN_ISSUES"
)) {
- copy("$ROOT/docs/$_", ".rockbox/docs/$_.txt");
+ copy("$ROOT/docs/$_", "$rbdir/docs/$_.txt");
}
if ($fonts) {
- copy("$ROOT/docs/profontdoc.txt", ".rockbox/docs/profontdoc.txt");
+ copy("$ROOT/docs/profontdoc.txt", "$rbdir/docs/profontdoc.txt");
}
for(("sample.colours",
"sample.icons"
)) {
- copy("$ROOT/docs/$_", ".rockbox/docs/$_");
+ copy("$ROOT/docs/$_", "$rbdir/docs/$_");
}
# Now do the WPS dance
if(-d "$ROOT/wps") {
- system("perl $ROOT/wps/wpsbuild.pl -r $ROOT $ROOT/wps/WPSLIST $target");
+ my $wps_build_cmd="perl $ROOT/wps/wpsbuild.pl ";
+ $wps_build_cmd=$wps_build_cmd."-v " if $verbose;
+ $wps_build_cmd=$wps_build_cmd." --rbdir=$rbdir -r $ROOT $ROOT/wps/WPSLIST $target";
+ print "wpsbuild: $wps_build_cmd\n" if $verbose;
+ system("$wps_build_cmd");
+ print "wps_build_cmd: done\n" if $verbose;
}
else {
print STDERR "No wps module present, can't do the WPS magic!\n";
}
# and the info file
- copy("rockbox-info.txt", ".rockbox/rockbox-info.txt");
+ copy("rockbox-info.txt", "$rbdir/rockbox-info.txt");
# copy the already built lng files
- glob_copy('apps/lang/*lng', '.rockbox/langs/');
+ glob_copy('apps/lang/*lng', "$rbdir/langs/");
}
@@ -403,7 +418,7 @@ $year+=1900;
sub runone {
my ($target, $fonts)=@_;
- # build a full install .rockbox directory
+ # build a full install .rockbox ($rbdir) directory
buildzip($target, $fonts);
unlink($output);
@@ -414,23 +429,23 @@ sub runone {
}
if($target && ($target !~ /(mod|ajz|wma)\z/i)) {
# On some targets, the image goes into .rockbox.
- copy("$target", ".rockbox/$target");
+ copy("$target", "$rbdir/$target");
undef $target;
}
if($verbose) {
- print "$ziptool $output .rockbox $target >/dev/null\n";
+ print "$ziptool $output $rbdir $target >/dev/null\n";
}
if($sim) {
- system("cp -r .rockbox simdisk/ >/dev/null");
+ system("cp -r $rbdir simdisk/ >/dev/null");
}
else {
- system("$ziptool $output .rockbox $target >/dev/null");
+ system("$ziptool $output $rbdir $target >/dev/null");
}
- # remove the .rockbox afterwards
- rmtree('.rockbox');
+ # remove the $rbdir afterwards
+ rmtree($rbdir);
};
if(!$exe) {
diff --git a/tools/configure b/tools/configure
index 9b3f108..d445752 100755
--- a/tools/configure
+++ b/tools/configure
@@ -15,6 +15,8 @@ use_logf="#undef ROCKBOX_HAS_LOGF"
scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
+rbdir=".rockbox"
+
#
# Begin Function Definitions
#
@@ -607,6 +609,13 @@ cat <<EOF
--type=TYPE Sets the build type. The shortcut is also valid.
Run without this option to see available types.
+
+ --rbdir=dir Use alternative rockbox directory (default: ${rbdir}).
+ This is useful for having multiple alternate builds on
+ your device that you can load with ROLO. However as the
+ bootloader looks for .rockbox you won't be able to boot
+ into this build.
+
--ccache Enable ccache use (done by default these days)
--no-ccache Disable ccache use
--help Shows this message (must not be used with other options)
@@ -2272,11 +2281,17 @@ else
defendian="ROCKBOX_LITTLE_ENDIAN"
fi
+if [ "1" != `parse_args --rbdir` ]; then
+ rbdir=`parse_args --rbdir`;
+ echo "Using alternate rockbox dir: ${rbdir}"
+fi
+
sed > autoconf.h \
-e "s,@ENDIAN@,${defendian},g" \
-e "s,^#undef ROCKBOX_HAS_LOGF,$use_logf,g" \
-e "s,@config_rtc@,$config_rtc,g" \
-e "s,@have_rtc_alarm@,$have_rtc_alarm,g" \
+ -e "s,@RBDIR@,${rbdir},g" \
<<EOF
/* This header was made by configure */
#ifndef __BUILD_AUTOCONF_H
@@ -2292,6 +2307,9 @@ sed > autoconf.h \
@config_rtc@
@have_rtc_alarm@
+/* root of Rockbox */
+#define ROCKBOX_DIR "/@RBDIR@"
+
#endif /* __BUILD_AUTOCONF_H */
EOF
@@ -2384,6 +2402,7 @@ sed > Makefile \
-e "s,@VOICETOOLSET@,${voicetoolset},g" \
-e "s,@LANGS@,${buildlangs},g" \
-e "s,@USE_ELF@,${USE_ELF},g" \
+ -e "s,@RBDIR@,${rbdir},g" \
<<EOF
## Automatically generated. http://www.rockbox.org/
@@ -2446,6 +2465,7 @@ export TTS_ENGINE=@TTS_ENGINE@
export ENC_OPTS=@ENC_OPTS@
export ENCODER=@ENCODER@
export USE_ELF=@USE_ELF@
+export RBDIR=@RBDIR@
include \$(TOOLSDIR)/root.make
diff --git a/tools/root.make b/tools/root.make
index 54da315..40ce6c5 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -201,27 +201,27 @@ tags:
$(SILENT)etags -o $(BUILDDIR)/TAGS $(filter-out %.o,$(SRC) $(OTHER_SRC))
fontzip:
- $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)\" -r "$(ROOTDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY)
+ $(SILENT)$(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 1 -o rockbox-fonts.zip $(TARGET) $(BINARY)
zip:
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done ; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY)
mapzip:
$(SILENT)find . -name "*.map" | xargs zip rockbox-maps.zip
fullzip:
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" -f 2 -o rockbox-full.zip $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 -o rockbox-full.zip $(TARGET) $(BINARY)
7zip:
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.7z" -z "7za a -mx=9" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY)
tar:
$(SILENT)rm -f rockbox.tar
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "$(ROOTDIR)" $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -o "rockbox.tar" -z "tar -cf" -r "$(ROOTDIR)" --rbdir="$(RBDIR)" $(TARGET) $(BINARY)
bzip2: tar
$(SILENT)bzip2 -f9 rockbox.tar
@@ -254,12 +254,12 @@ ifdef SIMVER
install:
@echo "Installing your build in your 'simdisk' dir"
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 0 $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 0 $(TARGET) $(BINARY)
fullinstall:
@echo "Installing a full setup in your 'simdisk' dir"
$(SILENT)for f in `cat $(BUILDDIR)/apps/features`; do feat="$$feat:$$f" ; done; \
- $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" -f 2 $(TARGET) $(BINARY)
+ $(TOOLSDIR)/buildzip.pl $(VERBOSEOPT) -t \"$(MODELNAME)$$feat\" -i \"$(TARGET_ID)\" -s -r "$(ROOTDIR)" --rbdir="$(RBDIR)" -f 2 $(TARGET) $(BINARY)
endif
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index f7d0952..4a27325 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -8,32 +8,60 @@
# $Id$
#
-$ROOT="..";
-
-if($ARGV[0] eq "-r") {
- $ROOT=$ARGV[1];
- shift @ARGV;
- shift @ARGV;
-}
+use strict;
+use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DTYPE_STUFF
+my $ROOT="..";
my $verbose;
-if($ARGV[0] eq "-v") {
- $verbose =1;
- shift @ARGV;
-}
-
my $firmdir="$ROOT/firmware";
+my $rbdir=".rockbox";
+my $wpslist;
+my $target;
-my $wpslist=$ARGV[0];
+# Get options
+GetOptions ( 'r|root=s' => \$ROOT,
+ 'v|verbose' => \$verbose,
+ 'rbdir=s' => \$rbdir, # If we want to put in a different directory
+ );
+
+($wpslist, $target) = @ARGV;
-my $target = $ARGV[1];
my $cppdef = $target;
my @depthlist = ( 16, 8, 4, 2, 1 );
+# These parameters are filled in as we parse wpslist
+my $wps;
+my $wps_prefix;
+my $rwps;
+my $width;
+my $height;
+my $font;
+my $fgcolor;
+my $bgcolor;
+my $statusbar;
+my $author;
+my $req_g;
+my $req_g_wps;
+my $req_t_wps;
+my $backdrop;
+my $lineselectstart;
+my $lineselectend;
+my $selecttype;
+my $iconset;
+my $viewericon;
+my $lineselecttextcolor;
+my $filetylecolor;
+
+# LCD sizes
+my ($main_height, $main_width, $main_depth);
+my ($remote_height, $remote_width, $remote_depth);
+my $has_remote;
+
+
if(!$wpslist) {
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
"Run this script in the root of the target build, and it will put all the\n",
- "stuff in .rockbox/wps/\n";
+ "stuff in $rbdir/wps/\n";
exit;
}
@@ -71,7 +99,7 @@ STOP
open(GETSIZE, "$c|");
- my ($height, $width);
+ my ($height, $width, $depth);
while(<GETSIZE>) {
if($_ =~ /^Height: (\d*)/) {
$height = $1;
@@ -96,15 +124,15 @@ sub mkdirs
{
my $wpsdir = $wps;
$wpsdir =~ s/\.(r|)wps//;
- mkdir ".rockbox/wps", 0777;
- mkdir ".rockbox/themes", 0777;
+ mkdir "$rbdir/wps", 0777;
+ mkdir "$rbdir/themes", 0777;
- if( -d ".rockbox/wps/$wpsdir") {
+ if( -d "$rbdir/wps/$wpsdir") {
#print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
}
else
{
- mkdir ".rockbox/wps/$wpsdir", 0777;
+ mkdir "$rbdir/wps/$wpsdir", 0777;
}
}
@@ -112,9 +140,9 @@ sub copybackdrop
{
#copy the backdrop file into the build dir
if ($backdrop ne '') {
- $dst = $backdrop;
+ my $dst = $backdrop;
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- $cmd = "cp $ROOT/$backdrop .rockbox/$dst";
+ my $cmd = "cp $ROOT/$backdrop $rbdir/$dst";
`$cmd`;
}
}
@@ -123,10 +151,10 @@ sub copythemefont
{
#copy the font specified by the theme
- $o=$font;
+ my $o=$font;
$o =~ s/\.fnt/\.bdf/;
- `mkdir .rockbox/fonts/ >/dev/null 2>&1`;
- $cmd ="$ROOT/tools/convbdf -f -o \".rockbox/fonts/$font\" \"$ROOT/fonts/$o\" ";
+ mkdir "$rbdir/fonts";
+ my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$font\" \"$ROOT/fonts/$o\" ";
`$cmd`;
}
@@ -135,6 +163,7 @@ sub copythemeicon
#copy the icon specified by the theme
if ($iconset ne '') {
+ $iconset =~ s/.rockbox/$rbdir/;
$iconset =~ /\/(.*icons\/(.*))/i;
`cp $ROOT/icons/$2 $1`;
}
@@ -145,6 +174,7 @@ sub copythemeviewericon
#copy the viewer icon specified by the theme
if ($viewericon ne '') {
+ $viewericon =~ s/.rockbox/$rbdir/;
$viewericon =~ /\/(.*icons\/(.*))/i;
`cp $ROOT/icons/$2 $1`;
}
@@ -164,10 +194,10 @@ sub copywps
# print "$req_t_wps $req_g_wps\n";
if (-e "$dir/$req_t_wps" ) {
- system("cp $dir/$req_t_wps .rockbox/wps/$wps");
+ system("cp $dir/$req_t_wps $rbdir/wps/$wps");
} elsif (-e "$dir/$req_g_wps") {
- system("cp $dir/$req_g_wps .rockbox/wps/$wps");
+ system("cp $dir/$req_g_wps $rbdir/wps/$wps");
open(WPSFILE, "$dir/$req_g_wps");
while (<WPSFILE>) {
@@ -178,12 +208,12 @@ sub copywps
if ($#filelist >= 0) {
if (-e "$dir/$wps_prefix/$req_g") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$req_g/$file .rockbox/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$req_g/$file $rbdir/wps/$wps_prefix/");
}
}
elsif (-e "$dir/$wps_prefix") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$file .rockbox/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$file $rbdir/wps/$wps_prefix/");
}
}
else {
@@ -210,11 +240,11 @@ sub buildcfg {
\# $cfg generated by wpsbuild.pl
\# $wps is made by $author
\#
-wps: /.rockbox/wps/$wps
+wps: /$rbdir/wps/$wps
MOO
;
if($font) {
- push @out, "font: /.rockbox/fonts/$font\n";
+ push @out, "font: /$rbdir/fonts/$font\n";
}
if($fgcolor && $main_depth > 2) {
push @out, "foreground color: $fgcolor\n";
@@ -231,7 +261,7 @@ MOO
} else {
# clip resolution from filename
$backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- push @out, "backdrop: /.rockbox/$backdrop\n";
+ push @out, "backdrop: /$rbdir/$backdrop\n";
}
}
if($lineselectstart && $main_depth > 2) {
@@ -256,13 +286,13 @@ MOO
push @out, "filetype colours: $filetylecolor\n";
}
if($rwps && $has_remote ) {
- push @out, "rwps: /.rockbox/wps/$rwps\n";
+ push @out, "rwps: /$rbdir/wps/$rwps\n";
}
- if(-f ".rockbox/wps/$cfg") {
+ if(-f "$rbdir/wps/$cfg") {
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
}
else {
- open(CFG, ">.rockbox/themes/$cfg");
+ open(CFG, ">$rbdir/themes/$cfg");
print CFG @out;
close(CFG);
}
@@ -273,11 +303,15 @@ MOO
($remote_height, $remote_width, $remote_depth) = getlcdsizes(1);
#print "LCD: ${main_height}x${main_width}x${main_depth}\n";
-$has_remote = 1 if ($remote_height && $remote_width && remote_depth);
+$has_remote = 1 if ($remote_height && $remote_width && $remote_depth);
+
+my $isrwps;
+my $within;
open(WPS, "<$wpslist");
while(<WPS>) {
my $l = $_;
+
# remove CR
$l =~ s/\r//g;
if($l =~ /^ *\#/) {
@@ -334,7 +368,7 @@ while(<WPS>) {
my $wpsdir = $1;
# If this WPS installable on this platform, one of the following
# two files will be present
- foreach $d (@depthlist) {
+ foreach my $d (@depthlist) {
next if ($d > $rdepth);
$req_g = $rwidth . "x" . $rheight . "x" . $d;