OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 ## | 2 ## |
3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. | 3 ## Copyright (c) 2014 The WebM project authors. All Rights Reserved. |
4 ## | 4 ## |
5 ## Use of this source code is governed by a BSD-style license | 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 | 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 | 7 ## tree. An additional intellectual property rights grant can be found |
8 ## in the file PATENTS. All contributing project authors may | 8 ## in the file PATENTS. All contributing project authors may |
9 ## be found in the AUTHORS file in the root of the source tree. | 9 ## be found in the AUTHORS file in the root of the source tree. |
10 ## | 10 ## |
11 | 11 |
12 if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \ | 12 if [ "$(uname -o 2>/dev/null)" = "Cygwin" ] \ |
13 && cygpath --help >/dev/null 2>&1; then | 13 && cygpath --help >/dev/null 2>&1; then |
14 FIXPATH='cygpath -m' | 14 FIXPATH='cygpath -m' |
15 else | 15 else |
16 FIXPATH='echo' | 16 FIXPATH='echo_path' |
17 fi | 17 fi |
18 | 18 |
19 die() { | 19 die() { |
20 echo "${self_basename}: $@" >&2 | 20 echo "${self_basename}: $@" >&2 |
21 exit 1 | 21 exit 1 |
22 } | 22 } |
23 | 23 |
24 die_unknown(){ | 24 die_unknown(){ |
25 echo "Unknown option \"$1\"." >&2 | 25 echo "Unknown option \"$1\"." >&2 |
26 echo "See ${self_basename} --help for available options." >&2 | 26 echo "See ${self_basename} --help for available options." >&2 |
27 exit 1 | 27 exit 1 |
28 } | 28 } |
29 | 29 |
| 30 echo_path() { |
| 31 for path; do |
| 32 echo "$path" |
| 33 done |
| 34 } |
| 35 |
| 36 # Output one, possibly changed based on the system, path per line. |
30 fix_path() { | 37 fix_path() { |
31 $FIXPATH "$1" | 38 $FIXPATH "$@" |
| 39 } |
| 40 |
| 41 # Corrects the paths in file_list in one pass for efficiency. |
| 42 fix_file_list() { |
| 43 # TODO(jzern): this could be more generic and take the array as a param. |
| 44 files=$(fix_path "${file_list[@]}") |
| 45 local IFS=$'\n' |
| 46 file_list=($files) |
32 } | 47 } |
33 | 48 |
34 generate_uuid() { | 49 generate_uuid() { |
35 local hex="0123456789ABCDEF" | 50 local hex="0123456789ABCDEF" |
36 local i | 51 local i |
37 local uuid="" | 52 local uuid="" |
38 local j | 53 local j |
39 #93995380-89BD-4b04-88EB-625FBE52EBFB | 54 #93995380-89BD-4b04-88EB-625FBE52EBFB |
40 for ((i=0; i<32; i++)); do | 55 for ((i=0; i<32; i++)); do |
41 (( j = $RANDOM % 16 )) | 56 (( j = $RANDOM % 16 )) |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 echo "${indent}<${tag}" | 104 echo "${indent}<${tag}" |
90 indent_push | 105 indent_push |
91 tag_attributes "$@" | 106 tag_attributes "$@" |
92 indent_pop | 107 indent_pop |
93 echo "${indent}/>" | 108 echo "${indent}/>" |
94 else | 109 else |
95 echo "${indent}<${tag}/>" | 110 echo "${indent}<${tag}/>" |
96 fi | 111 fi |
97 } | 112 } |
98 | 113 |
OLD | NEW |