Skip to content

Commit 0d4fe30

Browse files
committed
gitk: extract script to build executable
Extract the scrip that "builds" Gitk from our Makefile so that we can reuse it in Meson. Signed-off-by: Patrick Steinhardt <[email protected]>
1 parent e76b53e commit 0d4fe30

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

Makefile

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ gitk_libdir ?= $(sharedir)/gitk/lib
88
msgsdir ?= $(gitk_libdir)/msgs
99
msgsdir_SQ = $(subst ','\'',$(msgsdir))
1010

11+
SHELL_PATH ?= /bin/sh
1112
TCL_PATH ?= tclsh
1213
TCLTK_PATH ?= wish
1314
INSTALL ?= install
@@ -64,9 +65,7 @@ clean::
6465

6566
gitk-wish: gitk GIT-TCLTK-VARS
6667
$(QUIET_GEN)$(RM) $@ $@+ && \
67-
sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
68-
chmod +x $@+ && \
69-
mv -f $@+ $@
68+
$(SHELL_PATH) ./generate-tcl.sh "$(TCLTK_PATH_SQ)" "$<" "$@"
7069

7170
$(PO_TEMPLATE): gitk
7271
$(XGETTEXT) -kmc -LTcl -o $@ gitk

generate-tcl.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
WISH=$(echo "$1" | sed 's/|/\\|/g')
6+
INPUT="$2"
7+
OUTPUT="$3"
8+
9+
sed -e "1,3s|^exec .* \"\$0\"|exec $WISH \"\$0\"|" "$INPUT" >"$OUTPUT"+
10+
chmod a+x "$OUTPUT"+
11+
mv "$OUTPUT"+ "$OUTPUT"

0 commit comments

Comments
 (0)