From 3cfaf11b1dc742dcbbf48dd3d6a5ce376e23a2b8 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Wed, 28 Mar 2007 04:00:23 -0700 Subject: [PATCH 1/5] NO_TCLTK Makefile knob named NO_TCLTK was introduced. It prevents the build and installation of the Tcl/Tk dependent parts. Signed-off-by: Eygene Ryabinkin --- Makefile | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index b159ffd0ae..0797ad4a99 100644 --- a/Makefile +++ b/Makefile @@ -110,6 +110,8 @@ all:: # Define NO_PERL_MAKEMAKER if you cannot use Makefiles generated by perl's # MakeMaker (e.g. using ActiveState under Cygwin). # +# Define NO_TCLTK if you do not want Tcl/Tk GUI. +# GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -231,6 +233,12 @@ BUILT_INS = \ # what 'all' will build and 'install' will install, in gitexecdir 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 +endif + # Backward compatibility -- to be removed after 1.0 PROGRAMS += git-ssh-pull$X git-ssh-push$X @@ -661,13 +669,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) $(OTHER_PROGRAMS) ifneq (,$X) $(foreach p,$(patsubst %$X,%,$(filter %$X,$(ALL_PROGRAMS) $(BUILT_INS) git$X)), rm -f '$p';) endif all:: +ifndef NO_TCLTK $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all +endif $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) @@ -892,10 +902,13 @@ install: all $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(bindir_SQ)' $(INSTALL) -d -m755 '$(DESTDIR_SQ)$(gitexecdir_SQ)' $(INSTALL) $(ALL_PROGRAMS) '$(DESTDIR_SQ)$(gitexecdir_SQ)' - $(INSTALL) git$X gitk '$(DESTDIR_SQ)$(bindir_SQ)' + $(INSTALL) git$X '$(DESTDIR_SQ)$(bindir_SQ)' $(MAKE) -C templates DESTDIR='$(DESTDIR_SQ)' install $(MAKE) -C perl prefix='$(prefix_SQ)' install +ifndef NO_TCLTK + $(INSTALL) gitk '$(DESTDIR_SQ)$(bindir_SQ)' $(MAKE) -C git-gui install +endif if test 'z$(bindir_SQ)' != 'z$(gitexecdir_SQ)'; \ then \ ln -f '$(DESTDIR_SQ)$(bindir_SQ)/git$X' \ @@ -974,9 +987,11 @@ clean: rm -f gitweb/gitweb.cgi $(MAKE) -C Documentation/ clean $(MAKE) -C perl clean - $(MAKE) -C git-gui clean $(MAKE) -C templates/ clean $(MAKE) -C t/ clean +ifndef NO_TCLTK + $(MAKE) -C git-gui clean +endif rm -f GIT-VERSION-FILE GIT-CFLAGS .PHONY: all install clean strip From 81b63c707ed5962d45bd575c946a7127c19a3e35 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Wed, 28 Mar 2007 04:12:07 -0700 Subject: [PATCH 2/5] Add --with-tcltk and --without-tcltk to configure. --with-tcltk enables the search of the Tcl/Tk interpreter. If no interpreter is found then Tcl/Tk dependend parts are disabled. --without-tcltk unconditionally disables Tcl/Tk dependent parts. The original behaviour is not changed: bare './configure' just installs the Tcl/Tk part doing no checks for the interpreter. Signed-off-by: Eygene Ryabinkin --- Makefile | 12 +++++++++++- config.mak.in | 1 + configure.ac | 26 ++++++++++++++++++++++++++ 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 0797ad4a99..da086a7fed 100644 --- a/Makefile +++ b/Makefile @@ -112,6 +112,10 @@ all:: # # Define NO_TCLTK if you do not want Tcl/Tk GUI. # +# The TCLTK_PATH variable governs the location of the Tck/Tk interpreter. +# If not set it defaults to the bare 'wish'. If it is set to the empty +# string then NO_TCLTK will be forced (this is used by configure script). +# GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE @$(SHELL_PATH) ./GIT-VERSION-GEN @@ -161,6 +165,7 @@ AR = ar TAR = tar INSTALL = install RPMBUILD = rpmbuild +TCLTK_PATH = wish # sparse is architecture-neutral, which means that we need to tell it # explicitly what architecture to check for. Fix this up for yours.. @@ -616,6 +621,10 @@ ifdef NO_PERL_MAKEMAKER export NO_PERL_MAKEMAKER endif +ifeq ($(TCLTK_PATH),) +NO_TCLTK=NoThanks +endif + QUIET_SUBDIR0 = $(MAKE) -C # space to separate -C and subdir QUIET_SUBDIR1 = @@ -654,6 +663,7 @@ prefix_SQ = $(subst ','\'',$(prefix)) SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) PERL_PATH_SQ = $(subst ','\'',$(PERL_PATH)) +TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH)) LIBS = $(GITLIBS) $(EXTLIBS) @@ -676,7 +686,7 @@ endif all:: ifndef NO_TCLTK - $(QUIET_SUBDIR0)git-gui $(QUIET_SUBDIR1) all + $(QUIET_SUBDIR0)git-gui TCLTK_PATH='$(TCLTK_PATH_SQ)' $(QUIET_SUBDIR1) all endif $(QUIET_SUBDIR0)perl $(QUIET_SUBDIR1) PERL_PATH='$(PERL_PATH_SQ)' prefix='$(prefix_SQ)' all $(QUIET_SUBDIR0)templates $(QUIET_SUBDIR1) diff --git a/config.mak.in b/config.mak.in index 9a578405d8..eb9d7a5549 100644 --- a/config.mak.in +++ b/config.mak.in @@ -6,6 +6,7 @@ CFLAGS = @CFLAGS@ AR = @AR@ TAR = @TAR@ #INSTALL = @INSTALL@ # needs install-sh or install.sh in sources +TCLTK_PATH = @TCLTK_PATH@ prefix = @prefix@ exec_prefix = @exec_prefix@ diff --git a/configure.ac b/configure.ac index 3a8e778def..01fa0f0bda 100644 --- a/configure.ac +++ b/configure.ac @@ -75,6 +75,14 @@ GIT_ARG_SET_PATH(shell) # Define PERL_PATH to provide path to Perl. GIT_ARG_SET_PATH(perl) # +# Declare the with-tcltk/without-tcltk options. +AC_ARG_WITH(tcltk, +AS_HELP_STRING([--with-tcltk],[use Tcl/Tk GUI (default is YES)]) +AS_HELP_STRING([],[ARG is the full path to the Tcl/Tk interpreter.]) +AS_HELP_STRING([],[Bare --with-tcltk will make the GUI part only if]) +AS_HELP_STRING([],[Tcl/Tk interpreter will be found in a system.]),\ +GIT_PARSE_WITH(tcltk)) +# ## Checks for programs. @@ -84,6 +92,24 @@ AC_PROG_CC([cc gcc]) #AC_PROG_INSTALL # needs install-sh or install.sh in sources AC_CHECK_TOOL(AR, ar, :) AC_CHECK_PROGS(TAR, [gtar tar]) +# TCLTK_PATH will be set to some value if we want Tcl/Tk +# or will be empty otherwise. +if test -z "$NO_TCLTK"; then + if test "$with_tcltk" = ""; then + # No Tcl/Tk switches given. Do not check for Tcl/Tk, use bare 'wish'. + TCLTK_PATH=wish + AC_SUBST(TCLTK_PATH) + elif test "$with_tcltk" = "yes"; then + # Tcl/Tk check requested. + AC_CHECK_PROGS(TCLTK_PATH, [wish], ) + elif test -x "$with_tcltk"; then + AC_MSG_RESULT([Using Tcl/Tk interpreter $with_tcltk]) + TCLTK_PATH="$with_tcltk" + AC_SUBST(TCLTK_PATH) + else + AC_MSG_ERROR([Tcl/Tk interpreter was not found in $with_tcltk]) + fi +fi ## Checks for libraries. AC_MSG_NOTICE([CHECKS for libraries]) From 6bdb18a9cef9124937941c6e5bd2b645c9da6537 Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Wed, 28 Mar 2007 04:22:02 -0700 Subject: [PATCH 3/5] 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 da086a7fed..88f9025e4c 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 From 68daee085cef975c76d9eeba91a3836cf88bcc3f Mon Sep 17 00:00:00 2001 From: Eygene Ryabinkin Date: Thu, 29 Mar 2007 14:06:48 +0400 Subject: [PATCH 4/5] Eliminate checks of user-specified Tcl/Tk interpreter. Do not make the checks on the Tcl/Tk interpreter passed by '--with-tcltk=/path/to/wish' configure option: user is free to pass anything. Signed-off-by: Eygene Ryabinkin Signed-off-by: Junio C Hamano --- configure.ac | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/configure.ac b/configure.ac index 01fa0f0bda..50d2b85ace 100644 --- a/configure.ac +++ b/configure.ac @@ -102,12 +102,10 @@ if test -z "$NO_TCLTK"; then elif test "$with_tcltk" = "yes"; then # Tcl/Tk check requested. AC_CHECK_PROGS(TCLTK_PATH, [wish], ) - elif test -x "$with_tcltk"; then + else AC_MSG_RESULT([Using Tcl/Tk interpreter $with_tcltk]) TCLTK_PATH="$with_tcltk" AC_SUBST(TCLTK_PATH) - else - AC_MSG_ERROR([Tcl/Tk interpreter was not found in $with_tcltk]) fi fi From 30551781938ec98811b8903b653c58ee95368fe4 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Fri, 30 Mar 2007 00:59:43 -0700 Subject: [PATCH 5/5] Optional Tck/Tk: ignore generated files. Signed-off-by: Junio C Hamano --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index e8d2731ee5..b39f78fcdf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ GIT-CFLAGS +GIT-GUI-VARS GIT-VERSION-FILE git git-add @@ -141,6 +142,7 @@ git-verify-tag git-whatchanged git-write-tree git-core-*/?* +gitk-wish gitweb/gitweb.cgi test-chmtime test-date