From: Vladimír Čunát Date: Fri, 21 Oct 2016 11:38:06 +0000 (+0200) Subject: make: strip *.lua as intended since dcd89700 X-Git-Tag: v1.2.0-rc1~83^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=86ef92ea068a9c49d8d0638737b56b606362c260;p=thirdparty%2Fknot-resolver.git make: strip *.lua as intended since dcd89700 This saves a few kilobytes in the executable. Also, the name XXD seemed no longer suitable, as it does lua-specific cleaning. --- diff --git a/config.mk b/config.mk index fbed46eaa..9054705f6 100644 --- 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 diff --git a/daemon/daemon.mk b/daemon/daemon.mk index ff00fb108..fcdbde5ba 100644 --- a/daemon/daemon.mk +++ b/daemon/daemon.mk @@ -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 index 000000000..403dfa2d0 --- /dev/null +++ b/scripts/embed-lua.sh @@ -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 index 043e74afd..000000000 --- a/scripts/embed.sh +++ /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 $?