summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-01 16:15:27 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-01 16:15:27 +0000
commit9c0b2479f7025a84444adf08e3be8ced60dad013 (patch)
treef3d328dd73f46d599f0432cc43ae206798cbe4f6 /tools
parent2e7d92fef707a2cd30820fd0053c539c3ac8e2b3 (diff)
downloadrockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.tar.gz
rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.tar.bz2
rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.zip
Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox). This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local. On the DAPs it's a no-op, returing /.rockbox directly. Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools')
-rwxr-xr-xtools/buildzip.pl7
-rwxr-xr-xtools/configure49
-rw-r--r--tools/root.make20
3 files changed, 63 insertions, 13 deletions
diff --git a/tools/buildzip.pl b/tools/buildzip.pl
index 0358459c9c..7a127dea20 100755
--- a/tools/buildzip.pl
+++ b/tools/buildzip.pl
@@ -30,7 +30,6 @@ my $target_id; # passed in, not currently used
my $rbdir=".rockbox"; # can be changed for special builds
my $app;
-
sub glob_mkdir {
my ($dir) = @_;
mkpath ($dir, $verbose, 0777);
@@ -550,7 +549,7 @@ STOP
if(-d "$ROOT/wps") {
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 -m $modelname $ROOT/wps/WPSLIST $target";
+ $wps_build_cmd=$wps_build_cmd." --tempdir=$temp_dir --rbdir=$rbdir -r $ROOT -m $modelname $ROOT/wps/WPSLIST $target";
print "wpsbuild: $wps_build_cmd\n" if $verbose;
system("$wps_build_cmd");
print "wps_build_cmd: done\n" if $verbose;
@@ -607,6 +606,10 @@ sub runone {
# in the app the the layout is different (no .rockbox, but bin/lib/share)
$app = ($modelname eq "application");
+ unless ($app) {
+ #rbdir starts with '/', strip it
+ $rbdir = substr($rbdir, 1);
+ }
# build a full install .rockbox ($rbdir) directory
buildzip($target, $fonts);
diff --git a/tools/configure b/tools/configure
index 0896e5b699..ce23c2a965 100755
--- a/tools/configure
+++ b/tools/configure
@@ -19,7 +19,12 @@ use_bootchart="#undef DO_BOOTCHART"
scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
-rbdir=".rockbox"
+rbdir="/.rockbox"
+need_full_path=
+bindir=
+libdir=
+bindir_full=
+libdir_full=
#
# Begin Function Definitions
@@ -2603,7 +2608,27 @@ fi
target_id=100
modelname="application"
target="-DAPPLICATION"
- memory=32
+
+ if [ -z "$PREFIX" ]; then
+ rbdir="/usr/local/share/rockbox"
+ bindir="/usr/local/bin"
+ bindir_full=$bindir
+ libdir="/usr/local/lib"
+ libdir_full=$libdir
+ else
+ rbdir=`realpath $PREFIX/share/rockbox`
+ bindir="$PREFIX/bin"
+ libdir="$PREFIX/lib"
+ if [ -d bindir ]; then
+ bindir_full=`realpath $bindir`
+ fi
+ if [ -d libdir ]; then
+ libdir_full=`realpath $libdir`
+ fi
+ fi
+ need_full_path="yes"
+
+ memory=8
uname=`uname`
simcc "sdl-app"
tool="cp "
@@ -2999,7 +3024,15 @@ else
fi
if [ "$ARG_RBDIR" ]; then
- rbdir=$ARG_RBDIR
+ if [ "$need_full_path" = "yes" ]; then
+ rbdir=`realpath $ARG_RBDIR`
+ else # prepend '/' if needed
+ if [ -z `echo $ARG_RBDIR | grep -P '/.*'` ]; then
+ rbdir="/"$ARG_RBDIR
+ else
+ rbdir=$ARG_RBDIR
+ fi
+ fi
echo "Using alternate rockbox dir: ${rbdir}"
fi
@@ -3010,6 +3043,8 @@ sed > autoconf.h \
-e "s<@config_rtc@<$config_rtc<g" \
-e "s<@have_rtc_alarm@<$have_rtc_alarm<g" \
-e "s<@RBDIR@<${rbdir}<g" \
+ -e "s<@binpath@<${bindir_full}<g" \
+ -e "s<@libpath@<${libdir_full}<g" \
-e "s<@have_backlight@<$have_backlight<g" \
-e "s<@have_fmradio_in@<$have_fmradio_in<g" \
-e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \
@@ -3041,7 +3076,9 @@ sed > autoconf.h \
@have_rtc_alarm@
/* root of Rockbox */
-#define ROCKBOX_DIR "/@RBDIR@"
+#define ROCKBOX_DIR "@RBDIR@"
+#define ROCKBOX_BINARY_PATH "@binpath@"
+#define ROCKBOX_LIBRARY_PATH "@libpath@"
#endif /* __BUILD_AUTOCONF_H */
EOF
@@ -3154,6 +3191,8 @@ sed > Makefile \
-e "s<@LANGS@<${buildlangs}<g" \
-e "s<@USE_ELF@<${USE_ELF}<g" \
-e "s<@RBDIR@<${rbdir}<g" \
+ -e "s<@binpath@<${bindir}<g" \
+ -e "s<@libpath@<${libdir}<g" \
-e "s<@PREFIX@<$PREFIX<g" \
-e "s<@CMDLINE@<$cmdline<g" \
-e "s<@SDLCONFIG@<$sdl<g" \
@@ -3221,6 +3260,8 @@ export ENC_OPTS=@ENC_OPTS@
export ENCODER=@ENCODER@
export USE_ELF=@USE_ELF@
export RBDIR=@RBDIR@
+export ROCKBOX_BINARY_PATH=@binpath@
+export ROCKBOX_LIBRARY_PATH=@libpath@
export SDLCONFIG=@SDLCONFIG@
CONFIGURE_OPTIONS=@CMDLINE@
diff --git a/tools/root.make b/tools/root.make
index d90b40f0c6..145b1ade72 100644
--- a/tools/root.make
+++ b/tools/root.make
@@ -24,16 +24,22 @@ TOOLS = $(TOOLSDIR)/rdf2binary $(TOOLSDIR)/convbdf \
ifeq (,$(PREFIX))
-ifeq ($(APP_TYPE),sdl-sim)
+ifdef APP_TYPE
# for sims, set simdisk/ as default
-PREFIX = simdisk
-INSTALL = --install="$(PREFIX)"
+ifeq ($(APP_TYPE),sdl-sim)
+RBPREFIX = simdisk
+else ifeq ($(APP_TYPE),sdl-app)
+RBPREFIX = /usr/local
+endif
+
+INSTALL = --install="$(RBPREFIX)"
else
# /dev/null as magic to tell it wasn't set, error out later in buildzip.pl
INSTALL = --install=/dev/null
endif
else
-INSTALL = --install="$(PREFIX)"
+RBPREFIX = $(PREFIX)
+INSTALL = --install="$(RBPREFIX)"
endif
RBINFO = $(BUILDDIR)/rockbox-info.txt
@@ -280,8 +286,8 @@ voice: voicetools $(BUILDDIR)/apps/features
endif
bininstall: $(BUILDDIR)/$(BINARY)
- @echo "Installing your rockbox binary in your '$(PREFIX)' dir"
- $(SILENT)cp $(BINARY) "$(PREFIX)/.rockbox/"
+ @echo "Installing your rockbox binary in your '$(RBPREFIX)' dir"
+ $(SILENT)cp $(BINARY) "$(RBPREFIX)/.rockbox/"
install:
@echo "Installing your build in your '$(PREFIX)' dir"
@@ -351,4 +357,4 @@ ifneq (reconf,$(MAKECMDGOALS))
endif
reconf:
- $(SILENT$)PREFIX=$(PREFIX) $(TOOLSDIR)/configure $(CONFIGURE_OPTIONS)
+ $(SILENT$)$(TOOLSDIR)/configure $(CONFIGURE_OPTIONS)