From The Mana World
m (Jaxad0127 moved page MacOSX port to Archive:MacOSX port without leaving a redirect)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Introduction ==
== Introduction ==


The following is the result of a lot of hacking and working around small problems, and certainly not complete yet nor probably the way you should actually be building TMW for Mac.
These are rough instructions, feel free to expand them.


Note that TMW and all libraries are being installed to /Users/bjorn, you should probably use your own home directory. ;-)
You need to be using the master branch from github that contains the Xcode project file.


== Dependencies ==
== Using Xcode ==
 
For this you will need to have already downloaded the SDL.framework, SDL_mixer.framework, SDL_image.framework and (if not using trunk) the SDL_net.framework from [http://www.libsdl.org the SDL site].
All dependencies except the OpenGL library were statically linked.
 
=== OpenGL ===
 
On Tiger, we found the OpenGL headers in:
 
/System/Library/Frameworks/OpenGL.framework/Headers
 
These were copied to:
 
/Users/bjorn/include/GL
 
This is in order for Guichan and TMW to find "GL/gl.h".
 
=== libpng ===
 
libpng 1.2.8 does not use GNU autotools. We used "scripts/makefile.darwin" after modifying it to change the install prefix. Static libraries were installed by "make -f makefile.darwin install-static".
 
=== libogg ===
 
=== libvorbis ===
 
While the vorbis.com download page is still listing libvorbis 1.0.1, this version failed on Mac so libvorbis 1.1.1 was used which compiled fine.
 
=== libxml2 ===
 
=== SDL ===
 
After installing SDL, make sure sdl-config is in your path (like add /Users/bjorn/bin to the PATH environment variable). This ensures dependent packages can find the SDL headers and libraries.
 
=== SDL_image ===
 
=== SDL_mixer ===


=== Guichan ===
Download SDL. Install SDL.framework to /Library/Frameworks


We took the Guichan 0.4.0 release and applied one small fix to get transparency to work right on the big endian system. This fix can be found [http://guichan.sourceforge.net/forum/read.php?3,240 here].
Download SDL_mixer. Install SDL_mixer to /Library/Frameworks


'''Configure command:'''
Download SDL_image. Install SDL_image to /Library/Frameworks


<pre>
Open Xcode Project. I use Xcode 4.3.2 with Lion.
./configure --prefix=$HOME --disable-shared \
  --enable-force-sdl --enable-force-sdlimage --enable-force-opengl \
  CXXFLAGS="-I/Users/bjorn/include -I/Users/bjorn/include/SDL"
</pre>


=== PhysFS ===
Go to Preferences -> Downloads and install Command Line Tools.


PhysFS 1.0.0 needed a -lreadline added to its test_physfs_LDFLAGS in Makefile.in line 280.
Download and install MacPorts from [http://www.macports.org].


== The Mana World ==
Open Terminal window.


The src/Makefile.in file had to be modified to include net/win2mac.cpp.
run "sudo port selfupdate" to get latest ports tree.


'''Configure command:'''
run "sudo port install libxml2" to install libxml2.
<pre>
./configure --prefix=$HOME --with-opengl \
  CXXFLAGS="-I/Users/bjorn/include -I/Users/bjorn/include/SDL -I/Users/bjorn/include/libxml2 -DMACOSX" \
  LIBS="-L/Users/bjorn/lib -L/System/Library/Frameworks/OpenGL.framework/Libraries -lSDL -lpng"
</pre>


== Problems ==
run "sudo port install libguichan" to install guichan.
 
* Sound is crashy
 
* Performance could use some improvement (drawing windows like the chat window appears to be the main CPU hog
 
== Suggestions ==
 
Try --enable-static-link configure option and -static linker option.
 
Managed to build a segfaulting static binary of TMW on Linux with following command:
 
<pre>
./configure --prefix=$HOME --with-opengl LDFLAGS="-static" LIBS="-L/usr/X11R6/lib/ -lssl -lcrypto \
  -lpng -lmikmod -lSDL -ljpeg -lvorbisfile -lvorbis -logg -lz -lXext -lX11 -lpthread -ldl"
</pre>
 
It might be a good idea to try to get the OSX version done with a .app instead of static linking anyway since as [http://developer.apple.com/qa/qa2001/qa1118.html http://developer.apple.com/qa/qa2001/qa1118.html] states, you appear to need Csu module to link statically in OSX. I'm currently looking at how to make an Xcode Application that would include those dependencies as Frameworks which would apparently be a more OSX approach. I think that could also result in a more stable binary.
 
== Making it more Mac-like ==
 
Raw binaries, data files in folders, and .zip distributions are all nontypical for Mac applications. The source code for a Cocoa wrapper-program for tmw to solve these issues can be found here: http://home.comcast.net/~Catfish_Man/ManaWorld.zip
 
Place the tmw binary and data folder in the project folder, open ManaWorld.xcode (or .xcodeproj for Xcode 2.1 and later users. It can automatically convert between the two formats), and click build. You should get a copy of ManaWorld.app located in the build folder. Since it's built in development mode, this won't work except on the computer it's built on. To switch to deployment mode go to the build menu, choose build results, and change the active build configuration to Deployment.
 
You can make a compressed disk image of the application for distribution by running the following script (included with the wrapper):
 
<pre>
./buildDMG.pl -dmgName "ManaWorld" -buildDir . -volSize 4 -volName "ManaWorld" -compressionLevel=9 ./build/Deployment/ManaWorld.app/
</pre>
 
To add an icon, like the one TMW sets later, open /Developer/Applications/Utilities/Icon Composer. from there, drag the png icon from the data directories into each pane on the left. Then, save the icon to *.icns, and place it within the Resoures directory. Then, go up one level, then open Info.plist. There, click on Root, then click "add Child". name it CFBundleiconFile, change it's class to string, and it's value to your icon name. Logo out, then log back in, and it's icon has changed.
 
 
== Using Xcode ==
For this you will need to have already downloaded the SDL.framework, SDL_mixer.framework, SDL_image.framework and (if not using trunk) the SDL_net.framework from [http://www.libsdl.org the SDL site]. You will also need [http://libpng.sourceforge.net/ libpng], [http://www.zlib.net/ zlib] and [http://guichan.sourceforge.net guichan] which I will link to dynamically from /usr/lib.
You will also need to download [http://icculus.org/physfs/ physfs] (and if using the trunk version [http://enet.cubik.org enet]), which I compile inside the project.


First compile and install libpng, zlib and guichan to /usr/lib using the Makefiles (type make install in their respective directories from Terminal).
run "sudo port install libsdl_gfx" to install sdl_gfx.


Create a new project and select SDL OpenGL Application. This should already link you to the SDL and OpenGL frameworks.
run "sudo port install libsdl_net" to install sdl_net.


Add all the tmw .cpp and .h files to the source group. (Remove any atlantis files that may be there)
run "sudo port install libsdl_ttf" to install sdl_ttf.


Select Frameworks group and then choose Project->Add to Project. Do this for (by default in /System/Library/Frameworks)IOKit, Carbon, (by default these will be in /Library/Frameworks)SDL_mixer, SDL_net, SDL_image.
run "sudo port install physfs" to install PHYSFS.
(For trunk SDL_net is not needed)


Create a new group called physfs, and another called libs.
run "sudo port install libpng" to install PNG.
(For trunk create another group called enet)


Put the relevant physfs files inside the physfs group. (For trunk add the enet files to enet group)
run "sudo port install freetype" to install freetype (needed by SDL_ttf)
Add -L/usr/lib -lpng -lz -lguichan -lxml2 -lcurl to the linker flags inside the build options.


Add the search header paths needed (mainly /usr/include/[lib] or possibly need to add the path to headers in a Framework).
run "sudo port install libiconv" to install libconv
Add library search path if needed for /usr/lib.


Add -DPHYSFS_SUPPORTS_ZIP to compiler flags (or preprocessor macros). If you want to use OpenGL, add -DUSE_OPENGL to the compiler flags.
run "sudo port install gettext" to install libintl


Click build.
Click build in Xcode.


If you have any problems, ask in the [http://forums.themanaworld.org/viewforum.php?f=10 forums].
If you have any problems, ask in the [http://forums.themanaworld.org/viewforum.php?f=10 forums].

Latest revision as of 20:15, 1 July 2013

Introduction

These are rough instructions, feel free to expand them.

You need to be using the master branch from github that contains the Xcode project file.

Using Xcode

For this you will need to have already downloaded the SDL.framework, SDL_mixer.framework, SDL_image.framework and (if not using trunk) the SDL_net.framework from the SDL site.

Download SDL. Install SDL.framework to /Library/Frameworks

Download SDL_mixer. Install SDL_mixer to /Library/Frameworks

Download SDL_image. Install SDL_image to /Library/Frameworks

Open Xcode Project. I use Xcode 4.3.2 with Lion.

Go to Preferences -> Downloads and install Command Line Tools.

Download and install MacPorts from [1].

Open Terminal window.

run "sudo port selfupdate" to get latest ports tree.

run "sudo port install libxml2" to install libxml2.

run "sudo port install libguichan" to install guichan.

run "sudo port install libsdl_gfx" to install sdl_gfx.

run "sudo port install libsdl_net" to install sdl_net.

run "sudo port install libsdl_ttf" to install sdl_ttf.

run "sudo port install physfs" to install PHYSFS.

run "sudo port install libpng" to install PNG.

run "sudo port install freetype" to install freetype (needed by SDL_ttf)

run "sudo port install libiconv" to install libconv

run "sudo port install gettext" to install libintl

Click build in Xcode.

If you have any problems, ask in the forums.

--Trapdoor 01:39, 18 February 2007 (CET) / Updated 21 November 2007