Building AMX Mod X
AMX Mod X is a large project, but we've tried to make it as easy to build as possible. The directions here will step you through the entire process.
Requirements
Windows
- Install Visual Studio or Visual C++ 2010 or higher. Express editions should work fine. If you use 2013 or higher, make sure to get the "Desktop" version: Visual Studio Express 2013 for Desktop.
- Install Git. Make sure that you select the option that adds Git to PATH.
- Next, you will need to start an environment capable of running Python and interacting with the Visual Studio compiler. There are two ways to do this.
- Use MozillaBuild. MozillaBuild comes with Python, Mercurial, and a unix-like shell.
- Install MozillaBuild.
- Navigate to C:\mozilla-build and run the batch file corresponding to your Visual Studio version. For example, start-msvc10.bat for Visual Studio 2010 (10.0). Do not run an x64 version.
- Add Git to MozillaBuild's PATH. The easiest way to do this is to enter the following commands:
echo "export PATH=\$PATH:/c/Program\ Files\ \(x86\)/Git/bin" >> ~/.profile source ~/.profile
- Or, you can manually set up a shell.
- Install Mercurial.
- Install Python (any version will work). It will install to C:\Python27 by default for 2.7, or C:\Python34 for 3.4.
- Add Python to your PATH variable. Go to Control Panel, System, Advanced, Environment Variables. Add C:\Python27;C:\Python27\Scripts to PATH (or wherever your Python install is).
- Under Start, Programs, Microsoft Visual Studio, select the "Visual Studio Tools" folder and run "Visual Studio Command Prompt". Alternately, open a normal command prompt and run "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\vcvars.bat". Substitute your Visual Studio version if needed.
- Use MozillaBuild. MozillaBuild comes with Python, Mercurial, and a unix-like shell.
Note that AMX Mod X also has Visual Studio project files. These can be used for local development, however, they are not maintained nor are they used for official builds.
Linux
- Install Git, via either system packages or from the Git distribution.
- Install Mercurial, via either system packages or the Mercurial distribution.
- Install either the GNU C Compiler or the Clang compiler. On Debian/Ubuntu, the following commands will give you everything:
sudo apt-get install gcc g++ clang
- If building on a 64-bit system, a few additional packages may be required. For example on Debian/Ubuntu they are:
sudo apt-get install ia32-libs sudo apt-get install lib32z1 lib32z1-dev sudo apt-get install libc6-dev-i386 libc6-i386 sudo apt-get install gcc-multilib g++-multilib
Mac OS X
Mac OS X 10.7 or higher is required to build, however, AMX Mod X will work on versions as early as 10.5.
- Install Mercurial if you do not have it - there are a few ways to do this. Using the Mercurial distribution will work, or you can use macports or homebrew.
- Download and install XCode from the App Store. Launch XCode, then navigate to Preferences -> Downloads -> Command line tools -> Components -> Install. If you have recently upgraded XCode, you will need to perform this step again. AMX Mod X cannot build without XCode's command line tools.
Dependencies
Building AMX Mod X requires AMBuild, Metamod, the Half-Life SDK, and optionally MySQL 5. If you're using Linux, OS X, or Windows with MozillaBuild, you download and run the following script to get everything:
wget https://raw2.github.com/alliedmodders/amxmodx/master/support/checkout-deps.sh bash checkout-deps.sh
This will download everything required into amxmodx, hlsdk, and metamod-am. If AMBuild is not installed, it will also download it into ambuild, and prompt you for your password to install it.
If for some reason this script doesn't work, or you can't use it, you can get AMX Mod X and its dependencies like so:
hg clone http://hg.alliedmods.net/ambuild hg clone http://hg.alliedmods.net/metamod-am hg clone http://hg.alliedmods.net/hl2sdks/hlsdk git clone https://github.com/alliedmodders/amxmodx cd ambuild python setup.py install # May need sudo or root on Linux/OS X
Configuring
The first time you are building AMX Mod X, you must configure the build. First create a build folder, and then run configure.py. For example:
mkdir build cd build python ../amxmodx/configure.py
It is safe to reconfigure over an old build. However, it's probably a bad idea to configure inside a random, non-empty folder.
There are a few extra options you can pass to configure:
- --enable-debug - Compile with symbols and debug checks/assertions.
- --enable-optimize - Compile with optimizations.
- --no-mysql - If you didn't install MySQL, you can choose not to build the extension.
Building
To build AMX Mod X, simply navigate to your build folder and type ambuild:
cd build ambuild
Alternately, you can specify the path of the build folder:
ambuild build
The full package layouts that would be shipped for release are in the package folder of the build.