More flexible for various platforms.
git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@795 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
ESC=""
|
||||
ESC=`printf "\x1b"`
|
||||
ANSI_BOLD="${ESC}[1m"
|
||||
ANSI_NORMAL="${ESC}[0m"
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ usage() {
|
||||
|
||||
# The actual recursing function
|
||||
build_recurse() {
|
||||
local FILES SUBDIRS
|
||||
typeset FILES SUBDIRS
|
||||
# Perform an action for this dir
|
||||
eval FILES="\${$BUILD_FILES_VAR}"
|
||||
for FILE in $FILES; do
|
||||
@@ -69,7 +69,7 @@ build_dependancies() {
|
||||
|
||||
# Recursively build dependancy information
|
||||
build_rec_dependancies() {
|
||||
local DEPEND_FILE EXTRA_OFILES
|
||||
typeset DEPEND_FILE EXTRA_OFILES
|
||||
|
||||
echo "Building dependancy information..." 1>&2
|
||||
|
||||
@@ -103,7 +103,7 @@ build_collect_extra_o_files() {
|
||||
|
||||
# Recursively collect .o-files
|
||||
build_rec_collect_o_files() {
|
||||
local EXTRA_OFILES
|
||||
typeset EXTRA_OFILES
|
||||
|
||||
BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES
|
||||
export BUILD_FILES_VAR
|
||||
@@ -139,7 +139,7 @@ build_clean_dir() {
|
||||
}
|
||||
|
||||
build_clean() {
|
||||
local DEPEND_FILE
|
||||
typeset DEPEND_FILE
|
||||
eval DEPEND_FILE=".depend.\${${BUILD_PROJECT}_NAME%/}"
|
||||
rm -f "$DEPEND_FILE" build.vars config.state src/config.h
|
||||
BUILD_FILES_VAR=${BUILD_PROJECT}_CFILES
|
||||
@@ -183,7 +183,7 @@ build_check_dependencies() {
|
||||
|
||||
# Description: check if the program is compiled, and otherwise compile
|
||||
build_check_compile() {
|
||||
local NAME
|
||||
typeset NAME
|
||||
eval NAME="\${${BUILD_PROJECT}_NAME}"
|
||||
[ ! -e "$NAME" ] || return
|
||||
|
||||
@@ -192,7 +192,7 @@ build_check_compile() {
|
||||
|
||||
# Install the program
|
||||
build_install() {
|
||||
local BINS LIBS SRC DEST DESTDIR BINDIR LIBDIR
|
||||
typeset BINS LIBS SRC DEST DESTDIR BINDIR LIBDIR
|
||||
|
||||
echo "Installing libraries..." 2>&1
|
||||
eval LIBS="\${${BUILD_PROJECT}_INSTALL_LIBS}"
|
||||
|
||||
@@ -107,7 +107,7 @@ lexlt() {
|
||||
# Description: check if a program is present in the path
|
||||
# Arguments:
|
||||
have_program() {
|
||||
local TEMP_NAME TEMP_FILE TEMP_VERSION
|
||||
typeset TEMP_NAME TEMP_FILE TEMP_VERSION
|
||||
|
||||
eval eval TEMP_NAME="\\\"\$PROG_${1}_NAME\\\""
|
||||
if [ -z "$TEMP_NAME" ]; then
|
||||
@@ -151,7 +151,7 @@ but version $2 is required!"
|
||||
# Returns: 0 - if the library is found
|
||||
# 1 - if the library is not found
|
||||
have_library() {
|
||||
local LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \
|
||||
typeset LIB TEMP_NAME TEMP_PRESENT TEMP_LDFLAGS TEMP_CFLAGS \
|
||||
TEMP_VERSION
|
||||
|
||||
LIB="$1"
|
||||
@@ -213,7 +213,7 @@ but version $2 is required"
|
||||
# LIB_${1}_LDFLAGS are expected to exist. If two arguments are
|
||||
# supplied, so is LIB_${1}_VERSION.
|
||||
use_library() {
|
||||
local TEMP_CFLAGS TEMP_LDFLAGS
|
||||
typeset TEMP_CFLAGS TEMP_LDFLAGS
|
||||
have_library "$@"
|
||||
[ $? -eq 0 ] || exit 1
|
||||
|
||||
@@ -227,7 +227,7 @@ use_library() {
|
||||
# Description: check if a symbol is defined.
|
||||
# Arguments: $1 - the name of the symbol
|
||||
have_symbol() {
|
||||
local SYMBOL
|
||||
typeset SYMBOL
|
||||
SYMBOL="$1"
|
||||
|
||||
# TODO: I'll want the include handling to be done differently
|
||||
@@ -256,7 +256,7 @@ EOF
|
||||
# name of the symbol.
|
||||
# Arguments: $1 - the name of the symbol
|
||||
define_have_symbol() {
|
||||
local NAME VALUE
|
||||
typeset NAME VALUE
|
||||
NAME=`$TR a-z A-Z << EOF
|
||||
$1
|
||||
EOF
|
||||
@@ -271,7 +271,7 @@ EOF
|
||||
# Description: check if a header is available.
|
||||
# Arguments: $1 - the name of the header file
|
||||
have_header() {
|
||||
local HEADER
|
||||
typeset HEADER
|
||||
HEADER="$1"
|
||||
|
||||
try_compile_c "$TEMP_CFLAGS" "$TEMP_LDFLAGS" << EOF 2>&1 > /dev/null
|
||||
@@ -293,7 +293,7 @@ EOF
|
||||
# name of the header file. "sys/time.h" becomes "SYS_TIME_H".
|
||||
# Arguments: $1 - the name of the symbol
|
||||
define_have_header() {
|
||||
local NAME VALUE
|
||||
typeset NAME VALUE
|
||||
NAME=`$TR /.a-z __A-Z << EOF
|
||||
$1
|
||||
EOF
|
||||
@@ -312,7 +312,7 @@ EOF
|
||||
# Arguments: $1 - the symbol to add
|
||||
# $2 - the value of the symbol
|
||||
add_symbol() {
|
||||
local NAME
|
||||
typeset NAME
|
||||
|
||||
eval NAME="$1"
|
||||
eval "$NAME"=\"\$2\"
|
||||
@@ -349,7 +349,7 @@ EOF
|
||||
# If a filename doesn't end on .in, that filename is used
|
||||
# as target, and the filename with .in attached as source.
|
||||
substitute_vars() {
|
||||
local VARS VAR VALUE FILES FILE
|
||||
typeset VARS VAR VALUE FILES FILE
|
||||
|
||||
eval VARS=\"\$$1\"
|
||||
eval FILES=\"\$$2\"
|
||||
|
||||
@@ -57,7 +57,7 @@ EOF
|
||||
# Arguments: $1 - the type of menu item
|
||||
# $2 - the name of the menu item
|
||||
menu_init() {
|
||||
local INIT_FUN
|
||||
typeset INIT_FUN
|
||||
|
||||
eval INIT_FUN="\$MENU_ITEM_TYPE_$1_INIT"
|
||||
"$INIT_FUN" "$2"
|
||||
@@ -66,7 +66,7 @@ menu_init() {
|
||||
# Description: Initialise this menu
|
||||
# Arguments: $1 - the name of the menu
|
||||
menu_init_menu() {
|
||||
local MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
typeset MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
|
||||
MENU="$1"
|
||||
eval TEMP_ITEMS="\$MENU_${MENU}_ITEMS"
|
||||
@@ -82,7 +82,7 @@ menu_init_menu() {
|
||||
# Returns: 0 - if the choice is available
|
||||
# 1 - if the choice is not available
|
||||
menu_have_choice() {
|
||||
local MENU CHOICE TEMP_VALID TEMP_PRECOND
|
||||
typeset MENU CHOICE TEMP_VALID TEMP_PRECOND
|
||||
MENU="$1"
|
||||
CHOICE="$2"
|
||||
eval TEMP_VALID="\$CHOICE_${MENU}_OPTION_${CHOICE}_VALID"
|
||||
@@ -101,7 +101,7 @@ menu_have_choice() {
|
||||
# Description: Initialise this choice menu
|
||||
# Arguments: $1 - the name of the choice menu
|
||||
menu_init_choice() {
|
||||
local MENU TEMP_VALUE TEMP_DEFAULT TEMP_OPTIONS OPTION TEMP_TITLE
|
||||
typeset MENU TEMP_VALUE TEMP_DEFAULT TEMP_OPTIONS OPTION TEMP_TITLE
|
||||
MENU="$1"
|
||||
eval TEMP_VALUE="\$CHOICE_${MENU}_VALUE"
|
||||
eval TEMP_DEFAULT="\$CHOICE_${MENU}_DEFAULT"
|
||||
@@ -121,7 +121,7 @@ menu_init_choice() {
|
||||
# Description: Initialise this input menu
|
||||
# Arguments: $1 - the name of the input menu
|
||||
menu_init_input() {
|
||||
local MENU TEMP_VALUE TEMP_DEFAULT
|
||||
typeset MENU TEMP_VALUE TEMP_DEFAULT
|
||||
MENU="$1"
|
||||
eval TEMP_VALUE="\$INPUT_${MENU}_VALUE"
|
||||
if [ -z "$TEMP_VALUE" ]; then
|
||||
@@ -136,7 +136,7 @@ menu_init_input() {
|
||||
# $2 - the name of the menu item
|
||||
# Outputs: The string describing the value of the menu item
|
||||
menu_print_value() {
|
||||
local PRINT_VALUE
|
||||
typeset PRINT_VALUE
|
||||
|
||||
eval PRINT_VALUE="\$MENU_ITEM_TYPE_$1_PRINT_VALUE"
|
||||
"$PRINT_VALUE" "$2"
|
||||
@@ -153,7 +153,7 @@ menu_print_value_menu() {
|
||||
# Arguments: $1 - the name of the choice menu item
|
||||
# Outputs: The string describing the value of this choice menu
|
||||
menu_print_value_choice() {
|
||||
local TEMP_VALUE TEMP_TITLE
|
||||
typeset TEMP_VALUE TEMP_TITLE
|
||||
eval TEMP_VALUE="\$CHOICE_$1_VALUE"
|
||||
eval TEMP_TITLE=\"\$CHOICE_$1_OPTION_${TEMP_VALUE}_TITLE\"
|
||||
cat << EOF
|
||||
@@ -165,7 +165,7 @@ EOF
|
||||
# Arguments: $1 - the name of the input menu item
|
||||
# Outputs: The value of the given input menu
|
||||
menu_print_value_input() {
|
||||
local TEMP_VALUE TEMP_TITLE
|
||||
typeset TEMP_VALUE TEMP_TITLE
|
||||
eval TEMP_VALUE="\$INPUT_$1_VALUE"
|
||||
cat << EOF
|
||||
$TEMP_VALUE
|
||||
@@ -177,7 +177,7 @@ EOF
|
||||
# $2 - the name of the menu item
|
||||
# Outputs: The string describing the value of the menu item
|
||||
menu_handle() {
|
||||
local HANDLER
|
||||
typeset HANDLER
|
||||
|
||||
eval HANDLER="\$MENU_ITEM_TYPE_$1_HANDLER"
|
||||
"$HANDLER" "$2"
|
||||
@@ -186,7 +186,7 @@ menu_handle() {
|
||||
# Description: Process a menu-type menu item
|
||||
# Arguments: $1 - The name of the menu
|
||||
menu_handle_menu() {
|
||||
local TEMP_ITEMS I CHOICE NUM_ITEMS TEMP_TYPE MENU ITEM TEMP_TITLE
|
||||
typeset TEMP_ITEMS I CHOICE NUM_ITEMS TEMP_TYPE MENU ITEM TEMP_TITLE
|
||||
eval TEMP_ITEMS="\$MENU_$1_ITEMS"
|
||||
|
||||
MENU="$1"
|
||||
@@ -248,7 +248,7 @@ EOF
|
||||
# Description: Process a choice-type menu item
|
||||
# Arguments: $1 - The name of the menu
|
||||
menu_handle_choice() {
|
||||
local TEMP_OPTIONS I CHOICE NUM_OPTIONS TEMP_TYPE MENU OPTION \
|
||||
typeset TEMP_OPTIONS I CHOICE NUM_OPTIONS TEMP_TYPE MENU OPTION \
|
||||
TEMP_VALUE TEMP_TITLE SELECTED
|
||||
eval TEMP_OPTIONS="\$CHOICE_$1_OPTIONS"
|
||||
|
||||
@@ -335,7 +335,7 @@ EOF
|
||||
# Description: Process an input-type menu item
|
||||
# Arguments: $1 - The name of the menu
|
||||
menu_handle_input() {
|
||||
local ITEM TEMP_TITLE TEMP_VALUE TEMP_DEFAULT NEW_VALUE TEMP_VALIDATOR
|
||||
typeset ITEM TEMP_TITLE TEMP_VALUE TEMP_DEFAULT NEW_VALUE TEMP_VALIDATOR
|
||||
|
||||
ITEM="$1"
|
||||
eval TEMP_TITLE="\$INPUT_${ITEM}_TITLE"
|
||||
@@ -376,7 +376,7 @@ EOF
|
||||
# $2 - the name of the menu item
|
||||
# Outputs: The string describing the value of the menu item
|
||||
menu_save() {
|
||||
local SAVE_FUN
|
||||
typeset SAVE_FUN
|
||||
eval SAVE_FUN="\$MENU_ITEM_TYPE_$1_SAVE"
|
||||
"$SAVE_FUN" "$2"
|
||||
}
|
||||
@@ -386,7 +386,7 @@ menu_save() {
|
||||
# Arguments: $1 - the name of the menu
|
||||
# Outputs: The string describing the value of the menu
|
||||
menu_save_menu() {
|
||||
local MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
typeset MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
|
||||
MENU="$1"
|
||||
eval TEMP_ITEMS="\$MENU_${MENU}_ITEMS"
|
||||
@@ -401,7 +401,7 @@ menu_save_menu() {
|
||||
# Arguments: $1 - the name of the choice menu
|
||||
# Outputs: The string describing the value of the choice menu
|
||||
menu_save_choice() {
|
||||
local MENU TEMP_VALUE
|
||||
typeset MENU TEMP_VALUE
|
||||
MENU="$1"
|
||||
eval TEMP_VALUE="\$CHOICE_${MENU}_VALUE"
|
||||
cat << EOF
|
||||
@@ -414,7 +414,7 @@ EOF
|
||||
# Arguments: $1 - the name of the input menu
|
||||
# Outputs: The string describing the value of the input menu
|
||||
menu_save_input() {
|
||||
local MENU TEMP_VALUE
|
||||
typeset MENU TEMP_VALUE
|
||||
MENU="$1"
|
||||
eval TEMP_VALUE="\$INPUT_${MENU}_VALUE"
|
||||
cat << EOF
|
||||
@@ -427,7 +427,7 @@ EOF
|
||||
# Arguments: $1 - the type of menu item
|
||||
# $2 - the name of the menu item
|
||||
menu_process() {
|
||||
local PROCESS_FUN
|
||||
typeset PROCESS_FUN
|
||||
eval PROCESS_FUN="\$MENU_ITEM_TYPE_$1_PROCESS"
|
||||
"$PROCESS_FUN" "$2"
|
||||
}
|
||||
@@ -436,7 +436,7 @@ menu_process() {
|
||||
# for a menu.
|
||||
# Arguments: $1 - the name of the menu
|
||||
menu_process_menu() {
|
||||
local MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
typeset MENU TEMP_ITEMS ITEM TEMP_TYPE
|
||||
|
||||
MENU="$1"
|
||||
eval TEMP_ITEMS="\$MENU_${MENU}_ITEMS"
|
||||
@@ -450,7 +450,7 @@ menu_process_menu() {
|
||||
# a choice menu.
|
||||
# Arguments: $1 - the name of the choice menu
|
||||
menu_process_choice() {
|
||||
local MENU TEMP_VALUE TEMP_ACTION
|
||||
typeset MENU TEMP_VALUE TEMP_ACTION
|
||||
MENU="$1"
|
||||
eval TEMP_VALUE="\$CHOICE_${MENU}_VALUE"
|
||||
eval TEMP_ACTION="\$CHOICE_${MENU}_OPTION_${TEMP_VALUE}_ACTION"
|
||||
|
||||
Reference in New Issue
Block a user