Compiling PostGIS 2.0 on Mint 12 (ubuntu oneric)

Compiling PostGIS 2.0 on a fresh Mint12 install has been a little tricky mostly because of the geos version dependencies (>3.3.2). Initially, I thought I could use the ubuntu gdal package and a source compiled geos. However make check for postgis failed in the raster segment on a bunch of geos calls from gdal. Thus I devised to package the unstable geos (3.3.2) so that aptitude could build gdal against it. I was able to package and install the unstable geos but this didn’t solve the problem as the aptitude version of gdal is fixed to geos 3.2.3.

Sooooo. This was going to be a triumphant post about compiling postgis 2 but it has turned out to be a little less grandiose: How to package up a development version of geos (or any other development version of a package designed to be compiled from source) and install it via the package management system. BORING. Useful to know though. I relied heavily on IntroToDebianPackaging for conceptual guidance, though it uses a different package creation tool.

To create the .deb package I used dpkg-buildpackage but had to create a /debian directory and a few files. dpkg-buildpackage needs a directory called debian:
geos-3.3.2/debian/

First got the geos development package and unpacked using:
$ tar -jxvz geos-3.3.2.tar.bz2

Created a debian directory in it using guidelines from DebianWiki in the new
geos-3.3.2 source directory:
$ mkdir geos-3.3.2/debian

Then grabbed the ubuntu .deb package using:
$ aptitude download geos-3.2.2

Copied DEBIAN/control from the ubuntu package and modified it accordingly. Also copied copyright from the downloaded deb. and added changelog, rules, and compat to geos-3.3.2/debian/ per DebianPackagingWiki.

The key here was to use the same name when running:
# dch --create -v 1.0-1 --package libgeos

As is in the “Package” field in the control file.

After the above command you can cd to the root of the package and run dpkg-buildpackage which will create a .debi file in the parent directory which can be installed using dpkg -i .

Hope it works for ya!!

This entry was posted in Geospatial and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *