Install Allegro5 From SVN/OSX
From Allegro Wiki
Contents |
Preliminaries
There are two ways to install Allegro on Mac OS X, by using the terminal or by using the XCode GUI. This guide will mainly focus on the first method (*someone should write the second part*).
Required software
You will need the following tools installed:
- XCode. You can install this from your Mac OS X install DVD, or you can download it from Apple's developer website [1]
- CMake. You can download a .dmg installer from http://www.cmake.org/cmake/resources/software.html.
- An SVN client. There are various options, I use the commandline tools from the SVN download site.
Allegro depends on a number of external libraries and you will need to have these installed to use certain functionality. There are again two ways to install these packages: you may be able to find a developer framework with an installer, or you can use a package manager (either DarwinPorts or Fink). The examples below will use DarwinPorts. These dependencies are optional, but highly recommended because you will lose functionality without them.
- libpng and zlib - for loading PNG images.
- freetype2 - for loading and displaying TrueType fonts. You'll need a more-or-less recent version. If you get an error about "'FT_Size_RequestRec' undeclared (first use in this function)" you'll need to upgrade the version you have.
- libjpeg - for loading JPEG images.
- libogg and libvorbis - for loading sound files.
- physfs - a library that allows Allegro to read various compressed archives.
Assuming you have DarwinPorts, you can install all of these by typing
sudo port install zlib freetype libjpg libogg physfs sudo port upgrade --enforce-variants libpng +universal
in a Terminal window (you will be prompted for your password), enforce a universal binary install for libpng is required because Allegro is 32bit only, 64bit is not supported yet, maybe you need install other libraries as universal binaries too. Allegro will also use OpenAL for sound output and OpenGL for graphics, but these will already be installed on your system.
Note: to build the documentation, you will need the pandoc program. This can be installed through DarwinPorts (port install pandoc), but at the moment (January 2010) this does not work in Mac OS X 10.6 (Snow Leopard) because the Haskell compiler ghc does not yet work properly. This means that at the moment you will not be able to install the documentation on Snow Leopard.
Getting the source
Open a Terminal. At the commandline type
$ svn co https://alleg.svn.sourceforge.net/svnroot/alleg/allegro/branches/4.9 allegro
and finish by pressing return (don't type the $, that represents the command prompt).
Building Allegro from the Terminal
Change to the directory where you installed Allegro, say allegro (as in the above example)
$ cd allegro
It is normally a good idea to place all of the build generated files in a subdirectory (a so-called out-of-source build) because this makes it easier to restart with a clean slate (just delete the directory):
$ mkdir build $ cd build
Now it is time to configure Allegro:
$ cmake ..
If you want to change some of the options manually you may want to use ccmake rather than cmake in the above command. One of the things you may like to change is the location where Allegro is installed (you may want to use your personal directory rather than a system-wide location). When Allegro has been configured, type
$ make
and relax while everything compiles. If everything goes well you can type
$ sudo make install
to install Allegro. If you're installing in your own directory, you don't need sudo (but it doesn't hurt).
Building Allegro through Xcode
To begin with, these steps are almost the same as in the previous listing. In a Terminal window, change to the directory where you installed Allegro, say allegro
$ cd allegro
It is normally a good idea to place all of the build generated files in a subdirectory (a so-called out-of-source build) because this makes it easier to restart with a clean slate (just delete the directory):
$ mkdir build $ cd build
Now it is time to configure Allegro:
$ cmake -G Xcode ..
Cmake will now create an Xcode project file. Open the project file in Xcode as you normally would and compile Allegro.
TODO: Someone who has actually done any of this should finish this section.
