Difference between revisions of "Compile for Mac"

From UFO:AI
m (Universal (i.e., PPC + Intel) binaries)
 
(updates from LittleJohn)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
==Non-universal (i.e., Intel-only) binaries==
+
==macports==
 +
===Step 1. Installation===
  
===Step 1. Install MacPorts===
+
Install Xcode, X11, and MacPorts
  
 
Instructions are at {{http|guide.macports.org/#installing}}
 
Instructions are at {{http|guide.macports.org/#installing}}
This will have you install Apple's X11 (not sure why it is needed), the Xcode development environment (needed for the compiler, etc), and the MacPorts program.
+
This will have you install Apple's X11, the Xcode development environment (needed for the compiler, etc), and the MacPorts program.
  
===Step 2: Install SDL===
+
You can also download the X11.app from {{http|xquartz.macosforge.org/landing/|here}}
  
sudo port configure libsdl +universal
+
===Step 2: Install dependencies===
sudo port install libsdl-framework
 
sudo port install libsdl_mixer-framework libsdl_ttf-framework libsdl_image-framework
 
  
===Step 3: Install other libraries and tools===
+
  sudo port install libsdl-framework libsdl_mixer-framework libsdl_ttf-framework \
  sudo port install libtheora XviD git-core p7zip python26
+
jpeg libpng XviD libtheora gtk2 gtkglext gtksourceview2 git p7zip python27 \
 +
doxygen libsdl2 libsdl2_mixer libsdl2_ttf
  
 
Now you should be able to [[Getting the source|fetch UFO-AI]] and compile it.
 
Now you should be able to [[Getting the source|fetch UFO-AI]] and compile it.
  
==Universal (i.e., PPC + Intel) binaries==
+
===Step 3: Compilation===
 
 
Install the libraries gettext, openssl, libpng and libjpeg from MacPorts using the +universal variant (this is currently broken for libjpeg so you have to follow the manual steps described here: {{http|www.mail-archive.com/macports-users@lists.macosforge.org/msg05922.html}}
 
 
 
port install ''pkgname'' +universal
 
 
 
Add --enable-universal when running configure
 
 
 
./configure --enable-universal
 
 
 
Please note that it does not seem possible to build Radiant as a universal package at this time.
 
 
 
 
 
Step 1: Install Xcode, X11, and MacPorts. Requires downloading .dmg's and other mousing around. (As of Aug 29, 2009 libsdl will not install on Mac OS X 10.6 via MacPorts)
 
 
 
Step 1.5: Gtk2 will not build universal out of MacPorts currently. Glib2 is broken on PPCs, and ncursesw is broken for universal compilation. Until these are fixed, fetch gtk+2 frameworks from {{http|gtk-osx.org/}}. NB: This is not production quality code yet. Do not expect radiant to run.
 
 
 
Step 2: Run the following shell script:
 
This will request your password (for a "sudo" command), and the first time it will ask you to verify an SSL certificate fingerprint (for the svn checkout).
 
 
 
<pre>
 
#!/bin/sh
 
set -e # Abort on any error
 
 
 
sudo port -d selfupdate
 
sudo port -d upgrade outdated
 
 
 
# gtkglext requires gtk2; gtk2 requires glib2. They do not need to be
 
# explicitly mentioned.
 
 
 
sudo port install libsdl_image +universal libsdl_ttf +universal libsdl_mixer +universal \
 
jpeg +universal libpng +universal XviD +universal libtheora +universal gtkglext +universal gtksourceview2 +universal # openal +universal
 
 
 
# OpenAl is part of Mac os from 10.4 on.
 
# I don't know how up-to-date it is, but the version in macports is both
 
# out of date and does not support universal.
 
 
 
./configure --enable-universal
 
make
 
make uforadiant
 
make macinstaller
 
</pre>
 
 
 
If you have already non-universal ports installed, you have to uninstall them first by typing e.g.:
 
sudo port -f uninstall glib2
 
sudo port clean glib2
 
sudo port -v install glib2 +universal
 
 
 
If you are having trouble getting things to compile, be aware that most of the issues come from installing autoconfig/automake as universal. This doesn't actually need to be universal unless you are a file server for multiple arch development environments.
 
 
 
To work around this (the problem is in "ncursesw"), use the following command:
 
 
 
sudo port install libiconv +universal expat +universal automake libsdl_ttf +universal \
 
libsdl_mixer +universal jpeg +universal libpng +universal XviD +universal libtheora +universal
 
 
 
Automake (needed for building X-based stuff) ultimately needs gettext; gettext uses libiconv and expat (both of which build universal), and ncursesw (which does not). Gettext cannot compile universal until this is fixed.
 
 
 
Note that this does not solve the gimp stuff -- gtkglext, gtksourceview, which use gtk2 and glib2 (broken on PPC in MacPorts at this time) -- used by radiant.
 
 
 
First, run the configure script.
 
./configure
 
 
 
In latest svn version, UFORadiant is enabled by default. This might fail on a mac as it depends on
 
various external libraries like pkg-config, gtk+ etc. To disable UFORadiant, simply
 
./configure --disable-uforadiant
 
 
 
== Before compiling for the first time ==
 
 
UFO:AI compilation requires some paths that are not taken care of for you by the MacPorts installation process. Therefore, a minor edit to your .profile is needed.
 
UFO:AI compilation requires some paths that are not taken care of for you by the MacPorts installation process. Therefore, a minor edit to your .profile is needed.
  
Line 90: Line 24:
 
Toward the bottom, substitute this export command:
 
Toward the bottom, substitute this export command:
  
  export PATH=$PATH:/opt/local/bin:opt/local/sbin:opt/local
+
  export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/opt/local
  
 
Save the file, quit Terminal, then relaunch Terminal to make the new PATH operative.
 
Save the file, quit Terminal, then relaunch Terminal to make the new PATH operative.
Line 96: Line 30:
 
Now, the following "make" commands should execute without errors. You should also be able to compile newer versions of UFO:AI without editing .profile again, i.e., this is a one-time fix.
 
Now, the following "make" commands should execute without errors. You should also be able to compile newer versions of UFO:AI without editing .profile again, i.e., this is a one-time fix.
  
== Compilation ==
+
Change directory into the main ufoai folder.
 +
cd ufoai
 +
Establish the appropriate configuration for compiling.
 +
configure
 
To compile the binaries, just type (after the configure call was successful).
 
To compile the binaries, just type (after the configure call was successful).
 
  make
 
  make
Line 103: Line 40:
 
To create the application bundle (i.e., a .dmg), just type
 
To create the application bundle (i.e., a .dmg), just type
 
  make macinstaller
 
  make macinstaller
 +
 +
==fink==
 +
 +
After installing fink you should just type the following to your console:
 +
 +
fink install sdl sdl-ttf sdl-mixer libtheora0 libjpeg8 libpng15 libxml2 libcurl4 xvidcore gtk+2 gtksourceview2-dev gtksourceview2-shlibs gtkglext1 glib2-dev glib2-shlibs
  
 
[[Category:Coding]]
 
[[Category:Coding]]

Latest revision as of 14:39, 6 November 2014

macports

Step 1. Installation

Install Xcode, X11, and MacPorts

Instructions are at http://guide.macports.org/#installing This will have you install Apple's X11, the Xcode development environment (needed for the compiler, etc), and the MacPorts program.

You can also download the X11.app from here

Step 2: Install dependencies

sudo port install libsdl-framework libsdl_mixer-framework libsdl_ttf-framework \
jpeg libpng XviD libtheora gtk2 gtkglext gtksourceview2 git p7zip python27 \
doxygen libsdl2 libsdl2_mixer libsdl2_ttf

Now you should be able to fetch UFO-AI and compile it.

Step 3: Compilation

UFO:AI compilation requires some paths that are not taken care of for you by the MacPorts installation process. Therefore, a minor edit to your .profile is needed.

If you don't understand the preceding sentences: (a) Download TextWrangler (freeware) from http://www.barebones.com/products/textwrangler/download.html ; (b) Use its File > Open to navigate to your home folder and enable its "Show hidden files" option; and (c) Open the ".profile" file you should see now so you can edit it.

Toward the bottom, substitute this export command:

export PATH=$PATH:/opt/local/bin:/opt/local/sbin:/opt/local

Save the file, quit Terminal, then relaunch Terminal to make the new PATH operative.

Now, the following "make" commands should execute without errors. You should also be able to compile newer versions of UFO:AI without editing .profile again, i.e., this is a one-time fix.

Change directory into the main ufoai folder.

cd ufoai

Establish the appropriate configuration for compiling.

configure

To compile the binaries, just type (after the configure call was successful).

make

after that, you need to create the languages and maps

make lang models maps-sync

To create the application bundle (i.e., a .dmg), just type

make macinstaller

fink

After installing fink you should just type the following to your console:

fink install sdl sdl-ttf sdl-mixer libtheora0 libjpeg8 libpng15 libxml2 libcurl4 xvidcore gtk+2 gtksourceview2-dev gtksourceview2-shlibs gtkglext1 glib2-dev glib2-shlibs