Accept FS#9400 - "tools/configure more improvements" by Rosso Maltese.

This completes the command line capabilities of configure. You can now pass advanced build options (type=aXXX, where X are the shortcuts for the advanced options) as well as voice options. See configure --help.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@22228 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Thomas Martitz 2009-08-09 19:02:22 +00:00
parent a1b0e165cc
commit 5e1b9cd4a6
2 changed files with 200 additions and 150 deletions

View file

@ -485,6 +485,7 @@ Mykhailo Radzievskyi
Christophe Gouiran Christophe Gouiran
Asael Reiter Asael Reiter
Jens Erdmann Jens Erdmann
Rosso Maltese
The libmad team The libmad team
The wavpack team The wavpack team

349
tools/configure vendored
View file

@ -72,33 +72,6 @@ findtool(){
fi fi
} }
# parse the argument list, returns the value after the = in case of a
# option=value type option, returns 0 in case of --ccache or --no-ccache,
# returns 1 if the searched argument type wasn't fount in the argument list
# Usage [var = ]`parse_args <argumenttype>`, e.g. `parse_args --target`
# var definitons below are needed so that parse_args can see the arguments
arg1=$1 arg2=$2 arg3=$3 arg4=$4 arg5=$5 arg6=$6 arg7=$7 arg8=$8 arg9=$9
parse_args() {
ret="1"
for i in $arg1 $arg2 $arg3 $arg4 $arg5 $arg6 $arg7 $arg8 $arg9
do
if [ "$1" = "--ccache" ]; then
if [ "$i" = "--ccache" ]; then
ret="0"
fi
elif [ "$1" = "--no-ccache" ]; then
if [ "$i" = "--no-ccache" ]; then
ret="0"
fi
elif [ "$1" = `echo $i|cut -d'=' -f1` ]; then
ret=`echo $i|cut -d'=' -f2`
fi
done
echo "$ret"
}
simcc () { simcc () {
# default tool setup for native building # default tool setup for native building
@ -170,7 +143,7 @@ simcc () {
;; ;;
*) *)
echo "Unsupported system: $uname, fix configure and retry" echo "[ERROR] Unsupported system: $uname, fix configure and retry"
exit 2 exit 2
;; ;;
esac esac
@ -328,41 +301,50 @@ mipselcc () {
} }
whichadvanced () { whichadvanced () {
atype=`echo "$1" | cut -c 2-`
################################################################## ##################################################################
# Prompt for specific developer options # Prompt for specific developer options
# #
echo "" if [ "$atype" ]; then
echo "Enter your developer options (press enter when done)" interact=
printf "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (V)oice" else
if [ "$memory" = "2" ]; then interact=1
printf ", (8)MB MOD" echo ""
echo "Enter your developer options (press enter when done)"
printf "(D)EBUG, (L)ogf, (S)imulator, (P)rofiling, (V)oice"
if [ "$memory" = "2" ]; then
printf ", (8)MB MOD"
fi
if [ "$modelname" = "player" ]; then
printf ", Use (A)TA poweroff"
fi
if [ "$t_model" = "ondio" ]; then
printf ", (B)acklight MOD"
fi
if [ "$modelname" = "m5" ]; then
printf ", (F)M radio MOD"
fi
if [ "$modelname" = "h120" ]; then
printf ", (R)TC MOD"
fi
echo ""
fi fi
if [ "$modelname" = "player" ]; then
printf ", Use (A)TA poweroff"
fi
if [ "$t_model" = "ondio" ]; then
printf ", (B)acklight MOD"
fi
if [ "$modelname" = "m5" ]; then
printf ", (F)M radio MOD"
fi
if [ "$modelname" = "h120" ]; then
printf ", (R)TC MOD"
fi
echo ""
cont=1 cont=1
while [ $cont = "1" ]; do while [ $cont = "1" ]; do
option=`input`; if [ "$interact" ]; then
option=`input`
else
option=`echo "$atype" | cut -c 1`
fi
case $option in case $option in
[Dd]) [Dd])
if [ "yes" = "$profile" ]; then if [ "yes" = "$profile" ]; then
echo "Debug is incompatible with profiling" echo "Debug is incompatible with profiling"
else else
echo "define DEBUG" echo "DEBUG build enabled"
use_debug="yes" use_debug="yes"
fi fi
;; ;;
@ -390,32 +372,24 @@ whichadvanced () {
if [ "$memory" = "2" ]; then if [ "$memory" = "2" ]; then
memory="8" memory="8"
echo "Memory size selected: 8MB" echo "Memory size selected: 8MB"
else
cont=0
fi fi
;; ;;
[Aa]) [Aa])
if [ "$modelname" = "player" ]; then if [ "$modelname" = "player" ]; then
have_ata_poweroff="#define HAVE_ATA_POWEROFF" have_ata_poweroff="#define HAVE_ATA_POWEROFF"
echo "ATA poweroff enabled" echo "ATA poweroff enabled"
else
cont=0
fi fi
;; ;;
[Bb]) [Bb])
if [ "$t_model" = "ondio" ]; then if [ "$t_model" = "ondio" ]; then
have_backlight="#define HAVE_BACKLIGHT" have_backlight="#define HAVE_BACKLIGHT"
echo "Backlight functions enabled" echo "Backlight functions enabled"
else
cont=0
fi fi
;; ;;
[Ff]) [Ff])
if [ "$modelname" = "m5" ]; then if [ "$modelname" = "m5" ]; then
have_fmradio_in="#define HAVE_FMRADIO_IN" have_fmradio_in="#define HAVE_FMRADIO_IN"
echo "FM radio functions enabled" echo "FM radio functions enabled"
else
cont=0
fi fi
;; ;;
[Rr]) [Rr])
@ -423,30 +397,27 @@ whichadvanced () {
config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231" config_rtc="#define CONFIG_RTC RTC_DS1339_DS3231"
have_rtc_alarm="#define HAVE_RTC_ALARM" have_rtc_alarm="#define HAVE_RTC_ALARM"
echo "RTC functions enabled (DS1339/DS3231)" echo "RTC functions enabled (DS1339/DS3231)"
else
cont=0
fi fi
;; ;;
*) *)
cont=0 if [ "$interact" ]; then
cont=0
else
echo "[ERROR] Option $option unsupported"
fi
;; ;;
esac esac
if [ ! "$interact" ]; then
atype=`echo "$atype" | cut -c 2-`
[ "$atype" ] || cont=0
fi
done done
echo "done" echo "done"
if [ "yes" = "$voice" ]; then if [ "yes" = "$voice" ]; then
# Ask about languages to build # Ask about languages to build
echo "Select a number for the language to use (default is english)"
# The multiple-language feature is currently broken
# echo "You may enter a comma-separated list of languages to build"
picklang picklang
voicelanguage=`whichlang` voicelanguage=`whichlang`
if [ -z "$voicelanguage" ]; then
# pick a default
voicelanguage="english"
fi
echo "Voice language set to $voicelanguage" echo "Voice language set to $voicelanguage"
# Configure encoder and TTS engine for each language # Configure encoder and TTS engine for each language
@ -476,8 +447,10 @@ whichadvanced () {
# Configure voice settings # Configure voice settings
voiceconfig () { voiceconfig () {
thislang=$1 thislang=$1
echo "Building $thislang voice for $modelname. Select options" if [ ! "$ARG_TTS" ]; then
echo "" echo "Building $thislang voice for $modelname. Select options"
echo ""
fi
if [ -n "`findtool flite`" ]; then if [ -n "`findtool flite`" ]; then
FLITE="F(l)ite " FLITE="F(l)ite "
@ -542,8 +515,13 @@ voiceconfig () {
exit 3 exit 3
fi fi
echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI}${SWIFT}(${DEFAULT_CHOICE})?" if [ "$ARG_TTS" ]; then
option=`input` option=$ARG_TTS
else
echo "TTS engine to use: ${FLITE}${FESTIVAL}${ESPEAK}${SAPI}${SWIFT}(${DEFAULT_CHOICE})?"
option=`input`
fi
advopts="$advopts --tts=$option"
case "$option" in case "$option" in
[Ll]) [Ll])
TTS_ENGINE="flite" TTS_ENGINE="flite"
@ -579,35 +557,47 @@ voiceconfig () {
# Select which voice to use for Festival # Select which voice to use for Festival
if [ "$TTS_ENGINE" = "festival" ]; then if [ "$TTS_ENGINE" = "festival" ]; then
i=1 voicelist=`echo "(voice.list)"|festival -i 2>/dev/null |tr "\n" " "|sed -e 's/.*festival> (\(.*\)) festival>/\1/'|sort`
for voice in `echo "(voice.list)"|festival -i 2>/dev/null |tr "\n" " "|sed -e 's/.*festival> (\(.*\)) festival>/\1/'|sort`; do for voice in $voicelist; do
if [ "$i" = "1" ]; then TTS_FESTIVAL_VOICE="$voice" # Default choice
TTS_FESTIVAL_VOICE="$voice" # Default choice break
fi
printf "%3d. %s\n" "$i" "$voice"
i=`expr $i + 1`
done done
printf "Please select which Festival voice to use (default is $TTS_FESTIVAL_VOICE): " if [ "$ARG_VOICE" ]; then
CHOICE=`input` CHOICE=$ARG_VOICE
else
i=1
for voice in $voicelist; do
printf "%3d. %s\n" "$i" "$voice"
i=`expr $i + 1`
done
printf "Please select which Festival voice to use (default is $TTS_FESTIVAL_VOICE): "
CHOICE=`input`
fi
i=1 i=1
for voice in `echo "(voice.list)"|festival -i 2>/dev/null |tr "\n" " "|sed -e 's/.*festival> (\(.*\)) festival>/\1/'|sort`; do for voice in $voicelist; do
if [ "$i" = "$CHOICE" -o "$voice" = "$CHOICE" ]; then if [ "$i" = "$CHOICE" -o "$voice" = "$CHOICE" ]; then
TTS_FESTIVAL_VOICE="$voice" TTS_FESTIVAL_VOICE="$voice"
fi fi
i=`expr $i + 1` i=`expr $i + 1`
done done
advopts="$advopts --voice=$CHOICE"
echo "Festival voice set to $TTS_FESTIVAL_VOICE" echo "Festival voice set to $TTS_FESTIVAL_VOICE"
echo "(voice_$TTS_FESTIVAL_VOICE)" > festival-prolog.scm echo "(voice_$TTS_FESTIVAL_VOICE)" > festival-prolog.scm
fi fi
# Allow the user to input manual commandline options # Allow the user to input manual commandline options
printf "Enter $TTS_ENGINE options (enter for defaults \"$TTS_OPTS\"): " if [ "$ARG_TTSOPTS" ]; then
USER_TTS_OPTS=`input` USER_TTS_OPTS=$ARG_TTSOPTS
else
printf "Enter $TTS_ENGINE options (enter for defaults \"$TTS_OPTS\"): "
USER_TTS_OPTS=`input`
echo ""
fi
advopts="$advopts --ttsopts='$USER_TTS_OPTS'"
if [ -n "$USER_TTS_OPTS" ]; then if [ -n "$USER_TTS_OPTS" ]; then
TTS_OPTS="$USER_TTS_OPTS" TTS_OPTS="$USER_TTS_OPTS"
fi fi
echo "$TTS_ENGINE options set to $TTS_OPTS"
echo ""
if [ "$swcodec" = "yes" ]; then if [ "$swcodec" = "yes" ]; then
ENCODER="rbspeexenc" ENCODER="rbspeexenc"
@ -628,11 +618,17 @@ voiceconfig () {
echo "Using $ENCODER for encoding voice clips" echo "Using $ENCODER for encoding voice clips"
# Allow the user to input manual commandline options # Allow the user to input manual commandline options
printf "Enter $ENCODER options (enter for defaults \"$ENC_OPTS\"): " if [ "$ARG_ENCOPTS" ]; then
USER_ENC_OPTS=`input` USER_ENC_OPTS=$ARG_ENCOPTS
else
printf "Enter $ENCODER options (enter for defaults \"$ENC_OPTS\"): "
USER_ENC_OPTS=`input`
fi
advopts="$advopts --encopts='$USER_ENC_OPTS'"
if [ -n "$USER_ENC_OPTS" ]; then if [ -n "$USER_ENC_OPTS" ]; then
ENC_OPTS=$USER_ENC_OPTS ENC_OPTS=$USER_ENC_OPTS
fi fi
echo "$ENCODER options set to $ENC_OPTS"
TEMPDIR="${pwd}" TEMPDIR="${pwd}"
if [ -n "`findtool cygpath`" ]; then if [ -n "`findtool cygpath`" ]; then
@ -643,17 +639,25 @@ voiceconfig () {
picklang() { picklang() {
# figure out which languages that are around # figure out which languages that are around
for file in $rootdir/apps/lang/*.lang; do for file in $rootdir/apps/lang/*.lang; do
clean=`echo $file | sed -e 's:.*/::g' | cut "-d." -f1` clean=`basename $file .lang`
langs="$langs $clean" langs="$langs $clean"
done done
num=1 if [ "$ARG_LANG" ]; then
for one in $langs; do pick=$ARG_LANG
echo "$num. $one" else
num=`expr $num + 1` echo "Select a number for the language to use (default is english)"
done # FIXME The multiple-language feature is currently broken
# echo "You may enter a comma-separated list of languages to build"
read pick num=1
for one in $langs; do
echo "$num. $one"
num=`expr $num + 1`
done
pick=`input`
fi
advopts="$advopts --language=$pick"
} }
whichlang() { whichlang() {
@ -673,25 +677,19 @@ whichlang() {
num=`expr $num + 1` num=`expr $num + 1`
done done
done done
if [ -z "$output" ]; then
# pick a default
output="english"
fi
echo $output echo $output
} }
opt=$1 help() {
if [ "$TMPDIR" != "" ]; then
tmpdir=$TMPDIR
else
tmpdir=/tmp
fi
echo $tmpdir
if test "$opt" = "--help"; then
echo "Rockbox configure script." echo "Rockbox configure script."
echo "Invoke this in a directory to generate a Makefile to build Rockbox" echo "Invoke this in a directory to generate a Makefile to build Rockbox"
echo "Do *NOT* run this within the tools directory!" echo "Do *NOT* run this within the tools directory!"
echo "" echo ""
cat <<EOF cat <<EOF
Usage: configure [OPTION]... Usage: configure [OPTION]...
Options: Options:
--target=TARGET Sets the target, TARGET can be either the target ID or --target=TARGET Sets the target, TARGET can be either the target ID or
@ -705,8 +703,24 @@ cat <<EOF
without this option if you are not sure which the right without this option if you are not sure which the right
number is. number is.
--type=TYPE Sets the build type. The shortcut is also valid. --type=TYPE Sets the build type. Shortcuts are also valid.
Run without this option to see available types. Run without this option to see all available types.
Multiple values are allowed and managed in the input
order. So --type=b stands for Bootloader build, while
--type=ab stands for "Backlight MOD" build.
--language=LANG Set the language used for voice generation (used only if
TYPE is AV).
--tts=ENGINE Set the TTS engine used for voice generation (used only
if TYPE is AV).
--voice=VOICE Set voice to use with selected TTS (used only if TYPE is
AV).
--ttsopts=OPTS Set TTS engine manual options (used only if TYPE is AV).
--encopts=OPTS Set encoder manual options (used only if ATYPE is AV).
--rbdir=dir Use alternative rockbox directory (default: ${rbdir}). --rbdir=dir Use alternative rockbox directory (default: ${rbdir}).
This is useful for having multiple alternate builds on This is useful for having multiple alternate builds on
@ -721,7 +735,46 @@ cat <<EOF
EOF EOF
exit exit
}
ARG_CCACHE=
ARG_ENCOPTS=
ARG_LANG=
ARG_RAM=
ARG_RBDIR=
ARG_TARGET=
ARG_TTS=
ARG_TTSOPTS=
ARG_TYPE=
ARG_VOICE=
err=
for arg in "$@"; do
case "$arg" in
--ccache) ARG_CCACHE=1;;
--encopts=*) ARG_ENCOPTS=`echo "$arg" | cut -d = -f 2`;;
--language=*) ARG_LANG=`echo "$arg" | cut -d = -f 2`;;
--no-ccache) ARG_CCACHE=0;;
--ram=*) ARG_RAM=`echo "$arg" | cut -d = -f 2`;;
--rbdir=*) ARG_RBDIR=`echo "$arg" | cut -d = -f 2`;;
--target=*) ARG_TARGET=`echo "$arg" | cut -d = -f 2`;;
--tts=*) ARG_TTS=`echo "$arg" | cut -d = -f 2`;;
--ttsopts=*) ARG_TTSOPTS=`echo "$arg" | cut -d = -f 2`;;
--type=*) ARG_TYPE=`echo "$arg" | cut -d = -f 2`;;
--voice=*) ARG_VOICE=`echo "$arg" | cut -d = -f 2`;;
--help) help;;
*) err=1; echo "[ERROR] Option '$arg' unsupported";;
esac
done
[ "$err" ] && exit 1
advopts=
if [ "$TMPDIR" != "" ]; then
tmpdir=$TMPDIR
else
tmpdir=/tmp
fi fi
echo Using temporary directory $tmpdir
if test -r "configure"; then if test -r "configure"; then
# this is a check for a configure script in the current directory, it there # this is a check for a configure script in the current directory, it there
@ -779,8 +832,8 @@ toolsdir='\$(ROOTDIR)/tools'
# Figure out target platform # Figure out target platform
# #
if [ "1" != `parse_args --target` ]; then if [ "$ARG_TARGET" ]; then
buildfor=`parse_args --target`; buildfor=$ARG_TARGET
else else
echo "Enter target platform:" echo "Enter target platform:"
cat <<EOF cat <<EOF
@ -2318,10 +2371,10 @@ fi
if [ -z "$memory" ]; then if [ -z "$memory" ]; then
case $target_id in case $target_id in
15) 15)
echo "Enter size of your RAM (in MB): (Defaults to 32)" if [ "$ARG_RAM" ]; then
if [ "1" != `parse_args --ram` ]; then size=$ARG_RAM
size=`parse_args --ram`;
else else
echo "Enter size of your RAM (in MB): (Defaults to 32)"
size=`input`; size=`input`;
fi fi
case $size in case $size in
@ -2334,24 +2387,24 @@ if [ -z "$memory" ]; then
esac esac
;; ;;
*) *)
echo "Enter size of your RAM (in MB): (Defaults to 2)" if [ "$ARG_RAM" ]; then
if [ "1" != `parse_args --ram` ]; then size=$ARG_RAM
size=`parse_args --ram`; else
else echo "Enter size of your RAM (in MB): (Defaults to 2)"
size=`input`; size=`input`;
fi fi
case $size in case $size in
8) 8)
memory="8" memory="8"
;; ;;
*) *)
memory="2" memory="2"
;; ;;
esac esac
;; ;;
esac esac
echo "Memory size selected: $memory MB" echo "Memory size selected: $memory MB"
echo "" [ "$ARG_TYPE" ] || echo ""
fi fi
#remove end #remove end
@ -2374,8 +2427,8 @@ case $modelname in
*) *)
;; ;;
esac esac
if [ "1" != `parse_args --type` ]; then if [ "$ARG_TYPE" ]; then
btype=`parse_args --type`; btype=$ARG_TYPE
else else
echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual: (Defaults to N)" echo "Build (N)ormal, (A)dvanced, (S)imulator, (B)ootloader, $gdbstub(M)anual: (Defaults to N)"
btype=`input`; btype=`input`;
@ -2436,9 +2489,9 @@ fi
flash="" flash=""
echo "Simulator build selected" echo "Simulator build selected"
;; ;;
[Aa]) [Aa]*)
echo "Advanced build selected" echo "Advanced build selected"
whichadvanced whichadvanced $btype
;; ;;
[Gg]) [Gg])
extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES extradefines="-DSTUB" # for target makefile symbol EXTRA_DEFINES
@ -2523,9 +2576,9 @@ else
fi fi
if [ -z "$gccver" ]; then if [ -z "$gccver" ]; then
echo "WARNING: The compiler you must use ($CC) is not in your path!" echo "[WARNING] The compiler you must use ($CC) is not in your path!"
echo "WARNING: this may cause your build to fail since we cannot do the" echo "[WARNING] this may cause your build to fail since we cannot do the"
echo "WARNING: checks we want now." echo "[WARNING] checks we want now."
else else
# gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't # gccver should now be "3.3.5", "3.4.3", "2.95.3-6" and similar, but don't
@ -2612,15 +2665,13 @@ if test "$CC" = "m68k-elf-gcc"; then
GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'` GCCOPTS=`echo $GCCOPTS | sed 's/ -O / -Os /'`
fi fi
if [ "1" != `parse_args --ccache` ]; then if [ "$ARG_CCACHE" = "1" ]; then
echo "Enable ccache for building" echo "Enable ccache for building"
ccache="ccache" ccache="ccache"
else elif [ "$ARG_CCACHE" = "0" ]; then
if [ "1" = `parse_args --no-ccache` ]; then ccache=`findtool ccache`
ccache=`findtool ccache` if test -n "$ccache"; then
if test -n "$ccache"; then echo "Found and uses ccache ($ccache)"
echo "Found and uses ccache ($ccache)"
fi
fi fi
fi fi
@ -2647,8 +2698,8 @@ else
defendian="ROCKBOX_LITTLE_ENDIAN" defendian="ROCKBOX_LITTLE_ENDIAN"
fi fi
if [ "1" != `parse_args --rbdir` ]; then if [ "$ARG_RBDIR" ]; then
rbdir=`parse_args --rbdir`; rbdir=$ARG_RBDIR
echo "Using alternate rockbox dir: ${rbdir}" echo "Using alternate rockbox dir: ${rbdir}"
fi fi
@ -2721,12 +2772,10 @@ fi
#### Fix the cmdline ### #### Fix the cmdline ###
if test -n "$ccache"; then if test -n "$ccache"; then
cmdline="--ccache" cmdline="--ccache "
fi fi
cmdline="$cmdline --target=\$(MODELNAME) --ram=\$(MEMORYSIZE) --rbdir=\$(RBDIR) --type=$btype" cmdline="$cmdline--target=\$(MODELNAME) --ram=\$(MEMORYSIZE) --rbdir=\$(RBDIR) --type=$btype$advopts"
### end of cmdline ### end of cmdline
sed > Makefile \ sed > Makefile \