aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-03-11 11:07:19 +0100
committerPatrick Steinhardt <ps@pks.im>2025-05-13 08:27:11 +0200
commit854e88335a3e68af46f62ce72037293920bd06f2 (patch)
tree7f6851c21829f79cf7806ecab19b19db503cf6bb
parent3e656a43567b7d0f82e99d56b1a268feb789abff (diff)
downloadgit-854e88335a3e68af46f62ce72037293920bd06f2.tar.gz
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 <ps@pks.im>
-rw-r--r--Makefile12
-rwxr-xr-xgenerate-git-gui.sh29
2 files changed, 30 insertions, 11 deletions
diff --git a/Makefile b/Makefile
index 1cbb16a921..58a65dba24 100644
--- a/Makefile
+++ b/Makefile
@@ -127,7 +127,6 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
-TCLTK_PATH_SED = $(subst ','\'',$(subst \,\\,$(TCLTK_PATH)))
gg_libdir ?= $(sharedir)/git-gui/lib
libdir_SQ = $(subst ','\'',$(gg_libdir))
@@ -202,16 +201,7 @@ git-gui: windows/git-gui.sh
endif
$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS
- $(QUIET_GEN)rm -f $@ $@+ && \
- sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
- -e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
- -e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
- -e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \
- -e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
- git-gui.sh >$@+ && \
- chmod +x $@+ && \
- mv $@+ $@
+ $(QUIET_GEN)$(SHELL_PATH) generate-git-gui.sh "$<" "$@" ./GIT-GUI-BUILD-OPTIONS ./GIT-VERSION-FILE
XGETTEXT ?= xgettext
ifdef NO_MSGFMT
diff --git a/generate-git-gui.sh b/generate-git-gui.sh
new file mode 100755
index 0000000000..39dfafdc4a
--- /dev/null
+++ b/generate-git-gui.sh
@@ -0,0 +1,29 @@
+#!/bin/sh
+
+set -e
+
+if test "$#" -ne 4
+then
+ echo >&2 "usage: $0 <INPUT> <OUTPUT> <BUILD_OPTIONS> <VERSION_FILE>"
+ exit 1
+fi
+
+INPUT="$1"
+OUTPUT="$2"
+BUILD_OPTIONS="$3"
+VERSION_FILE="$4"
+
+. "${BUILD_OPTIONS}"
+. "${VERSION_FILE}"
+
+rm -f "$OUTPUT" "$OUTPUT+"
+sed \
+ -e "1s|#!.*/sh|#!$SHELL_PATH|" \
+ -e "s|@@SHELL_PATH@@|$SHELL_PATH|" \
+ -e "1,30s|^ exec wish | exec '$TCLTK_PATH' |" \
+ -e "s|@@GITGUI_VERSION@@|$GITGUI_VERSION|g" \
+ -e "s|@@GITGUI_RELATIVE@@|$GITGUI_RELATIVE|" \
+ -e "${GITGUI_RELATIVE}s|@@GITGUI_LIBDIR@@|$GITGUI_LIBDIR|" \
+ "$INPUT" >"$OUTPUT"+
+chmod +x "$OUTPUT"+
+mv "$OUTPUT"+ "$OUTPUT"