From df4ec4cf6f68d92d2fbf20e808722d242ab2b894 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Thu, 21 Feb 2008 19:27:46 -0500 Subject: [PATCH] git-gui: Avoid hardcoded Windows paths in Cygwin package files MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit When we are being built by the Cygwin package maintainers we need to embed the POSIX path to our library files and not the Windows path. Embedding the Windows path means all end-users who install our Cygwin package would be required to install Cygwin at the same Windows path as the package maintainer had Cygwin installed to. This requirement is simply not user-friendly and may be infeasible for a large number of our users. We now try to auto-detect if the Tcl/Tk binary we will use at runtime is capable of translating POSIX paths into Windows paths the same way that cygpath does the translations. If the Tcl/Tk binary gives us the same results then it understands the Cygwin path translation process and should be able to read our library files from a POSIX path name. If it does not give us the same answer as cygpath then the Tcl/Tk binary might actually be a native Win32 build (one that is not linked against Cygwin) and thus requires the native Windows path to our library files. We can assume this is not a Cygwin package as the Cygwin maintainers do not currently ship a pure Win32 build of Tcl/Tk. Reported on the git mailing list by Jurko Gospodnetić. Signed-off-by: Shawn O. Pearce --- Makefile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 1ba0e78..01e0a46 100644 --- a/Makefile +++ b/Makefile @@ -131,7 +131,17 @@ GITGUI_MACOSXAPP := ifeq ($(uname_O),Cygwin) GITGUI_SCRIPT := `cygpath --windows --absolute "$(GITGUI_SCRIPT)"` - gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + + # Is this a Cygwin Tcl/Tk binary? If so it knows how to do + # POSIX path translation just like cygpath does and we must + # keep libdir in POSIX format so Cygwin packages of git-gui + # work no matter where the user installs them. + # + ifeq ($(shell echo 'puts [file normalize /]' | '$(TCL_PATH_SQ)'),$(shell cygpath --mixed --absolute /)) + gg_libdir_sed_in := $(gg_libdir) + else + gg_libdir_sed_in := $(shell cygpath --windows --absolute "$(gg_libdir)") + endif else ifeq ($(exedir),$(gg_libdir)) GITGUI_RELATIVE := 1 -- 2.11.4.GIT