Tools for building MAME on Windows
The primary build of MAME is a command-line Windows program. It is compiled using gcc version 4.2.1 under the MinGW development environment. If you want to build your own version of MAME, there are two ways of acquiring the necessary tools to do so. The easy way is to download a pre-assembled package from this site, as described below, and add the DirectX headers to it. The hard way is to acquire all the individual components that are used directly from the original sources and assemble the pieces together. Both approaches are described below.
IMPORTANT: This current set of tools contains the necessary fixes to allow MinGW to work on Vista. If you have previously employed workarounds, you will need to disable them in order to make this work. This means removing extra paths from your environment, and removing the GCC_EXEC_PREFIX environment variable.
Information about setting up the previous set of build tools from June 2007 is still available.
The Easy Way
1. Root Directory
Create a root directory; generally, this is called mingw.
2. Install the mingw-mame package
This package is designed to be a relatively simple pre-assembled installation for the development environment. It consists of a collection of mostly GPL-licensed tools from a variety of sources, and is the exact same set of tools and headers/ libraries that are used to compile the official sources. Go to mamedev.org and download the following package:
Binaries | Source |
---|---|
mingw-mame-20070810.exe | (see the hard way section for sources) |
Extract this package into your mingw directory.
3. DirectX
Officially, you should go to microsoft.com and download the DirectX SDK, tweak the headers and libraries to work with MinGW, and then paste the results into your include and lib directories. Fortunately, the Allegro project has already done this for you.
Go to alleg.sourceforge.net, and download the following package:
Extract this file into a temporary directory and copy the following files into your mingw/include directory:
- d3d8.h
- d3d8caps.h
- d3d8types.h
- ddraw.h
- dinput.h
- dsound.h
4. Compile
Open up a command-line window. First, ensure that the mingw/bin directory is part of your search path. Do that by typing:
set path=%PATH%;mingw\bin
Next, switch to the directory where the MAME sources live:
cd mame-source-path
And then execute mingw32-make to build it:
mingw32-make
Wait a while, and you will have a fully built MAME executable.
The Hard Way
1. Root Directory
Create a root directory; generally, this is called mingw.
2. MinGW
MinGW is the official set compile tools for MAME. It is a repackaging of the gcc compiler along with the necessary tools, all ported to Windows. Part of MinGW is an effort to produce Windows-compatible header files so that you can build executables linked against standard Windows libraries. Apart from DirectX, this is a very complete solution for free Windows development, and much lighter weight than the Microsoft tools.
Go to mingw.sourceforge.net, and download the following binary packages (source links are provided as well, but the source is not necessary to set up the environment):
Extract all of these items into your mingw directory in the order listed, accepting any overwrites of existing files.
You also need to rename gcc-sjlj.exe (from the bin directory) to gcc.exe.
3. Win32 GNU-like tools
In order to build MAME, we rely on a few standard GNU tools. Fortunately, we only rely on basic behaviors of these tools, so we have taken the step of providing simple implementations of the common tools echo, rm, and mkdir.
In addition, the tools diff and patch are used for submitting code to MAME and for applying the latest intermediate 'u' update. These two tools have been built into Win32-native versions by taking the GNU tarballs and updating/modifying them as necessary to build under MinGW.
Binaries | Source |
---|---|
mame-gnulike-20070617.exe | mame-gnulike-src-20070617.exe |
Simply extract these items directly into your mingw/bin directory.
4. SDL
This step is optional, but is nice if you wish to have a complete development environment for both native Win32 and SDL hosted versions of MAME.
Go to http://www.libsdl.org/, and download the following package:
Binaries | Source |
---|---|
SDL-devel-1.2.11-mingw32.tar.gz (mirror) | SDL-1.2.11.tar.gz (mirror) |
Extract this file into your a temporary directory. Move the bin, include, and lib directories into your mingw directory, merging the contents with the existing directories.
5. DirectX and Compiling
Hop back to the Easy Way to finish these final two steps.