git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* git-gui cannot find share/git-gui under cygwin
@ 2007-06-19 12:28 Mark Levedahl
  2007-06-19 14:49 ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Levedahl @ 2007-06-19 12:28 UTC (permalink / raw)
  To: Shawn O. Pearce, Git Mailing List

Commit ea75ee3598ab6f8d0828f introduced logic to guess where 
share/git-gui/lib is at runtime, and this is broken on Cygwin. The basic 
problem is that:

/usr/bin = c:\cygwin\bin
/usr/share = c:\cygwin\usr\share

The detection logic correctly finds the wish binary in c:\cygwin\bin, 
and then assumes that the share directory is c:\cygwin\share rather than 
c:\cygwin\usr\share. Given this, git-gui does not load as it cannot find 
its share/git-gui/lib directory

Mark Levedahl

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git-gui cannot find share/git-gui under cygwin
  2007-06-19 12:28 git-gui cannot find share/git-gui under cygwin Mark Levedahl
@ 2007-06-19 14:49 ` Shawn O. Pearce
  2007-06-19 18:41   ` Mark Levedahl
  0 siblings, 1 reply; 4+ messages in thread
From: Shawn O. Pearce @ 2007-06-19 14:49 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: Git Mailing List

Mark Levedahl <mlevedahl@gmail.com> wrote:
> Commit ea75ee3598ab6f8d0828f introduced logic to guess where 
> share/git-gui/lib is at runtime, and this is broken on Cygwin. The basic 
> problem is that:
> 
> /usr/bin = c:\cygwin\bin
> /usr/share = c:\cygwin\usr\share
> 
> The detection logic correctly finds the wish binary in c:\cygwin\bin, 
> and then assumes that the share directory is c:\cygwin\share rather than 
> c:\cygwin\usr\share. Given this, git-gui does not load as it cannot find 
> its share/git-gui/lib directory

Yuck.  I'm considering applying the following.  It works ok on Mac
OS X where the bug isn't triggered anyway.  ;-) I won't be able to
test on Cygwin until tomorrow.

-->8--
git-gui: Correctly install to /usr/bin on Cygwin

Mark Levedahl <mlevedahl@gmail.com> noted that installation on Cygwin
to /usr/bin can cause problems with the automatic guessing of our
library location.  The problem is that installation to /usr/bin
means we actually have:

  /usr/bin   = c:\cygwin\bin
  /usr/share = c:\cygwin\usr\share

So git-gui guesses that its library should be found within the
c:\cygwin\share directory, as that is where it should be relative
to the script itself in c:\cygwin\bin.

In this case we have to use `cygpath` during installation to find out
what the mapping is from the UNIX path we are seeing in GNU make,
to the Windows path we will actually see in our Tcl/Tk process.
After that mapping has been performed we can then test to see if
our share directory can be found by relative location, or if we
need to encode the absolute location.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
---
 Makefile |   14 ++++++++++++--
 1 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3de0de1..1c01c83 100644
--- a/Makefile
+++ b/Makefile
@@ -7,6 +7,8 @@ GIT-VERSION-FILE: .FORCE-GIT-VERSION-FILE
 	@$(SHELL_PATH) ./GIT-VERSION-GEN
 -include GIT-VERSION-FILE
 
+uname_O := $(shell sh -c 'uname -o 2>/dev/null || echo not')
+
 SCRIPT_SH = git-gui.sh
 GITGUI_BUILT_INS = git-citool
 ALL_PROGRAMS = $(GITGUI_BUILT_INS) $(patsubst %.sh,%,$(SCRIPT_SH))
@@ -58,14 +60,22 @@ exedir_SQ = $(subst ','\'',$(exedir))
 
 $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh
 	$(QUIET_GEN)rm -f $@ $@+ && \
-	if test '$(exedir_SQ)' = '$(libdir_SQ)'; then \
+	A='$(exedir_SQ)' && \
+	B='$(libdir_SQ)' && \
+	if test "$(uname_O)" = Cygwin; then \
+		A="$$(cygpath -m -a "$$A")" && \
+		B="$$(cygpath -m -a "$$B")"; \
+	fi && \
+	if test "$$A" = "$$B"; then \
 		GITGUI_RELATIVE=1; \
+	else \
+		GITGUI_RELATIVE=; \
 	fi && \
 	sed -e '1s|#!.*/sh|#!$(SHELL_PATH_SQ)|' \
 		-e 's|^exec wish "$$0"|exec $(subst |,'\|',$(TCLTK_PATH_SQ)) "$$0"|' \
 		-e 's/@@GITGUI_VERSION@@/$(GITGUI_VERSION)/g' \
 		-e 's|@@GITGUI_RELATIVE@@|'$$GITGUI_RELATIVE'|' \
-		-e $$GITGUI_RELATIVE's|@@GITGUI_LIBDIR@@|$(libdir_SQ)|' \
+		-e $$GITGUI_RELATIVE"s|@@GITGUI_LIBDIR@@|$$B|" \
 		$@.sh >$@+ && \
 	chmod +x $@+ && \
 	mv $@+ $@
-- 
1.5.2.2.1012.ge05f4


-- 
Shawn.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: git-gui cannot find share/git-gui under cygwin
  2007-06-19 14:49 ` Shawn O. Pearce
@ 2007-06-19 18:41   ` Mark Levedahl
  2007-06-21  3:30     ` Shawn O. Pearce
  0 siblings, 1 reply; 4+ messages in thread
From: Mark Levedahl @ 2007-06-19 18:41 UTC (permalink / raw)
  To: Shawn O. Pearce; +Cc: Git Mailing List

Shawn O. Pearce wrote:
> Yuck.  I'm considering applying the following.  It works ok on Mac
> OS X where the bug isn't triggered anyway.  ;-) I won't be able to
> test on Cygwin until tomorrow.
>
>   
sorry, no joy. The problem is that gitexecdir=/usr/bin, but...

/usr/bin is a Cygwin mount point that points at c:\cygwin\bin.

so...

$ cygpath -m -a /bin
C:/cygwin/bin
$ cygpath -m -a /usr
C:/cygwin/usr
$ cygpath -m -a /usr/bin
C:/cygwin/bin
$ cygpath -m -a /usr/share
C:/cygwin/usr/share

and the result is that both  exedir_SQ  and  libdir_SQ  have the value  
/usr/share/git-gui-lib

I don't think there is a portable solution here. Maybe just say

    if test "$(uname_O)" = Cygwin; then \
        GITGUI_RELATIVE=; \
 
and be done with it.

Mark

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: git-gui cannot find share/git-gui under cygwin
  2007-06-19 18:41   ` Mark Levedahl
@ 2007-06-21  3:30     ` Shawn O. Pearce
  0 siblings, 0 replies; 4+ messages in thread
From: Shawn O. Pearce @ 2007-06-21  3:30 UTC (permalink / raw)
  To: Mark Levedahl; +Cc: Git Mailing List

Mark Levedahl <mlevedahl@gmail.com> wrote:
> Shawn O. Pearce wrote:
> >Yuck.  I'm considering applying the following.  It works ok on Mac
> >OS X where the bug isn't triggered anyway.  ;-) I won't be able to
> >test on Cygwin until tomorrow.
>  
> sorry, no joy. The problem is that gitexecdir=/usr/bin, but...

Thanks for the feedback.

> I don't think there is a portable solution here. Maybe just say
> 
>    if test "$(uname_O)" = Cygwin; then \
>        GITGUI_RELATIVE=; \
> 
> and be done with it.

Yup.  Done.  Now in my `maint`, `master` and `pu` branches.

-- 
Shawn.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-06-21  3:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-06-19 12:28 git-gui cannot find share/git-gui under cygwin Mark Levedahl
2007-06-19 14:49 ` Shawn O. Pearce
2007-06-19 18:41   ` Mark Levedahl
2007-06-21  3:30     ` Shawn O. Pearce

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).