Initial WebM release
[libvpx.git] / build / make / gen_msvs_def.sh
blob68b240624de648a65cf9da836bdd80b16c27df4d
1 #!/bin/bash
2 ##
3 ## Copyright (c) 2010 The VP8 project authors. All Rights Reserved.
4 ##
5 ## Use of this source code is governed by a BSD-style license and patent
6 ## grant that can be found in the LICENSE file in the root of the source
7 ## tree. All contributing project authors may be found in the AUTHORS
8 ## file in the root of the source tree.
9 ##
12 self=$0
13 self_basename=${self##*/}
14 EOL=$'\n'
16 show_help() {
17 cat <<EOF
18 Usage: ${self_basename} [options] file1 [file2 ...]
20 This script generates a MSVC module definition file containing a list of symbols
21 to export from a DLL. Source files are technically bash scripts (and thus may
22 use #comment syntax) but in general, take the form of a list of symbols:
24 <kind> symbol1 [symbol2, symbol3, ...]
26 where <kind> is either 'text' or 'data'
29 Options:
30 --help Print this message
31 --out=filename Write output to a file [stdout]
32 --name=project_name Name of the library (required)
33 EOF
34 exit 1
37 die() {
38 echo "${self_basename}: $@"
39 exit 1
42 die_unknown(){
43 echo "Unknown option \"$1\"."
44 echo "See ${self_basename} --help for available options."
45 exit 1
48 text() {
49 for sym in "$@"; do
50 echo " $sym" >> ${outfile}
51 done
54 data() {
55 for sym in "$@"; do
56 printf " %-40s DATA\n" "$sym" >> ${outfile}
57 done
60 # Process command line
61 for opt in "$@"; do
62 optval="${opt#*=}"
63 case "$opt" in
64 --help|-h) show_help
66 --out=*) outfile="$optval"
68 --name=*) name="${optval}"
70 -*) die_unknown $opt
72 *) file_list[${#file_list[@]}]="$opt"
73 esac
74 done
75 outfile=${outfile:-/dev/stdout}
76 [ -n "$name" ] || die "Library name (--name) must be specified!"
78 echo "LIBRARY ${name}" > ${outfile}
79 echo "EXPORTS" >> ${outfile}
80 for f in "${file_list[@]}"; do
81 . $f
82 done