Unix emulation and porting on Win32

Kvasi's guide to getting your windows to behave a little bit more like a sane operating system.
Presented in the same colors as my Emacs. :)
All paths in these examples must of course be changed to match your paths in order to work... (but if you didn't already know that you shouldn't be reading this file)

Cygwin

Download the setup, run it. Install the default stuff plus anyting you might need, like ssh and rxvt.

Change cygwin.bat to use rxvt as terminal instead of the the dos prompt:

start rxvt -e bash --login -i
or even better, make a shortcut that calls rxvt directly instead of a bat file. Like this:
C:\misc\cygwin\bin\rxvt.exe -e bash --login -i

Create a .Xdefaults in your home directory.
Add some stuff to make rxvt look like you want, may be something like this:

Rxvt.background:	midnight blue
Rxvt.foreground:	white
Rxvt.cursorColor:	red
Rxvt.font:		"Lucida Console-10"
Rxvt.scrollBar_right:	True
Rxvt.saveLines:		2048
More info at man rxvt

Cygwin should have created a .bashrc and a .bash_profile file in your home directory. .bash_profile basically calls .bashrc if there is one, so that it's always executed (login shells reads from .bash_profile and not .bashrc). For a better structure you might want to create .aliases, .paths etc. To run such a file at startup, write this in your .bashrc:

. ~/.aliases
If you get inaccurate time in cygwin (I don't think that's necessary anymore) try to set the timezone variable TZ for the correct time, the following works for CET countries using daylight savings time (Sweden etc):
export TZ=CET-1CEST-2,M3.5.0/02:00:00,M10.5.0/03:00:00
Create a .inputrc and add stuff to config Cygwin input behaviour:
# Ignore case for the command-line-completion functionality.
set completion-ignore-case On

# to show all characters like åäö
set meta-flag On
set input-meta On
set output-meta On
set convert-meta Off

# Make Delete work
"\e[3~": delete-char
For some reason the following no longer works with the latest versions of rxvt, don't know why. Hope they fix it.
"\C-v": paste-from-clipboard

One thing you should know about using another terminal emulator than cmd is that it buffers output due to that Windows doesn't recognize it as a terminal. Only output to terminals are unbuffered.

If you intend to use ssh and scp, then you should take a look at this, it explains how to exchange keys so that you can use ssh and scp without having to enter a password!

Emacs

Get the latest precompiled emacs from here, or if you want to try a cvs build, try here.

Declare the home variable in autoexec.bat if you use Windows 9x or ME so that home is defined even if emacs is not executed from Cygwin.

SET HOME=C:\misc\cygwin\home\myname
Or, if you have Windows XP or 2000 then you can declare environment variables for either the system or a specific user by setting them in:
settings->control panel->system->advanced->environment variables

Download a ftp client that works with emacs from here and edit your .emacs so thet emacs knows what ftp client to use. If you want to use SSH instead of ftp, check out this page.

(setq ange-ftp-ftp-program-name "c:/program files/emacs-21.3/bin/ftp.exe")
since ftp is unsecure you might want to use Tramp, which is an Emacs extension similar to Ange-FTP, but where Ange-FTP uses FTP to transfer the files, Tramp uses a shell login. To use tramp with NT-Emacs and cygwin's ssh you have to download tramp, eschange ssh keys, and add something like this to .emacs.
(add-to-list 'load-path "~/emacs/tramp-2.1.3/lisp/")
(require 'tramp)

;; (setq process-connection-type t)
(setq tramp-default-method "ssh")

(nconc (cadr (assq 'tramp-login-args (assoc "ssh" tramp-methods)))
       '(("bash" "-i")))
(setcdr (assq 'tramp-remote-sh (assoc "ssh" tramp-methods))
	'("bash -i"))
More about Tramp can be found here.

Since the win32 version of emacs doesn't use .Xdefault files the easiest way to configure things like colors, fonts and geometry of the window is in .emacs (you can do it in the registry, but the registry sucks). I'm not going to go into the detail about configuring emacs because there's just too much to say, you can look at my windows version of .emacs here or read the GNU Emacs FAQ For Windows.

Some things you can also configure by using command line argument, like:

runemacs.exe -fg white -bg "midnight blue" -cr red

You might want to install some modes like HTML helper mode and ctypes.

MinGW: Minimalist GNU For Windows

Since programs compiled with Cygwin's gcc use the Cygwin dll for posix emulation you might want a gcc version that uses Microsoft's standard C runtime library MSVCRT.DLL, and this is exactly what MinGW does.

Download MinGW, or even better download an IDE that uses MinGW, Dev-C++ and has other features such as easy package updater. To avoid the path trouble due to the same name of the compilers you should install MinGW or Dev-C++ in a separate directory, like:

C:\misc\MinGW\
or
C:\misc\Dev-Cpp\

Then add the path in .bashrc. To be able to switch between Cygwin's ggc (and it's tools) and MinGW's gcc (and it's tools) i chose to do like this:

export CYGWIN_PATH=$PATH
export MINGW_PATH=/cygdrive/c/misc/mingw/bin:$PATH
export PATH=$MINGW_PATH

alias cygwin='export PATH=$CYGWIN_PATH'
alias mingw='export PATH=$MINGW_PATH'
or
export CYGWIN_PATH=$PATH
export MINGW_PATH=/cygdrive/c/misc/Dev-Cpp/bin:$PATH
export PATH=$MINGW_PATH

alias cygwin='export PATH=$CYGWIN_PATH'
alias mingw='export PATH=$MINGW_PATH'
So the commands mingw and cygwin switch path.
Another thing I want to say is that the make that comes with mingw doesn't work nearly as well as the make that comes with cygwin, so to ensure that the correct version of make is used, either rename or delete the version of make distributed with MinGW. Another nifty little tool is colorgcc, it's a Perl wrapper to colorize the output of compilers with warning / error messages matching the gcc output format. To get it to work with Cygwin and MinGW you have to rename colorgcc to gcc and g++, make sure these are ahead of the ordianry gcc and g++ in $PATH, and make sure you use Cygwin's make.

For more info, check out the MinGW FAQ and
MinGW Support in Cygwin

GnuWin32

If there's any programs you miss in Cygwin there's another projekt porting GNU utils to Windows (native), namely GnuWin32. Among other things they have ported a lot of great graphics packages that's not available in Cygwin.

GNU utilities for Win32

Additional ports can be found here.

GTK+ and GIMP for Windows

GIMP and GTK+ can be downloaded from here.
Get the glade port wGLADE or get the glade port included in GtkAda.

The Fast Light Toolkit

And last but not least my favorite cross-platform GUI toolkit, FLTK.
It supports UNIX®/Linux® (X11), Microsoft® Windows®, and MacOS® X.

Microsoft Visual Studio .NET 2003

Using Microsoft Visual Studio .NET 2003 from Cygwin
Last Modified: Friday, 09-Sep-2005 15:41:35 MEST