summaryrefslogtreecommitdiffstats
path: root/build/embed.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build/embed.sh')
-rwxr-xr-xbuild/embed.sh12
1 files changed, 12 insertions, 0 deletions
diff --git a/build/embed.sh b/build/embed.sh
new file mode 100755
index 0000000..8d7d0f1
--- /dev/null
+++ b/build/embed.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+# Copyright © Tavian Barnes <tavianator@tavianator.com>
+# SPDX-License-Identifier: 0BSD
+
+# Convert data into a C array like #embed
+
+set -eu
+
+{ cat; printf '\0'; } \
+ | od -An -tx1 \
+ | sed 's/\([^ ][^ ]*\)/0x\1,/g'