Author Topic: Step by step guide for PtokaX compile and setup on FreeBSD  (Read 4368 times)

0 Members and 1 Guest are viewing this topic.

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Step by step guide for PtokaX compile and setup on FreeBSD
« 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:
Code: [Select]
wget http://www.PtokaX.org/files/0.4.1.1-posix-src.tgzResult should looks similar to this:


In my case wget command was unknown, to install wget i'm used:
Code: [Select]
pkg_add -r wgetResult should looks similar to this:


To decompress source use this command:
Code: [Select]
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:
Code: [Select]
cd PtokaX
cd tinyxml
Result looks like this:

Download tinyxml source with this command:
Code: [Select]
wget http://downloads.sourceforge.net/project/tinyxml/tinyxml/2.5.3/tinyxml_2_5_3.tar.gzResult should looks similar to this:

To decompress tinyxml source use this command:
Code: [Select]
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:
Code: [Select]
rmdir srcAnd rename tinyxml directory to src with this command:
Code: [Select]
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:
Code: [Select]
pkg_add -r gmakeResult can looks similar to this:


4. Now we can compile tinyxml, use this command:
Code: [Select]
gmakeResult should looks similar to this:


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:
Code: [Select]
cd ..
Again we use pkg_add to get lua package needed for compile.

Install Lua 5.1 with this command:
Code: [Select]
pkg_add -r lua51Result can looks similar to this:


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:
Code: [Select]
vim makefile
Use cursor keys on keyboard to move in that file. To start editing press Insert key on keyboard.

Search for this line:
Code: [Select]
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.1And change it to:
Code: [Select]
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:
Code: [Select]
$(CXX) -lpthread -lz -llua5.1 -lrt -o PtokaX \And change it to:
Code: [Select]
$(CXX) -lpthread -lz -lrt -o PtokaX \
Search for this line:
Code: [Select]
$(CURDIR)/tinyxml/tinyxml.aAnd change it to:
Code: [Select]
$(CURDIR)/tinyxml/tinyxml.a /usr/local/lib/lua51/liblua.a
To end editing press Esc key on keyboard.

To save file use this:
Code: [Select]
:w
And to quit editor use this:
Code: [Select]
:q
7. Now we can start PtokaX compile.
Use this command:
Code: [Select]
gmakeResult should on end looks similar to this  (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:
Code: [Select]
mv cfg.example cfg
Go to cfg dir with this command:
Code: [Select]
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:
Code: [Select]
vim Settings.xml
Search for this line:
Code: [Select]
<String Name="HubName">&lt;Enter hub name here&gt;</String><!-- Hub name. Min length 1, max 256. -->And change this:
Code: [Select]
&lt;Enter hub name here&gt;To your hubname. For example like that:
Code: [Select]
<String Name="HubName">PtokaX test</String><!-- Hub name. Min length 1, max 256. -->
Search for this line:
Code: [Select]
<String Name="HubAddress">&lt;Enter hub address here&gt;</String><!-- Hub address. Min length 1, max 256. -->And change this:
Code: [Select]
&lt;Enter hub address here&gt;To your hub address. For example like that:
Code: [Select]
<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:
Code: [Select]
vim RegisteredUsers.xml
Search for this line:
Code: [Select]
<Nick>Example_Nick</Nick>And change this:
Code: [Select]
Example_NickTo your nick name. For example like that:
Code: [Select]
<Nick>PPK</Nick>
Search for this line:
Code: [Select]
<Password>Example_Password</Password>And change this:
Code: [Select]
Example_PasswordTo your password. For example like that:
Code: [Select]
<Password>test</Password>
Search for this line:
Code: [Select]
<Profile>3</Profile><!-- 0 for master, 1 for operator, 2 for vip, 3 for reg -->And change this:
Code: [Select]
3To your profile. For example like that:
Code: [Select]
<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:
Code: [Select]
cd ..
And run PtokaX with this command:
Code: [Select]
./PtokaXResult should looks like this:

And from client similar to this:
« Last Edit: 13 September, 2009, 23:09:56 by PPK »
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PtokaX forum

Step by step guide for PtokaX compile and setup on FreeBSD
« on: 13 September, 2009, 22:32:15 »

Offline PPK

  • Administrator
  • Emperor
  • *****
  • Posts: 1 475
  • Karma: +209/-22
  • PtokaX developer
Re: Step by step guide for PtokaX compile and setup on FreeBSD
« Reply #1 on: 10 September, 2011, 18:23:22 »
Updated version of this guide is in PtokaX Wiki  8)
"Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris." - Larry Wall

PtokaX forum

Re: Step by step guide for PtokaX compile and setup on FreeBSD
« Reply #1 on: 10 September, 2011, 18:23:22 »