diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-05-27 04:03:37 (GMT) |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2007-05-27 04:03:37 (GMT) |
commit | ea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813 (patch) | |
tree | 8cf06430c7640120033444cd6c8d003773103870 /git-gui.sh | |
parent | 3d5793bf52223ccec40aff2839a3c5bad96bca8b (diff) | |
download | git-ea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813.zip git-ea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813.tar.gz git-ea75ee3598ab6f8d0828f8cc6ec3d4a5f8d66813.tar.bz2 |
git-gui: Guess our share/git-gui/lib path at runtime if possiblegitgui-0.7.2
Johannes Sixt asked me to try to avoid embedding the runtime location
of git-gui's library directory in the executable script. Not embedding
it helps the MinGW to be relocatable to another directory should a user
wish to install the programs in a directory other than the location the
packager wanted them to be installed into.
Most of this is a hack. We try to determine if the path of our master
git-gui script will be able to locate the lib by ../share/git-gui/lib.
This should be true if $(gitexecdir) and $(libdir) have the same prefix.
If they do then we defer the assignment of $(libdir) until runtime, and
we get it from $argv0 rather than embedding it into the script itself.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'git-gui.sh')
-rwxr-xr-x | git-gui.sh | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -25,7 +25,11 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA} ## configure our library set oguilib {@@GITGUI_LIBDIR@@} -if {[string match @@GITGUI_*@@ $oguilib]} { +set oguirel {@@GITGUI_RELATIVE@@} +if {$oguirel eq {1}} { + set oguilib [file dirname [file dirname [file normalize $argv0]]] + set oguilib [file join $oguilib share git-gui lib] +} elseif {[string match @@* $oguirel]} { set oguilib [file join [file dirname [file normalize $argv0]] lib] } set idx [file join $oguilib tclIndex] @@ -55,7 +59,7 @@ if {$idx ne {}} { } else { set auto_path [concat [list $oguilib] $auto_path] } -unset -nocomplain fd idx +unset -nocomplain oguilib oguirel idx fd if {![catch {set _verbose $env(GITGUI_VERBOSE)}]} { unset _verbose |