From XastirWiki
Jump to: navigation, search

This howto gives instructions for building Xastir from CVS on either Mepis 8.0 or 8.5 with all supported libraries enabled. It assumes the user already has a working installation of Mepis 8.0 or 8.5. Internet connectivity is also assumed.

If you already installed the binary version

Note: the description below on what to do if you already installed the binary version is nearly verbatim from the HowTo for Ubuntu 6.10 and 7.04. Although I expect it will apply to Mepis 8, I have not tried installing the binary version in Mepis and then removing it using this procedure.

If you installed a binary version of xastir from the Mepis/Debian repositories, you'll have a somewhat outdated version, and it will have installed into /usr instead of /usr/local. The source install described on this page will install into /usr/local, so you'll want to remove your binary install first before following these directions.

If you did a lot of map configuration with the binary install, all of your maps will be in /usr/share/xastir/maps. You'll need to copy those to a safe place before removing the binary install:

 mkdir /tmp/maps
 cp -r /usr/share/xastir/maps/* /tmp/maps

Then remove the binary package:

 su
 (enter your root password when prompted)
 apt-get remove xastir
 exit

You can then follow the instructions below to re-install xastir to /usr/local from sources. Once you're done, copy your maps back to the new installation directory:

 su
 (enter your root password when prompted)
 cp -r /tmp/maps/* /usr/local/share/xastir/maps
 exit

Then you need to edit your ~/.xastir/config/xastir.cnf file to change all occurances of "/usr/share" to "/usr/local/share"

You'll be back in business with a more easily updated xastir.

Preparing the system

First, make sure you have a working Mepis 8.x installation. Also check that you can access the Internet. As always, you should also back up whatever is essential in your installation in case anything goes wrong.

I recommend updating your installed packages to the latest versions first. This can be done using APT:

 su
 (enter your root password when prompted)
 apt-get update

Optionally you can upgrade your existing software using the following command:

 apt-get upgrade

If there was a kernel upgrade or something you may want to reboot your system before proceeding.

Start installing packages

A shell script is available further down the page in this write-up that automates the entire process of syncing with repositories, fetching and installing libraries as well as installing Xastir itself. See the link below:

If you prefer a manual installation, which provides more options including the installation of a better version of proj.4, continue on here.

  • Get the basic set of build tools:
 apt-get install build-essential
  • Get the libraries essential for building xastir:
 apt-get install cvs autoconf automake xorg-dev libmotif-dev graphicsmagick gv libxp-dev libcurl4-openssl-dev
  

Note: On my system, graphicsmagick was already installed. Given there have been different updated iso images of Mepis 8 releases, I documented fetching the package here just in case it was not always installed by default.

The above packages are required for the most basic minimum build of xastir. gv is not strictly required, but if you don't install it you will be unable to print. Note that this graphiscsmagick package is not the one that gives you on-line map support, it's the one that provides the "convert" utility needed to create the postscript that gv will use to print. This package and gv are both required to be able to print from xastir even with minimal map support.

  • Get additional libraries that will help for extra features:
 apt-get install gpsman gpsmanshp libpcre3-dev libdb4.6-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev libgraphicsmagick1-dev

Note: after fetching the set of packages above, be sure to type exit at the terminal to exit out of root mode.

Get XASTIR source code From the "bleeding edge" CVS repository

In this method, you get your source code directly from the "repository" that the developers use to work on the software. See Notes:CVS for details. Here's the step-by-step method for getting it this way.

  • Prepare your .cvsrc if you don't have one
 ls -l ~/.cvsrc
 

If the ls command shows that you already have a .cvsrc file in your home directory, skip this next step.

Create a .cvsrc file in a text editor:

 nano ~/.cvsrc
 

Enter these commands in the text file:

 cvs -z3
 update -P -d
 status -v
 diff -u

Save and exit your text editor. In the Nano editor, that is CNTRL-O, then CTRL-X.

  • Get the source code per README.CVS or Notes:CVS:

You can make different choices here for where you want to store your code. I'm putting it in a src directory under my home directory:

 mkdir ~/src
 cd ~/src
 cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir login
 cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir co xastir

The "login" line will result in a prompt for a password. Simply hit "Enter" here, as there is no password.

The last command could take a while to finish if you're on a slow link, as there are a lot of files to download.

  • Run bootstrap to generate Makefile.am and configure:
 cd xastir
 ./bootstrap.sh

Build the fully-enabled xastir

To get a fully-functional version of xastir, you need to install a few more libraries. These are the proj.4 library and the geotiff library. The Debian repositories have them, but the version of proj.4 they have is broken --- it is improperly compiled without datum grid support. Because libgeotiff depends on proj, installing them both from the official repository is a problem.

Install proj.4

The Debian reposistories have a version of proj.4, but this version was not built correctly with the NAD27/NAD83 datum conversion grids. These grids are not needed for Xastir, but if you use proj.4 for any other GIS tools (including GDAL), you need to build proj.4 (and everything that depends on it) from source instead.

  • Download the proj.4 source

As of this writing, the latest proj.4 source can be downloaded like this:

 cd ~/src
 wget http://download.osgeo.org/proj/proj-4.7.0.tar.gz 
 wget http://download.osgeo.org/proj/proj-datumgrid-1.4.tar.gz
  • Unpack proj.4
 tar zxvf proj-4.7.0.tar.gz
 cd proj-4.7.0/nad
 tar xzf ../../proj-datumgrid-1.4.tar.gz
 cd ..
  • Build and install proj.4
 ./configure
 make
 su
 (enter root password when prompted)
 make install
 ldconfig
 exit

Install libgeotiff

  • Download the libgeotiff source

As of this writing, the latest libgeotiff source can be downloaded like this:

 cd ~/src
 wget http://download.osgeo.org/geotiff/libgeotiff/libgeotiff-1.2.5.tar.gz
  • Unpack libgeotiff
 tar zxvf libgeotiff-1.2.5.tar.gz
 cd libgeotiff-1.2.5/
  • Build and install libgeotiff
 ./configure --with-ld-shared="gcc -shared"
 make
 su
 (enter root password if prompted)
 make install
 ldconfig
 exit

Install GDAL

This is an entirely optional install, and is pretty much unnecessary. Very few users will ever have need of it, as Xastir's use of GDAL is limited to only a small handful of unusual map types. It is recommended that the casual user skip this step.

  • Download the GDAL source

As of this writing, the latest GDAL source can be downloaded like this:

 cd ~/src
 wget http://download.osgeo.org/gdal/gdal-1.6.2.tar.gz
  • Unpack GDAL
 tar zxvf gdal-1.6.2.tar.gz
 cd gdal-1.6.2
  • Build and install GDAL:
 ./configure
 make
 su
 (enter root password when prompted)
 make install
 ldconfig
 exit

Note: the GDAL 'make' step seems to take a while to complete

Install Xastir

You've now got all the libraries in place and can build the fully enabled code.

  • Configure the code:
 cd ~/src/xastir
 mkdir build
 cd build
 ../configure
    

You should be rewarded with a list of features that all say "yes" after them. If you followed all the steps above, that should look like this:

 xastir 1.9.9 has been configured to use the following
 options and external libraries:
MINIMUM OPTIONS:
  ShapeLib (Vector maps) ................. : yes
RECOMMENDED OPTIONS:
  GraphicsMagick/ImageMagick (Raster maps) : yes (GraphicsMagick)
  pcre (Shapefile customization) ......... : yes
  dbfawk (Shapefile customization) ....... : yes
  rtree indexing (Shapefile speedups) .... : yes
  map caching (Raster map speedups) ...... : yes
  internet map retrieval ................. : yes (wget)
FOR THE ADVENTUROUS:
  AX25 (Linux Kernel I/O Drivers) ........ : yes
  libproj (USGS Topos & Aerial Photos) ... : yes
  GeoTiff (USGS Topos & Aerial Photos) ... : yes
  Festival (Text-to-speech) .............. : yes
  GDAL/OGR (Obtuse map formats) .......... : yes
  GPSMan/gpsmanshp (GPS downloads) ....... : yes


  • Build the code:
 make 
 su
 (enter root password if prompted)
 make install
 exit

If you intend to use Kernel AX.25 networking, you should also set the installed Xastir binary to be SUID root:

 su
 (enter root password if prompted)
 chmod u+s /usr/local/bin/xastir
 exit
  • Enjoy! You now have a fully functional xastir with all features enabled. You can launch it like this:
 xastir

The first time Xastir is run it'll pop up a dialog box asking you to set some station parameters.

Shell Script

The shell script below will automatically fetch and install Xastir and all of its dependencies for you. It installs everything except GDAL.

There are a few compromises associated with using the shell script. In order to simplify the installation, the script installs proj and geotiff from the repositories instead of from source. (The manual procedure above installs from source.) The version of proj in the Debian repository has a known issue with the way it was built, which does not affect Xastir but could affect other programs that use proj. In a nutshell, the script takes a few shortcuts in order to speed things up for the impatient.

Copy/paste the script text below into a new file named install-xastir.sh and save it. At the command line in the same directory where you saved it, enter the following command:

 chmod +x install-xastir.sh

Then execute the script with

 ./install-xastir.sh

The shell script text is immediately below

#!/bin/bash
# Build script for Xastir from CVS for Mepis 8.x
# September 29, 2010

if ! grep -q "MEPIS 8" /etc/lsb-release; then
  echo "This script applies only to MEPIS 8.x."
  exit 1
fi

# check if user is in root mode and abort if yes
if [ "`whoami`" = "root" ]
then
  echo -e "\nPlease do not run script as root."
  exit 1
fi

# refresh repositories and grab Xastir dependencies
echo -e "\nEnter your root password when prompted...\n"
su -c "apt-get -y install build-essential automake cvs \
 xorg-dev libmotif-dev graphicsmagick gv libxp-dev shapelib \
 gpsman gpsmanshp libpcre3-dev proj libshp-dev libdb4.6-dev \
 python-dev libax25-dev libgraphicsmagick1-dev libcurl4-openssl-dev \
 festival festival-dev libgeotiff-dev || exit 1"

# create a .cvsrc if one does not exist.
[ -f ~/.cvsrc ] || echo -e "cvs -z3\nupdate -P -d\nstatus -v\ndiff -u" > ~/.cvsrc

# create directories for source code, etc.
mkdir -p ~/src ; cd ~/src || exit 1

# retrieve Xastir from CVS
echo -e "\nHit <ENTER> when prompted for a password...\n"
cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir login
cvs -d:pserver:anonymous@xastir.cvs.sourceforge.net:/cvsroot/xastir co xastir || exit 1

# execute the bootstrap shell script
cd xastir
./bootstrap.sh

# create a build directory and configure
mkdir build; cd build || exit 1
../configure CPPFLAGS="-I/usr/include/geotiff" || exit 1

# compile and install
make || exit 1
echo -e "\nEnter your root password when prompted...\n"
su -c "make install"

Once the shell script has finished, simply type "xastir" in the command line in the terminal to start it up.

Additional points

Updating Xastir

The developers are always adding new features to Xastir and fixing bugs. You'll likely want to update your Xastir semi-regularly. Fortunately for you, you don't have to repeat all of the above steps each time. Updating is actually very simple:

 cd ~/src/xastir
 cvs update
 /bootstrap.sh
 cd build
 ../configure
 make
 su
 (enter root password if prompted)
 make install && sudo chmod u+s /usr/local/bin/xastir
 exit

Note: if you used the shell script to install Xastir, the configure line above needs to be entered as follows:

 ../configure CPPFLAGS="-I/usr/include/geotiff"

Festival

You have to start the festival server by hand in a shell window before starting xastir.

 festival --server &

Clicking File->Configure->Speech in xastir, I could get it to talk just by clicking the "Test" button in the dialog.