summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorBradley Sepos <[email protected]>2016-05-22 14:34:49 -0400
committerBradley Sepos <[email protected]>2016-06-02 13:11:13 -0400
commit4f2f1e3bf77d0f107e3fd9211fc162bdf340ed77 (patch)
treefcddc1a0c5bf4e32eb4d73a14b2d1e945cb5d5c1 /scripts
parent9c80229019a69d9599ed956c4fdd6579a0e7030b (diff)
scripts: Add script to build built-in presets.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build-presets.sh26
1 files changed, 26 insertions, 0 deletions
diff --git a/scripts/build-presets.sh b/scripts/build-presets.sh
new file mode 100755
index 000000000..da729dd5b
--- /dev/null
+++ b/scripts/build-presets.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+# usage: build-presets
+
+SELF="${BASH_SOURCE[0]}"
+BASE_DIR=$(cd $(dirname "${BASH_SOURCE[0]}") && pwd -P)
+BASE_DIR="${BASE_DIR:-$(pwd)}"
+LIBHB_DIR="${BASE_DIR}/../libhb"
+
+if ! cd "${LIBHB_DIR}"; then
+ exit 1
+fi
+
+JSON_TEMP=$(mktemp hb_builtin_presets.json.XXX)
+C_TEMP=$(mktemp hb_builtin_presets.h.XXX)
+if [[ "${JSON_TEMP:-}" == "" ]] || [[ "${C_TEMP:-}" == "" ]]; then
+ echo "unable to create temporary file" >2
+ exit 1
+fi
+"${BASE_DIR}/create_resources.py" libhb_presets.list "${JSON_TEMP}" \
+&& echo 'const char hb_builtin_presets_json[] =' > "${C_TEMP}" \
+&& "${BASE_DIR}/quotestring.py" "${JSON_TEMP}" >> "${C_TEMP}" \
+&& echo ';' >> "${C_TEMP}" \
+&& cp "${C_TEMP}" builtin_presets.h
+rm "${JSON_TEMP}" "${C_TEMP}"
+
+exit 0