Re: FW: [Mingw-msys] How do I recreate the MSYS distribution?
- Date: Thu, 01 Nov 2007 19:03:34 -0300
- From: Gonzalo Garramuño <ggarra@xxxxxxxxxxxxxxxxx>
- Subject: Re: [Mingw-msys] Default install location for CMake
Bill Hoffman wrote:
> OK, so it sounds like /usr/local is a good default for the CMake install
> prefix for the MSYS Makefile generator in CMake. Thanks for helping out!
> The trick now is to get CMake (a pure windows application), to know
> where /usr/local is on the disk. The approach for that seems to be to
> run the following commands:
> sh.exe -c 'cd /usr/local; pwd -W'
> if that fails then do this:
> sh.exe -c 'cd /usr; pwd -W'
> and tack on /local to the answer.
> I guess there is no equivalent of cygpath in msys that can be used.
While some have recommended using sh -e "cd path; pwd -W", assuming you
don't mind writing more code, personally I would rely on the output of
mount.exe. By finding if /usr/local or /usr is there, you can locate
the other paths.
C:\DOCUME~1\gga\CONFIG~1\Temp on /tmp type user (binmode,noumount)
c:\ActiveState\perl on /perl type user (binmode)
c:\msys\1.0\mingw on /mingw type user (binmode)
\\aura001\\bin on /gga/bin type user (binmode)
C:\msys\1.0 on / type user (binmode,noumount)
C:\msys\1.0 on /usr type user (binmode,noumount)
a: on /a type user (binmode,noumount)
c: on /c type user (binmode,noumount)
d: on /d type user (binmode,noumount)
e: on /e type user (binmode,noumount)
z: on /z type user (binmode,noumount)
The benefit of this is that you can run and parse this only once when
cmake starts, cache it in a hash, and then any command that needs to
find a path can locate the path by doing a case sensitive and case
insensitive search through the hash (msys is case insensitive, but samba
mounts might not be).
This makes not only /usr/local work but it would then make supporting
FIND_LIBRARY, FIND_PATH, etc. relatively easily and efficiently. You
can also easily discard invalid paths early on without needing to run
any external process.
With sh -e, in the best scenario as it is with msys by default, you are
always forking a new process for each path you want to check which would
make FIND_LIBRARY and similar relatively slow as they often have to
check 5 to 10 paths. In a worse case scenario, where sh.exe is not
bash, you end up forking not one but three processes.
By using sh.exe, cmake also cannot tell before hand if the path is going
to be valid or not until the command fails. And when it fails, you
might not know exactly why (is sh.exe or other command missing? is it
temporary network trouble? An invalid path?)
AMD4400 - ASUS48N-E
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
Mingw-msys mailing list