Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / libvpx / source / libvpx / build / make / msvs_common.sh
1 #!/bin/bash
2 ##
3 ##  Copyright (c) 2014 The WebM project authors. All Rights Reserved.
4 ##
5 ##  Use of this source code is governed by a BSD-style license
6 ##  that can be found in the LICENSE file in the root of the source
7 ##  tree. An additional intellectual property rights grant can be found
8 ##  in the file PATENTS.  All contributing project authors may
9 ##  be found in the AUTHORS file in the root of the source tree.
10 ##
11
12 if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \
13    && cygpath --help >/dev/null 2>&1; then
14     FIXPATH='cygpath -m'
15 else
16     FIXPATH='echo'
17 fi
18
19 die() {
20     echo "${self_basename}: $@" >&2
21     exit 1
22 }
23
24 die_unknown(){
25     echo "Unknown option \"$1\"." >&2
26     echo "See ${self_basename} --help for available options." >&2
27     exit 1
28 }
29
30 fix_path() {
31     $FIXPATH "$1"
32 }
33
34 generate_uuid() {
35     local hex="0123456789ABCDEF"
36     local i
37     local uuid=""
38     local j
39     #93995380-89BD-4b04-88EB-625FBE52EBFB
40     for ((i=0; i<32; i++)); do
41         (( j = $RANDOM % 16 ))
42         uuid="${uuid}${hex:$j:1}"
43     done
44     echo "${uuid:0:8}-${uuid:8:4}-${uuid:12:4}-${uuid:16:4}-${uuid:20:12}"
45 }
46
47 indent1="    "
48 indent=""
49 indent_push() {
50     indent="${indent}${indent1}"
51 }
52 indent_pop() {
53     indent="${indent%${indent1}}"
54 }
55
56 tag_attributes() {
57     for opt in "$@"; do
58         optval="${opt#*=}"
59         [ -n "${optval}" ] ||
60             die "Missing attribute value in '$opt' while generating $tag tag"
61         echo "${indent}${opt%%=*}=\"${optval}\""
62     done
63 }
64
65 open_tag() {
66     local tag=$1
67     shift
68     if [ $# -ne 0 ]; then
69         echo "${indent}<${tag}"
70         indent_push
71         tag_attributes "$@"
72         echo "${indent}>"
73     else
74         echo "${indent}<${tag}>"
75         indent_push
76     fi
77 }
78
79 close_tag() {
80     local tag=$1
81     indent_pop
82     echo "${indent}</${tag}>"
83 }
84
85 tag() {
86     local tag=$1
87     shift
88     if [ $# -ne 0 ]; then
89         echo "${indent}<${tag}"
90         indent_push
91         tag_attributes "$@"
92         indent_pop
93         echo "${indent}/>"
94     else
95         echo "${indent}<${tag}/>"
96     fi
97 }
98