NOTE: The native cocoa port is deprecated and unmaintained and will be removed
      when the GTK3 port is ready for prime time.

Building VICE on Mac OS X
-------------------------

This document describes how to build your own VICE binaries from the source
code. The following assumes that you are using a reasonably modern version of
macOS (>10.9) running on Intel hardware.

Currently the recommended port of VICE to use on macOS is the SDL or SDL2
version. The Cocoa port has not been maintained recently and therefore is not
recommended and will not be addressed in this Howto.

1. Prerequisites

1.1 Xcode

If you want to compile VICE yourself then you first need to install Apple's
Xcode command line tools. You do not necessarily require the whole Xcode IDE.
To install just the command line tools:

> xcode-select --install

Click the "Install" button.

1.2 External Dependencies

VICE relies on several libraries and tools that are not standard parts of
macOS (formerly known as OS X). There are several options to handle this.
Homebrew is the preferred choice as it most closely follows traditional
UNIX-style paths (/usr/local) and does not require elevated privileges to
operate. MacPorts is another option but is considerably more complicated and
ugly and may not necessarily work with the VICE sources without some editing.

To install Homebrew visit https://brew.sh and follow the simple instructions.

Once Homebrew is installed you will need either one of the following packages
(or both if you intend to build both versions of VICE):

sdl
sdl2

For example:

> brew install sdl2

You will also need:

autoconf
automake
portaudio

Optional:

cc65
ffmpeg
pkg-config (required for ffmpeg)
flac
giflib
jpeg
lame
libpng
libvorbis
mpg123

2. Building VICE

You build VICE in the usual way, as you would with any GNU Autoconf-style
package.

2.1 autogen.sh (SVN only)

If you used Subversion to check-out the sources directly from the repository
then you first need to run:

> ./autogen.sh

This will run the various AutoTools utilities and generate the "configure"
script that you then use to configure the sources for building.

2.1 configure

> ./configure --help

Lists available options to configure the source tree.

An example configuration that should get you a basic functioning VICE might
be:

> ./configure --enable-sdlui2 --disable-ethernet --disable-shared-ffmpeg

2.2 make

To actually compile and link the executables run:

> make

You are likely to see some warnings during the build but they should all be
non-fatal.

2.3 Build the App Packages

On macOS you generally want to build app packages and in fact there is no
ability to "make install" if you are on macOS. Instead, you should run:

> make bindist

This will create a directory with a name like "vice-macosx-sdl-x86_64-3.0" for
example. Inside will be all of the app packages for the VICE emulators along
with a tools directory, a doc directory and a few other text files.

Use Finder to navigate to that directory and fire up your emulators to test.
They can be dragged anywhere you prefer to store your emulator apps.

Optionally you can create a DMG file if you'd like to share your build.
Running the following will package up everything from the above directory into
a DMG file:

> make bindistzip

EOF

