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>
This commit is contained in:
2
.gitignore
vendored
2
.gitignore
vendored
@@ -2,7 +2,7 @@
|
|||||||
config.mak
|
config.mak
|
||||||
Git Gui.app*
|
Git Gui.app*
|
||||||
git-gui.tcl
|
git-gui.tcl
|
||||||
|
GIT-GUI-BUILD-OPTIONS
|
||||||
GIT-VERSION-FILE
|
GIT-VERSION-FILE
|
||||||
GIT-GUI-VARS
|
|
||||||
git-gui
|
git-gui
|
||||||
lib/tclIndex
|
lib/tclIndex
|
||||||
|
|||||||
6
GIT-GUI-BUILD-OPTIONS.in
Normal file
6
GIT-GUI-BUILD-OPTIONS.in
Normal file
@@ -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@
|
||||||
36
Makefile
36
Makefile
@@ -158,7 +158,7 @@ endif
|
|||||||
ifdef GITGUI_MACOSXAPP
|
ifdef GITGUI_MACOSXAPP
|
||||||
GITGUI_MAIN := git-gui.tcl
|
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 $@ $@+ && \
|
$(QUIET_GEN)rm -f $@ $@+ && \
|
||||||
echo '#!$(SHELL_PATH_SQ)' >$@+ && \
|
echo '#!$(SHELL_PATH_SQ)' >$@+ && \
|
||||||
echo 'if test "z$$*" = zversion ||' >>$@+ && \
|
echo 'if test "z$$*" = zversion ||' >>$@+ && \
|
||||||
@@ -173,7 +173,7 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
|
|||||||
chmod +x $@+ && \
|
chmod +x $@+ && \
|
||||||
mv $@+ $@
|
mv $@+ $@
|
||||||
|
|
||||||
Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-VARS \
|
Git\ Gui.app: GIT-VERSION-FILE GIT-GUI-BUILD-OPTIONS \
|
||||||
macosx/Info.plist \
|
macosx/Info.plist \
|
||||||
macosx/git-gui.icns \
|
macosx/git-gui.icns \
|
||||||
macosx/AppMain.tcl \
|
macosx/AppMain.tcl \
|
||||||
@@ -202,7 +202,7 @@ git-gui: windows/git-gui.sh
|
|||||||
cp $< $@
|
cp $< $@
|
||||||
endif
|
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 $@ $@+ && \
|
$(QUIET_GEN)rm -f $@ $@+ && \
|
||||||
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
|
||||||
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
|
-e 's|@@SHELL_PATH@@|$(SHELL_PATH_SQ)|' \
|
||||||
@@ -238,7 +238,7 @@ update-po:: $(PO_TEMPLATE)
|
|||||||
$(ALL_MSGFILES): %.msg : %.po
|
$(ALL_MSGFILES): %.msg : %.po
|
||||||
$(QUIET_MSGFMT0)$(MSGFMT) --statistics --tcl -l $(basename $(notdir $<)) -d $(dir $@) $< $(QUIET_MSGFMT1)
|
$(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 \
|
$(QUIET_INDEX)if echo \
|
||||||
$(foreach p,$(PRELOAD_FILES),source $p\;) \
|
$(foreach p,$(PRELOAD_FILES),source $p\;) \
|
||||||
auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \
|
auto_mkindex lib $(patsubst lib/%,%,$(sort $(ALL_LIBFILES))) \
|
||||||
@@ -252,21 +252,17 @@ lib/tclIndex: $(ALL_LIBFILES) GIT-GUI-VARS
|
|||||||
echo >>$@ ; \
|
echo >>$@ ; \
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TRACK_VARS = \
|
GIT-GUI-BUILD-OPTIONS: FORCE
|
||||||
$(subst ','\'',SHELL_PATH='$(SHELL_PATH_SQ)') \
|
@sed \
|
||||||
$(subst ','\'',TCL_PATH='$(TCL_PATH_SQ)') \
|
-e 's|@GITGUI_GITEXECDIR@|$(gitexecdir_SQ)|' \
|
||||||
$(subst ','\'',TCLTK_PATH='$(TCLTK_PATH_SQ)') \
|
-e 's|@GITGUI_LIBDIR@|$(libdir_SQ)|' \
|
||||||
$(subst ','\'',gitexecdir='$(gitexecdir_SQ)') \
|
-e 's|@GITGUI_RELATIVE@|$(GITGUI_RELATIVE)|' \
|
||||||
$(subst ','\'',gg_libdir='$(libdir_SQ)') \
|
-e 's|@SHELL_PATH@|$(SHELL_PATH_SQ)|' \
|
||||||
GITGUI_MACOSXAPP=$(GITGUI_MACOSXAPP) \
|
-e 's|@TCLTK_PATH@|$(TCLTK_PATH_SQ)|' \
|
||||||
#end TRACK_VARS
|
-e 's|@TCL_PATH@|$(TCL_PATH_SQ)|' \
|
||||||
|
$@.in >$@+
|
||||||
GIT-GUI-VARS: FORCE
|
@if grep -q '^[A-Z][A-Z_]*=@.*@$$' $@+; then echo "Unsubstituted build options in $@" >&2 && exit 1; fi
|
||||||
@VARS='$(TRACK_VARS)'; \
|
@if cmp $@+ $@ >/dev/null 2>&1; then $(RM) $@+; else mv $@+ $@; fi
|
||||||
if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
|
|
||||||
echo >&2 " * new locations or Tcl/Tk interpreter"; \
|
|
||||||
echo >$@ "$$VARS"; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
ifdef GITGUI_MACOSXAPP
|
ifdef GITGUI_MACOSXAPP
|
||||||
all:: git-gui Git\ Gui.app
|
all:: git-gui Git\ Gui.app
|
||||||
@@ -322,7 +318,7 @@ dist-version:
|
|||||||
|
|
||||||
clean::
|
clean::
|
||||||
$(RM_RF) $(GITGUI_MAIN) lib/tclIndex po/*.msg $(PO_TEMPLATE)
|
$(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
|
ifdef GITGUI_MACOSXAPP
|
||||||
$(RM_RF) 'Git Gui.app'* git-gui
|
$(RM_RF) 'Git Gui.app'* git-gui
|
||||||
endif
|
endif
|
||||||
|
|||||||
Reference in New Issue
Block a user