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 <rea-git@codelabs.ru>
Eygene Ryabinkin committed
Mar 28, 2007 at 04:22 UTC
6bdb18a9cef9124937941c6e5bd2b645c9da6537
1 file changed
+24
-3
Makefile
+24
-3
@@ -241,7 +241,7 @@ ALL_PROGRAMS = $(PROGRAMS) $(SCRIPTS)
241
# what 'all' will build but not install in gitexecdir
242
OTHER_PROGRAMS = git$X gitweb/gitweb.cgi
243
ifndef NO_TCLTK
244
-OTHER_PROGRAMS += gitk
244
+OTHER_PROGRAMS += gitk-wish
245
endif
246
247
# Backward compatibility -- to be removed after 1.0
@@ -694,6 +694,12 @@ endif
694
strip: $(PROGRAMS) git$X
695
$(STRIP) $(STRIP_OPTS) $(PROGRAMS) git$X
696
697
+gitk-wish: gitk GIT-GUI-VARS
698
+ $(QUIET_GEN)rm -f $@ $@+ && \
699
+ sed -e '1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' <gitk >$@+ && \
700
+ chmod +x $@+ && \
701
+ mv -f $@+ $@
702
+
703
git$X: git.c common-cmds.h $(BUILTIN_OBJS) $(GITLIBS) GIT-CFLAGS
704
$(QUIET_LINK)$(CC) -DGIT_VERSION='"$(GIT_VERSION)"' \
705
$(ALL_CFLAGS) -o $@ $(filter %.c,$^) \
@@ -872,6 +878,20 @@ GIT-CFLAGS: .FORCE-GIT-CFLAGS
878
echo "$$FLAGS" >GIT-CFLAGS; \
879
fi
880
881
+### Detect Tck/Tk interpreter path changes
882
+ifndef NO_TCLTK
883
+TRACK_VARS = $(subst ','\'',-DTCLTK_PATH='$(TCLTK_PATH_SQ)')
884
+
885
+GIT-GUI-VARS: .FORCE-GIT-GUI-VARS
886
+ @VARS='$(TRACK_VARS)'; \
887
+ if test x"$$VARS" != x"`cat $@ 2>/dev/null`" ; then \
888
+ echo 1>&2 " * new Tcl/Tk interpreter location"; \
889
+ echo "$$VARS" >$@; \
890
+ fi
891
+
892
+.PHONY: .FORCE-GIT-GUI-VARS
893
+endif
894
+
895
### Testing rules
896
897
# GNU make supports exporting all variables by "export" without parameters.
@@ -916,7 +936,7 @@ install: all
936
$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
937
$(MAKE) -C perl prefix='$(prefix_SQ)' install
938
ifndef NO_TCLTK
919
- $(INSTALL) gitk '$(DESTDIR_SQ)$(bindir_SQ)'
939
+ $(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
940
$(MAKE) -C git-gui install
941
endif
942
if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \
@@ -1000,9 +1020,10 @@ clean:
1020
$(MAKE) -C templates/ clean
1021
$(MAKE) -C t/ clean
1022
ifndef NO_TCLTK
1023
+ rm -f gitk-wish
1024
$(MAKE) -C git-gui clean
1025
endif
1005
- rm -f GIT-VERSION-FILE GIT-CFLAGS
1026
+ rm -f GIT-VERSION-FILE GIT-CFLAGS GIT-GUI-VARS
1027
1028
.PHONY: all install clean strip
1029
.PHONY: .FORCE-GIT-VERSION-FILE TAGS tags .FORCE-GIT-CFLAGS