X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=build%2Ffunctions.sh;fp=build%2Ffunctions.sh;h=0000000000000000000000000000000000000000;hp=c330d939f44826723a84816a4739d3b8a4c74a70;hb=bd62b2e6a6e5f1af5a635df3ff1a07f363d9ffe0;hpb=7ac3aee9efa7f9ce1a966df030b1f76f2b82ef2d diff --git a/build/functions.sh b/build/functions.sh deleted file mode 100755 index c330d93..0000000 --- a/build/functions.sh +++ /dev/null @@ -1,93 +0,0 @@ - - -# Print error message to stderr and exit. The error message can either be -# given as parameters or from stdin. -die() -{ - echo -n "fatal: " >/dev/stderr - if [ "x$*" != x ] - then - echo $* >/dev/stderr - else - while read line; - do - echo $line >/dev/stderr - done - fi - exit 1 -} - -# Parse an argument from an option in the form --option=argument. -parse_argument() -{ - echo $(echo $2 | sed -e "s/--$1=\\(.*\\)$/\\1/") - return $? -} - -# Insert all the escapes necessary to correctly quote a string for use in a -# shell command. -quote_string() -{ - for arg in "$@" - do - echo $1 | sed -e "s/'/\\'/g" \ - -e 's/"/\\"/g' \ - -e 's/|/\\|/g' \ - -e 's/&/\\&/g' \ - -e 's/;/\\;/g' \ - -e 's/;/\\;/g' \ - -e 's/(/\\(/g' \ - -e 's/)/\\)/g' \ - -e 's//\\>/g' \ - -e 's/ /\\ /g' \ - -e "s/\t/\\\t/g" \ - -e 's/\$/\\\$/g' - done -} - -# Add a definition to the compiler flags. The optional second parameter is -# the unquoted value. -define() -{ - if test "x$2" = x - then - defines="$defines -D$1" - else - defines="$defines -D$1=$2" - fi -} - -# Add a definition to the compiler flags with a quoted value. -define_string() -{ - arg=$(quote_string "$2") - define "$1" "\\\"$arg\\\"" -} - -undefine() -{ - for arg in "$@" - do - defines="$defines -U$arg" - done -} - -is_defined() -{ - for arg in "$@" - do - echo "$defines" | grep -e "-D$arg" 2>&1 >/dev/null || return 1 - done - return 0 -} - -is_undefined() -{ - for arg in "$@" - do - echo "$defines" | grep -e "-U$arg" 2>&1 >/dev/null || return 1 - done - return 0 -} -