Exult instructions for MacOS
----------------------------


To play
-------
First you need to get Ultima 7 or Serpent Isle. Either you own
it already, or you buy it somewhere. 

In the documentation of Exult (ReadMe, ReadMe.html) we describe 
several ways of how to install the original games and where to
put the files on your Mac so Exult finds them automatically.

Now download Exult, and have fun!


More Information
----------------
More information can be found in the accompanying files README and FAQ.
In addition, you might want to check out our homepage at
http://exult.info


How to compile on macOS
-----------------------

The following guide is only for people that want to compile Exult on their own. 
This is not needed if there is a current snapshot for macOS available on our 
download page.

Make sure you have Apple's Xcode, which can be installed for free from 
the App Store (https://apps.apple.com/de/app/xcode/id497799835?l=en&mt=12).

In order to compile Exult, you need to install several Unix packages.
If you are an expert, you may want to install them manually; for all others,
we recommend installing them via the package manager MacPorts (http://www.macports.org/).
Alternative package managers are Fink (https://www.finkproject.org) or 
Homebrew (https://brew.sh/).

With MacPorts install:
  libsdl2
  libvorbis
  munt-mt32emu
  libpng
  fluidsynth
  dylibbundler

Installing these packages with MacPorts will actually install many other
packages these depend on.
  
Open terminal and enter the following to allow the compile to find all the 
headers.

If you use MacPorts:
  export CFLAGS=-I/opt/local/include
  export CXXFLAGS=$CFLAGS
  export CPPFLAGS=$CFLAGS

Now you are ready to compile Exult. If you are compiling from Git, the
first thing you have to run is this:
  ./autogen.sh

The next step is the same whether you compile a release version or Git:
  ./configure
  make

This will give you a "exult" binary in the current directory. If you want
a nice Exult.app (double clickable from the Finder and all), enter this
command:
  make bundle

To use this bundle on another machine run
  make bundle_shared


How to compile a static version of Exult on macOS
-------------------------------------------------

You need to follow the above instructions on how to compile Exult. Then you have to
re-run configure and make
  ./configure --enable-static-libraries --with-macosx-static-lib-path=path/to/static/libs
  make

You need to enter the path to your prefix' static libs in the configure option 
"--with-macosx-static-lib-path=path/to/static/libs".
For MacPorts this would be "--with-macosx-static-lib-path=/opt/local/lib".

Take note however that compiling a static version of Exult Studio does not work.


How to compile Exult Studio on macOS
------------------------------------

If you want to compile Exult Studio, you have to install these packages:
  libsdl2
  gtk3

This will cause many other packages required by gtk3 to
be installed. 

After that, you have to re-run configure and make (remember to do the export commands 
to find the headers):
  ./configure --enable-exult-studio --enable-exult-studio-support
  make

- You need to add the path of Exult Studio to your PATH settings so that Exult 
can start Exult Studio on entering Map-Edit-Mode (ctrl+cmd+m).
Normally Exult Studio gets compiled in /path_to_the_Exult_source_code/mapedit, 
so if you do "export PATH=$PATH:/path_to_the_Exult_source_code/mapedit" before 
starting Exult, you can start using Exult and Exult Studio.
If you don't want to set the path to Exult Studio, you can also start Exult,
go into Map-Edit-Mode, start Exult Studio manually and click in it's menu
on File->Connect.

- You need to copy the file exult_studio.glade (found in 
/path_to_the_Exult_source_code/mapedit/) to your Exult data folder which is by 
default in /Library/Application Support/Exult/data.


How to build an Exult Studio app Bundle
---------------------------------------

You will need another package from MacPorts:
  gtk-mac-bundler

Follow the above steps to build Exult Studio and Exult with Exult Studio Support.
Afterwards run the commands:
  export PREFIX=PATH_TO_PREFIX
  make studiobundle

In the above command substitute PATH_TO_PREFIX with your real prefix path. 
If you use MacPorts this would be "/opt/local", so the commands look like this:
  export PREFIX=/opt/local
  make studiobundle

This will generate the Exult_Studio.app in your Exult source.


How to build the Gimp plugin
----------------------------

With MacPorts install:
  gimp2 +quartz

Then re-run configure and make
  ./configure --enable-tools --enable-gimp-plugin
  make

You will then find the Gimp plugin "u7shp" in the mapedit folder of our source. For the Gimp
to use it you need to copy it into ~/Library/Application Support/GIMP/2.10/plug-ins.
Note that this is again not a static build of the plugin and relies on your MacPorts installation.
So if you uninstall MacPorts the Plugin will cease to work.
