YETI compilation guide on Windows

Current YETI makes use of GNU make as well as C preprocessor. All of these are handled with ease on Linux, but not so on Windows. One solution is to use virtual environment using tools, such as VirtualBox and VMWare, to install Linux. Cygwin is a good alternative - it is a unix-like environment that runs on Windows, and it comes with common unix tools, including GNU make and C compiler, python, etc. Basically, it has all tools we need to build YETI!

But it was not completely intuitive, hence this guide.

Setting up Cygwin

Cygwin is available in 32-bit and 64-bit version. Because compilation of YETI requires very large memory consumption that is not supported by 32-bit software, 64-bit version is required. Download the 64-bit version installer from https://cygwin.com/, and save this in a permanent location. This installer also work as Cygwin updater, which you can run periodically to keep cygwin environment up to date. After it's downloaded, execute the installer.

Screen 1 - click next.

Screen 2 - choose "Install from Internet" and click next.

Screen 3 - pick a location where you want to install cygwin. I will use c:\cygwin64 in this guide. Click next.

Screen 4 - pick a location where the downloaded packages are stored. These files are used to install different packages within cygwin. Python is included in python package, etc. You can delete the contents of this directory after installation in complete, if you'd like.

Screen 5 - Select your Internet connection. Click next.

Screen 6 - Pick a mirror site. Many mirrors are available from where you can download cygwin packages. If you can find a server location near you, you can pick that. If you're behind a restrictive proxy/firewall that doesn't allow FTP communication, you can make sure to use http mirror. Click next after picking a mirror.

Screen 7 - All the basic packages to establish a working cygwin environment are pre-selected. We need to pick some additional packages we need for YETI projects.

Under Archive section - bzip2, unzip, zip, xz (optional, won't be used in this tutorial)

Under Base section - tar (should be selected by default)

Under Devel section - gcc-core, make, mercurial

Under Libs section - libjpeg-devel, libjpeg8, zlib, zlib-devel, zlib0

Under Net section - openssh (optional, needed if you want to start pushing changes to repo from Cygwin environment)

Under Python section - python3, python3-setuptools

Under Web section - wget

After you select these packages, click next. Cygwin will be installed at this point.

Last screen - If you want a shortcut icon on either Desktop or Start Menu, you can select the appropriate choice here. Click finish.

Setting up Python3 environment

This section is basically a rehash of the NML Getting Started guide , just tailored toward NML 0.4/nightly version.

Start this process by running Cygwin Terminal.

Cygwin Terminal quick tutorial

Copying and pasting is easy with Cygwin Terminal. Highlight any text automatically copies the highlighted text to Windows clipboard. Right-clicking anywhere on Cygwin Terminal shows a menu, and you can pastes what's in the Windows clipboard from there. You can change this behavior to have right-click to automatically paste the clipboard text - select Options in the right-click menu.

File name tab-completion is a useful feature available in Cygwin. Taking the PLY package show below for example, after you downloaded the PLY file, you can type "tar xzvf pl" then hit TAB key. It will complete the file name for you.

Installing required libraries

Type the following commands, and it will install pip, PLY and Pillow.

wget wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
pip install PLY
pip install Pillow

Installing NML

We will grab a copy of NML straight from its repo, and install it.

hg clone http://hg.openttdcoop.org/nml
cd nml
python3 setup.py install
cd ..
nmlc --version

If all is succesfull, you should see the response like this:

0.4.0.r5377:01988dfeee65 from 2014-09-21
Library versions encountered:
PIL: 1.1.7
PLY: 3.4

Huzzah! We're ready to start on the real work!

Cloning and compilation test

To complete this tutorial, let's clone the YETI repo, and compile it.

cd ~
mkdir src
cd src
hg clone http://hg.openttdcoop.org/yeti
cd yeti
make

Hopefully, you will be presented with a working YETI.tar after a few hours. It takes about 3 hours on my PC the very first time I compile YETI. After that, it's about a 2 minute job.