Re: [PATCH 09/12] gitk: extract script to build Gitk
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Feb 18, 2025, 22:25 UTC
- Message-ID
- <xmqqeczuj3fc.fsf@gitster.g>
- In-Reply-To
- <20250218-b4-pks-meson-contrib-v1-9-c3edd292beb8@pks.im>
Patrick Steinhardt <ps@pks.im> writes:
Show 8 quoted lines
> Extract the script that "builds" Gitk from our Makefile so that we can > reuse it in Meson. > > Signed-off-by: Patrick Steinhardt <ps@pks.im> > --- > gitk-git/Makefile | 7 +++---- > gitk-git/generate-tcl.sh | 11 +++++++++++ > 2 files changed, 14 insertions(+), 4 deletions(-)
You would want to coordinate this with Johannes Sixt, who may still want to maintain the subtree arrangement.
Thanks.
Show 42 quoted lines
> 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"