Author Topic: One stop guide to compiling glest and GAE  (Read 11581 times)

assassin

  • Guest
One stop guide to compiling glest and GAE
« on: 31 May 2009, 13:33:37 »
Getting glest and GAE installed onto your (linux) computer.
By Assassin

UPDATE 31/08/09: Improved install locations and added GAE v0.2.12
UPDATE 20/09/09: Improved security in installation with help from Jda

Can this post be Stickied Please?

EDIT: To install via SVN go here: https://forum.megaglest.org/index.php?topic=4375.msg27748#msg27748

Make sure you have all dependencies. (These will show up when you first run configure if you don't have them).

It is recommended that you go through these instructions step by step, so that you can post exactly what and where the problem is if something goes wrong.

Step 1: Normal Glest
First, we want to go to a temporary directory:
Code: [Select]
cd /tmp
Now get the source package:
Code: [Select]
wget http://kent.dl.sourceforge.net/sourceforge/glest/glest_source_3.2.2.zip
unzip it:
Code: [Select]
mkdir glestsource ; cd glestsource ; unzip /tmp/glest_source_3.2.2.zip
change to the compile directory:
Code: [Select]
cd mk/linux
change permissions:
Code: [Select]
chmod a+x autogen.sh
run autogen
Code: [Select]
./autogen.sh
run configure:
Code: [Select]
./configure
NOTE: this is when any missing dependencies will be shown.

now time to compile:
Code: [Select]
jam
now we have glest!

make a directory for it:
Code: [Select]
sudo mkdir /usr/local/games/glest ; sudo chown $USER:$USER /usr/local/games/glest
and move your files to it
Code: [Select]
mv glest /usr/local/games/glest/glest ; mv glest.ini /usr/local/games/glest/glest.ini ; mv glest_editor /usr/local/games/glest/glest_editor
now we can go to your permanent glest directory:
Code: [Select]
cd /usr/local/games/glest
now we need the data:
Code: [Select]
wget http://kent.dl.sourceforge.net/sourceforge/glest/glest_data_3.2.1.zip
unzip it:
Code: [Select]
unzip glest_data_3.2.1.zip
now annoyingly the files are all in a directory called "glest_game" but we want them in the root directory of glest so:
Code: [Select]
mv glest_game/data data ; mv glest_game/maps maps ; mv glest_game/scenarios scenarios ; mv glest_game/screens screens ; mv glest_game/techs techs ; mv glest_game/tilesets tilesets ; mv glest_game/tutorials tutorials ; mv glest_game/glest.ico glest.ico ;  mv glest_game/servers.ini servers.ini ; rm -r glest_game ; rm glest_data_3.2.1.zip
now we rename the .lng file:
Code: [Select]
cp data/lang/english.lng data/lang/english.lng.lng
Now glest should work. To test type ./glest

Step 2: GAE

Code: [Select]
cd /tmp
svn co https://glestae.svn.sourceforge.net/svnroot/glestae/trunk glest-svn
cd glest-svn/mk/linux
chmod a+x autogen.sh
./autogen.sh
./configure
jam
This would be a good time to go have a snack...
Code: [Select]
mv glestadv /usr/local/games/glest/glestadv
cd /tmp/glest-svn/data/game
mv data /usr/local/games/glest/data;
cd /tmp
wget http://glest.codemonger.org/files/glestadv-src-0.2.11.zip
unzip glestadv-src-0.2.11.zip
cd gae/data/glest_game
cp -r  data /usr/local/games/glest
mkdir /usr/local/games/glest/gae_scenarios
ln -s /usr/local/games/glest/scenarios /usr/local/games/glest/gae_scenarios/scenarios
sudo chown root:root /usr/local/games/glest

That should then mean that gae works!
to try type:
Code: [Select]
cd /usr/local/games/glest ; ./glestadv
Step 3: Sorting out scenarios:
Code: [Select]
mkdir /usr/local/games/glest/gae_scenarios
ln -s /usr/local/games/glest/scenarios /usr/local/games/glest/gae_scenarios/scenarios
NOTE:
* In-game, you will notice you have only one category of scenarios, called "All_scenarios". If you want to have your scenarios organized in different categories, just create one folder for each category you want inside folder gae_scenarios and move the scenarios you want for that category in there. E.g.:
Code: [Select]
sudo mkdir /usr/local/games/glest/gae_scenarios/megapack_v4
ln -s /usr/local/games/glest/scenarios/m4* /usr/local/games/glest/gae_scenarios/megapack_v4
(you will now have a new category containing only Titi's Megapack v4 scenarios. Wink )

now set the folder prioroties back to root (recoomended,but not 100% necessary)
Code: [Select]
sudo chown root:root /usr/local/games/glest
Step 4: Creating shortcuts in your $PATH

To find your path type type:
Code: [Select]
echo $PATHand chose whichever directory that you think is the most appropriate for glest.

(save these scripts as "glest" and "gae" (respectively) in your $PATH

VANILLA GLEST:
Code: [Select]
#!/bin/sh

# glest

MAINDIR=/usr/local/games/glest
DIR=$HOME/.glest
[ -d $DIR ] || mkdir $DIR
cd $DIR
if [ -f glest.ini ]; then
    # Update for Glest 3.2.1
    sed -i 's/\.lng//' glest.ini
    language=$(cat glest.ini | grep Lang | cut -d'=' -f2)
    [ -f $MAINDIR/data/lang/${language}.lng ] || \
        sed -i "s/${language}/english/" glest.ini
else
    cp $MAINDIR/glest.ini .
fi
[ -h glest ] || ln -s $MAINDIR/glest .
[ -f servers.ini ] || cp $MAINDIR/servers.ini .
for i in data docs scenarios techs tilesets; do
      [ -h $i ] || ln -s $MAINDIR/$i .
done
[ -d maps ] || mkdir maps
cd maps
for i in $MAINDIR/maps/*; do
      [ -h `basename $i` ] || ln -s $i .
done
cd ..

exec ./glest

GAE
Code: [Select]
#!/bin/sh

# glestadv

MAINDIR=/usr/local/games/glest
DIR=$HOME/.glest
[ -d $DIR ] || mkdir $DIR
cd $DIR
#if [ -f glestadv.ini ]; then # I could NOT get this to work properly for GAE. Hence
#    # Update for Glest 3.2.1 # I just commented this out, which means that, if you
#    sed -i 's/\.lng//' glestadv.ini # happen to messup your language settings, this script
#    language=$(cat glestadv.ini | grep Lang | cut -d'=' -f2) # will not automatically fix it for you. You'll have to
#    [ -f $MAINDIR/data/lang/${language}.lng ] || \ # manually fix it yourself.
#        sed -i "s/${language}/english/" glestadv.ini
#else
#    cp $MAINDIR/glestadv.ini .
#fi # End of commented-out language-setting routine.
[ -h glestadv ] || ln -s $MAINDIR/glestadv .
[ -f servers.ini ] || cp $MAINDIR/servers.ini .
for i in data docs scenarios techs tilesets gae_scenarios ; do
      [ -h $i ] || ln -s $MAINDIR/$i .
done
[ -d maps ] || mkdir maps
cd maps
for i in $MAINDIR/maps/*; do
      [ -h `basename $i` ] || ln -s $i .
done
cd ..

exec ./glestadv

To run gae just type "gae" in the terminal.

Note: place mods in /usr/local/games/glest/techs

Step 5: Enjoy!

Credit goes to Jda for improved security!
« Last Edit: 16 December 2009, 19:41:02 by assassin »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: One stop guide to compiling glest and GAE
« Reply #1 on: 1 June 2009, 00:20:44 »
Sweet!
I've had some issues getting linux working to my satisfaction, and will probably have to reinstall with a newer/better distro, but it'll be nice to have this all laid out for me when I get around to it.

Cheers !!  ;D
Glest Advanced Engine - Code Monkey

Timeline | Downloads

feldmann_markus

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #2 on: 30 July 2009, 12:19:19 »
If you want download glest over svn and install system wide:

cd /opt/
svn co https://glestae.svn.sourceforge.net/svnroot/glestae/trunk glest-svn
cd glest-svn/mk/linux/
chmod a+x autogen.sh
./autogen.sh
./configure
jam

cd /opt/
mkdir glest
chmod a+w glest
cd glest/
ln -s /opt/glest-svn/mk/linux/glestadv glest/glest
ln -s /opt/glest/glest /usr/local/bin/glest
ln -s /opt/glest-svn/mk/linux/glest_editor glest/glest_editor
ln -s /opt/glest/glest_editor /usr/local/bin/glest_editor

The Data should be downloaded as following:
cd /opt/
svn co https://glestae.svn.sourceforge.net/svnroot/glestae/data glest-data-svn
cd glest/
ln -s /opt/glest-data-svn/game/data/ glest/data
ln -s /opt/glest-data-svn/game/maps/ glest/maps
ln -s /opt/glest-data-svn/game/tilesets/ glest/tilesets
ln -s /opt/glest-data-svn/game/docs/ glest/docs
ln -s /opt/glest-data-svn/game/techs/ glest/techs
ln -s /opt/glest-data-svn/game/scenarios/ glest/scenarios
ln -s /opt/glest-data-svn/game/servers.ini glest/servers.ini
ln -s /opt/glest-data-svn/game/glestadv.ini glest/glestadv.ini
ln -s /opt/glest-data-svn/game/glest.ico/ glest/glest.ico

If you want to get a new version of glest:
cd /opt/glest-svn
svn update
Compile glest and glest-editor(See above)
cd /opt/glest-data-svn
svn update
« Last Edit: 30 July 2009, 13:29:49 by feldmann_markus »

silnarm

  • GAE Team
  • Behemoth
  • ********
  • Posts: 1,373
    • View Profile
Re: One stop guide to compiling glest and GAE
« Reply #3 on: 31 July 2009, 03:05:43 »
The 'chmod's shouldn't really be needed, but changing permissions doesn't count as modifying a file, so SVN never updates them.  I will remember to 'touch' all the shell scripts next I'm on the linux box, I promise.

Also, our data folder is incomplete :)
Glest Advanced Engine - Code Monkey

Timeline | Downloads

feldmann_markus

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #4 on: 31 July 2009, 06:38:23 »
Some of the Devs still said that they forget to upload the tech contents. :-) So i hope it will be in the next time uploaded. If they upload the tech contents, then it should be fine to only execute "svn update" in my ToDo and all is fine with few traffic. :-)

feldmann_markus

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #5 on: 31 July 2009, 06:43:53 »
The 'chmod's shouldn't really be needed, but changing permissions doesn't count as modifying a file, so SVN never updates them.
So you mean i should not chmod any of the downloaded files ? But the directory /opt/glest/ should be chmod, because of the ini files ? Otherwise i get an error. It would be nice if glest creates ini files in the home directory of the user, but it doesn't seem so. Any idea how to avoid this ?

hailstone

  • GAE Team
  • Battle Machine
  • ********
  • Posts: 1,568
    • View Profile
Re: One stop guide to compiling glest and GAE
« Reply #6 on: 31 July 2009, 09:22:31 »
Some of the Devs still said that they forget to upload the tech contents. :-) So i hope it will be in the next time uploaded.
Forgot that I hadn't uploaded rather than forgot to upload :P . It should be exactly the same as the one in vanilla glest's repository if you don't want to download everything again. http://glest.svn.sourceforge.net/viewvc/glest/trunk/data/glest_game/techs/magitech/factions/tech/

Quote from: feldmann_markus
It would be nice if glest creates ini files in the home directory of the user, but it doesn't seem so.
I keep the entire Glest game directory in home so there are no issues with permissions. It could be something to look into though.
Glest Advanced Engine - Admin/Programmer
https://sourceforge.net/projects/glestae/

umarzuki

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #7 on: 16 August 2009, 05:21:50 »
If you want download glest over svn and install system wide:

cd /opt/
svn co https://glestae.svn.sourceforge.net/svnroot/glestae/trunk glest-svn
cd glest-svn/mk/linux/
chmod a+x autogen.sh
./autogen.sh
./configure
jam

cd /opt/
mkdir glest
chmod a+w glest
cd glest/
ln -s /opt/glest-svn/mk/linux/glestadv glest/glest
ln -s /opt/glest/glest /usr/local/bin/glest
ln -s /opt/glest-svn/mk/linux/glest_editor glest/glest_editor
ln -s /opt/glest/glest_editor /usr/local/bin/glest_editor

The Data should be downloaded as following:
cd /opt/
svn co https://glestae.svn.sourceforge.net/svnroot/glestae/data glest-data-svn
cd glest/
ln -s /opt/glest-data-svn/game/data/ glest/data
ln -s /opt/glest-data-svn/game/maps/ glest/maps
ln -s /opt/glest-data-svn/game/tilesets/ glest/tilesets
ln -s /opt/glest-data-svn/game/docs/ glest/docs
ln -s /opt/glest-data-svn/game/techs/ glest/techs
ln -s /opt/glest-data-svn/game/scenarios/ glest/scenarios
ln -s /opt/glest-data-svn/game/servers.ini glest/servers.ini
ln -s /opt/glest-data-svn/game/glestadv.ini glest/glestadv.ini
ln -s /opt/glest-data-svn/game/glest.ico/ glest/glest.ico

If you want to get a new version of glest:
cd /opt/glest-svn
svn update
Compile glest and glest-editor(See above)
cd /opt/glest-data-svn
svn update
how do i fit in checkinstall with steps above in order to make a debian package on my debian 64 bit system so i can remove it anytime with apt?

assassin

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #8 on: 16 August 2009, 16:20:12 »
Glest does not support makeinstall and thus checkinstall due to the fact that it uses jam :(

jda

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #9 on: 18 September 2009, 13:56:04 »
A couple glitches:

You're installing Glest and GAE to /usr/local without using sudo which, in most linux out-of-the-box distros will not work, since /usr is owned by root and thus are all of its sub-folders.
Sollutions:
A) Use sudo before every command (including the ones after the ; character) starting from step:
Code: [Select]
mkdir /usr/local/games/glest This will however pose a security risk, as in order to actually play the game, you will have to run prefix it with sudo too (i.e. you will be running glestadv as root)! If you don't, no files can be written to /usr/local/games/glest and Glest will crash right on startup for not being able to create the file glest.log (and so will GAE I assume). And that file is not the only problem - the game will be unable to save anything to that folder.
It is unwise to run any command as root (e.g. prefixing it with the sudo command) unless it actually needs to be run so - in other words, something that would be a minor bug or glitch in GAE, with limited impact on your system might become a huge bug with serious consequences or even a possible backdoor for some malintended exploit.
See sollution for this sollution below.  :P

B) Replace step:
Code: [Select]
mkdir /usr/local/games/glest with this:
Code: [Select]
sudo mkdir /usr/local ; sudo chown $USER:$USER /usr/local ; mkdir /usr/local/games/glestThis will make /usr/local owned by user/group <your-user>/<your-user-group>. From then on, all commands run inside /usr/local/games/glest can be run by your regular user (instead of root) and you won't need to run GAE (or Glest) as root.
HOWEVER, that raises another security-problem. Though Glest/GAE now has limmited access to your system and hence is able to do little damage, it can still damage your personal files and folders - this is usually an "acceptable risk" as all programs are enabled some control over your system (otherwise they would be pointless).
But the problem now is that you can write to that executable file (glest or glestadv)! Binaries in Linux are usually owned by root and only root can change them; but usually everyone can execute them (there are exceptions) which is fairly safe. But now you've allowed a ton of programs and other exploit-doors to change your program! Hence, though the damage is limmited, the risk of someone malintendedly messing with your file has been increased.

Sollution for the problem with sollution A:
-> Have a folder you can safely write to and make it used by Glest/GAE as the default data and settings directory!
The .deb package available from Ubuntu repos implements this through a small shell-script (that also takes care of other stuff). This is the version I changed to work with the /usr/local directory we installed GAE/Glest to, instead of the Ubuntu package default directories, /usr/share and /usr/lib:

Vanilla Glest:
Code: [Select]
#!/bin/sh

# glest

MAINDIR=/usr/local/games/glest
DIR=$HOME/.glest
[ -d $DIR ] || mkdir $DIR
cd $DIR
if [ -f glest.ini ]; then
    # Update for Glest 3.2.1
    sed -i 's/\.lng//' glest.ini
    language=$(cat glest.ini | grep Lang | cut -d'=' -f2)
    [ -f $MAINDIR/data/lang/${language}.lng ] || \
        sed -i "s/${language}/english/" glest.ini
else
    cp $MAINDIR/glest.ini .
fi
[ -h glest ] || ln -s $MAINDIR/glest .
[ -f servers.ini ] || cp $MAINDIR/servers.ini .
for i in data docs scenarios techs tilesets; do
      [ -h $i ] || ln -s $MAINDIR/$i .
done
[ -d maps ] || mkdir maps
cd maps
for i in $MAINDIR/maps/*; do
      [ -h `basename $i` ] || ln -s $i .
done
cd ..

exec ./glest

GAE:
Code: [Select]
#!/bin/sh

# glestadv

MAINDIR=/usr/local/games/glest
DIR=$HOME/.glest
[ -d $DIR ] || mkdir $DIR
cd $DIR
#if [ -f glestadv.ini ]; then # I could NOT get this to work properly for GAE. Hence
#    # Update for Glest 3.2.1 # I just commented this out, which means that, if you
#    sed -i 's/\.lng//' glestadv.ini # happen to messup your language settings, this script
#    language=$(cat glestadv.ini | grep Lang | cut -d'=' -f2) # will not automatically fix it for you. You'll have to
#    [ -f $MAINDIR/data/lang/${language}.lng ] || \ # manually fix it yourself.
#        sed -i "s/${language}/english/" glestadv.ini
#else
#    cp $MAINDIR/glestadv.ini .
#fi # End of commented-out language-setting routine.
[ -h glestadv ] || ln -s $MAINDIR/glestadv .
[ -f servers.ini ] || cp $MAINDIR/servers.ini .
for i in data docs scenarios techs tilesets gae_scenarios ; do
      [ -h $i ] || ln -s $MAINDIR/$i .
done
[ -d maps ] || mkdir maps
cd maps
for i in $MAINDIR/maps/*; do
      [ -h `basename $i` ] || ln -s $i .
done
cd ..

exec ./glestadv

As you can see, I got some problems with automating the language settings for GAE. Hence I just commented that part out. If you can find a sollution, please post it (note: I did try and make a link english -> english.lng or english.lng.lng, also tried putting english.lng in the $HOME/.glest/glestadv.ini file instead of english. Either of these do solve the initial problem of glestadv crashing on startup; however, if you then go to the "Options" menu-item, GAE will crash with a somewhat similiar message as before).

Another issue regards the GAE Scenarios with Glest 3.2.2 - I could not get the Glest scenarios to work with it. For details, see this post.

assassin

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #10 on: 18 September 2009, 15:36:31 »
Thanks!
I wasn't so sure about some unix permissions to certain directories but I am now  ;)
I will update the guide shortly

jda

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #11 on: 19 September 2009, 18:45:29 »
You're welcome!

And BTW, I do think this topic should be stickied too!
I tried a couple of the stickies in the GAE section to install it and could get nowhere (at lest not fast!  :D ). This one was the one! ;)
And it should help to compile your own vanilla Glest too, of course...  ;D

assassin

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #12 on: 20 September 2009, 08:45:17 »
Yeah, no one check this part of the forum very much  :(
Do you know the dependencies for glest?

jda

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #13 on: 21 September 2009, 16:38:57 »
Did you try PMing this section's moderator?

For the dependencies, you can check the file mk/linux/config.log. All programs, libraries and headers glest needs to be built will have been checked and their results posted there. Assuming you successfully compiled it, that would mean all dependencies are listed in there - you'll have to parse some irrelevant output to get only what you want though...

As a general clue, the fact you have say package xorg (what you'll need in case configure tells you it couldn't find X) doesn't mean you'll have xorg-dev (which is what you actually need in order to build something that'll use X!).
So, if you know you have something that configure tells you you don't, chances are you are just missing the "dev" (development) package of it.  ;)

assassin

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #14 on: 22 September 2009, 06:18:52 »
Oh, thanks!
I will add dependencies when the next version of gae is out.

Do you know who this sections moderator is?

jda

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #15 on: 22 September 2009, 09:41:26 »
Just PMed you.  ;)

jda

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #16 on: 5 October 2009, 00:35:38 »
Thanks for the credit, assassin!  :-[

UPDATE 1: BTW, I just realised there was something not so great about one of my suggestions:
Code: [Select]
sudo mkdir /usr/local ; sudo chown $USER:$USER /usr/local ; mkdir /usr/local/games/glestwould avtually be better this way:
Code: [Select]
sudo mkdir /usr/local/games/glest ; sudo chown $USER:$USER /usr/local/games/glest(It's probably more system-wide secure and also doesn't go over this guide's reader's choices (or knowledge) regarding EVERYTHING in /usr/local (he/she may want to have other stuff besides glest/gae with different ownerships in there...)

UPDATE 2: Also, as you took that aproach, the scripts I gave you do not really increase the security of the system (they do work for automatically setting up the user-sepcific settings though)... But you can work around that by making /usr/local/games/glest owned by root again (after you've copied everything to it)... ;)
Code: [Select]
sudo chown root:root /usr/local/games/glestOf course, you will from now on need to use the sudo command and input you administrator password to add any data to your /usr/local/games/glest folder, but that's the proper way to do it anyways. ;) Though there is a more elegant alternative but it takes a little longer to setup...

UPDATE 3: Finally, the vanilla glest scenarios do not work out of the box with gae (details here).
The easy sollution is to setup the GAE specific gae_scenarios folder as follows:
Code: [Select]
sudo mkdir /usr/local/games/glest/gae_scenarios
sudo ln -s /usr/local/games/glest/scenarios /usr/local/games/glest/gae_scenarios/scenarios
NOTES:
* If the above is done before changing the ownership of /usr/local/games/glest back to root, you can omit the "sudo" commands.
* In-game, you will notice you have only one category of scenarios, called "All_scenarios". If you want to have your scenarios organized in different categories, just create one folder for each category you want inside folder gae_scenarios and move the scenarios you want for that category in there. E.g.:
Code: [Select]
sudo mkdir /usr/local/games/glest/gae_scenarios/megapack_v4
ln -s /usr/local/games/glest/scenarios/m4* /usr/local/games/glest/gae_scenarios/megapack_v4
(you will now have a new category containing only Titi's Megapack v4 scenarios. ;) )

assassin

  • Guest
Re: One stop guide to compiling glest and GAE
« Reply #17 on: 5 October 2009, 19:25:39 »
Cool, I'll update tomorrow.

 

anything