Building Chocolate Doom on Windows

From Chocolate Doom
Jump to: navigation, search
Chocolate Doom on Windows

Chocolate Doom is built on Windows using the Cygwin build environment. Windows developers may find this unusual as Microsoft Visual Studio is often considered the "standard" compiler for that platform. Cygwin provides a Unix-like development environment that is the same as other platforms, so the build system and compiler (autotools, make, gcc) are identical for every operating system that Chocolate Doom runs on. Using Cygwin also means that Chocolate Doom is not dependent on a proprietary tool.

Note that Cygwin is only used as a build environment: Chocolate Doom is actually built using the MinGW version of gcc, and is not linked against the Cygwin libraries (cygwin1.dll).

Building using Cygwin is not difficult. However, Cygwin is a Unix-like environment, so if you are not familiar with using a Unix command line, or find these instructions confusing, it may be a good idea to do some basic reading about how to use one. If you have used DOS or the Windows command line in the past you will find that things are fairly similar.

Developers who are unhappy with this arrangement can use the alternative build project files to compile using either Microsoft Visual Studio or Code::Blocks. However, be aware that these project files may be out of date, and the "canonical" way of building Chocolate Doom is using Cygwin.

Installing Cygwin[edit]

The first step is to install Cygwin. Cygwin has a graphical setup wizard that makes setting it up easy - simply download and run setup.exe from the website.

If you already have Cygwin installed, re-run the setup program again, and follow through the instructions in this section to make sure you have all the packages below installed.

Go through the setup program until the point where you are prompted to select which packages you want to install. Click the "view" button at the top right of the window and select "full" to get a single list of packages sorted by name, and select the following packages:

  • automake1.14
  • autoconf2.5
  • bash
  • git
  • mingw-gcc-core
  • mingw-w32api
  • make
  • python
  • wget
  • patchutils

Note that there are several compiler options available with Cygwin. mingw-gcc-core is presently the prefered compiler, as it can produce executables for ancient versions of Windows (NT3.x, NT4.0, 95, 98, Me). The standard gcc-core package produces exectubles with a dependency on Cygwin and behave as Unix programs, this is normally undesirable on Windows. mingw64-i686-gcc-core and mingw64-x86_64-gcc-core are also available, and work, but they cannot produce executables that run on old versions of Windows.

Having selected the necessary packages, click "next" to begin the install process. If you are installing Cygwin for the first time it may take a while to download and install all of the packages.

Auto-build script[edit]

Next, download the auto-build script. You can use wget to do this from the Cygwin Bash shell:


Next you need to run the script. You have the option of either building the latest stable release, or the latest bleeding-edge version from the Git repository.

For the stable version, type:

sh build-chocolate-doom

For the latest version from Git, type:

sh build-chocolate-doom -git

The auto-build script will download, build and install the SDL libraries automatically (this may take some time). These are installed in the chocolate-doom directory in your Cygwin home directory. If your Windows login name contains a space (eg. if it is your full name), you will likely experience problems because Unix scripts often fail when dealing with directories containing spaces. Before running the auto-build script, type this to build in a different directory:

mkdir /home/user
export HOME=/home/user


If the build is successful you should see the words "Build complete" and you will be returned to the command line. Type the following commands and you should see similar output:

user@host ~
$ cd ~/chocolate-doom

user@host ~/chocolate-doom
$ ls
build  chocolate-doom  chocolate-server  chocolate-setup  install  packages

user@host ~/chocolate-doom

Modifying the source code[edit]

If you want to make your own mods to the Chocolate Doom source, go to ~/chocolate-doom/build/chocolate-doom-(version) (stable release build) or ~/chocolate-doom/build/chocolate-doom-git (latest Git version). The source code is in the src directory; type make to build the code after making any mods.

Keeping up to date[edit]

If you have compiled the latest version from Git, you may want to keep up to date with new developments and bug fixes. To update to the latest version, go to ~/chocolate-doom/build/chocolate-doom-git and type:

git pull

See also[edit]