From dcd8970010e136d2f48c2f92e663a9b1bf791e42 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marek=20Vavru=C5=A1a?= <marek.vavrusa@nic.cz>
Date: Mon, 18 May 2015 21:02:58 +0200
Subject: [PATCH] scripts: embed/minify scripts in C code

---
 config.mk        | 2 +-
 scripts/embed.sh | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)
 create mode 100755 scripts/embed.sh

diff --git a/config.mk b/config.mk
index e8c4f46f4..17ec10a4f 100644
--- a/config.mk
+++ b/config.mk
@@ -16,6 +16,6 @@ CFLAGS	+= -std=c99 -D_GNU_SOURCE -Wall -fPIC -I$(abspath .) -I$(abspath lib/gene
 CFLAGS  += -DPACKAGE_VERSION="\"$(MAJOR).$(MINOR)\"" -DPREFIX="\"$(PREFIX)\"" -DMODULEDIR="\"$(MODULEDIR)\""
 RM	:= rm -f
 LN      := ln -s
-XXD     ?= hexdump -v -e '/1 "0x%02X, " " "'
+XXD     := ./scripts/embed.sh
 INSTALL := install
 PYTHON  := python
diff --git a/scripts/embed.sh b/scripts/embed.sh
new file mode 100755
index 000000000..1f57b8741
--- /dev/null
+++ b/scripts/embed.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+set -e
+alias strip="sed -e 's/^[    ]*//g; s/[ ][ ]*/ /g; /^--/d; /^$/d'"
+if hash xxd 2>/dev/null; then
+	xxd -i - < $1 | strip
+else
+	hexdump -v -e '/1 "0x%02X, " " "' < $1 | strip
+fi
-- 
GitLab