Building TerraGear in Ubuntu 910 (32- or 64-bit): Difference between revisions

From FlightGear wiki
Jump to navigation Jump to search
({{Terra}})
No edit summary
Line 21: Line 21:
         * wget [[http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz]]
         * wget [[http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz]]
         * wget [[http://www.robertnz.net/ftp/newmat11.tar.gz http://www.robertnz.net/ftp/newmat11.tar.gz]]
         * wget [[http://www.robertnz.net/ftp/newmat11.tar.gz http://www.robertnz.net/ftp/newmat11.tar.gz]]
         * wget [[http://www.naadsm.org/opensource/gpc/gpc-2.32.zip http://www.naadsm.org/opensource/gpc/gpc-2.32.zip]]
         * wget [[ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip]]


6.Simultaneously, openning another terminals sessions, we could download the source code of '''simgear''' and '''terragear-cs''':
6.Simultaneously, openning another terminals sessions, we could download the source code of '''simgear''' and '''terragear-cs''':
Line 175: Line 175:
         * wget [[http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz]]
         * wget [[http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz http://plib.sourceforge.net/dist/plib-1.8.5.tar.gz]]
         * wget [[http://www.robertnz.net/ftp/newmat11.tar.gz http://www.robertnz.net/ftp/newmat11.tar.gz]]
         * wget [[http://www.robertnz.net/ftp/newmat11.tar.gz http://www.robertnz.net/ftp/newmat11.tar.gz]]
         * wget [[http://www.naadsm.org/opensource/gpc/gpc-2.32.zip http://www.naadsm.org/opensource/gpc/gpc-2.32.zip]]
         * wget [[ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip ftp://ftp.cs.man.ac.uk/pub/toby/gpc/gpc232.zip]]


6.En simultáneo y abriendo otras sesiones de terminal se puede ir descargando el código de '''simgear''' y '''terragear-cs''':
6.En simultáneo y abriendo otras sesiones de terminal se puede ir descargando el código de '''simgear''' y '''terragear-cs''':

Revision as of 20:18, 8 October 2008

English - Inglés

Basic Install


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

2.Configure very well your video graphics card. I recommend NVIDIA or ATI chipsets (the tests was performed with NVIDIA).

   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 de 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 de 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, openning 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 de 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
   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


Español - Spanish

Instalación básica


1.Empezar con una instalación limpia de Ubuntu Hardy 64-bits (también funciona en 32 bits).

2.Configurar correctamente la tarjeta de video, es altamente recomendable que sea una NVIDIA o ATI. (Las pruebas se han hecho sobre la primera, es decir NVIDIA).

   a) Instalar envyng para obtener el último driver de video y sus respectivas dependencias:	
       * sudo apt-get install envyng-gtk
   b) En caso de presentarse problemas con la resolución (usualmente se nos puede presentar una de 640*480), se debe corregir la resolución del monitor.
      Para esto, abrir un terminal y escribir:
       * sudo displayconfig-gtk

3.Instalar los paquetes básicos para acceso cvs y de desarrollo:

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

4.Ubicar algún directorio donde procederemos a realizar la compilación de todas las aplicaciones y la descarga de las fuentes respectivas

 (Este es un procedimiento de orden más que necesario).

5.Descargar los paquetes en el directorio creado (ejemplo: 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.En simultáneo y abriendo otras sesiones de terminal se puede ir descargando el código de simgear y terragear-cs:

       * cvs -d :pserver:cvsguest@cvs.simgear.org:/var/cvs/SimGear-0.3 login
   (clave: 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.Antes de proceder a compilar los paquetes principales debemos entender que el terragear depende del simgear y este a su vez tiene varias dependencias que satisfacer.

 La más complicada es plib que requiere de diversos paquetes y -posiblemente- una modificación en su archivo configure.
       * sudo apt-get install xlibmesa-gl-dev freeglut3-dev glutg3-dev libglut3-dev xorg-dev
   a) Descomprimir el archivo plib y dirigirse al sub-directorio creado.
   b) Opcionalmente: En la linea 6749 del archivo configure debemos quitar el -lXi, cuidando los espacios del caso.
   c) Proceder a la compilación del caso con:
       * ./configure && make
   d) Para instalar la libreria no olvidar que se necesita permisos de administrador:
       * sudo make install

8.Como paso previo a compilar simgear no debemos olvidar instalar los siguientes paquetes:

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

9.Nos vamos al directorio donde hemos descargado simgear y ahora lo compilaremos, no sin antes saber que cuando uno emplea un cvs para descargar el código fuente

 se debe generar el archivo configure y esto se hace con:
       * ./autogen.sh
   El archivo configure está creado ahora.
       * ./configure && make
       * sudo make install

10.Para continuar debemos cumplir con 2 dependencias: gpc y newmat. Debemos descomprimir ambos paquetes y dentro de cada directorio:

   a) GPC:
       - Crearemos un Makefile según el archivo README.gpc incluido dentro del directorio terragear-cs. Puedes también copiar y pegar las líneas siguientes:
                       # 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
       - Modificaremos el archivo gpc.h, buscando y cambiando el valor de DBL_EPSILON por 0.000001
   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.Finalmente, y antes de proceder con la compilación en sí del terragear-cs, debemos instalar algunos paquetes adicionales con:

       * sudo apt-get install libwxgtk2.8-dev libcurl4-openssl-dev
   Para luego, dentro de su directorio:
       * ./autogen.sh
       * ./configure && make
       * sudo make install

12.Listo, ya podemos hacer uso de terragear.


Pasos opcionales


13.Si queremos emplear el comando photo y de esta manera poder insertar imágenes en nuestra escena, entonces necesitaremos el comando chop.pl:

       * sudo gedit /usr/local/bin/chop.pl:
   Copiar el código siguiente:
               #!/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);
                   }
               }
   Guardar el archivo.
   Instalar unas últimas 2 dependencias que permiten manipular en sí las imágenes:
       * sudo apt-get install imagemagick netpbm

14. Instalar QGIS para mejorar nuestro escenario.

       * sudo gedit /etc/apt/source.list
   Agregar al final:
               deb http://ppa.launchpad.net/qgis/ubuntu hardy main
   Luego no olvidar de:
       * sudo apt-get update
       * sudo apt-get install qgis qgis-plugin-grass


problems? suggestions? ideas? please send me a mail to: alfonsodg@gmail.com