--- mapnik-0.5.1.orig/bindings/python/SConscript
+++ mapnik-0.5.1/bindings/python/SConscript
@@ -28,7 +28,7 @@
 prefix = env['PYTHON_PREFIX'] + '/' + env['LIBDIR_SCHEMA'] + '/python' + env['PYTHON_VERSION'] + '/site-packages/'
 install_prefix = env['DESTDIR'] + '/' + prefix
 
-thread_suffix = '-mt'
+thread_suffix = '-mt-1_33_1'
 
 if env['PLATFORM'] == 'FreeBSD':
     thread_suffix = ''
@@ -58,11 +58,11 @@
 paths = """
 mapniklibpath = '%s'
 inputpluginspath = mapniklibpath + '/input'
-fontscollectionpath = mapniklibpath + '/fonts'
+fontscollectionpath = '/usr/share/fonts/truetype/ttf-dejavu'
 """
 
 exp =  r"%s{2,}" % os.sep
-mapnik_plugins_dir  = re.sub(exp,os.sep, env['PREFIX'] + '/'+env['LIBDIR_SCHEMA']+'/mapnik')
+mapnik_plugins_dir  = re.sub(exp,os.sep, env['PREFIX'] + '/'+env['LIBDIR_SCHEMA']+'/mapnik/0.5')
 file('mapnik/paths.py','w').write(paths % (mapnik_plugins_dir,))
 
 pymapnik = glob.glob('mapnik/*.py')
--- mapnik-0.5.1.orig/demo/c++/rundemo.cpp
+++ mapnik-0.5.1/demo/c++/rundemo.cpp
@@ -40,16 +40,16 @@
 {    
     if (argc != 2)
     {
-        std::cout << "usage: ./rundemo <mapnik_install_dir>\n";
+        std::cout << "usage: ./rundemo <mapnik_plugin_dir>\n";
         return EXIT_SUCCESS;
     }
     
     using namespace mapnik;
     try {
         std::cout << " running demo ... \n";
-        std::string mapnik_dir(argv[1]);
-        datasource_cache::instance()->register_datasources(mapnik_dir + "/lib/mapnik/input/"); 
-        freetype_engine::register_font(mapnik_dir + "/lib/mapnik/fonts/DejaVuSans.ttf");
+        std::string mapnik_plugin_dir(argv[1]);
+        datasource_cache::instance()->register_datasources(mapnik_plugin_dir); 
+        freetype_engine::register_font("/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf");
         
         Map m(800,600);
         m.set_background(color_factory::from_string("white"));
--- mapnik-0.5.1.orig/demo/c++/readme.txt
+++ mapnik-0.5.1/demo/c++/readme.txt
@@ -2,8 +2,9 @@
 
 To build (using GCC/G++ toolkit):
 
-g++ -O3 -I/usr/local/include/mapnik -I/opt/boost/include/boost-1_33_1 -I/usr/include/freetype2 -I../../agg/include -L/usr/local/lib -lmapnik rundemo.cpp -o rundemo
+g++ -O3 -I/usr/include/freetype2 -I/usr/include/agg2 -lmapnik rundemo.cpp -o rundemo
 
+(You will need to have libagg-dev installed for this to work).
 
 To run:
 
@@ -12,4 +13,4 @@
 For more detailed comments have a look in demo/python/rundemo.py
 
 Have fun!
-Artem.
+Artem (and Dominic for the Debian package)
--- mapnik-0.5.1.orig/demo/README
+++ mapnik-0.5.1/demo/README
@@ -0,0 +1,4 @@
+To use the files contained within, you need to copy the directory to
+somewhere you can write to, then gunzip */*.gz.
+
+-- Dominic Hargreaves, for the Debian package.
--- mapnik-0.5.1.orig/utils/shapeindex/SConscript
+++ mapnik-0.5.1/utils/shapeindex/SConscript
@@ -26,7 +26,7 @@
 prefix = env['PREFIX']
 install_prefix = env['DESTDIR'] + '/' + prefix
 
-thread_suffix = '-mt'
+thread_suffix = '-mt-1_33_1'
 
 if env['PLATFORM'] == 'FreeBSD':
     thread_suffix = ''
--- mapnik-0.5.1.orig/debian/libmapnik-dev.examples
+++ mapnik-0.5.1/debian/libmapnik-dev.examples
@@ -0,0 +1 @@
+demo/*
--- mapnik-0.5.1.orig/debian/libmapnik-dev.install
+++ mapnik-0.5.1/debian/libmapnik-dev.install
@@ -0,0 +1,3 @@
+usr/include/*
+usr/lib/*.so
+usr/bin/mapnik-plugin-base
--- mapnik-0.5.1.orig/debian/compat
+++ mapnik-0.5.1/debian/compat
@@ -0,0 +1 @@
+5
--- mapnik-0.5.1.orig/debian/python-mapnik.install
+++ mapnik-0.5.1/debian/python-mapnik.install
@@ -0,0 +1,2 @@
+usr/lib/python*/site-packages/mapnik/*
+usr/lib/python*/site-packages/mapnik/*/*
--- mapnik-0.5.1.orig/debian/mapnik-utils.install
+++ mapnik-0.5.1/debian/mapnik-utils.install
@@ -0,0 +1 @@
+usr/bin/shapeindex
--- mapnik-0.5.1.orig/debian/watch
+++ mapnik-0.5.1/debian/watch
@@ -0,0 +1,4 @@
+version=3
+opts=downloadurlmangle=s/prdownload/download/ \
+http://developer.berlios.de/project/showfiles.php?group_id=3133 \
+http://prdownload.berlios.de/mapnik/mapnik_src-(.*).tar.gz
--- mapnik-0.5.1.orig/debian/libmapnik0.5.install
+++ mapnik-0.5.1/debian/libmapnik0.5.install
@@ -0,0 +1,2 @@
+usr/lib/lib*.so.*
+usr/lib/mapnik/*/input/*
--- mapnik-0.5.1.orig/debian/mapnik-utils.manpages
+++ mapnik-0.5.1/debian/mapnik-utils.manpages
@@ -0,0 +1 @@
+debian/shapeindex.1
--- mapnik-0.5.1.orig/debian/libmapnik-dev.docs
+++ mapnik-0.5.1/debian/libmapnik-dev.docs
@@ -0,0 +1 @@
+docs/epydocs
--- mapnik-0.5.1.orig/debian/mapnik-plugin-base.1
+++ mapnik-0.5.1/debian/mapnik-plugin-base.1
@@ -0,0 +1,35 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH MAPNIK-PLUGIN-BASE 1 "February 6, 2008"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+mapnik-plugin-base \- determine path to Mapnik plugins
+.SH SYNOPSIS
+.B mapnik-plugin-base
+.SH DESCRIPTION
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" respectively.
+\fBmapnik-plugin-base\fP outputs the directory containing Mapnik plugins
+relevant to the version of Mapnik being targetted.
+.SH OPTIONS
+There are no options.
+.SH AUTHOR
+mapnik-plugin-path was written by Dominic Hargreaves.
+.PP
+This manual page was written by Dominic Hargreaves <dom@earth.li>,
+for the Debian project (but may be used by others).
--- mapnik-0.5.1.orig/debian/copyright
+++ mapnik-0.5.1/debian/copyright
@@ -0,0 +1,194 @@
+This package was debianized by Dominic Hargreaves <dom@earth.li> on
+Tue, 12 Dec 2006 20:32:12 +0000.
+
+It was downloaded from http://www.mapnik.org/ and
+svn://svn.mapnik.org/trunk
+
+Upstream Author: Artem Pavlenko, Jean-Francois Doyon
+
+Copyright: 2006-2008 Artem Pavlenko, Jean-Francois Doyon
+
+License:
+
+    This package is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This package is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this package; if not, write to the Free Software
+    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+
+On Debian systems, the complete text of the GNU Lesser General
+Public License can be found in `/usr/share/common-licenses/LGPL'.
+
+The Debian packaging is (C) 2006-2008, Dominic Hargreaves <dom@earth.li> and
+is licensed under the GPL, see `/usr/share/common-licenses/GPL'.
+
+The following included software is licensed separately:
+
+agg/
+----
+
+Copyright (C) 2002-2005 Maxim Shemanarev (McSeem) 
+
+Permission to copy, use, modify, sell and distribute this software
+is granted provided this copyright notice appears in all copies.
+This software is provided "as is" without express or implied
+warranty, and with no claim as to its suitability for any purpose.
+
+scons/
+------
+
+Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007 The SCons Foundation
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
+WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+fonts/dejavu-ttf-2.14/
+------------------------------
+
+Fonts are (c) Bitstream (see below). DejaVu changes are in public domain.
+Glyphs imported from Arev fonts are (c) Tavmjung Bah (see below)
+
+
+Copyright (c) 2003 by Bitstream, Inc. All Rights Reserved. Bitstream
+Vera is a trademark of Bitstream, Inc.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and associated
+documentation files (the "Font Software"), to reproduce and distribute
+the Font Software, including without limitation the rights to use,
+copy, merge, publish, distribute, and/or sell copies of the Font
+Software, and to permit persons to whom the Font Software is furnished
+to do so, subject to the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Bitstream" or the word "Vera".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Bitstream Vera" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+BITSTREAM OR THE GNOME FOUNDATION BE LIABLE FOR ANY CLAIM, DAMAGES OR
+OTHER LIABILITY, INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL,
+OR CONSEQUENTIAL DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF THE USE OR INABILITY TO USE THE FONT
+SOFTWARE OR FROM OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the names of Gnome, the Gnome
+Foundation, and Bitstream Inc., shall not be used in advertising or
+otherwise to promote the sale, use or other dealings in this Font
+Software without prior written authorization from the Gnome Foundation
+or Bitstream Inc., respectively. For further information, contact:
+fonts at gnome dot org.
+
+Arev Fonts Copyright
+------------------------------
+
+Copyright (c) 2006 by Tavmjong Bah. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of the fonts accompanying this license ("Fonts") and
+associated documentation files (the "Font Software"), to reproduce
+and distribute the modifications to the Bitstream Vera Font Software,
+including without limitation the rights to use, copy, merge, publish,
+distribute, and/or sell copies of the Font Software, and to permit
+persons to whom the Font Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright and trademark notices and this permission notice
+shall be included in all copies of one or more of the Font Software
+typefaces.
+
+The Font Software may be modified, altered, or added to, and in
+particular the designs of glyphs or characters in the Fonts may be
+modified and additional glyphs or characters may be added to the
+Fonts, only if the fonts are renamed to names not containing either
+the words "Tavmjong Bah" or the word "Arev".
+
+This License becomes null and void to the extent applicable to Fonts
+or Font Software that has been modified and is distributed under the
+"Tavmjong Bah Arev" names.
+
+The Font Software may be sold as part of a larger software package but
+no copy of one or more of the Font Software typefaces may be sold by
+itself.
+
+THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
+OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL
+TAVMJONG BAH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
+DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
+OTHER DEALINGS IN THE FONT SOFTWARE.
+
+Except as contained in this notice, the name of Tavmjong Bah shall not
+be used in advertising or otherwise to promote the sale, use or other
+dealings in this Font Software without prior written authorization
+from Tavmjong Bah. For further information, contact: tavmjong @ free
+. fr.
+
+
+tinyxml/
+--------
+
+Original code (2.0 and earlier) copyright (c) 2000-2006 Lee Thomason
+(www.grinninglizard.com)
+
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
+damages arising from the use of this software.
+
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
+redistribute it freely, subject to the following restrictions:
+
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
+would be appreciated but is not required.
+
+2. Altered source versions must be plainly marked as such, and
+must not be misrepresented as being the original software.
+
+3. This notice may not be removed or altered from any source
+distribution.
--- mapnik-0.5.1.orig/debian/control
+++ mapnik-0.5.1/debian/control
@@ -0,0 +1,98 @@
+Source: mapnik
+Priority: optional
+Maintainer: Dominic Hargreaves <dom@earth.li>
+Build-Depends: libboost-thread-dev, libboost-filesystem-dev, libboost-regex-dev, libboost-program-options-dev, libboost-python-dev, libpng12-dev, libjpeg62-dev, libtiff4-dev, zlib1g-dev, libfreetype6-dev, libpq-dev, proj, libltdl3-dev, libfribidi-dev, python, debhelper (>= 5.0.38), python2.4-dev, python-central (>= 0.5.6), libgdal1-dev, libxml2-dev, libagg-dev, libboost-iostreams-dev
+Standards-Version: 3.7.3
+Section: libs
+XS-Python-Version: 2.4
+
+Package: libmapnik0.5
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ttf-dejavu
+Suggests: postgis
+Description: C++/Python toolkit for developing GIS applications (libraries)
+ Mapnik is an OpenSource C++/Python toolkit for developing GIS
+ (Geographic Information Systems) applications. At the core is a C++
+ shared library providing algorithms/patterns for spatial data access and
+ visualization.
+ .
+ Essentially a collection of geographic objects (map, layer, datasource,
+ feature, geometry), the library doesn't rely on "windowing systems" and
+ is intended to work in multi-threaded environments
+ .
+ High-level Python bindings (boost.python) facilitate rapid application
+ development, targeting zope3, django, etc.
+ .
+ This package contains the shared library and input plugins.
+
+Package: mapnik-plugins
+Section: libs
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, libmapnik0.5
+Description: C++/Python toolkit for developing GIS applications (transitional)
+ This is a transitional package; plugins are now shipped in the main
+ library package.
+
+Package: libmapnik-dev
+Section: libdevel
+Architecture: all
+Depends: libmapnik0.5 (>= ${source:Version}), libmapnik0.5 (<< ${source:Version}.1~), libboost-thread-dev, libboost-filesystem-dev, libboost-regex-dev, libboost-program-options-dev, libboost-python-dev, libpng12-dev, libjpeg62-dev, libtiff4-dev, zlib1g-dev, libfreetype6-dev, libpq-dev, proj, libltdl3-dev, libfribidi-dev, libc6-dev | libc-dev
+Description: C++/Python toolkit for developing GIS applications (devel)
+ Mapnik is an OpenSource C++/Python toolkit for developing GIS
+ (Geographic Information Systems) applications. At the core is a C++
+ shared library providing algorithms/patterns for spatial data access and
+ visualization.
+ .
+ Essentially a collection of geographic objects (map, layer, datasource,
+ feature, geometry), the library doesn't rely on "windowing systems" and
+ is intended to work in multi-threaded environments
+ .
+ High-level Python bindings (boost.python) facilitate rapid application
+ development, targeting zope3, django, etc.
+ .
+ This package contains the development headers, API documentation, and
+ build utilities.
+
+Package: mapnik-utils
+Section: utils
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Description: C++/Python toolkit for developing GIS applications (utilities)
+ Mapnik is an OpenSource C++/Python toolkit for developing GIS
+ (Geographic Information Systems) applications. At the core is a C++
+ shared library providing algorithms/patterns for spatial data access and
+ visualization.
+ .
+ Essentially a collection of geographic objects (map, layer, datasource,
+ feature, geometry), the library doesn't rely on "windowing systems" and
+ is intended to work in multi-threaded environments
+ .
+ High-level Python bindings (boost.python) facilitate rapid application
+ development, targeting zope3, django, etc.
+ .
+ This package contains miscellaneous utilities distributed with mapnik:
+ .
+ - shapeindex:
+   program to creates file system based index for ESRI shape-files
+
+Package: python-mapnik
+Section: python
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, ${python:Depends}, mapnik-plugins
+Provides: ${python:Provides}
+XB-Python-Version: ${python:Versions}
+Description: C++/Python toolkit for developing GIS applications (Python)
+ Mapnik is an OpenSource C++/Python toolkit for developing GIS
+ (Geographic Information Systems) applications. At the core is a C++
+ shared library providing algorithms/patterns for spatial data access and
+ visualization.
+ .
+ Essentially a collection of geographic objects (map, layer, datasource,
+ feature, geometry), the library doesn't rely on "windowing systems" and
+ is intended to work in multi-threaded environments
+ .
+ High-level Python bindings (boost.python) facilitate rapid application
+ development, targeting zope3, django, etc.
+ .
+ This package contains the Python bindings.
--- mapnik-0.5.1.orig/debian/docs
+++ mapnik-0.5.1/debian/docs
@@ -0,0 +1 @@
+README
--- mapnik-0.5.1.orig/debian/NEWS
+++ mapnik-0.5.1/debian/NEWS
@@ -0,0 +1,14 @@
+mapnik (0.5~svn638-1) experimental; urgency=low
+
+  * This Debian revision of mapnik moves the input plugins from their default
+    location in /usr/lib/mapnik/input to /usr/lib/mapnik/0.5/input, to allow
+    multiple library versions to coexist on one system (the ABI of the plugins
+    is tied to the core library version). The input plugins are therefore
+    shipped in the same package as the core library. This situation is subject
+    to review with upstream, and may change; but for now, you will need to
+    ensure that your data source registration uses the correct path for the
+    version of the library you are using. You can use the mapnik-plugin-path
+    utility included in the libmapnik-dev package to automatically determine
+    the patch at build time.   
+
+ -- Dominic Hargreaves <dom@earth.li>  Wed, 06 Feb 2008 17:52:17 +0000
--- mapnik-0.5.1.orig/debian/build-svn-tarball.sh
+++ mapnik-0.5.1/debian/build-svn-tarball.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+set -e
+
+REPO="svn://svn.mapnik.org/trunk"
+PKGNAME="mapnik"
+
+TMP=`mktemp -d -p .`
+cd $TMP
+REV=`svn info $REPO|grep ^Revision|cut -d\  -f2`
+VER="0.5~svn$REV"
+svn export -r $REV $REPO $PKGNAME-$VER
+tar zcvf ${PKGNAME}_$VER.orig.tar.gz $PKGNAME-$VER
--- mapnik-0.5.1.orig/debian/libmapnik-dev.manpages
+++ mapnik-0.5.1/debian/libmapnik-dev.manpages
@@ -0,0 +1 @@
+debian/mapnik-plugin-base.1
--- mapnik-0.5.1.orig/debian/mapnik-plugin-base
+++ mapnik-0.5.1/debian/mapnik-plugin-base
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+SOVER=`readlink /usr/lib/libmapnik.so |sed -e 's/libmapnik.so.//'`
+
+echo /usr/lib/mapnik/$SOVER
--- mapnik-0.5.1.orig/debian/rules
+++ mapnik-0.5.1/debian/rules
@@ -0,0 +1,109 @@
+#!/usr/bin/make -f
+# -*- makefile -*-
+# Sample debian/rules that uses debhelper.
+# This file was originally written by Joey Hess and Craig Small.
+# As a special exception, when this file is copied by dh-make into a
+# dh-make output file, you may use that output file without restriction.
+# This special exception was added by Craig Small in version 0.37 of dh-make.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+GDAL_LIBNAME=$(subst -l,,$(filter -lgdal%,$(shell gdal-config --libs)))
+
+# scons flags
+SCONS_FLAGS=BOOST_TOOLKIT=gcc PROJ_INCLUDES=/usr/include PGSQL_INCLUDES=/usr/include/postgresql PROJ_LIBS=/usr/lib GDAL_INCLUDES=/usr/include/gdal DESTDIR=$(CURDIR)/debian/tmp PREFIX=/usr BIDI=yes PYTHON=/usr/bin/python2.4 XMLPARSER=libxml2 GDAL_LIBNAME=$(GDAL_LIBNAME)
+
+CFLAGS = -Wall -g
+
+ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
+	CFLAGS += -O0
+else
+	CFLAGS += -O2
+endif
+
+configure: configure-stamp
+configure-stamp:
+	dh_testdir
+	# Add here commands to configure the package.
+
+	touch configure-stamp
+
+
+build: build-stamp
+build-stamp: configure-stamp 
+	dh_testdir
+
+	# Add here commands to compile the package.
+	python scons/scons.py $(SCONS_FLAGS)
+	touch $@
+
+clean:
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp configure-stamp
+
+	# Add here commands to clean up after the build process.
+	#-$(MAKE) clean
+	python scons/scons.py $(SCONS_FLAGS) --clean
+	rm -rf .sconf_temp
+	find -name '*.pyc' -exec rm -f {} \;
+	rm -f config.log bindings/python/mapnik/paths.py 
+	find -name '.sconsign*' -exec rm -f {} \;
+	find -name '*.o' -exec rm -f {} \;
+	rm -f utils/shapeindex/shapeindex
+
+	# Lintian fix
+	chmod -x demo/viewer/images/*.png
+
+	dh_clean 
+
+install: build
+	dh_testdir
+	dh_testroot
+	dh_clean -k 
+	dh_installdirs
+
+	# Add here commands to install the package into debian/tmp
+	python scons/scons.py $(SCONS_FLAGS) install
+	find $(CURDIR)/debian/tmp -name '.sconsign' -exec rm -f {} \;
+	install -d $(CURDIR)/debian/tmp/usr/bin
+	install -m 0755 debian/mapnik-plugin-base $(CURDIR)/debian/tmp/usr/bin
+
+# Build architecture-independent files here.
+binary-indep: build install
+# We have nothing to do by default.
+
+# Build architecture-dependent files here.
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs 
+	dh_installdocs
+	dh_installexamples -Xdata/new
+	dh_install --sourcedir=debian/tmp
+#	dh_installmenu
+#	dh_installdebconf	
+#	dh_installlogrotate
+#	dh_installemacsen
+#	dh_installpam
+#	dh_installmime
+#	dh_installinit
+#	dh_installcron
+#	dh_installinfo
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+#	dh_perl
+	dh_pycentral
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install configure
--- mapnik-0.5.1.orig/debian/shapeindex.1
+++ mapnik-0.5.1/debian/shapeindex.1
@@ -0,0 +1,60 @@
+.\"                                      Hey, EMACS: -*- nroff -*-
+.\" First parameter, NAME, should be all caps
+.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
+.\" other parameters are allowed: see man(7), man(1)
+.TH SHAPEINDEX 1 "January 11, 2007"
+.\" Please adjust this date whenever revising the manpage.
+.\"
+.\" Some roff macros, for reference:
+.\" .nh        disable hyphenation
+.\" .hy        enable hyphenation
+.\" .ad l      left justify
+.\" .ad b      justify to both left and right margins
+.\" .nf        disable filling
+.\" .fi        enable filling
+.\" .br        insert line break
+.\" .sp <n>    insert n+1 empty lines
+.\" for manpage-specific macros, see man(7)
+.SH NAME
+shapeindex \- program to creates file system based index for ESRI shapefiles
+.SH SYNOPSIS
+.B shapeindex
+.RI [ options ]
+.SH DESCRIPTION
+This manual page documents briefly the
+.B shapeindex
+command.
+.PP
+.\" TeX users may be more comfortable with the \fB<whatever>\fP and
+.\" \fI<whatever>\fP escape sequences to invode bold face and italics, 
+.\" respectively.
+\fBshapeindex\fP is a program that creates file system based index (*.index)
+for ESRI shapefiles. These files are used for fast 'in box' queries on large
+shapefiles.
+.SH OPTIONS
+This program follows the usual GNU command line syntax, with long
+options starting with two dashes (`-').
+A summary of options is included below.
+.TP
+.B \-h, \-\-help
+Show summary of options.
+.TP
+.B \-V, \-\-version
+Show version of program.
+.TP
+.B \-v, \-\-verbose
+Show verbose output.
+.TP
+.B \-d, \-\-depth [arg]
+Specify maximum tree depth (default 8)
+.TP
+.B \-r, \-\-ratio [arg]
+Specify split ratio (default 0.55)
+.TP
+.B \-\-shape_files [file1 file2..fileN]
+Specify shape files to index
+.SH AUTHOR
+shapeindex was written by Artem Pavlenko.
+.PP
+This manual page was written by Dominic Hargreaves <dom@earth.li>,
+for the Debian project (but may be used by others).
--- mapnik-0.5.1.orig/debian/python-mapnik.examples
+++ mapnik-0.5.1/debian/python-mapnik.examples
@@ -0,0 +1 @@
+utils/ogcserver/*
--- mapnik-0.5.1.orig/debian/changelog
+++ mapnik-0.5.1/debian/changelog
@@ -0,0 +1,86 @@
+mapnik (0.5.1-1~bpo40+1) etch-backports; urgency=low
+
+  * Backport to etch
+    - build against python2.4 to match boost bindings in etch
+    - relax versioned dependencies on boost libraries
+    - adjust bindings/python/SConscript, SConstruct, and src/SConscript
+      for different boost library naming
+
+ -- Dominic Hargreaves <dom@earth.li>  Thu,  1 May 2008 22:57:55 +0100
+
+mapnik (0.5.1-1) unstable; urgency=low
+
+  * New upstream release: re-enables regex support (closes: #471717)
+  * Configure gdal library name dynamically at build time and remove
+    versioned dependency on libgdal1-dev (closes: #473958)
+
+ -- Dominic Hargreaves <dom@earth.li>  Thu,  3 Apr 2008 21:41:32 +0100
+
+mapnik (0.5.0-3) unstable; urgency=low
+
+  * Fix FTBFS with gcc 4.3: include missing headers (closes: #454898)
+  * Fix watch file to cope with new filename
+  * Explicitly link again python 2.5 boost library (closes: #468770)
+
+ -- Dominic Hargreaves <dom@earth.li>  Tue, 25 Mar 2008 20:14:22 +0000
+
+mapnik (0.5.0-2) unstable; urgency=low
+
+  * Fix plugin path in python bindings (closes: #466144)
+  * Remove libboost-serialization-dev build depends again, as
+    #457654 has been fixed.
+  * python-all-dev build depends changed to python2.5-dev
+
+ -- Dominic Hargreaves <dom@earth.li>  Sun, 24 Feb 2008 00:51:03 +0000
+
+mapnik (0.5.0-1) unstable; urgency=low
+
+  * New (final) upstream release
+  * Add libboost-serialization-dev build depends back, to work around
+    #457654 in libboost-dev.
+
+ -- Dominic Hargreaves <dom@earth.li>  Mon, 11 Feb 2008 23:01:05 +0000
+
+mapnik (0.5~svn638-1) experimental; urgency=low
+
+  * New upstream release
+    - Remove build dependency on libboost-serialization-dev
+    - Add build dependency on libgdal1-dev
+    - Bump python build dependency
+    - Add build dependency on libxml2-dev
+    - Now shipping with upstream's soname
+    - Don't link main library against unnecessary libraries
+    - Add build dependency on libboost-iostreams-dev
+    - Missing includes fixed (closes: #454898)
+  * Correct watch file (thanks to Raphael Geissert; closes: #450108)
+  * Update Standard-Version (no changes)
+  * Update build-svn-tarball.sh
+  * Add mapnik-plugin-base to determine the path to plugins
+  * Add Suggests on postgis
+
+ -- Dominic Hargreaves <dom@earth.li>  Wed,  6 Feb 2008 18:07:29 +0000
+
+mapnik (0.4.0-2) unstable; urgency=low
+
+  * Improve description for mapnik-utils (closes: #420286)
+  * Fix FTBFS due to Boost changes: tweak SConstruct and
+    build dependencies (closes: #425901)
+  * Tweak clean target to fix repeated builds
+
+ -- Dominic Hargreaves <dom@earth.li>  Fri, 25 May 2007 00:15:23 +0100
+
+mapnik (0.4.0-1) unstable; urgency=low
+
+  * New upstream release
+  * Remove support for multiple python versions, as Python boost bindings
+    are version-specific.
+  * Include ogcserver script as an example for the python-mapnik package.
+
+ -- Dominic Hargreaves <dom@earth.li>  Fri,  9 Mar 2007 17:14:28 +0000
+
+mapnik (0.3.0+svn424-1) unstable; urgency=low
+
+  * Initial release (Closes: #402792)
+
+ -- Dominic Hargreaves <dom@earth.li>  Sun, 14 Jan 2007 15:53:35 +0000
+
--- mapnik-0.5.1.orig/plugins/input/postgis/SConscript
+++ mapnik-0.5.1/plugins/input/postgis/SConscript
@@ -42,5 +42,5 @@
 
 postgis_inputdriver = env.SharedLibrary('postgis', source=postgis_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries)
 
-env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', postgis_inputdriver)
-env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
+env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input', postgis_inputdriver)
+env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input')
--- mapnik-0.5.1.orig/plugins/input/gdal/SConscript
+++ mapnik-0.5.1/plugins/input/gdal/SConscript
@@ -31,7 +31,7 @@
 	"""
         )
 
-libraries = ['gdal' ]
+libraries = [env['GDAL_LIBNAME'] ]
 if env['PLATFORM'] == 'Darwin':
     libraries.append('mapnik')
     libraries.append('iconv') 
@@ -39,5 +39,5 @@
 
 gdal_inputdriver = env.SharedLibrary('gdal', source=gdal_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries)
 
-env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', gdal_inputdriver)
-env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
+env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input', gdal_inputdriver)
+env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input')
--- mapnik-0.5.1.orig/plugins/input/shape/SConscript
+++ mapnik-0.5.1/plugins/input/shape/SConscript
@@ -35,7 +35,7 @@
         shape_io.cpp
 	"""
         )
-thread_suffix = '-mt'
+thread_suffix = '-mt-1_33_1'
 if env['PLATFORM'] == 'FreeBSD':
     thread_suffix = ''
     
@@ -52,5 +52,5 @@
 
 shape_inputdriver = env.SharedLibrary('shape', SHLIBSUFFIX='.input', source=shape_src, SHLIBPREFIX='', LIBS = libraries)
 
-env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', shape_inputdriver)
-env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
+env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input', shape_inputdriver)
+env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input')
--- mapnik-0.5.1.orig/plugins/input/raster/SConscript
+++ mapnik-0.5.1/plugins/input/raster/SConscript
@@ -38,5 +38,5 @@
 
 raster_inputdriver = env.SharedLibrary('raster', source=raster_src, SHLIBPREFIX='', SHLIBSUFFIX='.input', LIBS=libraries)
 
-env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input', raster_inputdriver)
-env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/input')
+env.Install(install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input', raster_inputdriver)
+env.Alias('install', install_prefix + '/' + env['LIBDIR_SCHEMA'] + '/mapnik/0.5/input')
--- mapnik-0.5.1.orig/src/SConscript
+++ mapnik-0.5.1/src/SConscript
@@ -31,6 +31,14 @@
 install_prefix = env['DESTDIR'] + '/' + prefix
 
 libraries = ['agg'] + env['LIBS']
+# Debian hack to clean up linking of main library (fixes dpkg-shlibdeps
+# warnings)
+libraries.remove('z')
+libraries.remove('z')
+libraries.remove('pq')
+libraries.remove(env['GDAL_LIBNAME'])
+libraries.remove('boost_program_options-gcc-mt-1_33_1')
+libraries.remove('boost_iostreams-gcc-mt-1_33_1')
 
 if env['PLATFORM'] == 'Darwin':
     libraries.append('iconv')
--- mapnik-0.5.1.orig/SConstruct
+++ mapnik-0.5.1/SConstruct
@@ -23,7 +23,7 @@
 import os, sys, platform
 
 if platform.uname()[4] == 'x86_64':
-    LIBDIR_SCHEMA='lib64' 
+    LIBDIR_SCHEMA='lib' 
 elif platform.uname()[4] == 'ppc64':
     LIBDIR_SCHEMA='lib64'
 else:
@@ -55,6 +55,7 @@
 opts.Add(PathOption('PROJ_LIBS', 'Search path for PROJ.4 library files', '/usr/local/' + LIBDIR_SCHEMA))
 opts.Add(PathOption('GDAL_INCLUDES', 'Search path for GDAL include files', '/usr/include'))
 opts.Add(PathOption('GDAL_LIBS', 'Search path for GDAL library files', '/usr/' + LIBDIR_SCHEMA))
+opts.Add('GDAL_LIBNAME', 'Name of the GDAL library to link against', 'gdal')
 opts.Add(PathOption('PYTHON','Python executable', sys.executable))
 opts.Add(ListOption('INPUT_PLUGINS','Input drivers to include','all',['postgis','shape','raster','gdal']))
 opts.Add(ListOption('BINDINGS','Language bindings to build','all',['python']))
@@ -78,7 +79,7 @@
 color_print (4,"Building on %s ..." % env['PLATFORM'])
 Help(opts.GenerateHelpText(env))
 
-thread_suffix = '-mt'
+thread_suffix = '-mt-1_33_1'
 
 if env['PLATFORM'] == 'FreeBSD':
     thread_suffix = ''
@@ -93,7 +94,7 @@
     if not val in env[key]: env[key].append(val)
 
 # Libraries and headers dependency checks
-env['CPPPATH'] = ['#agg/include', '#tinyxml', '#include', '#']
+env['CPPPATH'] = ['#agg/include', '#include', '#']
 env['LIBPATH'] = ['#agg', '#src']
 
 # Solaris & Sun Studio settings (the `SUNCC` flag will only be
@@ -154,7 +155,7 @@
 ]
 
 CXX_LIBSHEADERS = [
-    ['gdal', 'gdal_priv.h',False]
+    [env['GDAL_LIBNAME'], 'gdal_priv.h',False]
 ]
 
 if env['BIDI'] : C_LIBSHEADERS.append(['fribidi','fribidi/fribidi.h',True])
@@ -188,7 +189,7 @@
 for count, libinfo in enumerate(BOOST_LIBSHEADERS):
     if  env['THREADING'] == 'multi' :
         if not conf.CheckLibWithHeader('boost_%s%s%s' % (libinfo[0],env['BOOST_APPEND'],thread_suffix), libinfo[1], 'C++') and libinfo[2] :
-            color_print(1,'Could not find header or shared library for boost %s, exiting!' % libinfo[0])
+            color_print(1,'Could not find header or shared library for boost_%s%s%s, exiting!' % (libinfo[0],env['BOOST_APPEND'],thread_suffix))
             Exit(1)
     elif not conf.CheckLibWithHeader('boost_%s%s' % (libinfo[0], env['BOOST_APPEND']), libinfo[1], 'C++') :
         color_print(1,'Could not find header or shared library for boost %s, exiting!' % libinfo[0])
@@ -224,7 +225,7 @@
 if 'raster' in inputplugins:
     SConscript('plugins/input/raster/SConscript')
 
-if 'gdal' in inputplugins and 'gdal' in env['LIBS']:
+if 'gdal' in inputplugins and env['GDAL_LIBNAME'] in env['LIBS']:
     SConscript('plugins/input/gdal/SConscript')
 
 if 'gigabase' in inputplugins and 'gigabase_r' in env['LIBS']:
