Building terragear-cs in Ubuntu 64

From wiki.flightgear.org

Jump to: navigation, search

Basic Install

1. Start with a clean (new) installation of Ubuntu 64 bits (works also in 32 bits).

2. Make sure your video/graphics card is very well configured. I recommend NVidia or ATI chipsets (though NVidia is more thoroughly tested).
a) Install enving to obtain the latest drivers and their dependencies.

       * sudo apt-get install envyng-gtk

b) In case of problem with the resolution (usually a bad one with 640*480), we must fix it. We can do it with:

       * sudo displayconfig-gtk

3.Install the basic packages for CVS access and development:

       * sudo apt-get install cvs git-core curl automake g++ gcc

4.Make a directory where download and install the proper packages (Order procedure, suggested but not required).

5.Download the files inside the new created directory (ex: Scenery_Creator): plib 1.8.5,newmat 11,gpc 2.32:

       * wget [http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz]
       * wget [http://www.robertnz.net/ftp/newmat11.tar.gz]
       * wget [ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip]

6.Simultaneously, opening another terminals sessions, we could download the source code of simgear and terragear-cs:

       * cvs -d :pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3 login
   (password: guest)
       * cvs -d :pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3 co source
       * git clone http://mapserver.flightgear.org/git/terragear-cs/

7.Before proceed to compile the main packages, we must understand that terragear depends from simgear, and this last one has many dependencies to satisfy.

 The most complicated is plib which has many dependencies and -possibly- a configure file modification.
       * sudo apt-get install xlibmesa-gl-dev freeglut3-dev glutg3-dev libglut3-dev xorg-dev
   a) Uncompress the file plib and goto to their directory.
   b) Optionally: In the line 6749 we could find and remove the -lXi expression, carefull with the spaces.
   c) Proceed with the compilation:
       * ./configure && make
   d) The library installation requires -always- from super-user permissions:
       * sudo make install

8.As previous step to compile simgear, don't forget install the next packages:

       * sudo apt-get install libopenal-dev libalut-dev openscenegraph zlib1g-dev libopenscenegraph-dev

9.Goto to the directory simgear to start the compilation. Remember that when we download source code with a cvs software as git or svn we need to

 generate the configure file:
       * ./autogen.sh
   The configure file is now created.
       * ./configure && make
       * sudo make install

10.To follow, we must satisfy 2 more dependencies: gpc and newmat. Unpackage those files and inside each directory:

   a) GPC:
       - Copy and paste the next lines and create the Makefile file:
                       # Unix/Linux makefile for GPC 2.32
                       #
                       # Riley Rainey  (riley.rainey@websimulations.com)
                       CFLAGS = -O -g
                       libgenpolyclip.a: gpc.o
                               rm -f $@
                               ar cr $@ $<
                               ranlib $@
                       clean:
                               rm -f libgenpolyclip.a *.o core *~
                       install: libgenpolyclip.a
                               -mkdir -p /usr/local/lib
                               -mkdir -p /usr/local/include
                               install libgenpolyclip.a /usr/local/lib/libgenpolyclip.a
                               install gpc.h /usr/local/include/gpc.h
       - Modify the file gpc.h, searching and changing the value of DBL_EPSILON for 0.000001
       - And -obviously- make and sudo make install.... Done!!!
   b) NEWMAT:
       * make -f nm_gnu.mak
       * sudo cp libnewmat.a /usr/local/lib
       * sudo mkdir /usr/local/include/newmat
       * sudo cp *.h /usr/local/include/newmat
               

11.Finally and before proceed with the compilation of terragear-cs, we must satisfy some additional libraries:

       * sudo apt-get install libwxgtk2.8-dev libcurl4-openssl-dev
   After that, inside of the directory:
       * ./autogen.sh
       * ./configure && make
       * sudo make install

12.Done, we are ready to use terragear.


Optional steps

13.If we wish use the photo command and insert images inside our scenery, we need the chop.pl command:

       * sudo gedit /usr/local/bin/chop.pl:
   Copy and paste the follow code:
               #!/usr/bin/perl
               die "Usage: $0 file xdiv ydiv res\n" if ( $#ARGV != 3 );
                   
               $file = shift @ARGV;
               $xdiv = shift @ARGV;
               $ydiv = shift @ARGV;
               $res = shift @ARGV;
               die "Must start with a .png file\n" if ( $file !~ m/\.png$/ );
               # extract image dimensions
               $info = `file $file`;
               $info =~ s/,//g;
               ($junk, $type, $junk, $junk, $width, $junk, $height, $junk)
                   = split(/\s+/, $info, 8);
               print "$width - $height\n";
               $basename = $file;
               $basename =~ s/\.png$//;
               # convert source image to pnm
               `pngtopnm $basename.png > $basename.pnm`;
               $dx = $width / $xdiv;
               $dy = $height / $ydiv;
               for ( $j = 0; $j < $ydiv; $j++ ) {
                   for ( $i = 0; $i < $xdiv; $i++ ) {
                       print "Paso $i $j\n";
                       $x = $dx * $i;
                       $y = $height - $dy * ($j + 1);
                       $outputpnm = sprintf("$basename%X%X.pnm", $i, $j);
                       $outputsgi = sprintf("$basename%X%X.sgi", $i, $j);
                       $outputrgb = sprintf("$basename%X%X.rgb", $i, $j);
                	printf "Diviendo archivos...\n";
                       printf "pnmcut $x $y $dx $dy $basename.pnm | pnmscale -xysize $res $res > $outputpnm\n";
                       `pnmcut $x $y $dx $dy $basename.pnm | pnmscale -xsize $res -ysize $res > $outputpnm`;
                       printf "Convirtiendo archivos...\n";
                       `convert $outputpnm $outputsgi`;
                       printf "Renombrando archivos...\n";
                       rename($outputsgi, $outputrgb);
                       unlink($outputpnm);
                   }
               }
   Save the file.
   Install those additional packages which allows image manipulation:
       * sudo apt-get install imagemagick netpbm

14. Install QGIS for scenery edit.

       * sudo gedit /etc/apt/source.list
   Add to the bottom:
               deb http://ppa.launchpad.net/qgis/ubuntu hardy main
   Don't forget:
       * sudo apt-get update
       * sudo apt-get install qgis qgis-plugin-grass


{{{img_left}}} TerraGear {{{img_right}}} {{{img_large}}}

TerraGearBuilding TerragearBuilding terragear-cs in Ubuntu 64
Using TerragearUsing the Custom Scenery TerraGear ToolsetBTG File FormatTile Index SchemeGeographic Coordinate Systems


Personal tools