From 3beab989344d50bfed9d9d6f5bd207ca97808fc7 Mon Sep 17 00:00:00 2001 From: Mitch Riedstra Date: Fri, 9 Mar 2018 01:38:22 -0500 Subject: Added OS check in target 'vis-single-payload.inc' Reading through the Github issues,it sounds as if this was meant for Linux and the if statement reflects that. If that's not the case it can be changed. ( https://github.com/martanne/vis/issues/162 ) FreeBSD's `od` has a different format compared to the GNU Coreutils version. The output format is also a little bit different. For some reason both `sed` and `gsed` on FreeBSD can't find the end of file if commands have been previously passed with `-e` so I pipe from sed into sed again. Added `-f -` to both tar commands to make it obvious as to where the output is going. --- Makefile | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 2026c24..51eb407 100644 --- a/Makefile +++ b/Makefile @@ -72,9 +72,27 @@ vis-single-payload.inc: $(EXECUTABLES) lua/* echo '#ifndef VIS_SINGLE_PAYLOAD_H' > $@ echo '#define VIS_SINGLE_PAYLOAD_H' >> $@ echo 'static unsigned char vis_single_payload[] = {' >> $@ - tar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 --numeric-owner --mode='a+rX-w' -c \ - $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) | xz -T 1 | \ - od -t x1 -A none -v | sed 's/\([0-9a-f]\+\)/0x\1,/g;$$s/,$$/ };/' >> $@ + if [ "$$(uname)" = "Linux" ] ; then \ + tar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 --numeric-owner \ + --mode='a+rX-w' \ + -c $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) \ + -f - \ + | xz -T 1 \ + | od -t x1 -A none -v \ + | sed 's/\([0-9a-f]\+\)/0x\1,/g;$$s/,$$/ };/' >> $@ ; \ + elif [ "$$(uname)" = "FreeBSD" ] ; then \ + gtar --mtime='2014-07-15 01:23Z' --owner=0 --group=0 \ + --numeric-owner --mode='a+rX-w' \ + -c $(EXECUTABLES) $$(find lua -name '*.lua' | LC_ALL=C sort) \ + -f - \ + | xz -T 1 \ + | od -t x1 -v \ + | sed -Ee's/^[0-9a-fA-F]+//' \ + -e's/([0-9a-f]+)/0x\1,/g' \ + -e'/^[ ]*$$/d' \ + | sed -Ee'$$ s/,[^0-9a-f]*$$/ };/' \ + >> $@ ;\ + fi echo '#endif' >> $@ vis-single: vis-single.c vis-single-payload.inc -- cgit v1.2.3