This file explains how to compile wcd for DOS and Windows
with GNU C compiler (GCC, DJGPP/MinGW/Cygwin). 

For Unix/Linux compile instructions see file UNIX.txt

For how to install the program on DOS/Windows see file DOS.txt.


Prerequisites
=============

* gcc       : GNU C compiler
* make      : GNU make
* sh        : POSIX type shell
* coreutils : GNU core utilities package

Optional:

* gettext   : Framework to help GNU packages produce multi-lingual messages.
* libiconv  : Character set conversion library.
DOS/Windows
* pdcurses  : CRT screen handling and optimization package
Cygwin
* ncurses   : CRT screen handling and optimization package


Only needed if you change the manual page:

* perl        : Practical Extraction and Report Language (perlpod)
* groff       : GNU troff text formatting system.
* ghostscript : An interpreter for the PostScript language and for PDF (ps2pdf)

Needed for building packages:

* zip         : compressor-archiver


gcc
===

DOS            : DJGPP     : http://www.delorie.com/djgpp/
Windows        : MinGW     : http://www.mingw.org/
Windows 64 bit : MinGW-w64 : http://mingw-w64.sourceforge.net/
Cygwin         : CYGWIN    : http://cygwin.com/

MinGW-w64 provides a cross-compiler that you can run on 32 bit Windows.
MinGW-w64 can produce programs for 32 and 64 bit Windows.


sh
==

A POSIX type shell. A copy of Bash or Zsh will do.

GNU make may not work as expected if you don't have a proper shell installed.
You can choose a shell for GNU Make by setting the environment variable SHELL.
See also the GNU make manual:

http://www.gnu.org/software/make/manual/make.html#Choosing-the-Shell

DJGPP     : Includes bash
MinGW     : Includes bash in the MSYS environment.
MinGW-w64 : You can use MinGW's MSYS
CYGWIN    : Includes bash and zsh.

In DJGPP it is certain that you get problems if you don't make the SHELL
variable point to bash (c:/djgpp/bin/bash.exe).


make, coreutils
===============

make and coreutils can be found as packages on the web site of the gcc compiler.

Coreutiles is needed for `chmod', `install', `mkdir', `mv', `rm', and `uname'.
install   : copy files and set their attributes (part of GNU `coreutils' package).

For DJGPP compiler use package `fileutils' instead of `coreutils'. Coreutils is
not (yet) available for DJGPP.

DJGPP     : http://www.delorie.com/pub/djgpp/current/v2gnu/
MinGW     : http://sourceforge.net/projects/mingw/files/
CYGWIN    : download via the installer program setup.exe.

For MinGW(-w64) use MSYS-make in the MSYS environment.


MinGW without MSYS
==================

You can build wcd in a normal Windows Command Prompt, using the MinGW gcc
compiler without the MSYS environment. For this you need GNU make, the
coreutils package and a POSIX type shell that works in the Windows Command
Prompt.

Get GNU Make and the coreutils package from the GnuWin32 project.

GnuWin32: http://gnuwin32.sourceforge.net/

Instead of MSYS bash you can use the native zsh for Windows:

http://www.xs4all.nl/~waterlan/zsh-3.0.5-nt-beta-0.75.zip
or an updated WinZsh at:
http://zsh-nt.sourceforge.net/

Copy `zsh.exe' as `sh.exe' somewhere in PATH.
Define SHELL, pointing to sh.exe.

Now you have a proper shell for GNU make.

See also file problems.txt.

It is advised to use the MSYS environment though.


gettext (libintl) and libiconv
==============================

gettext and libiconv can be found as packages on the web site of the gcc compiler.

DJGPP     : http://www.delorie.com/pub/djgpp/current/v2gnu/
MinGW     : http://sourceforge.net/projects/mingw/files/
MinGW-w64 : http://sourceforge.net/projects/mingw-w64/files/
CYGWIN    : download via the installer program setup.exe.


Until wcd version 5.1.1 I used GnuWin32's gettext/libiconv instead of MinGW's,
because the GnuWin32 port of libintl (part of gettext) has builtin relocation
support. From wcd version 5.1.2 I use MinGW's gettext/libiconv. Wcd win32
binaries are packed with a patched version of MinGW's libintl-8.dll that also
supports relocation. See also http://www.xs4all.nl/~waterlan/libintl.html

MinGW-w64 may not have all packages available yet.


PDCurses
========

To build wcd with PDCurses interface you need to have the PDCurses
library installed. Get PDCurses at http://sourceforge.net/projects/pdcurses/
Compile it and copy the library file into the \lib directory of your
compiler and the curses.h file in the \include directory.

To get support for the original console colours for the Windows 32 bit
version you need PDCurses 2.7 or higher.

I reported the following bug on http://sourceforge.net/projects/pdcurses/
*  Bug 1144353: Scroll out of window when screen buffer is large (Windows)
This bug is solved in PDCurses 2.7.


man, groff and ghostscript
==========================

These packages are needed if you want to work on the wcd manual page. Using man,
groff, and ghostscript the file src/man/man1/wcd.1 is convert to a manual in
text, PostScript and PDF format in the `doc' directory.

The converted manual pages are included in the wcd source package. So if you
don't change the wcd manual, you don't need these packages.

Man, groff and ghostscript are available in the Cygwin environment.


Problems on Windows VISTA/7
===========================

To be able to run `gmake install' you may need adminstrator rights. You can get
a Command Prompt with administrator rights if you right click on the Command
Prompt icon and select `run as administrator'.


Basic Installation
==================

dos32    : DOS 32 bit
dos32bsh : DOS 32 bit for BASH
win32    : Windows 32 bit console version.
win32zsh : Windows 32 bit MSYS and ZSH version.
win32psh : Windows 32 bit PowerShell version.
win64    : Windows 64 bit console version.
win64psh : Windows 64 bit PowerShell version.
msys     : Native MSYS version.
cygwin   : Cygwin version.

Change to the appropriate directory `dos32', `dos32bsh', `win32',
`win32zsh', `win32psh', 'msys',  or `cygwin'.


Build wcd:

  Type `make' to compile the package.

Install wcd:

  Type `make install' to install the package.

  `make install' will also compile the package if it wasn't done yet.

To start clean:

  Type `make clean'


Native Language Support (NLS)
=============================

NLS is by default enabled. To disable reset the ENABLE_NLS variable:

  make ENABLE_NLS=


Curses interface
================

The default interface is curses.

win32* uses PDCurses (CURSES=pdcurses)
cygwin, os2 uses NCurses (CURSES=ncurses)

To disable CURSES and compile with stdio interface, reset the CURSES variable:

  make CURSES=


Conio interface (DOS only)
==========================

To enable the conio interface instead of curses add CONIO=1:


  make CONIO=1


Unicode support
===============

To activate Unicode support add UCS=1 to the make command:

 `make UCS=1'

This requires a (pd/n)curses installation with wide character support.
Not supported for DOS versions of wcd.

Unicode support makes only sense if you compile for Windows PowerShell
or Cygwin 1.7 and up.


Installation Names
==================

By default `make install' will install the program in /usr/local/bin, the
language files in /usr/local/share/locale and the man file in
/usr/local/share/man. You can specify an installation prefix other than
`/usr/local' by giving `make' the option `prefix=PATH'.


Example:

  make clean
  make prefix=c:/Users/waterlan
  make install prefix=c:/Users/waterlan


dos32    : The default PREFIX is c:/djgpp
dos32bsh : The default PREFIX is c:/djgpp
win32    : The default PREFIX is c:/usr/local
win32zsh : The default PREFIX is c:/usr/local
win32psh : The default PREFIX is c:/usr/local
win64    : The default PREFIX is c:/usr/local
win64psh : The default PREFIX is c:/usr/local
msys     : The default PREFIX is /usr
cygwin   : The default PREFIX is /usr


distribution package
====================

After installation a ready-to-run binary distribution package can be created.

  Type `make dist' to create the package.


