From The Mana World
m (Jaxad0127 moved page MacOSX port to Archive:MacOSX port without leaving a redirect)
 
(15 intermediate revisions by 6 users 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".
Download SDL. Install SDL.framework to /Library/Frameworks


=== libpng ===
Download SDL_mixer. Install SDL_mixer to /Library/Frameworks


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".
Download SDL_image. Install SDL_image to /Library/Frameworks


=== libogg ===
Open Xcode Project. I use Xcode 4.3.2 with Lion.


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


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.
Download and install MacPorts from [http://www.macports.org].


=== libxml2 ===
Open Terminal window.


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


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.
run "sudo port install libxml2" to install libxml2.


=== SDL_image ===
run "sudo port install libguichan" to install guichan.


=== SDL_mixer ===
run "sudo port install libsdl_gfx" to install sdl_gfx.


=== Guichan ===
run "sudo port install libsdl_net" to install sdl_net.


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].
run "sudo port install libsdl_ttf" to install sdl_ttf.


'''Configure command:'''
run "sudo port install physfs" to install PHYSFS.


<pre>
run "sudo port install libpng" to install PNG.
./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 ===
 
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:'''
<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 ==
 
* 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 ==
Create a new project and select SDL OpenGL Application. This should already link you to the SDL and OpenGL frameworks.


Add all the .cpp and .h files to the source group. (Remove any atlantis files that may be there)
run "sudo port install freetype" to install freetype (needed by 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, libpng, and guichan.
run "sudo port install libiconv" to install libconv
(For trunk SDL_net is not needed)


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


Put the relevant physfs files inside the physfs group.
Click build in Xcode.
Add libxml2.dylib and libcurl.3.dylib to the libs group.
(For trunk add the enet files to enet group)


Add the search header path if needed for all the Frameworks, and /usr/include and /usr/include/libxml2.
If you have any problems, ask in the [http://forums.themanaworld.org/viewforum.php?f=10 forums].
Add library search path if needed for /usr/lib.


Click build.
--[[User:Trapdoor|Trapdoor]] 01:39, 18 February 2007 (CET) / Updated 21 November 2007
--[[User:Trapdoor|Trapdoor]] 01:39, 18 February 2007 (CET)
[[Category:programming]]

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