Building Allegro 4.4.3+ Deluxe from source code on Windows with MinGW-W64
WIP: Last update : 11/17/2019
Download the binary package here :
This section will go over the basic requirements of building Allegro 4.4.3. There are quite a few optional dependencies that you would probably like to have support for compiled in. Don't worry, we'll get to that. First the build tools, and then second, the dependencies, and third, building allegro and the included tools.
Before that, here are a few downloads made available for your convenience :
Download links :
- MSYS 1.0.11
- HTML Help Workshop
Downloads for the dependencies and dependency package
This dependency package contains the following libraries source code as of the last update time of this page.
Included are :
- Allegro 4.4.3 from GIT
- AlFont 2.0.9 (with the latest patch included)
- MASkinG 0.8
- LibOGG 1.3.4
- LibVORBIS 1.3.6
- libPNG 1.6.37
- ZLIB 1.2.11
- Freetype 2.10.1
After downloading the A4DepSources.7z archive file, use 7-zip to extract the contents to c. There will be a folder called libsrc inside the archive. So you should now have c:\libsrc as a directory. The following tutorial assumes this is where you put it. If you put it somewhere else, that works. Know that it will be referred to as the libsrc folder in the tutorial though.
Installing the build tools
Use 7-Zip's provided installer to install 7-Zip.
Use CMake's provided installer to install CMake version 3 or greater. Build process tested with CMake 3.14.
When installing CMake, choose the option to add CMake to your %PATH%
Use GIT's provided installer to install GIT.
Before we can build anything, we need a working compiler. This guide uses MinGW-W64 on Windows.
To install MinGW use 7-zip to extract the archive. Rename this folder to 'mingw' and move it to c:\
Now add "c:\mingw\bin" to your PATH. You can do this through the windows environment variables settings page, or you can do it with a script containing the command :
This prepends the mingw bin directory to your system PATH. This will only last as long as the current command window is open. Hence the need for a startup script for compiling with MinGW. I'll leave this as an exercise to the readers.
Installing MSYS 1.0.11
To build several of the dependency libraries, we need to use MSYS 1.0.11 to use the autotools builds.
Instructions for installing MSYS 1.0 can be found here. You need to install MSYS 1.0.11, the MSYS DTK, and then extract the MSYS Core over the top of your new installation. Install to the default location, which is C:\msys. I put together an archive containing all the files you need to install MSYS 1.0.11. Find it here :
Next, run your new msys.bat file in your new c:/msys/1.0 folder to launch the MSYS shell. Verify you have a working installation and the path is set correctly. By default, msys will add c:\mingw\bin to its path. At the terminal, type
It should output the version of gcc you are using. If so, you're good to go.
Now we get to the fun part, compiling the libraries. Ogg and Vorbis are easy, but require MSYS to build because they depend on configure scripts. libPNG, ZLIB, and Freetype2 all build with cmake, which makes it easier. After those are built, we can move on to Allegro, AlFont, and Masking. Then we can build the AllegroFontEditor.
We will be installing everything to a common directory to save trouble later. Create a folder to install to. That folder will be referred to as the distro folder from henceforth on in this guide.
Compiling with MSYS 1.0
Since ogg and vorbis rely on configure scripts to build, we must run them through MSYS. MSYS2 will work, but will not be covered here.
First step is to open an msys terminal and check that our compiler is working.
Open msys.bat from your desktop link of the newly installed MSYS and run the following commands :
You should see that /mingw/bin is on the path. By default MSYS mounts c:\mingw to /mingw.
After the second command, you should see the version of g++ in use in the output.
If one or the other fails, check your MSYS and MinGW installations.
Begin by changing directories to your libsrc directory :
There are some common commands to each installation. First change directory into the ogg or vorbis folder, then execute the following commands;
Ogg has to be built first, as Vorbis depends on it. The Vorbis configure script is still retarded sometimes so you may have to configure and install ogg twice. Once for your mingw compiler directory, and once for the distro we are building.
Run the normal steps above, and then rut it once using the mingw compiler's install prefix :
Vorbis is easy. Just use the generic steps above to make and install.
Compiling with CMake
Compiling with cmake is easy.
Following are the generic commands you will use for each library you build with cmake.
First open a command prompt and use your script or set command to add the compiler to the %PATH%.
Second, execute 'cd c:\libsrc' and then cd to the appropriate directory for zlib, libpng, or freetype2.
Third, for each library create a build folder, change directory to it, and execute cmake-gui.
Once you're in cmake-gui, there are some common configuration variables that need to be set. Choose whether to build in debug or release mode, and where to install it.
CMAKE_BUILD_TYPE [Release | Debug]
Once you configure and generate the build files, go back to your command prompt and enter the following commands :
ZLIB and LibPNG need to be built first, as FreeType2 depends on them, and libPNG depends on ZLIB, so ZLIB first.
For ZLIB, set the INSTALL directory entries in cmake-gui before generating build files.
For libPNG, you just need to tell it where ZLIB is.
For FreeType2, you need to enable a few things and tell it where ZLIB and libPNG are.
Make sure the following two options are checked :
Compile Allegro 4.4.3+
Allegro 4 builds with CMake, so for the most part you can follow the directions in the Compiling with CMake section.
Allegro 4 is highly configurable. Run the configure process once, and several items will be highlighted in red. We need to set the directories and libraries for DirectX and DXGUID, because Allegro depends on both.
For DirectX and MinGW-W64 it comes in the compiler directory. For a 32-bit compiler the directory is 'c:\mingw\i686-w64-mingw32'. DirectX will be contained in the include and lib subdirectories of this folder. Set the following CMake variables appropriately :
Likewise, you will need to set the include folder and link library for LibPNG, ZLIB, Ogg, and Vorbis and Vorbisfile.
You will also need to check or clear the SHARED CMake variable to build a dynamic or static library.
AlFont now builds with cmake, so it's easier than ever. Simply specify the directories for Allegro, Freetype2, LibPNG, and ZLIB. Alternatively on first run specify the dependency path using the DEPDIR cmake variable.
MASkinG now builds with cmake, so it's easier than ever. Simply specify the directories for AlFont, Allegro, Freetype2, LibPNG, and ZLIB. Alternatively on first run specify the dependency path using the DEPDIR cmake variable.
AllegroFontEditor now builds with cmake, so it's easier than ever. Simply specify the directories for Masking, AlFont, Allegro, Freetype2, LibPNG, and ZLIB. Alternatively on first run specify the dependency path using the DEPDIR cmake variable.