summaryrefslogtreecommitdiff
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.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
30my $rbdir=".rockbox"; # can be changed for special builds 30my $rbdir=".rockbox"; # can be changed for special builds
31my $app; 31my $app;
32 32
33
34sub glob_mkdir { 33sub glob_mkdir {
35 my ($dir) = @_; 34 my ($dir) = @_;
36 mkpath ($dir, $verbose, 0777); 35 mkpath ($dir, $verbose, 0777);
@@ -550,7 +549,7 @@ STOP
550 if(-d "$ROOT/wps") { 549 if(-d "$ROOT/wps") {
551 my $wps_build_cmd="perl $ROOT/wps/wpsbuild.pl "; 550 my $wps_build_cmd="perl $ROOT/wps/wpsbuild.pl ";
552 $wps_build_cmd=$wps_build_cmd."-v " if $verbose; 551 $wps_build_cmd=$wps_build_cmd."-v " if $verbose;
553 $wps_build_cmd=$wps_build_cmd." --rbdir=$rbdir -r $ROOT -m $modelname $ROOT/wps/WPSLIST $target"; 552 $wps_build_cmd=$wps_build_cmd." --tempdir=$temp_dir --rbdir=$rbdir -r $ROOT -m $modelname $ROOT/wps/WPSLIST $target";
554 print "wpsbuild: $wps_build_cmd\n" if $verbose; 553 print "wpsbuild: $wps_build_cmd\n" if $verbose;
555 system("$wps_build_cmd"); 554 system("$wps_build_cmd");
556 print "wps_build_cmd: done\n" if $verbose; 555 print "wps_build_cmd: done\n" if $verbose;
@@ -607,6 +606,10 @@ sub runone {
607 606
608 # in the app the the layout is different (no .rockbox, but bin/lib/share) 607 # in the app the the layout is different (no .rockbox, but bin/lib/share)
609 $app = ($modelname eq "application"); 608 $app = ($modelname eq "application");
609 unless ($app) {
610 #rbdir starts with '/', strip it
611 $rbdir = substr($rbdir, 1);
612 }
610 613
611 # build a full install .rockbox ($rbdir) directory 614 # build a full install .rockbox ($rbdir) directory
612 buildzip($target, $fonts); 615 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"
19 19
20scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'` 20scriptver=`echo '$Revision$' | sed -e 's:\\$::g' -e 's/Revision: //'`
21 21
22rbdir=".rockbox" 22rbdir="/.rockbox"
23need_full_path=
24bindir=
25libdir=
26bindir_full=
27libdir_full=
23 28
24# 29#
25# Begin Function Definitions 30# Begin Function Definitions
@@ -2603,7 +2608,27 @@ fi
2603 target_id=100 2608 target_id=100
2604 modelname="application" 2609 modelname="application"
2605 target="-DAPPLICATION" 2610 target="-DAPPLICATION"
2606 memory=32 2611
2612 if [ -z "$PREFIX" ]; then
2613 rbdir="/usr/local/share/rockbox"
2614 bindir="/usr/local/bin"
2615 bindir_full=$bindir
2616 libdir="/usr/local/lib"
2617 libdir_full=$libdir
2618 else
2619 rbdir=`realpath $PREFIX/share/rockbox`
2620 bindir="$PREFIX/bin"
2621 libdir="$PREFIX/lib"
2622 if [ -d bindir ]; then
2623 bindir_full=`realpath $bindir`
2624 fi
2625 if [ -d libdir ]; then
2626 libdir_full=`realpath $libdir`
2627 fi
2628 fi
2629 need_full_path="yes"
2630
2631 memory=8
2607 uname=`uname` 2632 uname=`uname`
2608 simcc "sdl-app" 2633 simcc "sdl-app"
2609 tool="cp " 2634 tool="cp "
@@ -2999,7 +3024,15 @@ else
2999fi 3024fi
3000 3025
3001if [ "$ARG_RBDIR" ]; then 3026if [ "$ARG_RBDIR" ]; then
3002 rbdir=$ARG_RBDIR 3027 if [ "$need_full_path" = "yes" ]; then
3028 rbdir=`realpath $ARG_RBDIR`
3029 else # prepend '/' if needed
3030 if [ -z `echo $ARG_RBDIR | grep -P '/.*'` ]; then
3031 rbdir="/"$ARG_RBDIR
3032 else
3033 rbdir=$ARG_RBDIR
3034 fi
3035 fi
3003 echo "Using alternate rockbox dir: ${rbdir}" 3036 echo "Using alternate rockbox dir: ${rbdir}"
3004fi 3037fi
3005 3038
@@ -3010,6 +3043,8 @@ sed > autoconf.h \
3010 -e "s<@config_rtc@<$config_rtc<g" \ 3043 -e "s<@config_rtc@<$config_rtc<g" \
3011 -e "s<@have_rtc_alarm@<$have_rtc_alarm<g" \ 3044 -e "s<@have_rtc_alarm@<$have_rtc_alarm<g" \
3012 -e "s<@RBDIR@<${rbdir}<g" \ 3045 -e "s<@RBDIR@<${rbdir}<g" \
3046 -e "s<@binpath@<${bindir_full}<g" \
3047 -e "s<@libpath@<${libdir_full}<g" \
3013 -e "s<@have_backlight@<$have_backlight<g" \ 3048 -e "s<@have_backlight@<$have_backlight<g" \
3014 -e "s<@have_fmradio_in@<$have_fmradio_in<g" \ 3049 -e "s<@have_fmradio_in@<$have_fmradio_in<g" \
3015 -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \ 3050 -e "s<@have_ata_poweroff@<$have_ata_poweroff<g" \
@@ -3041,7 +3076,9 @@ sed > autoconf.h \
3041@have_rtc_alarm@ 3076@have_rtc_alarm@
3042 3077
3043/* root of Rockbox */ 3078/* root of Rockbox */
3044#define ROCKBOX_DIR "/@RBDIR@" 3079#define ROCKBOX_DIR "@RBDIR@"
3080#define ROCKBOX_BINARY_PATH "@binpath@"
3081#define ROCKBOX_LIBRARY_PATH "@libpath@"
3045 3082
3046#endif /* __BUILD_AUTOCONF_H */ 3083#endif /* __BUILD_AUTOCONF_H */
3047EOF 3084EOF
@@ -3154,6 +3191,8 @@ sed > Makefile \
3154 -e "s<@LANGS@<${buildlangs}<g" \ 3191 -e "s<@LANGS@<${buildlangs}<g" \
3155 -e "s<@USE_ELF@<${USE_ELF}<g" \ 3192 -e "s<@USE_ELF@<${USE_ELF}<g" \
3156 -e "s<@RBDIR@<${rbdir}<g" \ 3193 -e "s<@RBDIR@<${rbdir}<g" \
3194 -e "s<@binpath@<${bindir}<g" \
3195 -e "s<@libpath@<${libdir}<g" \
3157 -e "s<@PREFIX@<$PREFIX<g" \ 3196 -e "s<@PREFIX@<$PREFIX<g" \
3158 -e "s<@CMDLINE@<$cmdline<g" \ 3197 -e "s<@CMDLINE@<$cmdline<g" \
3159 -e "s<@SDLCONFIG@<$sdl<g" \ 3198 -e "s<@SDLCONFIG@<$sdl<g" \
@@ -3221,6 +3260,8 @@ export ENC_OPTS=@ENC_OPTS@
3221export ENCODER=@ENCODER@ 3260export ENCODER=@ENCODER@
3222export USE_ELF=@USE_ELF@ 3261export USE_ELF=@USE_ELF@
3223export RBDIR=@RBDIR@ 3262export RBDIR=@RBDIR@
3263export ROCKBOX_BINARY_PATH=@binpath@
3264export ROCKBOX_LIBRARY_PATH=@libpath@
3224export SDLCONFIG=@SDLCONFIG@ 3265export SDLCONFIG=@SDLCONFIG@
3225 3266
3226CONFIGURE_OPTIONS=@CMDLINE@ 3267CONFIGURE_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 \
24 24
25 25
26ifeq (,$(PREFIX)) 26ifeq (,$(PREFIX))
27ifeq ($(APP_TYPE),sdl-sim) 27ifdef APP_TYPE
28# for sims, set simdisk/ as default 28# for sims, set simdisk/ as default
29PREFIX = simdisk 29ifeq ($(APP_TYPE),sdl-sim)
30INSTALL = --install="$(PREFIX)" 30RBPREFIX = simdisk
31else ifeq ($(APP_TYPE),sdl-app)
32RBPREFIX = /usr/local
33endif
34
35INSTALL = --install="$(RBPREFIX)"
31else 36else
32# /dev/null as magic to tell it wasn't set, error out later in buildzip.pl 37# /dev/null as magic to tell it wasn't set, error out later in buildzip.pl
33INSTALL = --install=/dev/null 38INSTALL = --install=/dev/null
34endif 39endif
35else 40else
36INSTALL = --install="$(PREFIX)" 41RBPREFIX = $(PREFIX)
42INSTALL = --install="$(RBPREFIX)"
37endif 43endif
38 44
39RBINFO = $(BUILDDIR)/rockbox-info.txt 45RBINFO = $(BUILDDIR)/rockbox-info.txt
@@ -280,8 +286,8 @@ voice: voicetools $(BUILDDIR)/apps/features
280endif 286endif
281 287
282bininstall: $(BUILDDIR)/$(BINARY) 288bininstall: $(BUILDDIR)/$(BINARY)
283 @echo "Installing your rockbox binary in your '$(PREFIX)' dir" 289 @echo "Installing your rockbox binary in your '$(RBPREFIX)' dir"
284 $(SILENT)cp $(BINARY) "$(PREFIX)/.rockbox/" 290 $(SILENT)cp $(BINARY) "$(RBPREFIX)/.rockbox/"
285 291
286install: 292install:
287 @echo "Installing your build in your '$(PREFIX)' dir" 293 @echo "Installing your build in your '$(PREFIX)' dir"
@@ -351,4 +357,4 @@ ifneq (reconf,$(MAKECMDGOALS))
351endif 357endif
352 358
353reconf: 359reconf:
354 $(SILENT$)PREFIX=$(PREFIX) $(TOOLSDIR)/configure $(CONFIGURE_OPTIONS) 360 $(SILENT$)$(TOOLSDIR)/configure $(CONFIGURE_OPTIONS)