git-gui: Make git-gui lib dir configurable at runime
authorDavid Turner <dturner@twopensource.com>
Mon, 21 Jul 2014 20:41:38 +0000 (16:41 -0400)
committerPat Thoyts <patthoyts@users.sourceforge.net>
Sun, 10 Aug 2014 11:48:28 +0000 (12:48 +0100)
Introduce the GIT_GUI_LIB_DIR environment variable, to tell git-gui
where to look for TCL libs. This allows a git-gui which has been
built with a prefix of /foo to be run out of directory /bar. This is
the equivalent of GIT_EXEC_PATH or GITPERLLIB but for git-gui's TCL
libraries.

Signed-off-by: David Turner <dturner@twitter.com>
Signed-off-by: Pat Thoyts <patthoyts@users.sourceforge.net>
Makefile
git-gui.sh
macosx/AppMain.tcl
index cde8b2ea31969192136d5c541458cc43c358d4dc..4f00bdd3d69babe8a58c4989406eaa6fb5f36a50 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -177,7 +177,8 @@ git-gui: GIT-VERSION-FILE GIT-GUI-VARS
        echo then >>$@+ && \
        echo '  'echo \'git-gui version '$(GITGUI_VERSION)'\' >>$@+ && \
        echo else >>$@+ && \
-       echo '  'exec \''$(libdir_SQ)/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\' \
+       echo '  libdir="$${GIT_GUI_LIB_DIR:-$(libdir_SQ)}"' >>$@+ && \
+       echo '  'exec \"'$$libdir/Git Gui.app/Contents/MacOS/$(subst \,,$(TKEXECUTABLE))'\" \
                '"$$0" "$$@"' >>$@+ && \
        echo fi >>$@+ && \
        chmod +x $@+ && \
index b186329d28c07825992fad039746df8563a92c3b..6cbb36eab6a75aa0b2bdf751eade5a6ae6ea76f2 100755 (executable)
@@ -49,7 +49,11 @@ catch {rename send {}} ; # What an evil concept...
 ##
 ## locate our library
 
-set oguilib {@@GITGUI_LIBDIR@@}
+if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
+       set oguilib $::env(GIT_GUI_LIB_DIR)
+} else {
+       set oguilib {@@GITGUI_LIBDIR@@}
+}
 set oguirel {@@GITGUI_RELATIVE@@}
 if {$oguirel eq {1}} {
        set oguilib [file dirname [file normalize $argv0]]
index 738bdd03ed8a3940ae9bec362ddcfd16a3c48e9c..b6c6dc35003bb30a97feebcec6e3247f71f0c314 100644 (file)
@@ -1,5 +1,10 @@
 set gitexecdir {@@gitexecdir@@}
-set gitguilib  {@@GITGUI_LIBDIR@@}
+if { [info exists ::env(GIT_GUI_LIB_DIR) ] } {
+       set gitguilib $::env(GIT_GUI_LIB_DIR)
+} else {
+       set gitguilib {@@GITGUI_LIBDIR@@}
+}
+
 set env(PATH) "$gitexecdir:$env(PATH)"
 
 if {[string first -psn [lindex $argv 0]] == 0} {