vis

a vi-like editor based on Plan 9's structural regular expressions

git clone https://9o.is/git/vis.git

commit 723c1ff4940f9a835187024d9d108c0a2d571f65
parent 978b68436c1a715f7a2b9cfedee19d09f1bf8178
Author: Christian Hesse <mail@eworm.de>
Date:   Wed, 11 Jan 2017 10:50:02 +0100

single: allow to build self-extracting executable

This allows to create a self extracting executable. The standalone
binary and lua files are extracted to /tmp/.vis-XXXXXX, vis is started
with the given command line arguments, finally temporary files are
removed.

Signed-off-by: Christian Hesse <mail@eworm.de>

Diffstat:
M.gitignore | 1+
MGNUmakefile | 5+++++
Avis-single.sh | 14++++++++++++++
3 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore @@ -3,6 +3,7 @@ /dependency /vis /vis-menu +/vis-single *.css *.gcda *.gcno diff --git a/GNUmakefile b/GNUmakefile @@ -185,4 +185,9 @@ standalone: clean CFLAGS="-I$(DEPS_INC) --static -Wl,--as-needed" LDFLAGS="-L$(DEPS_LIB)" CC=musl-gcc PATH=$(DEPS_BIN):$$PATH $(MAKE) +single: standalone + cp vis-single.sh vis-single + strip vis + tar c vis lua/ | gzip -9 >> vis-single + .PHONY: standalone local dependencies-common dependencies-local dependencies-clean diff --git a/vis-single.sh b/vis-single.sh @@ -0,0 +1,14 @@ +#!/bin/sh + +set -e + +VISTMP="$(mktemp -d -p "${TMPDIR:-/tmp}" .vis-XXXXXX)" +trap 'rm -rf "$VISTMP"' EXIT INT QUIT TERM HUP + +sed '1,/^__TAR_GZ_ARCHIVE_BELOW__$/d' "$0" | gzip -d | tar xC "$VISTMP" + +"$VISTMP/vis" "$@" + +exit $? + +__TAR_GZ_ARCHIVE_BELOW__