Difference between revisions of "Compiling for Mac OS X"

From The Powder Toy
Jump to: navigation, search
(Added homebrew instructions for Lua)
m (add warning about the page being outdated)
 
Line 1: Line 1:
 +
'''This guide is old and should only be used for reference''', see the main page for an updated guide
 +
 
''Copy paster from forum thread. Clarify where needed''
 
''Copy paster from forum thread. Clarify where needed''
  

Latest revision as of 01:38, 24 August 2014

This guide is old and should only be used for reference, see the main page for an updated guide

Copy paster from forum thread. Clarify where needed

Ok I don't know if this is where it goes but I *think* I finally grasped the idea, with whatever methods, to compile as efficiently as I could. Thanks to some people at this Mac forum, and to flarn2006 who helped me I guess for the last step, even though I didn't get it at first but then when this dude explained it to me at those forums it clicked lol.

Notice: This is for 10.6 and below! If you are lion or further, go to this page: link

Ok so.

First step you need to take is install XCode/Developer Tools, even though the method we compile with in this guide is through the Terminal/command line, I'm sure there is a way to compile with XCode as well, hopefully in the future someone can find out :P.

Download XCode from here: [1]

Also let's install SDL, the PROPER way, so you don't get any errors during compiling.

First, get this file:

[2]

Next, open up your console (terminal) and change to the directory that you downloaded this file to. Probably 'Downloads' in your user folder. Next, type in:

tar xzf SDL-1.2.14.tar.gz

This will extract all the files into a folder called SDL-1.2.14. Go to this folder by typing:

cd SDL-1.2.14

There's a configure and a makefile in this folder. You'll have to run both.

./configure && make

It'll check that you can compile then a bunch of stuff. After it's done, you have one more step:

sudo make install

Now you need to install Lua.

There are several ways to do this:

Option 1. is via homebrew

   If you wish to install Lua via homebrew, first download and install homebrew from [3]
   Follow the install instructions there, and then open a new Terminal window.
   Type the following and hit enter:
   brew install lua
   Homebrew will then install Lua.

Option 2. is via Macports

    If you wish to install Lua this way, you must download Macports from [4]
     Follow all install instructions the Macports website and installer give you, and then open a terminal.
     
     Type the following and hit enter:
     sudo port install lua
      
     Macports will do its thing and Lua will be installed

Option 3. is via Lua source.

     Download this file:[5]
     Next, open up your console (terminal) and change to the directory that you downloaded this file to. Next, type in:

tar xzf lua-5.1.4.tar.gz

This will extract all the files into a folder called lua-5.1.4 Go to this folder by typing:

cd lua-5.1.4

Run this:

./configure && make

Then run:

sudo make install

Lua has been installed in the system, but TPT will not accept it yet.

Open The Powder Toy's source folder and open "makefile" with TextEdit.

Find the line that says "powder-x", near this you will see a bit of text that says "-lua5.1", remove the 5.1 from this and save the file.

---

Fourth step step, after all that's done, in the Terminal, you need to cd to the powdertoy source folder, so we can start compiling.

Type in cd, like in this picture: [6]

Next, what I would usually do is just drag the folder into the Terminal window to make the linking easy.

Should end up like this: [http:i54.tinypic.com/96hyds.png]http:i54.tinypic.com/96hyds.png]

Click enter, and after that do "make powder-x". It should start writing a bunch of things, warnings and stuff, which are fine. Towards the end when it's done, it usually says 'strip powder-x' like in this picture: [7]

Now you should have 2 files in the folder, the important one being 'powder-x' which is a "unix executable file", therefore it only runs from the command line, which we don't want, here is a pic of the outcome: [8]

---

Now since we want to actually have a complete stand alone application rather than a crappy command line based one, so we can share with our buddies and show off in the forums, there is a third step to do that, and here I explain my method on it.

Now notice in one of the pics I had a Powder.app next to the folder, yes, now I will explain what to do.

1) Right click on the Powder.app > "Show package contents" >/Contents/MacOS, you will notice something familiar...it's a powder-x file!

2) Go to the source folder, mine is cracker, since he is an awesome modder, and drag the powder-x in the source folder, into the one in the Powder.app one, replacing the one in there. Here is a pic for dummies: [9]

3) Open Powder.app now, and voila! Perfect, complete app, just like the one on the website :) with the icons and everything, no command line launching needed! Share to your hearts content, I hope this long overdue guide helped all of you fill those gaps that were left for us OS X users :( now we can enjoy powder toy fun too!

4) Here is another picture for the lulz: [10]

Credits:

Dudes at MacRumors. Dudes here, and I guess flarn2006. Cracker for his awesome mod. I'm proud to be a 'crack' head :) get it? Crackhead? harharharhar....I am so funny... -___-. AntB for doing the wiki formatting (Self-promotion FTW!)