]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
make: strip *.lua as intended since dcd89700
authorVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 21 Oct 2016 11:38:06 +0000 (13:38 +0200)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Fri, 21 Oct 2016 11:40:47 +0000 (13:40 +0200)
This saves a few kilobytes in the executable.
Also, the name XXD seemed no longer suitable,
as it does lua-specific cleaning.

config.mk
daemon/daemon.mk
scripts/embed-lua.sh [new file with mode: 0755]
scripts/embed.sh [deleted file]

index fbed46eaa1ec456d94fa408a9a5772da52cb35d5..9054705f65e54f22b6a9b978733616e0f9dc97a8 100644 (file)
--- a/config.mk
+++ b/config.mk
@@ -23,7 +23,7 @@ ETCDIR ?= $(PREFIX)/etc/kresd
 CC     ?= cc
 RM     := rm -f
 LN      := ln -s
-XXD     := ./scripts/embed.sh
+XXD_LUA := ./scripts/embed-lua.sh
 INSTALL := install
 
 # Flags
index ff00fb108b99bd5e6802b5ca101f82d9838c2cb9..fcdbde5ba851880cd1eec916c93df49ebb40ecbd 100644 (file)
@@ -12,7 +12,7 @@ kresd_DIST := daemon/lua/kres.lua daemon/lua/trust_anchors.lua
 
 # Embedded resources
 %.inc: %.lua
-       @$(call quiet,XXD,$<) $< > $@
+       @$(call quiet,XXD_LUA,$<) $< > $@
 ifeq ($(AMALG), yes)
 kresd.amalg.c: daemon/lua/sandbox.inc daemon/lua/config.inc
 else
diff --git a/scripts/embed-lua.sh b/scripts/embed-lua.sh
new file mode 100755 (executable)
index 0000000..403dfa2
--- /dev/null
@@ -0,0 +1,10 @@
+#!/bin/sh
+set -e
+# clean unnecessary stuff from the lua file
+alias strip="sed -e 's/^[\t ]*//g; s/  */ /g; /^--/d; /^$/d'"
+if command -v xxd > /dev/null 2>&1; then
+       strip < "$1" | xxd -i -
+else
+       strip < "$1" | hexdump -v -e '/1 "0x%02X, " " "'
+fi
+exit $?
diff --git a/scripts/embed.sh b/scripts/embed.sh
deleted file mode 100755 (executable)
index 043e74a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-alias strip="sed -e 's/^[    ]*//g; s/[ ][ ]*/ /g; /^--/d; /^$/d'"
-if command -v xxd > /dev/null 2>&1; then
-       xxd -i - < $1 | strip
-else
-       hexdump -v -e '/1 "0x%02X, " " "' < $1 | strip
-fi
-exit $?