diff options
| author | Patrick Steinhardt <ps@pks.im> | 2025-05-12 11:25:05 +0200 |
|---|---|---|
| committer | Patrick Steinhardt <ps@pks.im> | 2025-05-13 08:27:09 +0200 |
| commit | 3271d2e9e71678cdc22378b1fd58c07641f8c424 (patch) | |
| tree | e1224be10143829e3c2a683df121c402825199b2 | |
| parent | 309bb874dcba2c96f8b12d20bed16cf6a1ea0133 (diff) | |
git-gui: replace GIT-GUI-VARS with GIT-GUI-BUILD-OPTIONS
The GIT-GUI-VARS file is used to track whether any of our build options
has changed. Unfortunately, the format of that file does not allow us to
propagate those build options to other scripts. But as we are about to
introduce support for the Meson build system, we will extract a couple
of scripts to deduplicate core build logic across Makefiles and Meson.
With this refactoring, it will become necessary to make build options
more widely accessible.
Replace GIT-GUI-VARS with a new GIT-GUI-BUILD-OPTIONS file that is being
populated from a template. This file can easily be sourced from build
scripts in subsequent steps.
Signed-off-by: Patrick Steinhardt <ps@pks.im>
| -rw-r--r-- | .gitignore | 2 | ||||
| -rw-r--r-- | GIT-GUI-BUILD-OPTIONS.in | 6 | ||||
| -rw-r--r-- | Makefile | 36 |
3 files changed, 23 insertions, 21 deletions
diff --git a/.gitignore b/.gitignore index 6483b21cbf..ff6e0be4b4 100644 --- a/.gitignore +++ b/.gitignore @@ -2,7 +2,7 @@ config.mak Git Gui.app* git-gui.tcl +GIT-GUI-BUILD-OPTIONS GIT-VERSION-FILE -GIT-GUI-VARS git-gui lib/tclIndex diff --git a/GIT-GUI-BUILD-OPTIONS.in b/GIT-GUI-BUILD-OPTIONS.in new file mode 100644 index 0000000000..3c112af578 --- /dev/null +++ b/GIT-GUI-BUILD-OPTIONS.in @@ -0,0 +1,6 @@ +GITGUI_GITEXECDIR=@GITGUI_GITEXECDIR@ +GITGUI_LIBDIR=@GITGUI_LIBDIR@ +GITGUI_RELATIVE=@GITGUI_RELATIVE@ +SHELL_PATH=@SHELL_PATH@ +TCLTK_PATH=@TCLTK_PATH@ +TCL_PATH=@TCL_PATH@ @@ -158,7 +158,7 @@ endif ifdef GITGUI_MACOSXAPP GITGUI_MAIN := git-gui.tcl -git-gui: GIT-VERSION-FILE GIT-GUI-VARS +git-gui: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS $(QUIET_GEN)rm -f $@ $@+ && \ echo '#!$(SHELL_PATH_SQ)' >$@+ && \ echo 'if test "z$$*" = zversion ||' >>$@+ && \ @@ -173,7 +173,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS chmod +x $@+ && \ mv $@+ $@ -Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \ +Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS \ macosx/Info.plist \ macosx/git-gui.icns \ macosx/AppMain.tcl \ @@ -202,7 +202,7 @@ git-gui: windows/git-gui.sh cp $< $@ endif -$(GITGUI_MAIN): git-gui.sh GIT-VERSION-FILE GIT-GUI-VARS +$(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)|' \ @@ -238,7 +238,7 @@ update-po:: $(PO_TEMPLATE) $(ALL_MSGFILES): %.msg : %.po $(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1) -lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS +lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-BUILD-OPTIONS $(QUIET_INDEX)if echo \ $(foreach p,$(PRELOAD_FILES),source $p\;) \ auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \ @@ -252,21 +252,17 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS echo >>$@ ; \ fi -TRACK_VARS = \ - $(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \ - $(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \ - $(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \ - $(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \ - $(subst ','\'',gg_libdir='$(libdir_SQ)') \ - GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \ -#end TRACK_VARS - -GIT-GUI-VARS: FORCE - @VARS='$(TRACK_VARS)'; \ - if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \ - echo >&2 " * new locations or Tcl/Tk interpreter"; \ - echo >$@ "$$VARS"; \ - fi +GIT-GUI-BUILD-OPTIONS: FORCE + @sed \ + -e 's|@GITGUI_GITEXECDIR@|$(gitexecdir_SQ)|' \ + -e 's|@GITGUI_LIBDIR@|$(libdir_SQ)|' \ + -e 's|@GITGUI_RELATIVE@|$(GITGUI_RELATIVE)|' \ + -e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \ + -e 's|@TCLTK_PATH@|$(TCLTK_PATH_SQ)|' \ + -e 's|@TCL_PATH@|$(TCL_PATH_SQ)|' \ + $@.in >$@+ + @if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi + @if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi ifdef GITGUI_MACOSXAPP all:: git-gui Git\ Gui.app @@ -322,7 +318,7 @@ dist-version: clean:: $(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE) - $(RM_RF) GIT-VERSION-FILE GIT-GUI-VARS + $(RM_RF) GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS ifdef GITGUI_MACOSXAPP $(RM_RF) 'Git Gui.app'* git-gui endif |
