forked from ValveSoftware/steam-runtime
-
Notifications
You must be signed in to change notification settings - Fork 0
/
make-sdk.sh
executable file
·66 lines (57 loc) · 1.6 KB
/
make-sdk.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
#!/bin/bash
#
# Script to build the set of runtime archives for distribution
# The top level directory
TOP=$(cd "${0%/*}" && echo "${PWD}")
cd "${TOP}"
# We'll compress with xz
# If this changes you need to update sdk/setup.sh
ARCHIVE_EXT="tar.xz"
function ExitUsage()
{
echo "Usage: $0 [--version=<value>] [<output-path>]" >&2
exit 1
}
# Process command line options
while [ "$1" != "" ]; do
case "$1" in
--version=*)
VERSION=$(expr "$1" : '[^=]*=\(.*\)')
shift
;;
*)
if [ "$ARCHIVE_OUTPUT_DIR" = "" ]; then
ARCHIVE_OUTPUT_DIR="$1"
else
ExitUsage
fi
shift
break
esac
done
if [ -z "${VERSION}" ]; then
VERSION="$(date +%F)"
fi
if [ -z "${ARCHIVE_OUTPUT_DIR}" ]; then
ARCHIVE_OUTPUT_DIR="/tmp/steam-runtime"
fi
# Figure out our runtime name
SDK_NAME="steam-runtime-sdk_${VERSION}"
# Create the temporary output path
WORKDIR=tmp/${SDK_NAME}
rm -rf ${WORKDIR}
mkdir -p ${WORKDIR}
cp -a sdk/* ${WORKDIR}
chmod u+w -R ${WORKDIR}
# Pack it up!
ARCHIVE_NAME="${SDK_NAME}.${ARCHIVE_EXT}"
ARCHIVE="${ARCHIVE_OUTPUT_DIR}/${ARCHIVE_NAME}"
echo "Creating ${ARCHIVE}"
mkdir -p "${ARCHIVE_OUTPUT_DIR}"
(cd tmp; tar caf "${ARCHIVE}" ${SDK_NAME}) || exit 4
(cd "${ARCHIVE_OUTPUT_DIR}"; md5sum "${ARCHIVE_NAME}" >"${ARCHIVE}.md5")
(cd "${ARCHIVE_OUTPUT_DIR}"; ln -sf "${ARCHIVE_NAME}" $(echo "${ARCHIVE_NAME}" | sed "s,${VERSION},latest,"))
(cd "${ARCHIVE_OUTPUT_DIR}"; ln -sf "${ARCHIVE_NAME}.md5" $(echo "${ARCHIVE_NAME}" | sed "s,${VERSION},latest,").md5)
ls -l "${ARCHIVE}"
rm -rf ${WORKDIR}
# vi: ts=4 sw=4 expandtab