remove executable bit
[libvpx.git] / build / make / gen_msvs_def.sh
blob4defcc2e7c7e5f25339c5a23ac9a57b4c7aec36f
1 #!/bin/bash
2 ##
3 ## Copyright (c) 2010 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.
13 self=$0
14 self_basename=${self##*/}
15 EOL=$'\n'
17 show_help() {
18 cat <<EOF
19 Usage: ${self_basename} [options] file1 [file2 ...]
21 This script generates a MSVC module definition file containing a list of symbols
22 to export from a DLL. Source files are technically bash scripts (and thus may
23 use #comment syntax) but in general, take the form of a list of symbols:
25 <kind> symbol1 [symbol2, symbol3, ...]
27 where <kind> is either 'text' or 'data'
30 Options:
31 --help Print this message
32 --out=filename Write output to a file [stdout]
33 --name=project_name Name of the library (required)
34 EOF
35 exit 1
38 die() {
39 echo "${self_basename}: $@"
40 exit 1
43 die_unknown(){
44 echo "Unknown option \"$1\"."
45 echo "See ${self_basename} --help for available options."
46 exit 1
49 text() {
50 for sym in "$@"; do
51 echo " $sym" >> ${outfile}
52 done
55 data() {
56 for sym in "$@"; do
57 printf " %-40s DATA\n" "$sym" >> ${outfile}
58 done
61 # Process command line
62 for opt in "$@"; do
63 optval="${opt#*=}"
64 case "$opt" in
65 --help|-h) show_help
67 --out=*) outfile="$optval"
69 --name=*) name="${optval}"
71 -*) die_unknown $opt
73 *) file_list[${#file_list[@]}]="$opt"
74 esac
75 done
76 outfile=${outfile:-/dev/stdout}
77 [ -n "$name" ] || die "Library name (--name) must be specified!"
79 echo "LIBRARY ${name}" > ${outfile}
80 echo "EXPORTS" >> ${outfile}
81 for f in "${file_list[@]}"; do
82 . $f
83 done