This howto was inspired by the howto HowTo:Ubuntu_8.10. Special thanks to the contributors to that howto, and to the Xastir developers. You will notice that this howto is similar to the previously mentioned howto, but I decided to create a new one rather than try to modify the existing one to fit Ubuntu 9.04 or 9.10 (even though there are only a few differences in the way Xastir is installed).
This howto gives instructions for building Xastir from CVS on Ubuntu 9.04 with all supported libraries enabled. It assumes the user already has a working installation of Ubuntu 9.04, either on a physical machine or a virtual machine. Installation of Ubuntu itself is not covered in this howto. Internet connectivity is also assumed. It is also applicable to Ubuntu 9.10 with very few modifications.
Note: the description below on what to do if you already installed the binary version is verbatim from the HowTo for Ubuntu 6.10 and 7.04. Although I expect it still applies, I have not tried installing the binary version in 9.04 and then removing it using this procedure.
If you installed a binary version of xastir using the "apt-get install xastir" option, 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:
sudo apt-get remove xastir
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:
sudo cp -r /tmp/maps/* /usr/local/share/xastir/maps
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.
I didn't have to do anything to the repository settings as the newer versions of Ubuntu already have the universe and multiverse repositories configured.
First, make sure you have a working Ubuntu 9.04 installation. Also check that you can access the Internet. As always, you should also make a complete backup of your system, just in case something goes horribly wrong.
I recommend updating your installed packages to the latest versions first. This can be done using APT:
sudo apt-get update sudo apt-get upgrade
If there was a kernel upgrade or something you may want to reboot your system before proceeding.
sudo apt-get install build-essential
sudo apt-get install cvs autoconf automake xorg-dev libmotif-dev imagemagick gv libxp-dev
These 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 imagemagick 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.
sudo apt-get install gpsman gpsmanshp libpcre3-dev libdb4.7-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev libmagickcore-dev
If you prefer GraphicsMagick to ImageMagick (many do), you can modify the two installation lines above:
sudo apt-get install cvs autoconf automake xorg-dev libmotif-dev graphicsmagick gv libxp-dev sudo apt-get install gpsman gpsmanshp libpcre3-dev libdb4.7-dev python-dev libax25-dev shapelib libshp-dev festival festival-dev libgraphicsmagick1-dev
This is an acceptable modification as long as you're not using other software that absolutely requires ImageMagick --- the two dev packages conflict unnecessarily, and therefore GraphicsMagick is not an option if you are using software other than Xastir that mandates ImageMagick.
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.
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:
Enter these commands in the text file:
cvs -z3 update -P -d status -v diff -u
Save and exit your text editor.
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:email@example.com:/cvsroot/xastir login cvs -d:pserver:firstname.lastname@example.org:/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.
cd xastir ./bootstrap.sh
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 Ubuntu 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. There are two solutions: use the "UbuntuGIS" unofficial PPA (Personal Package Archive) to get properly compiled versions, or build from source.
This is by far the easiest and fastest method to get the geotiff and proj libraries, if you trust the unofficial packages. They have been shown to work Just Fine, and are the recommended approach. Using these repositories will keep your installed packages managed by apt. Building from source instead will require you to maintain your proj and libgeotiff installs yourself.
To install the two required libraries from the alternate PPA, you need to add to your apt.sources file, install a key, and then install the packages.
sudo -i echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu jaunty main" >> /etc/apt/sources.list echo "deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu jaunty main" >> /etc/apt/sources.list apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 089EBE08314DF160 apt-get update apt-get install libproj-dev libgeotiff-dev exit
If you are building for a later version of Ubuntu than 9.04 (Jaunty), change the two "deb" lines to point at the appropriate version. On 9.10 that means you should issue
echo "deb http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu karmic main" >> /etc/apt/sources.list echo "deb-src http://ppa.launchpad.net/ubuntugis/ubuntugis-unstable/ubuntu karmic main" >> /etc/apt/sources.list
Only build these two packages from source if you really don't trust the unofficial UbuntuGIS PPA (there is no reason not to, as it is a set of GIS packages maintained by GIS users who keep on top of the problems, unlike the main repositories).
The Ubuntu 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.
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
tar zxvf proj-4.7.0.tar.gz cd proj-4.7.0/nad tar xzf ../../proj-datumgrid-1.4.tar.gz cd ..
./configure make sudo make install sudo ldconfig
As of this writing, the latest libgeotiff source can be downloaded like this:
tar zxvf libgeotiff-1.2.5.tar.gz cd libgeotiff-1.2.5/
./configure --with-ld-shared="gcc -shared" make sudo make install sudo ldconfig
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.
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
tar zxvf gdal-1.6.2.tar.gz cd gdal-1.6.2
./configure make sudo make install sudo ldconfig
Note: the GDAL 'make' step seems to take a while to complete
You've now got all the libraries in place and can build the fully enabled code.
cd ~/src/xastir mkdir build cd build ../configure
If you installed the libgeotiff and libproj packages from the UbuntuGIS PPA, then you will need to add a command line argument to 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.7 has been configured to use the following options and external libraries:
ShapeLib (Vector maps) ................. : yes
GraphicsMagick/ImageMagick (Raster maps) : yes (ImageMagick) 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
make sudo make install
If you intend to use Kernel AX.25 networking, you should also set the installed Xastir binary to be SUID root:
sudo chmod u+s /usr/local/bin/xastir
The first time Xastir is run it'll pop up a dialog box asking you to set some station parameters.
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 sudo make install && sudo chmod u+s /usr/local/bin/xastir
Or there is a script that will run the commands for you:
cd ~/src/xastir ./update-xastir
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.