Skip to content

Commit

Permalink
git-gui: Make git-gui lib dir configurable at runime
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Turner authored and Pat Thoyts committed Aug 10, 2014
1 parent 8871820 commit a3b3ae3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $@+ && \
Expand Down
6 changes: 5 additions & 1 deletion git-gui.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
7 changes: 6 additions & 1 deletion macosx/AppMain.tcl
Original file line number Diff line number Diff line change
@@ -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} {
Expand Down

0 comments on commit a3b3ae3

Please sign in to comment.