Skip to content

Commit 854e883

Browse files
committed
git-gui: extract script to generate "git-gui"
Extract script to generate "git-gui". This change allows us to reuse the build logic with the Meson build system. Signed-off-by: Patrick Steinhardt <[email protected]>
1 parent 3e656a4 commit 854e883

File tree

2 files changed

+30
-11
lines changed

2 files changed

+30
-11
lines changed

Makefile

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,6 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
127127
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
128128
TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
129129
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
130-
TCLTK_PATH_SED = $(subst ','\'',$(subst \,\\,$(TCLTK_PATH)))
131130

132131
gg_libdir ?= $(sharedir)/git-gui/lib
133132
libdir_SQ = $(subst ','\'',$(gg_libdir))
@@ -202,16 +201,7 @@ git-gui: windows/git-gui.sh
202201
endif
203202

204203
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
205-
$(QUIET_GEN)rm -f $@ $@+ && \
206-
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
207-
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
208-
-e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
209-
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
210-
-e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \
211-
-e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
212-
git-gui.sh >$@+ && \
213-
chmod +x $@+ && \
214-
mv $@+ $@
204+
$(QUIET_GEN)$(SHELL_PATH) generate-git-gui.sh "$<" "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
215205

216206
XGETTEXT ?= xgettext
217207
ifdef NO_MSGFMT

generate-git-gui.sh

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
3+
set -e
4+
5+
if test "$#" -ne 4
6+
then
7+
echo >&2 "usage: $0 <INPUT> <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
8+
exit 1
9+
fi
10+
11+
INPUT="$1"
12+
OUTPUT="$2"
13+
BUILD_OPTIONS="$3"
14+
VERSION_FILE="$4"
15+
16+
. "${BUILD_OPTIONS}"
17+
. "${VERSION_FILE}"
18+
19+
rm -f "$OUTPUT" "$OUTPUT+"
20+
sed \
21+
-e "1s|#!.*/sh|#!$SHELL_PATH|" \
22+
-e "s|@@SHELL_PATH@@|$SHELL_PATH|" \
23+
-e "1,30s|^ exec wish | exec '$TCLTK_PATH' |" \
24+
-e "s|@@GITGUI_VERSION@@|$GITGUI_VERSION|g" \
25+
-e "s|@@GITGUI_RELATIVE@@|$GITGUI_RELATIVE|" \
26+
-e "${GITGUI_RELATIVE}s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
27+
"$INPUT" >"$OUTPUT"+
28+
chmod +x "$OUTPUT"+
29+
mv "$OUTPUT"+ "$OUTPUT"

0 commit comments

Comments
 (0)