-
-
Notifications
You must be signed in to change notification settings - Fork 492
RavuAlHemio_Mac_OS_X_Compilation
So you've decided to compile SuperTux on Mac OS X. It's a bit less error-prone than Building on Windows, so just follow these instructions and you should get it up and running (optionally as a universal binary) in just about no time.
While this document describes how to make use of the OpenGL and OpenAL frameworks that are included with Mac OS X, it tells you how to get SDL compiled and installed UNIX-style (/usr/include and /usr/lib). If you wish to use the SDL framework available on its website, you will have to do some things differently. (This is where Linux programming knowledge is useful.)
This guide also makes you compile SuperTux UNIX-style; you will use the Terminal instead of Xcode. Since it also describes exclusive use of GCC 4.0, your build will only run on versions ≥ Tiger. (Search the web to find out how to use GCC 3 for the PPC build.)
Quite a few instructions here imply you have already found your way around the terminal. If you haven't, you may wish to search for a few tutorials to become more proficient.
Insert your Mac OS X installation CD into your DVD-ROM drive. In the window that opens, double-click on '''Xcode Tools''' and then on '''XcodeTools.mpkg'''. Continue through the installation wizard until you come to the '''Installation Type''' section. Here, click '''Customize'''. A successful constellation only requires '''Developer Tools Software''', '''gcc 4.0''', the '''Software Development Ki ts''' and the '''Mac OS X 10.4 (Universal) SDK''' (from under '''Cross Development'''). Keep on clicking yourself through the wizard until said tools are installed.
You will need the following libraries to run SuperTux:
- [http://libsdl.org/ SDL]
- [http://libsdl.org/projects/SDL_image/ SDL_image] ** [http://libpng.org/pub/png/libpng.html libpng] ** [http://ijg.org/ libjpeg]
- [http://icculus.org/physfs/ PhysicsFS]
- [http://xiph.org/downloads/ libogg and libvorbis]
lipo i386.dylib ppc.dylib -create -output fat.dylib
. (Do this for both static (.a
) and dynamic (.dylib
) libraries.) Then, move these fat libraries into /usr/lib and you're ready to do the next step.
To configure a library for the architecture you're currently ''not'' on, you can simply supply a different target to configure, like so:
./configure --target=powerpc-apple-darwin8.0.0
./configure --target=i386-apple-darwin8.0.0
The exception to this rule are libpng and libjpeg, which don't use autoconf. In their case, you will have to modify CPPFLAGS and LDFLAGS in the Makefiles to contain either -arch i386
(if on PPC for Intel) or -arch ppc
(if on Intel for PPC). libpng also requires you to modify the section where the library itself is built; just search for -dynamiclib
and add the proper -arch flag before or after it.
Most of the time, the triplet ./configure && make && sudo make install
(supplying your own password when asked for it) is enough.
If you intend to build distributable app bundles, pass ''--enable-jpg-shared=false --enable-png-shared=false'' flags to configure when compiling SDL_image.
( '''Note:''' RavuAlHemio, the original author of this document instructed to install libraries in /usr. I (Auria) personally prefer leaving the install default to /usr/local, because this way i can easily tell at any time what libs came with OS X and what libs i installed myself. That's valuable knowledge when you need to decide which libs you will package inside the app bundle ;) Nonetheless, if you would like to install in /usr instead, run ./configure --prefix=/usr && make && sudo make install
. If you install in /usr/local, also don't forget to add /usr/local/bin to your PATH)
Since SuperTux uses jam as its building tool, you'll need to download and compile that too. (Apple bundles it with the development tools, but their version is somehow defective, so you're better off getting a clean distribution from Perforce.)
First, download the archive (either in zip or uncompressed tar format) from the [ftp://ftp.perforce.com/jam/ Perforce FTP server]. Then, extract the files into a directory of your choice, enter it via the Terminal and run make
. When everything is done, copy the resulting jam binary from build.x86 or build.ppc to /usr/bin (e.g. sudo cp build.x86/jam /usr/bin/
) and you're all set.
To download the development version of SuperTux, you'll need [http://subversion.tigris.org/ Subversion]. You can either download precompiled disk images or compile the source yourself using the triplet introduced above. Once this is done, follow the directions in the article Download/Subversion.
In the Terminal, switch to the directory you have checked out SuperTux into. Then, run the following command to generate the configure script:
./autogen.sh
If you don't get any answer and find yourself back at the command prompt, everything should have gone well. Next, you will have to do a nice hack: link the header files for OpenGL and OpenAL so that SuperTux can find them. This hack is awesomely stupid. Just issue the following commands:
ln -s /System/Library/Frameworks/OpenAL.framework/Headers/ AL ln -s /System/Library/Frameworks/OpenGL.framework/Headers/ GL
At long last, you can run configure. Here there are two ways.
- If you just want to run supertux on your computer the Unix way, run:
./configure --with-apple-opengl-framework CPPFLAGS="-I."
- If you want to make an app bundle, rather run:
./configure --with-apple-opengl-framework CPPFLAGS="-I. -DMACOSX"
-arch i386 -arch ppc
For example LDFLAGS ?= "-framework OpenAL" becomes LDFLAGS ?= "-framework OpenAL -arch i386 -arch ppc"
You will also have to modify config.h. If you have a PowerPC machine, you will find the following lines in your config.h: #define WORDS_BIGENDIAN 1 and on an Intel box: /* #undef WORDS_BIGENDIAN */
Just transform this line into these three lines: #ifdef BIG_ENDIAN
#endif
Now, at long last, you can run the command that will compile everything.
jam
This will take forever (mainly when you're compiling a universal binary), so grab a coffee or other beverage, play a game of chess, whatever.
When the build process is completed and you are feeling lucky, the following command will start SuperTux and make your life complete:
./supertux
This should have done the trick. If something is too unclear or you think I haven't added enough detail, please alert me on this article's User talk:RavuAlHemio/Mac OS X compilation and I will do my best to improve this document.
Okay, launching from the terminal works, but you'd like an app bundle like all OS X native apps. The instructions below will make it happen.
- create a folder named e.g. "supertux_bundle" and cd into it.
- copy the 'supertux' executable you just built into this folder.
- copy the 'data' folder there too (if you built supertux from SVN be careful as the one you see is filled with SVN invisible files)
- pick a file you think makes a nice icon (e.g. /data/images/creatures/tux_grow/left-7.png), resize it to at least 128x128 in your favorite graphics editor, and turn it into a .icns file with an app like [http://www.stalkingwolf.net/software/cocothumbx/ CocoThumbX]. Rename it to "supertux.icns" and place it in the same folder.
- In this folder, place a file called "info.plist" with the following contents:
CFBundleDevelopmentRegion English CFBundleExecutable supertux CFBundleInfoDictionaryVersion 6.0 CFBundleName Supertux CFBundleIconFile supertux.icns CFBundlePackageType APPL CFBundleVersion 0.3.0 CSResourcesFileMapped
('''When you copy and paste from your web browser, make sure the line endings are okay. Sometimes web browsers gives non-Unix line endings if you copy from them. Text editor Smultron has a feature to fix them and probably others too.''')
- create the skeleton with a script like this one:
mkdir -p ./SuperTux.app/Contents/Resources mkdir ./SuperTux.app/Contents/MacOS cp info.plist ./SuperTux.app/Contents/info.plist cp supertux.icns ./SuperTux.app/Contents/Resources/supertux.icns cp supertux ./SuperTux.app/Contents/MacOS/supertux cp -r ./data ./SuperTux.app/Contents/Resources/data
- The app bundle will be ready and if all went correctly you should now be able to run SuperTux with a double-click from the Finder! It will not have an icon right now but that will eventually appear. '''However''', this bundle cannot yet be distributed as it depends on libraries not included inside the bundle.
These instructions should result in a package that you can compress as dmg and put as download on a website.
-
Download mac dylib bundler from http://macdylibbundler.sf.net version 0.3 or better and build it with ''make && sudo make install''
-
run the following command on the terminal:
dylibbundler -b -x ./SuperTux.app/Contents/MacOS/supertux -d ./SuperTux.app/Contents/libs/ -od
- On my computer, libphysfs was linked in a weird way i had never seen before so there were a few problems.
This will only work if you installed libs in /usr/local or another prefix (e.g. /opt/local for macports). If you put them in /usr they are undistinguishable from libraries installed by default on OS X so it's harder to package them, and dylibbundler won't be able to do it automatically.
Done! Want to test to see if everything is linked properly? ''sudo mv /usr/local /usr/local-disabled'' (or any other suffix) will temporarly restore your mac in a near vanilla state for libraries. Then you can test the game, and of course run the opposite command after to put the folder back in its correct location. You can also test the resulting executable and libraries with ''otool -L''
Home
Guidelines
Game Mechanics
Tools
Engine
- Cameras in other games
- Collision
- Configuration File
- Console
- Cutscenes
- Game_Engine
- Lighting
- Map_transformer
- Portables
- SceneGraph
- Scripting
Specifications
Milestones
- Milestone 1 Analysis
- Milestone 2 Design Document
- Milestone 2 Design Document Old
- Milestone 3 Design Document
Building (mostly outdated)
- INSTALL.md
- Building
- Building on macOS
- Building SuperTux
- Building on Windows
- Building with MXE (cross-compile)
Meetings