Configuring a build environment on Windows

Post Reply
rotunda
Site Admin
Posts: 77
Joined: Wed Mar 24, 2010 2:19 pm

Configuring a build environment on Windows

Post by rotunda »

In this thread, I will describe how I have configured the build environment for XPilot on Windows 7. Most of the steps should work on systems as old as Windows 2000, although it will have to be verified by somebody who is using those systems.

I. Installing the basic runtime environment and the compiler: MSYS + mingw32

Follow the steps from this site: http://www.mingw.org/wiki/Getting_Started
From now on, I assume you chose the default destination path: c:\mingw

NOTE 2012-07-14:
Update the list of packages that could be installed in the MSYS environment. The command works a bit like the Debian apt-get.

Code: Select all

mingw-get update
A few programs are not installed by default, but you will need them for this tutorial, so now run:

Code: Select all

mingw-get install msys-wget msys-unzip
II. Install additional libraries

NOTE 2012-07-14:
In the this section, we download and install binary and header files for the libraries. We do not attempt to compile the libraries ourselves, although this should work as well.

First, start the mingw shell (there should be a shortcut in the Start --> Programs menu).

a) Install zlib

Code: Select all

wget http://sourceforge.net/projects/libpng/files/zlib/1.2.7/zlib-1.2.7.tar.bz2/download
tar xjvf zlib-1.2.7.tar.bz2
cd zlib-1.2.7
make -f win32/Makefile.gcc
INCLUDE_PATH=/mingw/include LIBRARY_PATH=/mingw/lib BINARY_PATH=/mingw/bin make -f win32/Makefile.gcc install
b) Install expat

Code: Select all

wget http://sourceforge.net/projects/expat/files/expat/2.1.0/expat-2.1.0.tar.gz/download
tar zxvf expat-2.1.0.tar.gz
cd expat-2.1.0
./configure --prefix=/mingw/
make
make install
c) Install SDL

The main library:

Code: Select all

wget http://www.libsdl.org/release/SDL-devel-1.2.15-mingw32.tar.gz
tar zxvf SDL-devel-1.2.15-mingw32.tar.gz
cp -a SDL-1.2.15/bin/* /mingw/bin/
cp -a SDL-1.2.15/include/* /mingw/include/
cp -a SDL-1.2.15/lib/* /mingw/lib/
cp -a SDL-1.2.15/share/aclocal/* /mingw/share/aclocal/
Edit the sdl-config script to correct the installation path:

Code: Select all

vim /mingw/bin/sdl-config
Change the value of the prefix variable from "/usr/local/cross-tools/i686-w64-mingw32" to "/mingw".
Save and exit (press Escape, type :wq, press Enter).

The SDL_ttf library:

Code: Select all

wget http://www.libsdl.org/projects/SDL_ttf/release/SDL_ttf-devel-2.0.11-VC.zip
unzip SDL_ttf-devel-2.0.11-VC.zip
cp -a SDL_ttf-2.0.11/include/* /mingw/include/SDL/
cp -a SDL_ttf-2.0.11/lib/x86/* /mingw/lib/
The SDL_image library:

Code: Select all

wget http://www.libsdl.org/projects/SDL_image/release/SDL_image-devel-1.2.12-VC.zip
unzip SDL_image-devel-1.2.12-VC.zip
cp -a SDL_image-1.2.12/include/* /mingw/include/SDL/
cp -a SDL_image-1.2.12/lib/x86/* /mingw/lib/
d) Install OpenAL

Code: Select all

wget http://kcat.strangesoft.net/openal-soft-1.14-bin.zip
unzip openal-soft-1.14-bin.zip
cp -a openal-soft-1.14-bin/include/* /mingw/include/
cp -a openal-soft-1.14-bin/Win32/* openal-soft-1.14-bin/lib/Win32/* /mingw/lib/
cp -a /mingw/lib/soft_oal.dll /mingw/lib/openal32.dll

Code: Select all

wget http://connect.creativelabs.com/openal/Downloads/ALUT/freealut-1.1.0-bin.zip
unzip freealut-1.1.0-bin.zip
cp -a freealut-1.1.0-bin/include/* /mingw/include/
cp -a freealut-1.1.0-bin/lib/* /mingw/lib/
cp -a /mingw/lib/alut.dll /mingw/lib/alut.dll.a
III. Install the NSIS install shield maker

Download in your web browser on Windows:

Code: Select all

http://sourceforge.net/projects/nsis/files/NSIS%202/2.46/nsis-2.46-setup.exe/download
Execute and follow the instructions.
rotunda
Site Admin
Posts: 77
Joined: Wed Mar 24, 2010 2:19 pm

Re: Configuring a build environment on Windows

Post by rotunda »

Now, checking out the source code and building it.

I. Set up git

Important for developers. Git on MSYS changes the line endings to CRLF by default. This can cause a mess and we want to disable it. Add the following line to the [core] section of your .git/config:

Code: Select all

    autocrlf = false
II. Check out the code

Code: Select all

git clone git://git.code.sf.net/p/bloodspilot/bloodspilot-client-sdl bloodspilot-bloodspilot-client-sdl
III. Building

Open the MinGW shell.

Code: Select all

cd bloodspilot-client-sdl
cp configure.ac.windows configure.ac
./bootstrap
./configure
make
Then double-click on contrib/windows/bloodspilot-client-sdl.iss and build your installation binary.
Post Reply