summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d4278b5)
raw | patch | inline | side by side (parent: d4278b5)
author | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 21 Sep 2007 01:25:34 +0000 (21:25 -0400) | ||
committer | Shawn O. Pearce <spearce@spearce.org> | |
Fri, 21 Sep 2007 03:16:53 +0000 (23:16 -0400) |
Cygwin has been stuck on the 8.4.1 version of Tcl/Tk for quite some
time, even though the main Tcl/Tk distribution is already shipping
an 8.4.15. The problem is Tcl/Tk no longer supports Cygwin so
apparently building the package for Cygwin is now a non-trivial task.
Its actually quite easy to build the native Win32 version of Tcl/Tk
by compiling with the -mno-cygwin flag passed to GCC but this means
we lose all of the "fancy" Cygwin path translations that the Tcl
library was doing for us. This is particularly an issue when we
are trying to start git-gui through the git wrapper as the git
wrapper is passing off a Cygwin path for $0 and Tcl cannot find
the startup script or the library directory.
We now use `cygpath -m -a` to convert the UNIX style paths to Windows
style paths in our startup script if we are building on Cygwin.
Doing so allows either the Cygwin-ized Tcl/Tk 8.4.1 that comes with
Cygwin or a manually built 8.4.15 that is running the pure Win32
implementation to read our script.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
time, even though the main Tcl/Tk distribution is already shipping
an 8.4.15. The problem is Tcl/Tk no longer supports Cygwin so
apparently building the package for Cygwin is now a non-trivial task.
Its actually quite easy to build the native Win32 version of Tcl/Tk
by compiling with the -mno-cygwin flag passed to GCC but this means
we lose all of the "fancy" Cygwin path translations that the Tcl
library was doing for us. This is particularly an issue when we
are trying to start git-gui through the git wrapper as the git
wrapper is passing off a Cygwin path for $0 and Tcl cannot find
the startup script or the library directory.
We now use `cygpath -m -a` to convert the UNIX style paths to Windows
style paths in our startup script if we are building on Cygwin.
Doing so allows either the Cygwin-ized Tcl/Tk 8.4.1 that comes with
Cygwin or a manually built 8.4.15 that is running the pure Win32
implementation to read our script.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Makefile | patch | blob | history | |
git-gui.sh | patch | blob | history |
diff --git a/Makefile b/Makefile
index 8c87d836d8307098e4c7d6dfbc9d830a253dd0aa..6236dd6ad397e72956dfa43ec3c7add2698486a3 100644 (file)
--- a/Makefile
+++ b/Makefile
SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
TCL_PATH_SQ = $(subst ','\'',$(TCL_PATH))
TCLTK_PATH_SQ = $(subst ','\'',$(TCLTK_PATH))
+TCLTK_PATH_SED = $(subst ','\'',$(subst \,\\,$(TCLTK_PATH)))
gg_libdir ?= $(sharedir)/git-gui/lib
libdir_SQ = $(subst ','\'',$(gg_libdir))
+libdir_SED = $(subst ','\'',$(subst \,\\,$(gg_libdir)))
+exedir = $(dir $(gitexecdir))share/git-gui/lib
-exedir = $(dir $(gitexecdir))share/git-gui/lib
-exedir_SQ = $(subst ','\'',$(exedir))
+GITGUI_SCRIPT := $$0
+GITGUI_RELATIVE :=
+
+ifeq ($(exedir),$(gg_libdir))
+ GITGUI_RELATIVE := 1
+endif
+
+ifeq ($(uname_O),Cygwin)
+ GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"`
+ ifeq ($(GITGUI_RELATIVE),)
+ gg_libdir := $(shell cygpath --windows --absolute "$(gg_libdir)")
+ endif
+endif
$(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
$(QUIET_GEN)rm -f $@ $@+ && \
- GITGUI_RELATIVE= && \
- if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \
- if test "$(uname_O)" = Cygwin; \
- then GITGUI_RELATIVE= ; \
- else GITGUI_RELATIVE=1; \
- fi; \
- fi && \
sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
- -e 's|^ exec wish "$$0"| exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
+ -e '1,30s|^ argv0=$$0| argv0=$(GITGUI_SCRIPT)|' \
+ -e '1,30s|^ exec wish | exec '\''$(TCLTK_PATH_SED)'\'' |' \
-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
- -e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
- -e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
+ -e 's|@@GITGUI_RELATIVE@@|$(GITGUI_RELATIVE)|' \
+ -e '$(GITGUI_RELATIVE)s|@@GITGUI_LIBDIR@@|$(libdir_SED)|' \
$@.sh >$@+ && \
chmod +x $@+ && \
mv $@+ $@
diff --git a/git-gui.sh b/git-gui.sh
index db1507cdece56fa1031d5036e9887e39a98caf5f..5a465e1c7dd19c36d764ed4d20b7d02eb72f2b8a 100755 (executable)
--- a/git-gui.sh
+++ b/git-gui.sh
echo 'git-gui version @@GITGUI_VERSION@@'; \
exit; \
fi; \
- exec wish "$0" -- "$@"
+ argv0=$0; \
+ exec wish "$argv0" -- "$@"
set appvers {@@GITGUI_VERSION@@}
set copyright {
exit 1
}
if {![file isdirectory $_gitdir] && [is_Cygwin]} {
- catch {set _gitdir [exec cygpath --unix $_gitdir]}
+ catch {set _gitdir [exec cygpath --windows $_gitdir]}
}
if {![file isdirectory $_gitdir]} {
catch {wm withdraw .}