From 6bdb18a9cef9124937941c6e5bd2b645c9da6537 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Wed, 28 Mar 2007 04:22:02 -0700 Subject: [PATCH] Rewrite Tcl/Tk interpreter path for the GUI tools. --with-tcltk=/path/to/wish sets the TCLTK_PATH variable that is used to substitute the location of the wish interpreter in the Tcl/Tk programs. New tracking file, GIT-GUI-VARS, was introduced: it tracks the location of the Tcl/Tk interpreter and activates the GUI tools rebuild if the interpreter path was changed. The separate tracker is better than the GIT-CFLAGS: there is no need to rebuild the whole git if the interpreter path was changed. Signed-off-by: Eygene Ryabinkin --- Makefile | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index da086a7fe..88f9025e4 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,7 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS) # what 'all' will build but not install in gitexecdir OTHER_PROGRAMS = git$X gitweb/gitweb.cgi ifndef NO_TCLTK -OTHER_PROGRAMS += gitk +OTHER_PROGRAMS += gitk-wish endif # Backward compatibility -- to be removed after 1.0 @@ -694,6 +694,12 @@ endif strip: $(PROGRAMS) git$X $(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X +gitk-wish: gitk GIT-GUI-VARS + $(QUIET_GEN)rm -f $@ $@+ && \ + sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' $@+ && \ + chmod +x $@+ && \ + mv -f $@+ $@ + git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) GIT-CFLAGS $(QUIET_LINK)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \ $(ALL_CFLAGS) -o $@ $(filter %.c,$^) \ @@ -872,6 +878,20 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS echo "$$FLAGS" >GIT-CFLAGS; \ fi +### Detect Tck/Tk interpreter path changes +ifndef NO_TCLTK +TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)') + +GIT-GUI-VARS: .FORCE-GIT-GUI-VARS + @VARS='$(TRACK_VARS)'; \ + if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \ + echo 1>&2 " * new Tcl/Tk interpreter location"; \ + echo "$$VARS" >$@; \ + fi + +.PHONY: .FORCE-GIT-GUI-VARS +endif + ### Testing rules # GNU make supports exporting all variables by "export" without parameters. @@ -916,7 +936,7 @@ install: all $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C perl prefix='$(prefix_SQ)' install ifndef NO_TCLTK - $(INSTALL) gitk '$(DESTDIR_SQ)$(bindir_SQ)' + $(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk $(MAKE) -C git-gui install endif if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \ @@ -1000,9 +1020,10 @@ clean: $(MAKE) -C templates/ clean $(MAKE) -C t/ clean ifndef NO_TCLTK + rm -f gitk-wish $(MAKE) -C git-gui clean endif - rm -f GIT-VERSION-FILE GIT-CFLAGS + rm -f GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS .PHONY: all install clean strip .PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS -- 2.30.2