Compiling legacy TPT for Linux

From The Powder Toy
Revision as of 19:47, 28 September 2011 by Simon (talk | contribs) (1 revision)
Jump to: navigation, search

You will need the following packages:

git-core - GIT control system, lets you connect to the repo

libsdl1.2-dev - SDL Libaries

libbz2-dev - BZip2 Libaries - 64bit systems use lib64bz2-dev

liblua5.1-0-dev - Lua libaries

build-essential - Compiling tools

Ubuntu/Debian Users can click copy/paste the line below into their address bar to automatically download and install the needed packages. Note: These packages may or may not have the same names on all distributions, they may not even exist, they will most like do so though.\\ apt:build-essential,libsdl1.2-dev,libbz2-dev,liblua5.1-0-dev,git-core

Get the source

This is taken from Triclops200s' Win32 Code Set-up and modified for linux where I can.


1) You need to make an account at [[1]]


2) Give your email to GitHub (necessary) under email addresses).


If you already have a RSA keypair you want to use, skip this step

3) Open terminal and run this command:

$ ssh-keygen -t rsa -C "<githubusername>@github.com"


3a) Leave the file location blank when it prompts you.


3b) Type a strong passphrase and confirm the passphrase.


4) Open /home/<username>/.ssh/id_rsa.pub in gedit or another graphical editor.


5) Go to your github account > SSH Public Keys. Copy the entire file contents into the the "Key" box. Make sure you don't add any extra spaces or lines (there IS an extra line at the end, though). Name the key anything you like in the Title box and hit "Add key".


6) Open terminal and type:

$ ssh git@github.com

You may get something like this:\\ The authenticity of host 'github.com (207.97.227.239)' can't be established.\\ RSA key fingerprint is 16:27:ac:a5:76:28:2d:36:63:1b:56:4d:eb:df:a6:48.\\ Are you sure you want to continue connecting (yes/no)?\\ Type yes and press enter. You will get a "warning" saying github has been added to the list of known hosts. You will then be prompted for your password. Enter it and press enter. You should get a message like this:\\ Hi <github username>! You've successfully authenticated, but GitHub does not provide shell access.\\ Connection to github.com closed.

If it doesn't work, go back to step 3 and try again.

NOTE: It will return an error saying theres no SSH support, but the text will contain your username so its nothing to worry about, it worked.


7) Go to [[2]] and click the "Fork" button. This will create a copy of The Powder Toy in your account.


8) In a terminal, use

$ git clone git@github.com:<github username>/The-Powder-Toy.git /path/to/folder

Example

$ git clone git@github.com:antb/The-Powder-Toy.git /home/antb/TPT

This will download an up-to date copy of the source code to your computer for you to edit as you see fit.


9) To compile the source code, just run

$make powder-sse

There will be a LOT of output in your terminal, but provided the last thing to some out is strip powder-sse it's worked ok and you can run it using ./powder-sse.

10) Once your happy with your changes and are ready to put them up for everyone else to see:

$ git commit -va You will be presented with either vim or nano, enter your commit message at the top of the file, save, then exit.

11) When you think your changes are ready for anyone to use and are ready to publish on GitHub, use:

$ git push

It will ask for your RSA password again. Watch for any errors and if there aren't any, you're done!

12) Use $ git remote add origin git@github.com:<gitname>/<gitrepo> if you cannot commit or push.


If you just want to checkout the sourcecode, run this command:

%%$ git clone git://github.com/FacialTurd/The-Powder-Toy.git%%

Updating

If you make your own mod, no doubt you'll be wanting to keep your source code up to date with Simon's. cd to your powder folder on run these:\\ $ %%git remote add upstream git://github.com/FacialTurd/The-Powder-Toy.git%%\\ $ git pull upstream master\\ If will give you some output, and any merge problems. Open any failed files in your favourite text editor. Any failed merges will me marked with %%<<<<<<%%, %%======%% and %%>>>>>>%%. Use your noggin to put which piece in the right place.

Lua errors

On some distributions, you will get errors complaining of missing lua headers even when you have them installed. To fix these, you will need to edit the Makefile. Add -DLUA_R_INCL to CFLAGS and change -llua5.1 to -llua in LFLAGS.

Easier way=

Download source. Do step 1. Mark every line in script.sh with: #, but leave: make

powder-debug. without it. Then run script.sh in terminal.

Related

How to: Cross Compile to Windows