This repository has been archived by the owner on Aug 3, 2022. It is now read-only.
mirrored from https://chromium.googlesource.com/webm/webmdshow
-
Notifications
You must be signed in to change notification settings - Fork 14
/
release.sh
208 lines (184 loc) · 5.45 KB
/
release.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
#!/bin/sh
##
## Copyright (c) 2014 The WebM project authors. All Rights Reserved.
##
## Use of this source code is governed by a BSD-style license
## that can be found in the LICENSE file in the root of the source
## tree. An additional intellectual property rights grant can be found
## in the file PATENTS. All contributing project authors may
## be found in the AUTHORS file in the root of the source tree.
##
. $(dirname $0)/common/common.sh
cleanup() {
local readonly res=$?
cd "${ORIG_PWD}"
if [ $res -ne 0 ]; then
elog "cleanup() trapped error"
fi
if [ "${KEEP_RELEASE_DIR}" != "yes" ] && [ -n "${RELEASE_DIR}" ]; then
rm -rf "${RELEASE_DIR}"
fi
}
release_usage() {
cat << EOF
Usage: ${0##*/} [arguments]
--help: Display this message and exit.
--keep-release-dir: Keep the release directory after archiving.
--show-program-output: Show output from each step.
--verbose: Show more output.
--version: Dotted version number for this release (loaded from git repo
if not specified).
Note: The 7-zip (7za.exe) and NSIS (makensis.exe) command line tools must be
in your path.
Builds webmdshow-VERSION.zip:
webmdshow-VERSION/
inc/
vp8decoder.idl
vp8decoderidl.c
vp8decoderidl.h
vp8encoder.idl
vp8encoderidl.c
vp8encoderidl.h
vp9decoder.idl
vp9decoderidl.c
vp9decoderidl.h
vpxdecoder.idl
vpxdecoderidl.c
vpxdecoderidl.h
webmmux.idl
webmmuxidl.c
webmmuxidl.h
src/
vorbistypes.cc
vorbistypes.h
webmtypes.cc
webmtypes.h
AUTHORS.TXT
LICENSE.TXT
PATENTS.TXT
README.TXT
install_webmdshow.exe
makewebm.exe
playwebm.exe
This script must be run from the directory containing the webmdshow
repository from which the release was built.
EOF
}
trap cleanup EXIT
KEEP_RELEASE_DIR=""
WEBMDSHOW="webmdshow"
# Parse the command line.
while [ -n "$1" ]; do
case "$1" in
--help)
release_usage
exit
;;
--keep-release-dir)
KEEP_RELEASE_DIR="yes"
;;
--show-program-output)
devnull=
;;
--verbose)
VERBOSE="yes"
;;
--version)
VERSION="$2"
shift
;;
--webmdshow)
WEBMDSHOW="$2"
shift
;;
*)
release_usage
exit 1
;;
esac
shift
done
check_tool 7za.exe
check_tool makensis.exe -version # We must pass -version to makensis; it
# returns a failure code to the shell
# when run without parameters.
if [ -z "${VERSION}" ]; then
cd "${WEBMDSHOW}"
VERSION="$(git tag | grep webmdshow | tail -n1 | tr -d "webmdshow-")"
cd "${ORIG_PWD}"
fi
if [ -z "${VERSION}" ]; then
elog "Unable to read version from webmdshow repo and none provided."
exit 1
fi
readonly RELEASE_DIR="webmdshow-${VERSION}"
readonly RELEASE_ZIP="${RELEASE_DIR}.zip"
if [ -z "${RELEASE_DIR}" ] || [ -z "${RELEASE_ZIP}" ]; then
elog "Empty release archive and/or directory names."
exit 1
fi
if [ ! -d "${WEBMDSHOW}" ] || [ ! -d "dll" ] || [ ! -d "exe" ]; then
elog "Missing webmdshow and/or dll and/or exe directory."
release_usage
exit
fi
if [ "${VERBOSE}" = "yes" ]; then
cat <<EOF
RELEASE_DIR=${RELEASE_DIR}
RELEASE_ZIP=${RELEASE_ZIP}
VERSION=${VERSION}
WEBMDSHOW=${WEBMDSHOW}
EOF
fi
# Create the empty directory structure for the archive.
vlog "*** Creating directories. ***"
eval mkdir -p ${RELEASE_DIR}/inc ${devnull}
eval mkdir -p ${RELEASE_DIR}/src ${devnull}
# Copy IDL files (and their generated .c and .h file counterparts) to
# ${RELEASE_DIR}/inc/.
vlog "*** Copying interface files. ***"
readonly IDL_BASE_NAMES="vp8decoder vp8encoder vp9decoder vpxdecoder webmmux"
readonly IDL_DIR="${RELEASE_DIR}/inc"
for idlbase in ${IDL_BASE_NAMES}; do
eval cp -p "${WEBMDSHOW}/IDL/${idlbase}.idl" "${IDL_DIR}" ${devnull}
eval cp -p "${WEBMDSHOW}/IDL/${idlbase}idl.c" "${IDL_DIR}" ${devnull}
eval cp -p "${WEBMDSHOW}/IDL/${idlbase}idl.h" "${IDL_DIR}" ${devnull}
done
# Copy sources for Vorbis and WebM types.
vlog "*** Copying source files. ***"
readonly SRC_BASE_NAMES="vorbistypes webmtypes"
readonly SRC_DIR="${RELEASE_DIR}/src"
for srcbase in ${SRC_BASE_NAMES}; do
eval cp -p "${WEBMDSHOW}/common/${srcbase}.cc" "${SRC_DIR}" ${devnull}
eval cp -p "${WEBMDSHOW}/common/${srcbase}.h" "${SRC_DIR}" ${devnull}
done
# Copy executables.
vlog "*** Copying executables. ***"
readonly EXE_FILES="makewebm.exe playwebm.exe"
readonly EXE_BUILD_DIR="exe/webmdshow/Release"
for exe in ${EXE_FILES}; do
eval cp -p "${EXE_BUILD_DIR}/${exe}" "${RELEASE_DIR}" ${devnull}
done
# Copy text files.
vlog "*** Copying text files. ***"
readonly TEXT_FILES="AUTHORS.TXT LICENSE.TXT PATENTS.TXT README.TXT"
for text_file in ${TEXT_FILES}; do
eval cp -p "${WEBMDSHOW}/${text_file}" "${RELEASE_DIR}" ${devnull}
done
# Build the installer and copy it to ${RELEASE_DIR}.
vlog "*** Building installer. ***"
readonly INSTALLER_DIR="${WEBMDSHOW}/installer"
readonly INSTALLER="install_webmdshow.exe"
if [ -e "${INSTALLER_DIR}/${INSTALLER}" ]; then
eval rm -f "${INSTALLER_DIR}/${INSTALLER}" ${devnull}
fi
eval makensis.exe "${INSTALLER_DIR}/webmdshow.nsi" ${devnull}
if [ ! -e "${INSTALLER_DIR}/${INSTALLER}" ]; then
elog "Installer build failed."
exit 1
fi
eval mv "${INSTALLER_DIR}/${INSTALLER}" "${RELEASE_DIR}" ${devnull}
# Create the archive.
vlog "*** Creating ${RELEASE_ZIP} ***"
eval 7za.exe a -tzip "${RELEASE_ZIP}" "${RELEASE_DIR}" ${devnull}
vlog "Done."