Subject: [PATCH] Fix paths on FreeBSD by processing gitk like other scripts

From: Eric Anholt <[email-masked]>
Date: Fri, 07 Apr 2006 14:03:51 -0700

The paths for python and tk are not /usr/bin for FreeBSD, so I moved
gitk to gitk.tk and added a rule to sed in the proper path to "wish" in
making gitk, and also added the appropriate default path for python.

-- 
Eric Anholt                     [email-masked]
[email-masked]                 [email-masked]
diff --git a/.gitignore b/.gitignore
index b5959d6..e9d5a7b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,7 @@ git-verify-tag
 git-whatchanged
 git-write-tree
 git-core-*/?*
+gitk
 test-date
 test-delta
 common-cmds.h
diff --git a/Makefile b/Makefile
index 3367b8c..de28dec 100644
--- a/Makefile
+++ b/Makefile
@@ -136,6 +136,9 @@ SCRIPT_PERL = \
 SCRIPT_PYTHON = \
 	git-merge-recursive.py
 
+SCRIPT_TK = \
+	gitk.tk
+
 SCRIPTS = $(patsubst %.sh,%,$(SCRIPT_SH)) \
 	  $(patsubst %.perl,%,$(SCRIPT_PERL)) \
 	  $(patsubst %.py,%,$(SCRIPT_PYTHON)) \
@@ -174,6 +177,15 @@ # Backward compatibility -- to be remove
 PROGRAMS += git-ssh-pull$X git-ssh-push$X
 
 # Set paths to tools early so that they can be used for version tests.
+ifeq ($(uname_S),FreeBSD)
+	ifndef PYTHON_PATH
+		PYTHON_PATH = /usr/local/bin/python
+	endif
+	ifndef WISH_PATH
+		WISH_PATH = /usr/local/bin/wish8.4
+	endif	
+endif
+
 ifndef SHELL_PATH
 	SHELL_PATH = /bin/sh
 endif
@@ -183,6 +195,9 @@ endif
 ifndef PYTHON_PATH
 	PYTHON_PATH = /usr/bin/python
 endif
+ifndef WISH_PATH
+	WISH_PATH = wish
+endif
 
 PYMODULES = \
 	gitMergeCommon.py
@@ -484,6 +499,12 @@ common-cmds.h: Documentation/git-*.txt
 	    -e 's|@@GIT_PYTHON_PATH@@|$(GIT_PYTHON_DIR_SQ)|g' \
 	    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \
 	    $@.py >$@
+	chmod +x $@
+
+$(patsubst %.tk,%,$(SCRIPT_TK)) : % : %.tk
+	rm -f $@
+	sed -e "s|exec wish|exec $(WISH_PATH)|" \
+	    $@.tk >$@
 	chmod +x $@
 
 git-cherry-pick: git-revert
diff --git a/gitk b/gitk.tk
similarity index 100%
rename from gitk
rename to gitk.tk