From The Mana World
Revision as of 23:00, 26 March 2012 by Trapdoor (talk | contribs) (Updated Mac OSX building instructions)

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.

Note that TMW and all libraries are being installed to /Users/bjorn, you should probably use your own home directory. ;-)

Dependencies

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

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 here.

Configure command:

./configure --prefix=$HOME --disable-shared \
  --enable-force-sdl --enable-force-sdlimage --enable-force-opengl \
  CXXFLAGS="-I/Users/bjorn/include -I/Users/bjorn/include/SDL"

PhysFS

PhysFS 1.0.0 needed a -lreadline added to its test_physfs_LDFLAGS in Makefile.in line 280.

The Mana World

The src/Makefile.in file had to be modified to include net/win2mac.cpp.

Configure command:

./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"

Problems

  • 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:

./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"

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 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):

./buildDMG.pl -dmgName "ManaWorld" -buildDir . -volSize 4 -volName "ManaWorld" -compressionLevel=9 ./build/Deployment/ManaWorld.app/

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 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