diff -pruN 1.4.0-8/debian/changelog 1.4.0-8.1/debian/changelog
--- 1.4.0-8/debian/changelog	2013-10-20 21:37:53.000000000 +0000
+++ 1.4.0-8.1/debian/changelog	2013-10-20 21:37:54.000000000 +0000
@@ -1,3 +1,14 @@
+mozart (1.4.0-8.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Replaced tcl8.4-dev and tk8.4-dev in build dependencies by tcl8.5-dev
+    and tk8.5-dev and added --with-tcl and --with-tk configure options.
+    (closes: #726030)
+  * Created local texmf.cnf with openout_all=r option to fix FTBFS with
+    newer texlive default setting openout_all=p.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 20 Oct 2013 18:48:15 +0400
+
 mozart (1.4.0-8) unstable; urgency=low
 
   * Whoops, really change standards version to 3.9.2 as promised below.
diff -pruN 1.4.0-8/debian/control 1.4.0-8.1/debian/control
--- 1.4.0-8/debian/control	2013-10-20 21:37:53.000000000 +0000
+++ 1.4.0-8.1/debian/control	2013-10-20 21:37:54.000000000 +0000
@@ -6,7 +6,7 @@ Standards-Version: 3.9.2
 Homepage: http://www.mozart-oz.org/
 Vcs-Git: git://anonscm.debian.org/collab-maint/mozart.git
 Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/mozart.git
-Build-Depends: debhelper (>> 7.0.0), bison (>= 1.25), flex-old (>= 2.5.3), ghostscript, libgdbm-dev, libgmp-dev, m4, netpbm, sp, tcl8.4-dev, texlive, texlive-pstricks, tk8.4-dev, zlib1g-dev, emacs23 | emacs22 | xemacs21
+Build-Depends: debhelper (>> 7.0.0), bison (>= 1.25), flex-old (>= 2.5.3), ghostscript, libgdbm-dev, libgmp-dev, m4, netpbm, sp, tcl8.5-dev, texlive, texlive-pstricks, tk8.5-dev, zlib1g-dev, emacs23 | emacs22 | xemacs21
 
 Package: mozart
 Architecture: hppa i386 m68k mipsel mips powerpc sparc s390 arm armeb armel kfreebsd-i386 sh4
diff -pruN 1.4.0-8/debian/rules 1.4.0-8.1/debian/rules
--- 1.4.0-8/debian/rules	2013-10-20 21:37:53.000000000 +0000
+++ 1.4.0-8.1/debian/rules	2013-10-20 21:37:54.000000000 +0000
@@ -24,6 +24,8 @@ installdir_doc := $(CURDIR)/debian/mozar
 ozhome := /usr/share/mozart
 ozplatform := $(shell $(srcdir)/share/bin/ozplatform)
 
+export TEXMFCNF := $(CURDIR)/debian:
+
 source: source-stamp
 source-stamp:
 	dh_testdir
@@ -46,6 +48,8 @@ configure-stamp: source-stamp $(srcdir)/
 		--disable-copy-tcl-libs \
 		--disable-compile-elisp \
 		--disable-contrib-micq \
+		--with-tcl=/usr/lib/tcl8.5 \
+		--with-tk=/usr/lib/tk8.5 \
 		--enable-opt \
 		--enable-doc \
 		--with-documents=all
diff -pruN 1.4.0-8/debian/texmf.cnf 1.4.0-8.1/debian/texmf.cnf
--- 1.4.0-8/debian/texmf.cnf	1970-01-01 00:00:00.000000000 +0000
+++ 1.4.0-8.1/debian/texmf.cnf	2013-10-20 21:37:54.000000000 +0000
@@ -0,0 +1 @@
+openout_any=r
diff -pruN 1.4.0-8/share/bin/ozplatform 1.4.0-8.1/share/bin/ozplatform
--- 1.4.0-8/share/bin/ozplatform	2013-10-20 21:37:53.000000000 +0000
+++ 1.4.0-8.1/share/bin/ozplatform	2013-10-20 21:37:54.000000000 +0000
@@ -87,6 +87,8 @@ case $system in
    ;;
    *i*86*Darwin*)       OZARCH=darwin-i386
    ;;
+   x86_64\ Linux\ *)    OZARCH=linux-i486
+   ;;
    *)  	                OZARCH=unknown-unknown
    ;;
 esac
diff -pruN 1.4.0-8/share/lib/wp/Tk.oz 1.4.0-8.1/share/lib/wp/Tk.oz
--- 1.4.0-8/share/lib/wp/Tk.oz	2013-10-20 21:37:53.000000000 +0000
+++ 1.4.0-8.1/share/lib/wp/Tk.oz	2013-10-20 21:37:54.000000000 +0000
@@ -458,8 +458,8 @@ define
 	    in
 	       %% Changed for Debian/GNU: use the pre-installed
 	       %% versions of tcl and tk
-	       {OS.putEnv 'TCL_LIBRARY' '/usr/lib/tcl8.4'}
-	       {OS.putEnv 'TK_LIBRARY'  '/usr/lib/tk8.4'}
+	       {OS.putEnv 'TCL_LIBRARY' '/usr/share/tcltk/tcl8.5'}
+	       {OS.putEnv 'TK_LIBRARY'  '/usr/share/tcltk/tk8.5'}
 
 	       % RS: on MS Windows we use a socket: before we used
 	       % pipes, but on NT this made problems when certain background
