git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eygene Ryabinkin <rea-git@codelabs.ru>
To: Junio C Hamano <junkio@cox.net>
Cc: Jakub Narebski <jnareb@gmail.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	git@vger.kernel.org
Subject: [PATCH] Added Tcl/Tk interpreter path rewriting for the GUI tools.
Date: Wed, 28 Mar 2007 13:13:44 +0400	[thread overview]
Message-ID: <20070328091344.GR14837@codelabs.ru> (raw)
In-Reply-To: <20070328091209.GQ14837@codelabs.ru>

--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>
---
 Makefile         |   31 ++++++++++++++++++++++++++++---
 git-gui/Makefile |   17 +++++++++++++++--
 2 files changed, 43 insertions(+), 5 deletions(-)

diff --git a/Makefile b/Makefile
index bfde029..0034666 100644
--- a/Makefile
+++ b/Makefile
@@ -690,11 +690,15 @@ export prefix gitexecdir TAR INSTALL DESTDIR SHELL_PATH template_dir
 
 ### Build rules
 
-all:: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitk gitweb/gitweb.cgi
+all:: $(ALL_PROGRAMS) $(BUILT_INS) git$X gitweb/gitweb.cgi
 ifneq (,$X)
 	$(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';)
 endif
 
+ifndef NO_TCLTK
+all:: gitk-wish
+endif
+
 all::
 ifndef NO_TCLTK
 	$(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all
@@ -705,6 +709,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"|' < gitk > $@+ && \
+	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,$^) \
@@ -892,6 +902,18 @@ 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
+endif
+
 ### Testing rules
 
 # GNU make supports exporting all variables by "export" without parameters.
@@ -934,7 +956,7 @@ install: all
 	$(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)'
 	$(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)'
 ifndef NO_TCLTK
-	$(INSTALL) gitk '$(DESTDIR_SQ)$(bindir_SQ)'
+	$(INSTALL) gitk-wish '$(DESTDIR_SQ)$(bindir_SQ)'/gitk
 endif
 	$(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install
 	$(MAKE) -C perl prefix='$(prefix_SQ)' install
@@ -1030,10 +1052,13 @@ ifndef NO_TCLTK
 endif
 	$(MAKE) -C templates/ clean
 	$(MAKE) -C t/ clean
-	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
+ifndef NO_TCLTK
+.PHONY: .FORCE-GIT-GUI-VARS
+endif
 
 ### Check documentation
 #
diff --git a/git-gui/Makefile b/git-gui/Makefile
index 733c07e..4ef6fac 100644
--- a/git-gui/Makefile
+++ b/git-gui/Makefile
@@ -40,10 +40,13 @@ gitexecdir_SQ = $(subst ','\'',$(gitexecdir))
 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
 TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
 
+git-gui: GIT-GUI-VARS
+
 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	$(QUIET_GEN)rm -f $@ $@+ && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 		-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
+		-e'1,3s|^exec .* "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
 		$@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
@@ -66,7 +69,17 @@ dist-version:
 	@echo $(GITGUI_VERSION) > $(TARDIR)/version
 
 clean::
-	rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE
+	rm -f $(ALL_PROGRAMS) GIT-VERSION-FILE GIT-GUI-VARS
+
+### Detect Tck/Tk interpreter path changes
+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: all install dist-version clean
-.PHONY: .FORCE-GIT-VERSION-FILE
+.PHONY: .FORCE-GIT-VERSION-FILE .FORCE-GIT-GUI-VARS
-- 
1.5.0.3-dirty

  reply	other threads:[~2007-03-28  9:14 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-20 11:45 [PATCH] Added make options NO_GUI and WITH_P4IMPORT Eygene Ryabinkin
2007-03-21  0:35 ` Jakub Narebski
2007-03-21  5:14   ` Eygene Ryabinkin
2007-03-21 11:16     ` Johannes Schindelin
2007-03-21 11:50       ` Eygene Ryabinkin
2007-03-21 14:25         ` Johannes Schindelin
2007-03-21 14:38           ` Paolo Bonzini
2007-03-21 14:42             ` Eygene Ryabinkin
2007-03-21 14:49               ` Paolo Bonzini
2007-03-21 14:58               ` Alex Riesen
2007-03-24 23:16                 ` Jakub Narebski
2007-03-21 14:40           ` Eygene Ryabinkin
2007-03-21 15:35             ` Johannes Schindelin
2007-03-21 16:01               ` Eygene Ryabinkin
2007-03-21 16:17                 ` Junio C Hamano
2007-03-26  7:31                   ` Eygene Ryabinkin
2007-03-26  7:32                     ` [PATCH] Added options NO_TCLTK, WITH_P4IMPORT and --with-tcltk/--without-tcltk Eygene Ryabinkin
2007-03-26  8:27                       ` Junio C Hamano
2007-03-27 10:26                         ` [PATCH] Add the WITH_P4IMPORT knob to the Makefile Eygene Ryabinkin
2007-03-27 10:54                           ` Junio C Hamano
2007-03-27 11:22                             ` Eygene Ryabinkin
2007-03-27 11:25                               ` [PATCH] Added git-p4 package to the list of git RPMs Eygene Ryabinkin
2007-03-27 16:03                                 ` [PATCH] Remove unused WITH_OWN_SUBPROCESS_PY from RPM spec Brian Gernhardt
2007-04-04 18:30                                 ` [PATCH] Added git-p4 package to the list of git RPMs Junio C Hamano
2007-04-05 12:50                                   ` Eygene Ryabinkin
2007-03-26  8:30                       ` [PATCH] Added options NO_TCLTK, WITH_P4IMPORT and --with-tcltk/--without-tcltk Jakub Narebski
2007-03-26  8:36                         ` Junio C Hamano
2007-03-26 10:03                           ` Eygene Ryabinkin
2007-03-27  4:12                             ` Junio C Hamano
2007-03-27  6:59                               ` Eygene Ryabinkin
2007-03-27 10:24                                 ` [PATCH] Added configure options --with-tcltk/--without-tcltk Eygene Ryabinkin
2007-03-27 10:53                                   ` Junio C Hamano
2007-03-27 11:07                                     ` Eygene Ryabinkin
2007-03-28  1:52                                       ` Junio C Hamano
2007-03-28  9:12                                         ` [PATCH] Add --with-tcltk and --without-tcltk to configure Eygene Ryabinkin
2007-03-28  9:13                                           ` Eygene Ryabinkin [this message]
2007-03-28 19:48                                           ` Junio C Hamano
2007-03-29  7:44                                             ` Eygene Ryabinkin
2007-03-29  8:00                                               ` Junio C Hamano
2007-03-29  8:29                                                 ` Eygene Ryabinkin
2007-03-29  8:35                                                   ` Junio C Hamano
2007-03-29  8:58                                                     ` Eygene Ryabinkin
2007-03-29  9:12                                                       ` Tom Prince
2007-03-29 10:06                                                         ` Eygene Ryabinkin
2007-03-29 10:06                                                           ` [PATCH] Eliminate checks of user-specified Tcl/Tk interpreter Eygene Ryabinkin
2007-03-29 10:07                                               ` [PATCH] Added correct Python path to the RPM specfile Eygene Ryabinkin
2007-03-26  8:25                     ` [PATCH] Added make options NO_GUI and WITH_P4IMPORT Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070328091344.GR14837@codelabs.ru \
    --to=rea-git@codelabs.ru \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=jnareb@gmail.com \
    --cc=junkio@cox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).