From adbedc2c02aa4be420a800ebd491bf6f0cee1051 Mon Sep 17 00:00:00 2001 From: kugel Date: Sun, 14 Nov 2010 15:29:11 +0000 Subject: [PATCH] Fix path detection for app builds in configure and buildzip.pl. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28592 a1c6a512-1295-4272-9138-f99709370657 --- tools/buildzip.pl | 26 ++++++++++++++++++++------ tools/configure | 54 +++++++++++++++++++++++++----------------------------- 2 files changed, 45 insertions(+), 35 deletions(-) diff --git a/tools/buildzip.pl b/tools/buildzip.pl index 22a706224..62413acd3 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl @@ -18,8 +18,8 @@ use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DT my $ROOT=".."; -my $ziptool="zip -r9"; -my $output="rockbox.zip"; +my $ziptool; +my $output; my $verbose; my $install; my $exe; @@ -27,7 +27,7 @@ my $target; my $modelname; my $incfonts; my $target_id; # passed in, not currently used -my $rbdir=".rockbox"; # can be changed for special builds +my $rbdir; # can be non-.rockbox for special builds my $app; sub glob_mkdir { @@ -197,16 +197,30 @@ sub make_install { # Get options GetOptions ( 'r|root=s' => \$ROOT, - 'z|ziptool=s' => \$ziptool, + 'z|ziptool:s' => \$ziptool, 'm|modelname=s' => \$modelname, # The model name as used in ARCHOS in the root makefile 'i|id=s' => \$target_id, # The target id name as used in TARGET_ID in the root makefile - 'o|output=s' => \$output, + 'o|output:s' => \$output, 'f|fonts=s' => \$incfonts, # 0 - no fonts, 1 - fonts only 2 - fonts and package 'v|verbose' => \$verbose, 'install=s' => \$install, # install destination - 'rbdir=s' => \$rbdir, # If we want to put in a different directory + 'rbdir:s' => \$rbdir, # If we want to put in a different directory ); +# GetOptions() doesn't remove the params from @ARGV if their value was "" +# Thus we use the ":" for those for which we use a default value in case of "" +# and assign the default value afterwards +if ($ziptool eq '') { + $ziptool = "zip -r9"; +} +if ($output eq '') { + $output = "rockbox.zip" +} +if ($rbdir eq '') { + $rbdir = ".rockbox"; +} + +# Now @ARGV shuold be free of any left-overs GetOptions left ($target, $exe) = @ARGV; my $firmdir="$ROOT/firmware"; diff --git a/tools/configure b/tools/configure index ed3d63c61..efeaa92a9 100755 --- a/tools/configure +++ b/tools/configure @@ -24,8 +24,6 @@ rbdir="/.rockbox" need_full_path= bindir= libdir= -bindir_full= -libdir_full= app_platform= app_lcd_width= @@ -87,21 +85,25 @@ app_get_platform() { app_lcd_height="#define LCD_HEIGHT $app_lcd_height" # setup files and paths depending on the platform if [ "$app_platform" = "sdl" ]; then - if [ -z "$PREFIX" ]; then + if [ -z "$ARG_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` + if [ -d "$ARG_PREFIX" ]; then + if [ -z `echo $ARG_PREFIX | grep "^/"` ]; then + ARG_PREFIX=`realpath $ARG_PREFIX` + if [ "0" != "$?" ]; then + echo "ERROR: Could not get prefix path (is realpath installed?)." + exit + fi + fi + rbdir="$ARG_PREFIX/share/rockbox" + bindir="$ARG_PREFIX/bin" + libdir="$ARG_PREFIX/lib" + else + echo "ERROR: PREFIX does not does not exist" + exit fi fi output="rockbox" @@ -122,9 +124,7 @@ app_get_platform() { fi rbdir="/data/data/org.rockbox/app_rockbox/rockbox" bindir="/data/data/org.rockbox/lib" - bindir_full=$bindir libdir="/data/data/org.rockbox/app_rockbox" - libdir_full=$libdir output="librockbox.so" bootoutput="librockbox.so" fi @@ -953,6 +953,7 @@ ARG_TYPE= ARG_VOICE= ARG_ARM_EABI= ARG_ARM_THUMB= +ARG_PREFIX="$PREFIX" err= for arg in "$@"; do case "$arg" in @@ -974,7 +975,7 @@ for arg in "$@"; do --no-eabi) ARG_ARM_EABI=0;; --thumb) ARG_ARM_THUMB=1;; --no-thumb) ARG_ARM_THUMB=0;; - --prefix=*) PREFIX=`echo "$arg" | cut -d = -f 2`;; + --prefix=*) ARG_PREFIX=`echo "$arg" | cut -d = -f 2`;; --help) help;; *) err=1; echo "[ERROR] Option '$arg' unsupported";; esac @@ -3119,15 +3120,6 @@ else fi if [ "$ARG_RBDIR" ]; then - if [ "$need_full_path" = "yes" ]; then - rbdir=`realpath $ARG_RBDIR` - else # prepend '/' if needed - if [ -z `echo $ARG_RBDIR | grep '^/'` ]; then - rbdir="/"$ARG_RBDIR - else - rbdir=$ARG_RBDIR - fi - fi echo "Using alternate rockbox dir: ${rbdir}" fi @@ -3138,8 +3130,8 @@ sed > autoconf.h \ -e "s<@config_rtc@<$config_rtc Makefile \ @@ -3306,7 +3302,7 @@ sed > Makefile \ -e "s<@RBDIR@<${rbdir}