Open main menu

Compiling ScummVM/macOS

< Compiling ScummVM
Revision as of 16:05, 27 March 2016 by Criezy (talk | contribs) (→‎Obtaining the required libraries: add instructions for manual compilation)

Compiling ScummVM under OS X

Compiling ScummVM under OS X requires setting up the build environment first, and then compiling the sources either via command line, or the XCode GUI

Things needed

XCode

This can be installed from the Apple Store

XCode command line tools

After installing XCode, open a terminal and type

xcode-select --install

Package manager

Getting the required libraries is easier with a package manager. The three most well-known ones are MacPorts, Homebrew and Fink.

1. MacPorts

Get the MacPorts installer for your OS X version from the MacPorts installation page

2. Homebrew

You can install homebrew by pasting the following into a terminal:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3. Fink

You can install Fink by downloading and building the source from the Fink Source Release page

Obtaining the required libraries

After downloading the XCode command line tools and a package manager, enter the following command to install all the required libraries:

1. MacPorts

sudo port install libsdl libjpeg-turbo libmpeg2 libogg libvorbis flac libmad libpng libtheora faad2 freetype zlib fluidsynth

2. Homebrew

brew install sdl jpeg-turbo libmpeg2 libogg libvorbis flac libmad libpng theora faad2 freetype lzlib fluid-synth

3. Fink

TODO

4. Manual compilation

Get the source code from the libraries. With this method you will not only need to get the libraries ScummVM uses directly, but also those they depend on.

All the libraries are compiled and installed in the same way:

cd thelib-src
./configure --prefix=/path/to/install
make
make install

The default installation path is /usr/local, but you will need admin privileges to install the libraries in this location.

cd thelib-src
./configure
make
sudo make install

If you want your compilation to be compatible with older system, use the -mmacosx-version-min flag (for example -mmacosx-version-min=10.5). To force compilation in 32 bits use -arch i386. You can do that by setting environment variables before compiling all the libraries and ScummVM:

export LDFLAGS="-arch i386 -mmacosx-version-min=10.5"
export CFLAGS="-arch i386 -mmacosx-version-min=10.5"
export CXXFLAGS="-arch i386 -mmacosx-version-min=10.5"

bzip2 is an exception. There is no configure and you directly call make with options. For example:

make CFLAGS="-arch i386 -mmacosx-version-min=10.5 -Wall -Winline -O2 -g -D_FILE_OFFSET_BITS=64" LDFLAGS="-arch i386 -mmacosx-version-min=10.5"
make install PREFIX=/Users/criezy/Dev/scummvm-releases/libs

If you plan to build the ScummVM app bundle, you will need to generate static libraries. For most of the libraries this is done by default, but for a few you need to specify you want static libraries when invoking configure. Here are suggested configure options for each library. If the library is not listed in the table below this means the default is fine.

Library configure flags Comments
pkg-config --with-internal-glib
glib --enable-static
libmpeg2 --disable-sdl

Need to add -std=gnu89 to CFLAGS (for example 'export CFLAGS="-std=gnu89"' before invoking configure)

FLAC --enable-static --disable-asm-optimizations
Theora --disable-examples
  • Need to edit configure before running it to remove flag -fforce-addr
  • Examples do not compile with libpng 1.6

Compiling ScummVM via the command line

Configuring ScummVM

Run the configure script - type "./configure" in the directory with the ScummVM source files. If no errors come up, you should be ready to compile ScummvM. Run "./configure --help" for a list of optional features (eg additional, not yet enabled engines).

Compiling ScummVM

Run "make clean" and then "make"

Installing ScummVM

Either run ./scummvm from the current directory or run make install to install ScummVM (you can then run it using "scummvm" from any directory)

Compiling ScummVM via the XCode GUI

Creating an XCode project

  • Compile create_project inside devtools/create_project
  • Copy the generated create_project tool in the ScummVM root folder
  • Run the following:
./create_project . --xcode --build-events --disable-nasm

Build the XCode project

  • Open and build the XCode project
  • Note that you may need to change the project architecture. Click on the ScummVM project, and change "Architectures" to "64-bit Intel (x86_64)"
  • If you're using XCode 5 or newer, you will also need to go to Product -> Scheme -> Edit Scheme -> Run tab -> Options tab and uncheck "Allow debugging when using document Versions Browser", otherwise the invalid "nsdocumentrevisionsdebugmode" option will be passed to the ScummVM executable by XCode

Further reading