Extract the script that "builds" Gitk from our Makefile so that we can reuse it in Meson. Signed-off-by: Patrick Steinhardt <ps@xxxxxx> --- gitk-git/Makefile | 7 +++---- gitk-git/generate-tcl.sh | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/gitk-git/Makefile b/gitk-git/Makefile index e1f0aff4a19..a396eef581e 100644 --- a/gitk-git/Makefile +++ b/gitk-git/Makefile @@ -8,6 +8,7 @@ gitk_libdir ?= $(sharedir)/gitk/lib msgsdir ?= $(gitk_libdir)/msgs msgsdir_SQ = $(subst ','\'',$(msgsdir)) +SHELL_PATH ?= /bin/sh TCL_PATH ?= tclsh TCLTK_PATH ?= wish INSTALL ?= install @@ -63,10 +64,8 @@ clean:: $(RM) gitk-wish po/*.msg GIT-TCLTK-VARS gitk-wish: gitk GIT-TCLTK-VARS - $(QUIET_GEN)$(RM) $@ $@+ && \ - sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \ - chmod +x $@+ && \ - mv -f $@+ $@ + $(QUIET_GEN)$(RM) $@ $@+ + $(QUIET_GEN)$(SHELL_PATH) ./generate-tcl.sh "$(TCLTK_PATH_SQ)" "$<" "$@" $(PO_TEMPLATE): gitk $(XGETTEXT) -kmc -LTcl -o $@ gitk diff --git a/gitk-git/generate-tcl.sh b/gitk-git/generate-tcl.sh new file mode 100755 index 00000000000..46bba6d2464 --- /dev/null +++ b/gitk-git/generate-tcl.sh @@ -0,0 +1,11 @@ +#!/bin/sh + +set -e + +WISH=$(echo "$1" | sed 's/|/\\|/g') +INPUT="$2" +OUTPUT="$3" + +sed -e "1,3s|^exec .* \"\$0\"|exec $WISH \"\$0\"|" "$INPUT" >"$OUTPUT"+ +chmod a+x "$OUTPUT"+ +mv "$OUTPUT"+ "$OUTPUT" -- 2.48.1.666.gff9fcf71b7.dirty