diff --git a/lal/debian/changelog b/lal/debian/changelog
index 5e242443b06579cc46a893f9e749e1ab032bb790..5a06362416fc4ff6ae87fd8646a20f1400308b20 100644
--- a/lal/debian/changelog
+++ b/lal/debian/changelog
@@ -1,3 +1,9 @@
+lal (5.3-1lscsoft1) unstable; urgency=low
+
+  * LAL 5.3 for Metaio 8.2
+
+ -- Steffen Grunewald <steffen.grunewald@aei.mpg.de>  Fri, 21 Nov 2008 12:10:00 +0100
+
 lal (5.2-7lscsoft2) unstable; urgency=low
 
   * prefix=/opt/lscsoft/lal, some more fixes
diff --git a/lal/debian/control b/lal/debian/control
index 6303cda12c99a0e10026c76764de4b849db721d1..d2c8be8c94ddec26981f065aa06caa88471bb392 100644
--- a/lal/debian/control
+++ b/lal/debian/control
@@ -2,12 +2,12 @@ Source: lal
 Section: lscsoft
 Priority: optional
 Maintainer: Steffen Grunewald <steffen.grunewald@aei.mpg.de>
-Build-Depends: debhelper (>= 5), autotools-dev, automake, m4, libgsl0-dev (>= 1.9), libframe-dev, libmetaio-dev (>= 7.2), fftw3-dev, zlib1g-dev
+Build-Depends: debhelper (>= 5), autotools-dev, automake, m4, libgsl0-dev (>= 1.9), libframe-dev, libmetaio-dev (>= 8.2), fftw3-dev, zlib1g-dev, libxml2-dev (>= 2.6), pkg-config
 Standards-Version: 3.7.2
 
 Package: lal
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libgsl0 (>= 1.9) | libgsl0ldbl (>= 1.10), libframe0, libmetaio0 (>= 7.2), fftw3, zlib1g
+Depends: ${shlibs:Depends}, ${misc:Depends}, libgsl0 (>= 1.9) | libgsl0ldbl (>= 1.10), libframe0, libmetaio1 (>= 8.2), fftw3, zlib1g, libxml2 (>= 2.6)
 Description: LSC Algorithm Library
  The LSC Algorithm Library for gravitational wave analysis.
  This package contains the shared-object libraries needed to run applications
@@ -15,7 +15,7 @@ Description: LSC Algorithm Library
 
 Package: lal-dev
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, libgsl0-dev (>= 1.9), libframe-dev, libmetaio-dev (>= 7.2), fftw3-dev, zlib1g-dev
+Depends: ${shlibs:Depends}, ${misc:Depends}, libgsl0-dev (>= 1.9), libframe-dev, libmetaio-dev (>= 8.2), fftw3-dev, zlib1g-dev, libxml2-dev (>= 2.6)
 Description: Files and documentation needed for compiling programs that use LAL
  The LSC Algorithm Library for gravitational wave analysis.
  This package contains files needed to build applications that use the LAL library
diff --git a/lal/debian/copyright b/lal/debian/copyright
index b27c5f30ae74628a57c876de817cb8d402893863..8942d171718c8e8d6a7a54a74d70dd0fee1e3816 100644
--- a/lal/debian/copyright
+++ b/lal/debian/copyright
@@ -1,5 +1,6 @@
 This package was debianized by Kipp Cannon <kipp@gravity.phys.uwm.edu> on
-Fri, 21 Jan 2005 12:00:00 -0500.
+Fri, 21 Jan 2005 12:00:00 -0500, and by Steffen Grunewald <steffen.grunewald@aei.mpg.de> on
+Fri,  5 Oct 2007 13:09:39 +0200.
 
 It was checked out of the LSCSoft CVS pserver.
 Official releases are available from http://lsc-group.phys.uwm.edu/daswg/download/software/
@@ -12,4 +13,4 @@ License:
 
 
 
-The Debian packaging is (C) 2007, Steffen Grunewald <steffen.grunewald@aei.mpg.de>.
+The Debian packaging is (C) 2008, Steffen Grunewald <steffen.grunewald@aei.mpg.de>.
diff --git a/lal/debian/rules b/lal/debian/rules
index 2a49c23f7da500273974792029268fa3faea09ca..e6689fd062dd1c96515c023842d485770bb79678 100755
--- a/lal/debian/rules
+++ b/lal/debian/rules
@@ -13,6 +13,8 @@ DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 PREFIX = /opt/lscsoft/lal
+FRAMEPREFIX = /opt/lscsoft/libframe
+METAIOPREFIX = /opt/lscsoft/libmetaio
 
 CFLAGS = -Wall -g
 
@@ -33,6 +35,7 @@ configure:
 config.status : configure
 	dh_testdir
 #	LDFLAGS="-Wl,-z,defs"
+	PKG_CONFIG_PATH=$(FRAMEPREFIX)/lib/pkgconfig:$(METAIOPREFIX)/lib/pkgconfig \
 	CFLAGS="$(CFLAGS)" \
 	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
 		--prefix=$(PREFIX) \
@@ -47,7 +50,6 @@ build : build-stamp
 build-stamp :  config.status
 	dh_testdir
 
-	# Add here commands to compile the package.
 	$(MAKE)
 	-yes "" | $(MAKE) dvi
 	-yes "" | $(MAKE) check
@@ -63,12 +65,7 @@ clean:
 
 	# Add here commands to clean up after the build process.
 	-$(MAKE) cvs-clean
-#ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-#	cp -f /usr/share/misc/config.sub config.sub
-#endif
-#ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-#	cp -f /usr/share/misc/config.guess config.guess
-#endif
+	-$(MAKE) distclean
 	dh_clean 
 
 
@@ -78,11 +75,10 @@ install : build
 	dh_clean -k
 	dh_installdirs
 
-	# Add here commands to install the package into debian/lal.
 	$(MAKE) DESTDIR=$(CURDIR)/debian/lal install
 
 	# split off -dev
-	mkdir -p $(CURDIR)/debian/lal-dev/$(PREFIX)/bin $(CURDIR)/debian/lal-dev/$(PREFIX)/lib $(CURDIR)/debian/lal-dev/$(PREFIX)/include
+#	mkdir -p $(CURDIR)/debian/lal-dev/$(PREFIX)/bin $(CURDIR)/debian/lal-dev/$(PREFIX)/lib $(CURDIR)/debian/lal-dev/$(PREFIX)/include
 	mv $(CURDIR)/debian/lal/$(PREFIX)/bin/lal-config $(CURDIR)/debian/lal-dev/$(PREFIX)/bin/
 	mv $(CURDIR)/debian/lal/$(PREFIX)/lib/*a $(CURDIR)/debian/lal-dev/$(PREFIX)/lib/
 	mv $(CURDIR)/debian/lal/$(PREFIX)/lib/pkgconfig $(CURDIR)/debian/lal-dev/$(PREFIX)/lib/
@@ -93,8 +89,6 @@ install : build
 	dh_install -s
 
 
-# Must not depend on anything. This is to be called by
-# binary in another 'make' thread.
 binary-common :
 	dh_testdir
 	dh_testroot
@@ -120,12 +114,11 @@ binary-common :
 #	dh_perl
 	dh_makeshlibs
 	dh_installdeb
-	dh_shlibdeps
+	LD_LIBRARY_PATH=$(PREFIX)/lib dh_shlibdeps
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
 
-# Build architecture dependant packages using the common target.
 binary :  install
 	$(MAKE) -f debian/rules DH_OPTIONS=-a binary-common
 
diff --git a/lalapps/debian/changelog b/lalapps/debian/changelog
index 89923b5c9b8ae6d214fd4c9b4453308587b8fca0..7118a57c946874226f6a8351f3320cb4dca9b9c0 100644
--- a/lalapps/debian/changelog
+++ b/lalapps/debian/changelog
@@ -1,3 +1,9 @@
+lalapps (5.3-1lscsoft1) unstable; urgency=low
+
+  * 5.3 release for Metaio 8.2
+
+ -- Steffen Grunewald <steffen.grunewald@aei.mpg.de>  Fri, 21 Nov 2008 12:10:00 +0100
+
 lalapps (5.2-7lscsoft2) unstable; urgency=low
 
   * prefix=/opt/lscsoft/lalapps, some fixes
diff --git a/lalapps/debian/control b/lalapps/debian/control
index dee9300a638894cbe72fd5f848f43557aa79332c..fb5453186abe3520f8667e14a830c31109fb3487 100644
--- a/lalapps/debian/control
+++ b/lalapps/debian/control
@@ -2,12 +2,13 @@ Source: lalapps
 Section: lscsoft
 Priority: optional
 Maintainer: Steffen Grunewald <steffen.grunewald@aei.mpg.de>
-Build-Depends: debhelper (>= 5), autotools-dev, automake, lal-dev, lal, libgsl0-dev (>= 1.9), zlib1g-dev
+Build-Depends: debhelper (>= 5), autotools-dev, automake, m4, libgsl0-dev (>= 1.9), libframe-dev, libmetaio-dev (>= 8.2), fftw3-dev, lal-dev (>= 5.3), lal (>= 5.3), zlib1g-dev, libxml2-dev (>= 2.6), pkg-config, python2.4-dev, python2.5-dev
 Standards-Version: 3.7.2
 
 Package: lalapps
 Architecture: any
-Depends: ${shlibs:Depends}, ${misc:Depends}, lal, libgsl0 (>= 1.9) | libgsl0ldbl (>= 1.9), zlib1g
+Depends: ${shlibs:Depends}, ${misc:Depends}, zlib1g, libgsl0 (>= 1.9) | libgsl0ldbl (>= 1.9), libframe0, libmetaio1 (>=8.2), fftw3, lal (>= 5.3), libxml2 (>= 2.6), python2.4
+Recommends: python2.5
 Description: LSC Algorithm Library Applications
  The LSC Algorithm Library Applications for gravitational wave data analysis.
  This package contains applications that are built on tools in the
diff --git a/lalapps/debian/rules b/lalapps/debian/rules
index ef03b11706dea871229fec57013a196ebb31e42b..d7a0900bf261833c51934cdf0ac08dfe008fe687 100755
--- a/lalapps/debian/rules
+++ b/lalapps/debian/rules
@@ -16,6 +16,8 @@ DEB_HOST_GNU_TYPE   ?= $(shell dpkg-architecture -qDEB_HOST_GNU_TYPE)
 DEB_BUILD_GNU_TYPE  ?= $(shell dpkg-architecture -qDEB_BUILD_GNU_TYPE)
 
 PREFIX = /opt/lscsoft/lalapps
+FRAMEPREFIX = /opt/lscsoft/libframe
+METAIOPREFIX = /opt/lscsoft/libmetaio
 LALPREFIX = /opt/lscsoft/lal
 
 CFLAGS = -Wall -g
@@ -32,22 +34,24 @@ configure:
 config.status: configure
 	dh_testdir
 
-#	LDFLAGS="-Wl,-z,defs"
-	CFLAGS="$(CFLAGS)" \
-	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
-	    --prefix=$(PREFIX) \
-	    --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
-	    --enable-nightly=no \
-	    --enable-frame --enable-metaio \
-	    --with-lal-prefix=$(LALPREFIX) \
-	    --disable-debug
+#	LDFLAGS="-Wl,-z,defs" \
+# moved to install
+#	CFLAGS="$(CFLAGS)" \
+#	PKG_CONFIG_PATH=$(FRAMEPREFIX)/lib/pkgconfig:$(METAIOPREFIX)/lib/pkgconfig:$(LALPREFIX)/lib/pkgconfig \
+#	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+#	    --prefix=$(PREFIX) \
+#	    --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info \
+#	    --enable-nightly=no \
+#	    --enable-frame --enable-metaio \
+#	    --disable-debug
 
 build: build-stamp
 
 build-stamp:  config.status
 	dh_testdir
 
-	$(MAKE)
+# moved to install
+#	$(MAKE)
 
 	touch $@
 
@@ -56,15 +60,8 @@ clean:
 	dh_testroot
 	rm -f build-stamp 
 
-	# Add here commands to clean up after the build process.
 	-$(MAKE) cvs-clean
 	-$(MAKE) distclean
-#ifneq "$(wildcard /usr/share/misc/config.sub)" ""
-#	cp -f /usr/share/misc/config.sub config.sub
-#endif
-#ifneq "$(wildcard /usr/share/misc/config.guess)" ""
-#	cp -f /usr/share/misc/config.guess config.guess
-#endif
 	dh_clean 
 
 install: build
@@ -73,15 +70,45 @@ install: build
 	dh_clean -k 
 	dh_installdirs
 
-	# Add here commands to install the package into debian/lalapps.
-	$(MAKE) DESTDIR=$(CURDIR)/debian/lalapps install
-
-# 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
+	set -e; \
+	for v in 2.5 2.4; do                                                         \
+	PYTHON="python$$v"                                                    \
+	CFLAGS="$(CFLAGS)"                                                    \
+	PKG_CONFIG_PATH=$(FRAMEPREFIX)/lib/pkgconfig:$(METAIOPREFIX)/lib/pkgconfig:$(LALPREFIX)/lib/pkgconfig \
+	./configure --host=$(DEB_HOST_GNU_TYPE) --build=$(DEB_BUILD_GNU_TYPE) \
+	    --prefix=$(PREFIX)                                                \
+	    --mandir=\$${prefix}/share/man --infodir=\$${prefix}/share/info   \
+	    --enable-nightly=no                                               \
+	    --enable-frame --enable-metaio                                    \
+	    --disable-debug ;                                                        \
+	PYTHON="python$$v"                                                    \
+	$(MAKE) ;                                                                    \
+	echo "tree after build:" ;                                                   \
+	ls -lR $(CURDIR)/debian ;                                                    \
+	PYTHON="python$$v"                                                    \
+	$(MAKE) DESTDIR=$(CURDIR)/debian/lalapps install ;                           \
+	echo "tree after install:" ;                                                 \
+	ls -lR $(CURDIR)/debian ;                                                    \
+	$(MAKE) clean ;                                                              \
+	echo "tree after clean:" ;                                                   \
+	ls -lR $(CURDIR)/debian ;                                                    \
+	done
+	set -e; \
+	for i in `find debian -mindepth 2 -type f ! -perm 755`; do       \
+		if head -n1 $$i | grep -q '^#!' ; then                   \
+		        chmod +x $$i;                                    \
+		fi ;                                                     \
+	done
+	set -e; \
+	for i in `find debian/$(PACKAGE)/$(PREFIX)/bin -type f`; do      \
+	        echo $$i;                                                \
+	        if head -n1 $$i | grep -q '^#!.*python$$' ; then         \
+	                sed -i '1s/python$$/python2.4/' $$i;             \
+	        fi ;                                                     \
+	done
+
+
+binary-common: build install
 	dh_testdir
 	dh_testroot
 	dh_installchangelogs ChangeLog
@@ -106,10 +133,10 @@ binary-arch: build install
 #	dh_perl
 	dh_makeshlibs
 	dh_installdeb
-	dh_shlibdeps
+	LD_LIBRARY_PATH=$(PREFIX)/lib dh_shlibdeps
 	dh_gencontrol
 	dh_md5sums
 	dh_builddeb
 
-binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary install 
+binary: binary-common
+.PHONY: build clean binary-common binary install