PtokaX forum

PtokaX => FAQ section => Topic started by: PPK on 13 September, 2009, 22:32:15

Title: Step by step guide for PtokaX compile and setup on FreeBSD
Post by: PPK on 13 September, 2009, 22:32:15
First important note. It is looks long, it is looks hard, but it is easy and everything can be done in less than 5 minutes  ;)

This guide was tested on clean installation of FreeBSD 7.2. Everything is done from command line, that means that everything can be done over ssh on remote server.

In my case was only base system installed, that means that after startup and login i was already in command line and working directory was my home directory. If you are not in command line then you need to go here some way (ie if gnome is installed then open terminal).

1. First thing needed for PtokaX compile is source, you will download it with this command:
wget http://www.PtokaX.org/files/0.4.1.1-posix-src.tgz
Result should looks similar to this:
(http://www.ptokax.org/files/images/02-wget-px.png)

In my case wget command was unknown, to install wget i'm used:
pkg_add -r wget
Result should looks similar to this:
(http://www.ptokax.org/files/images/01-pkg_add-wget.png)

To decompress source use this command:
tar -xf 0.4.1.1-posix-src.tgz

2. Next thing needed for PtokaX compile is tinyxml, for that you need to go to PtokaX source tinyxml directory.
Use these to commands to change working directory:
cd PtokaX
cd tinyxml

Result looks like this:
(http://www.ptokax.org/files/images/03-cd-tinyxml.png)
Download tinyxml source with this command:
wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.5.3/tinyxml_2_5_3.tar.gz
Result should looks similar to this:
(http://www.ptokax.org/files/images/04-wget-tinyxml.png)
To decompress tinyxml source use this command:
tar -xf tinyxml_2_5_3.tar.gz

Because my makefile want tinyxml source in src subdir (now is empty) and tinyxml was unpacked to tinyxml remove that src directory with this command:
rmdir src
And rename tinyxml directory to src with this command:
mv tinyxml src

3. Before we can start tinyxml compile we need gmake package. We can install it using pkg_add command.
To install gmake package use this command:
pkg_add -r gmake
Result can looks similar to this:
(http://www.ptokax.org/files/images/05-pkg_add-gmake.png)

4. Now we can compile tinyxml, use this command:
gmake
Result should looks similar to this:
(http://www.ptokax.org/files/images/06-gmake-tinyxml.png)

5. Now when tinyxml is compiled we can prepare things for PtokaX compile.
First change directory from tinyxml sub dir to PtokaX root, use this command:
cd ..

Again we use pkg_add to get lua package needed for compile.

Install Lua 5.1 with this command:
pkg_add -r lua51
Result can looks similar to this:
(http://www.ptokax.org/files/images/07-pkg_add-lua.png)

6. Because FreeBSD have some different things related to lua library we need to make three moddifications to makefile.
Open makefile in text editor with this command:
vim makefile

Use cursor keys on keyboard to move in that file. To start editing press Insert key on keyboard.

Search for this line:
INCLUDE = -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1
And change it to:
INCLUDE = -Itinyxml/src -I/usr/include -I/usr/local/include -I/usr/local/include/lua51 -I/usr/include/lua5.1 -I/usr/pkg/include -I/usr/include/lua -I/usr/include/lua/5.1

Search for this line:
$(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \
And change it to:
$(CXX) -lpthread -lz -lrt -o PtokaX \

Search for this line:
$(CURDIR)/tinyxml/tinyxml.a
And change it to:
$(CURDIR)/tinyxml/tinyxml.a /usr/local/lib/lua51/liblua.a

To end editing press Esc key on keyboard.

To save file use this:
:w

And to quit editor use this:
:q

7. Now we can start PtokaX compile.
Use this command:
gmake
Result should on end looks similar to this (http://www.ptokax.org/files/images/08-gmake-PtokaX.png)  (image not posted here because is big ;D)

8. If everything was ok you now have PtokaX executable. Before you run it you should do atleast basic setup.
In source we have config examples, we use them to setup your PtokaX hub.
First we rename cfg.example directory to cfg with this command:
mv cfg.example cfg

Go to cfg dir with this command:
cd cfg

To be able to run PtokaX we need to set atleast hubname and hub address.

Open Setting.xml in text editor with this command:
vim Settings.xml

Search for this line:
<String Name="HubName">&lt;Enter hub name here&gt;</String><!-- Hub name. Min length 1, max 256. -->
And change this:
&lt;Enter hub name here&gt;
To your hubname. For example like that:
<String Name="HubName">PtokaX test</String><!-- Hub name. Min length 1, max 256. -->

Search for this line:
<String Name="HubAddress">&lt;Enter hub address here&gt;</String><!-- Hub address. Min length 1, max 256. -->
And change this:
&lt;Enter hub address here&gt;
To your hub address. For example like that:
<String Name="HubAddress">192.168.0.13</String><!-- Hub address. Min length 1, max 256. -->

End editing, save file and quit editor like before with makefile.

9. This part is not needed, but is good to create registered user for yourself.

Open RegisteredUsers.xml in text editor with this command:
vim RegisteredUsers.xml

Search for this line:
<Nick>Example_Nick</Nick>
And change this:
Example_Nick
To your nick name. For example like that:
<Nick>PPK</Nick>

Search for this line:
<Password>Example_Password</Password>
And change this:
Example_Password
To your password. For example like that:
<Password>test</Password>

Search for this line:
<Profile>3</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg -->
And change this:
3
To your profile. For example like that:
<Password><Profile>0</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg --></Password>

End editing, save file and quit editor like before with makefile and Settings.

10. Now you can run PtokaX.
Change from cfg directory to PtokaX root with this command:
cd ..

And run PtokaX with this command:
./PtokaX
Result should looks like this:
(http://www.ptokax.org/files/images/09-start-PtokaX.png)
And from client similar to this:
(http://www.ptokax.org/files/images/10-check-run.png)
Title: Re: Step by step guide for PtokaX compile and setup on FreeBSD
Post by: PPK on 10 September, 2011, 18:23:22
Updated version of this guide is in PtokaX Wiki (http://wiki.ptokax.org/doku.php/settingup/compile_and_setting_freebsd)  8)