# Farrago Cygwin Setup

Here's a description of one way to set up your Cygwin environment for use in working on Farrago. There are other ways to do it; this one is known to work and allows you to pretty much pretend you're not even running Windows.

1. Start by installing (or upgrading to) the latest Cygwin distribution. If you're planning to build the Fennel library, the Fennel INSTALL.mingw doc has more details on particular Cygwin packages and versions required.
2. Choose a directory which will contain third-party software and the Farrago build environment. For example, I chose my home directory, /home/jvs, which is on my d: drive (referred to in Windows as d:\cygwin\home\jvs). This will be referred to as the "home" directory.
3. Create a "mirror" directory outside of the cygwin root on the same drive. For me, this was d:\home\jvs (referred to in Cygwin as /cygdrive/d/home/jvs).
4. Move anything in the home directory to the mirror directory (nothing if you're starting from scratch), leaving the original directory empty.
5. Delete the home directory (rmdir /home/jvs).
6. Create a symbolic link so that the home directory aliases the mirror directory (ln -s /cygdrive/d/home/jvs /home/jvs).
7. Now, if we ignore the drive letter and slash direction, the path to the home directory looks the same regardless of whether we are running a Cygwin program or a native Windows program (including Java applications such as ant). This means environment variables can be defined just once and used by both environments.
8. Install the native Windows Perforce client programs, NOT the Cygwin Perforce client. If you need to use both, be sure to set your path in such a way that when you are working on Farrago, you use the Windows client programs. The Cygwin Perforce client seems to get confused by the symlinks.
9. Cygwin sets the PWD environment variable with a Unix path, so the Windows Perforce client can't read it, giving it trouble finding your .p4config file. You can work around this by setting environment variable P4CONFIG to have the Windows path to your .p4config file, e.g. export P4CONFIG=$(cygpath -w "/home/jvs/.p4config")
10. When you create a Perforce client definition, make sure the client root is under the home directory, without a drive letter (e.g. /home/jvs). Set the LineEnd attribute to `share` to avoid problems with CRLF, and also set your `CYGWIN` environment variable to contain the `binmode` attribute.
11. Sync the code and you should be ready to follow the rest of the build instructions.