--- esdl-1.2.orig/debian/copyright
+++ esdl-1.2/debian/copyright
@@ -0,0 +1,50 @@
+This package was debianized by Brent A. Fulgham <bfulgham@debian.org> on
+Thu,  7 Nov 2002 23:28:51 -0800
+
+It was downloaded from http://esdl.sourceforge.net.
+
+Upstream Author: Dan Gudmundsson <dgud@users.sourceforge.net>
+
+Copyright:
+
+Copyright 2002-2009 Dan Gudmundsson <dgud@users.sourceforge.net>
+          2007 Klas Johansson <klajo@users.sourceforge.net>
+
+This software is copyrighted by Dan Gudmundsson, and other parties.
+The following terms apply to all files associated with the software unless
+explicitly disclaimed in individual files.
+
+The authors hereby grant permission to use, copy, modify, distribute,
+and license this software and its documentation for any purpose, provided
+that existing copyright notices are retained in all copies and that this
+notice is included verbatim in any distributions. No written agreement,
+license, or royalty fee is required for any of the authorized uses.
+Modifications to this software may be copyrighted by their authors
+and need not follow the licensing terms described here, provided that
+the new terms are clearly indicated on the first page of each file where
+they apply.
+
+IN NO EVENT SHALL THE AUTHORS OR DISTRIBUTORS BE LIABLE TO ANY PARTY
+FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ARISING OUT OF THE USE OF THIS SOFTWARE, ITS DOCUMENTATION, OR ANY
+DERIVATIVES THEREOF, EVEN IF THE AUTHORS HAVE BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+THE AUTHORS AND DISTRIBUTORS SPECIFICALLY DISCLAIM ANY WARRANTIES,
+INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.  THIS SOFTWARE
+IS PROVIDED ON AN "AS IS" BASIS, AND THE AUTHORS AND DISTRIBUTORS HAVE
+NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR
+MODIFICATIONS.
+
+GOVERNMENT USE: If you are acquiring this software on behalf of the
+U.S. government, the Government shall have only "Restricted Rights"
+in the software and related documentation as defined in the Federal 
+Acquisition Regulations (FARs) in Clause 52.227.19 (c) (2).  If you
+are acquiring the software on behalf of the Department of Defense, the
+software shall be classified as "Commercial Computer Software" and the
+Government shall have only "Restricted Rights" as defined in Clause
+252.227-7013 (c) (1) of DFARs.  Notwithstanding the foregoing, the
+authors grant the U.S. Government and others acting in its behalf
+permission to use and distribute the software in accordance with the
+terms specified in this license. 
--- esdl-1.2.orig/debian/erlang-esdl.docs
+++ esdl-1.2/debian/erlang-esdl.docs
@@ -0,0 +1,2 @@
+debian/README.Debian
+Readme
--- esdl-1.2.orig/debian/watch
+++ esdl-1.2/debian/watch
@@ -0,0 +1,6 @@
+# Watch control file for uscan
+
+# Compulsory line, this is a version 3 file
+version=3
+
+http://sf.net/esdl/esdl-([\d.]*).src.tar.gz
--- esdl-1.2.orig/debian/erlang-esdl-doc.dirs
+++ esdl-1.2/debian/erlang-esdl-doc.dirs
@@ -0,0 +1 @@
+/usr/share/doc/erlang-esdl-doc/html
--- esdl-1.2.orig/debian/erlang-esdl-doc.doc-base
+++ esdl-1.2/debian/erlang-esdl-doc.doc-base
@@ -0,0 +1,9 @@
+Document: erlang-esdl-doc
+Title: Erlang SDL Bindings Documentation
+Author: Dan Gudmundsson
+Abstract: Documentation for the SDL bindings to the Erlang programming language
+Section: Programming
+
+Format: HTML
+Index: /usr/share/doc/erlang-esdl-doc/html/index.html
+Files: /usr/share/doc/erlang-esdl-doc/html/*
--- esdl-1.2.orig/debian/compat
+++ esdl-1.2/debian/compat
@@ -0,0 +1 @@
+5
--- esdl-1.2.orig/debian/erlang-esdl-dev.docs
+++ esdl-1.2/debian/erlang-esdl-dev.docs
@@ -0,0 +1,2 @@
+debian/README.Debian
+Readme
--- esdl-1.2.orig/debian/changelog
+++ esdl-1.2/debian/changelog
@@ -0,0 +1,316 @@
+esdl (1.2-1) experimental; urgency=low
+
+  * New upstream release.
+  * Moved the installed files back to /usr/lib/erlang/lib tree because their
+    conflicts with main Erlang distribution are resolved.
+  * Do not include gl.hrl in sdl_img.erl and sdl_ttf.erl as it is not necessary
+    and breaks their build.
+  * Replaced -fpic by -fPIC in c_src/Makefile.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Fri, 23 Dec 2011 22:22:47 +0400
+
+esdl (1.0.1-4) experimental; urgency=low
+
+  * Fixed typo in package description (closes: #601194).
+  * Bumped standards version to 3.9.2.
+  * Fixed loading driver esdl_driver into Erlang R15B.
+  * Upload to experimental as Erlang R15B is there yet.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 17 Dec 2011 12:45:07 +0400
+
+esdl (1.0.1-3) unstable; urgency=low
+
+  * Changed maintainer's email address to the mailing list
+    pkg-erlang-devel@lists.alioth.debian.org.
+  * Changed VCS headers to svn://svn.debian.org/.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 17 Oct 2009 15:18:48 +0400
+
+esdl (1.0.1-2) unstable; urgency=low
+
+  * Removed Torsten Werner from the uploaders list as per his request.
+  * Added README.source where it is explained how to apply a series of patches
+    to a pristine source.
+  * Overridden lintian warning about wirtual package dependency without real
+    package dependency because it's intentional and warns for breakage
+    on Erlang updates.
+  * Bumped standards version to 3.8.3.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 17 Oct 2009 14:33:23 +0400
+
+esdl (1.0.1-1) unstable; urgency=low
+
+  * New upstream release.
+  * Added Klas Johansson to debian/copyright as an author of SDL_img and
+    SDL_ttf bindings.
+  * Removed tail call patch because the bug is fixed upstream.
+  * Removed hack for arm architecture because this architecture is no longer
+    in Debian.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 23 May 2009 18:10:19 +0400
+
+esdl (1.0-1) unstable; urgency=low
+
+  * New upstream release.
+  * Enabled newly implemented SDL_ttf (TrueType fonts) and SDL_image (loading
+    images as SDL surfaces) support.
+  * Renamed source package to esdl to match upstream name.
+  * Renamed binary package to erlang-esdl as this name better fits Erlang
+    modules naming scheme, introduced in erlang since 1:13.b.
+  * Removed sources from the binary package and split out Erlang headers
+    and documentation into separate packages erlang-esdl-dev and
+    erlang-esdl-doc.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 17 May 2009 16:10:32 +0400
+
+libsdl-erlang (0.96.0626-13) unstable; urgency=low
+
+  * Upload to unstable after Erlang R13B is uploaded to sid.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Fri, 01 May 2009 13:26:01 +0400
+
+libsdl-erlang (0.96.0626-12) experimental; urgency=low
+
+  * Removed unnecessary package grep-dctrl from build dependencies.
+  * Added build dependency on version 1:13.b of erlang-dev to simplify
+    transition to Erlang R13B.
+  * Replaced all instances of erlang:fault/1 (which is removed from Erlang
+    in version R13) by erlang:error/1.
+  * Moved installed binaries from /usr/lib/erlang/lib hierarchy to
+    /usr/lib/esdl directory because modules gl and glu conflict with wxErlang
+    which is included into Erlang since version R13A. This means that to use
+    esdl ona has to run Erlang emulator with -pa /usr/lib/esdl/ebin option
+    and cannot use wxErlang at the same time. Documented this option in
+    README.Debian.
+  * Bumped standards version to 3.8.1.
+  * Instructed uscan control file debian/watch to use SourceForge redirector.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Wed, 22 Apr 2009 21:04:35 +0400
+
+libsdl-erlang (0.96.0626-11) unstable; urgency=low
+
+  * Redefined HOME environment variable to fix FTBFS in case when HOME points
+    to an existing inaccessible directory.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Fri, 18 Jul 2008 13:21:06 +0400
+
+libsdl-erlang (0.96.0626-10) unstable; urgency=low
+
+  * Reordered calls to dh_makeshlibs, dh_shlibdeps, dh_installdeb in
+    debian/rules.
+  * Removed obsolete packages (xlibmesa-gl-dev and xlibmesa-glu-dev) from
+    build-dependencies.
+  * Bumped standards version to 3.8.0.
+  * Added Vcs-Svn and Vcs-Browser headers to debian/control.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Fri, 18 Jul 2008 11:38:46 +0400
+
+libsdl-erlang (0.96.0626-9) unstable; urgency=low
+
+  * Removed perl from build dependencies because it is build-essential.
+  * Added a patch which replaces deprecated tail +2 call by tail -n +2.
+  * Added a hack to bypass GCC internal compiler error on arm architecture.
+  * Use quilt for patch management.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 25 May 2008 18:43:38 +0400
+
+libsdl-erlang (0.96.0626-8) unstable; urgency=low
+
+  * Added homepage header to debian/control.
+  * Bumped standards version to 3.7.3.
+  * Fixed doc-base registration file (fixed typo Abtract -> Abstract and
+    section name capitalization programming -> Programming).
+  * Clarified copyright statement.
+  * Lowered erlang version in build-dependencies to make porting the package
+    to etch easier.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sun, 25 May 2008 14:35:13 +0400
+
+libsdl-erlang (0.96.0626-7) unstable; urgency=low
+
+  * Added Sergei Golovan <sgolovan@debian.org> to uploaders list.
+  * Rewritten clean target in debian/rules to ignore only missing Makefile
+    error.
+  * Bumped debhelper compatibility level to 5.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Thu, 06 Sep 2007 21:23:05 +0400
+
+libsdl-erlang (0.96.0626-6) unstable; urgency=low
+
+  [ Sergei Golovan ]
+  * Added dependency on erlang ABI virtual package.
+  * Added build-indep and build-arch targets to debain/rules.
+
+ -- Torsten Werner <twerner@debian.org>  Tue, 26 Jun 2007 18:57:19 +0400
+
+libsdl-erlang (0.96.0626-5) unstable; urgency=low
+
+  * Switched to erlang-depends.
+
+ -- Torsten Werner <twerner@debian.org>  Wed, 11 Apr 2007 19:19:12 +0400
+
+libsdl-erlang (0.96.0626-4) unstable; urgency=low
+
+  [ Sergei Golovan ]
+  * Added author name and packaging information to debian/copyright.
+
+ -- Erlang Packagers <erlang-pkg-devel@lists.berlios.de>  Thu, 14 Sep 2006 20:32:03 +0400
+
+libsdl-erlang (0.96.0626-3) unstable; urgency=low
+
+  [ Torsten Werner ]
+  * Made Build-Depends compatible with sarge, etch, and ubuntu.
+
+  [ Sergei Golovan ]
+  * Added versioned erlang dependency.
+
+ -- Erlang Packagers <erlang-pkg-devel@lists.berlios.de>  Wed, 09 Aug 2006 23:27:56 +0400
+
+libsdl-erlang (0.96.0626-2) unstable; urgency=low
+
+  [ Sergei Golovan ]
+  * Upload to unstable.
+
+ -- Erlang Packagers <erlang-pkg-devel@lists.berlios.de>  Wed, 19 Jul 2006 09:48:34 +0400
+
+libsdl-erlang (0.96.0626-1) experimental; urgency=low
+
+  [ Sergei Golovan ]
+  * New upstream version.
+  * Added debian/watch.
+
+ -- Erlang Packagers <erlang-pkg-devel@lists.berlios.de>  Tue, 11 Jul 2006 21:44:59 +0400
+
+libsdl-erlang (0.95.0630-2) unstable; urgency=low
+
+  * New maintainer (Closes:  #368073).
+
+  [ Sergei Golovan ]
+  * Bumped standards version to 3.7.2.
+  * Incorporated non-maintainer upload changes from 0.95.0630-1.1
+    (Closes: #366723, #368357).
+  * Changed Build-Depends and Depends to reflect erlang 10.b.10
+    package structure.
+  * Added get-orig-source target to debian/rules.
+
+ -- Erlang Packagers <erlang-pkg-devel@lists.berlios.de>  Mon, 10 Jul 2006 23:22:12 +0400
+
+libsdl-erlang (0.95.0630-1.1) unstable; urgency=low
+
+  * Non-Maintainer Upload.
+  * Build-depend on libglu1-mesa-dev instead of xlibmesa-glu-dev. 
+    (Closes: #366723)
+
+ -- Frederik Schüler <fs@debian.org>  Sat, 20 May 2006 17:38:41 +0000
+
+libsdl-erlang (0.95.0630-1) unstable; urgency=low
+
+  * New upstream version.
+  * Bumped standards version to 3.6.2.
+
+ -- Will Newton <will@debian.org>  Wed,  6 Jul 2005 13:37:49 +0100
+
+libsdl-erlang (0.94.1025-1) unstable; urgency=low
+
+  * New maintainer.
+  * New upstream version.
+  * Package removed from sarge. (Closes: #305995)
+  * Moved from interpreters to libs section.
+  * Updated standards version.
+  * Removed non-functional postinst and redundant README.Debian. 
+
+ -- Will Newton <will@debian.org>  Thu, 19 May 2005 17:18:25 +0100
+
+libsdl-erlang (0.94.0615-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Mon,  9 Aug 2004 23:43:31 -0700
+
+libsdl-erlang (0.94.0125-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sat,  7 Feb 2004 21:31:13 -0800
+
+libsdl-erlang (0.93.0526-1) unstable; urgency=low
+
+  * New upstream release
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Mon, 23 Jun 2003 23:09:20 -0700
+
+libsdl-erlang (0.93.0314-1) unstable; urgency=low
+
+  * New upstream release.
+  * Fragment_program_arb added as an extension.
+  * Erldemo program now sports bump mapping.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Fri, 16 May 2003 23:10:23 -0700
+
+libsdl-erlang (0.93.0131-2) unstable; urgency=low
+
+  * Correction to postinst.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sat,  8 Feb 2003 23:59:42 -0800
+
+libsdl-erlang (0.93.0131-1) unstable; urgency=low
+
+  * New upstream release
+  * Put erlang files in versioned directory, per Erlang standards.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sat,  8 Feb 2003 23:11:07 -0800
+
+libsdl-erlang (0.91.1009-9) unstable; urgency=low
+
+  * Added build-depends on xlibmesa-glu-dev for autobuilders.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sat,  8 Feb 2003 00:01:06 -0800
+
+libsdl-erlang (0.91.1009-8) unstable; urgency=low
+
+  * Close the final lintian error.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Thu, 30 Jan 2003 21:19:03 -0800
+
+libsdl-erlang (0.91.1009-7) unstable; urgency=low
+
+  * Correct several lintian errors.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Tue, 28 Jan 2003 21:45:03 -0800
+
+libsdl-erlang (0.91.1009-6) unstable; urgency=low
+
+  * Correct build-depends to be Build-Depends-Indep.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Tue, 28 Jan 2003 21:32:25 -0800
+
+libsdl-erlang (0.91.1009-5) unstable; urgency=low
+
+  * Add build-dependency on xlibmesa-gl-dev so GL dependencies are met and
+    autobuilders can build package.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Mon, 27 Jan 2003 23:32:21 -0800
+
+libsdl-erlang (0.91.1009-4) unstable; urgency=low
+
+  * Correct doc-base path, so menu entry takes you to correct documentation.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sat, 14 Dec 2002 23:01:10 -0800
+
+libsdl-erlang (0.91.1009-3) unstable; urgency=low
+
+  * Add Erlang to build-depends.  Whoops!
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Thu, 14 Nov 2002 22:01:46 -0800
+
+libsdl-erlang (0.91.1009-2) unstable; urgency=low
+
+  * Include 'src' files so Wings3D will build.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Sun, 10 Nov 2002 00:12:56 -0800
+
+libsdl-erlang (0.91.1009-1) unstable; urgency=low
+
+  * New upstream release.
+
+ -- Brent A. Fulgham <bfulgham@debian.org>  Thu,  7 Nov 2002 23:28:51 -0800
--- esdl-1.2.orig/debian/erlang-esdl-doc.docs
+++ esdl-1.2/debian/erlang-esdl-doc.docs
@@ -0,0 +1,2 @@
+debian/README.Debian
+Readme
--- esdl-1.2.orig/debian/erlang-esdl-doc.examples
+++ esdl-1.2/debian/erlang-esdl-doc.examples
@@ -0,0 +1 @@
+test/*
--- esdl-1.2.orig/debian/erlang-esdl-doc.install
+++ esdl-1.2/debian/erlang-esdl-doc.install
@@ -0,0 +1 @@
+debian/tmp/usr/lib/erlang/lib/esdl-*/doc/*	usr/share/doc/erlang-esdl-doc/html
--- esdl-1.2.orig/debian/README.source
+++ esdl-1.2/debian/README.source
@@ -0,0 +1,8 @@
+This package uses quilt to manage all modifications to the upstream
+source. Changes are stored in the source package as diffs in
+debian/patches and applied during the build.
+
+To get detailed instructions on how to apply the series of patches
+and modify them, please read /usr/share/doc/quilt/README.source
+
+ -- Sergei Golovan <sgolovan@debian.org>  Sat, 17 Oct 2009 14:29:52 +0400
--- esdl-1.2.orig/debian/erlang-esdl.dirs
+++ esdl-1.2/debian/erlang-esdl.dirs
@@ -0,0 +1 @@
+/usr/share/lintian/overrides
--- esdl-1.2.orig/debian/control
+++ esdl-1.2/debian/control
@@ -0,0 +1,53 @@
+Source: esdl
+Section: libs
+Priority: optional
+Maintainer: Debian Erlang Packagers <pkg-erlang-devel@lists.alioth.debian.org>
+Uploaders: Sergei Golovan <sgolovan@debian.org>
+Build-Depends: debhelper (>= 5.0.0), quilt, erlang-dev (>= 1:14.b.1),
+ libsdl1.2-dev, libsdl-ttf2.0-dev, libsdl-image1.2-dev,
+ libgl1-mesa-dev | libgl-dev, libglu1-mesa-dev | libglu-dev
+Standards-Version: 3.9.2
+Homepage: http://esdl.sourceforge.net
+Vcs-Svn: svn://svn.debian.org//svn/pkg-erlang/libsdl-erlang/trunk/
+Vcs-Browser: http://svn.debian.org/wsvn/pkg-erlang/libsdl-erlang/trunk/
+
+
+Package: erlang-esdl
+Architecture: any
+Depends: ${erlang:Depends}, ${erlang-abi:Depends}, ${shlibs:Depends}, ${misc:Depends}
+Conflicts: libsdl-erlang
+Replaces: libsdl-erlang
+Provides: libsdl-erlang
+Description: Erlang bindings to the Simple Direct Media Library
+ SDL (Simple DirectMedia Layer) is a generic API that provides low
+ level access to audio, keyboard, mouse, and display framebuffer
+ across multiple platforms.
+ .
+ Open Source Erlang is a functional programming language designed at
+ the Ericsson Computer Science Laboratory.
+ .
+ ESDL is an Erlang binding to the SDL, and might be used to write
+ multimedia application in Erlang.
+
+Package: erlang-esdl-dev
+Section: devel
+Architecture: all
+Depends: erlang-esdl (>= ${source:Version}), ${shlibs:Depends}, ${misc:Depends}
+Suggests: erlang-esdl-doc
+Description: Erlang bindings to the SDL (development files)
+ ESDL is an Erlang binding to the SDL, and might be used to write
+ multimedia application in Erlang.
+ .
+ This package includes ESDL headers which are necessary to build Erlang
+ applications which use ESDL.
+
+Package: erlang-esdl-doc
+Section: doc
+Architecture: all
+Depends: ${shlibs:Depends}, ${misc:Depends}
+Suggests: erlang-esdl
+Description: Erlang bindings to the SDL (documentation)
+ ESDL is an Erlang binding to the SDL, and might be used to write
+ multimedia application in Erlang.
+ .
+ This package includes ESDL documentation and examples.
--- esdl-1.2.orig/debian/README.Debian
+++ esdl-1.2/debian/README.Debian
@@ -0,0 +1,16 @@
+ESDL Debian README
+
+ESDL is a library which provides Erlang bindings to Simple Direct Media
+Library. Since version 1.2-1 it installs into /usr/lib/erlang/lib directory
+tree which allows one to use ESDL without any additional command line
+options. For example, in
+/usr/share/doc/erlang-esdl-doc/examples directory (provided that
+erlang-esdl-doc package is installed) you may run:
+
+erl -smp enable -s erldemo go
+
+and get a simple nice ESDL demo. Note that since version 1.2 ESDL uses
+wxErlang which doesn't work without SMP, so it's better to add -smp enable
+option.
+
+ -- Sergei Golovan <sgolovan@debian.org>  Wed, 21 Dec 2011 15:18:16 +0400
--- esdl-1.2.orig/debian/rules
+++ esdl-1.2/debian/rules
@@ -0,0 +1,130 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+
+export HOME := $(CURDIR)/debian
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+export QUILT_PATCHES := debian/patches
+
+-include vsn.mk
+TOPDIR := $(CURDIR)/debian/tmp
+PACKAGEDIR := /usr/lib/erlang/lib/$(ESDL_VSN)
+
+patch: patch-stamp
+patch-stamp:
+	dh_testdir
+	quilt push -a || test $$? = 2
+	touch patch-stamp
+
+unpatch: patch-stamp
+	dh_testdir
+	quilt pop -a || test $$? = 2
+	rm -rf .pc
+	rm -f patch-stamp
+
+build: build-indep build-arch
+build-indep: config-stamp build-stamp
+build-arch: config-stamp build-stamp
+build-stamp:
+	dh_testdir
+	#
+	$(MAKE) ENABLE_SDL_TTF=yes ENABLE_SDL_IMAGE=yes
+	#
+	touch build-stamp
+
+config: config-stamp
+config-stamp: patch-stamp
+	touch config-stamp
+
+clean: clean-patched unpatch
+	dh_testdir
+	dh_testroot
+	dh_clean
+
+clean-patched: patch-stamp
+	dh_testdir
+	dh_testroot
+	rm -f build-stamp install-stamp config-stamp
+	#
+	# Add here commands to clean up after the build process.
+	$(MAKE) clean ENABLE_SDL_TTF=yes ENABLE_SDL_IMAGE=yes
+	#
+	find . -name \*~ -exec rm {} \;
+	find . -name erl_crash.dump -exec rm {} \;
+
+install: install-stamp
+install-stamp: build-stamp
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	mkdir -m 755 -p $(TOPDIR)$(PACKAGEDIR)
+	#
+	# Add here commands to install the package into debian/tmp.
+	$(MAKE) install ENABLE_SDL_TTF=yes ENABLE_SDL_IMAGE=yes \
+			INSTALLDIR=$(TOPDIR)$(PACKAGEDIR)
+	#
+	rm -f $(TOPDIR)$(PACKAGEDIR)/Readme*
+	rm -f $(TOPDIR)$(PACKAGEDIR)/license.terms
+	rm -f $(TOPDIR)$(PACKAGEDIR)/vsn
+	#
+	chmod a-x $(TOPDIR)$(PACKAGEDIR)/doc/*
+	chmod a-x $(TOPDIR)$(PACKAGEDIR)/src/*
+	chmod a-x $(TOPDIR)$(PACKAGEDIR)/c_src/*
+	chmod a-x $(TOPDIR)$(PACKAGEDIR)/include/*
+	#
+	touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build-stamp install-stamp
+	dh_testdir -i
+	dh_testroot -i
+	dh_installdirs -i
+	dh_install -i
+	dh_installdocs -i
+	dh_installexamples -i
+	chmod a-x $(CURDIR)/debian/erlang-esdl-doc/usr/share/doc/erlang-esdl-doc/examples/*
+	dh_installchangelogs -i
+	dh_strip -i
+	dh_compress -i -X.erl -X.beam -X.wav -X.bmp
+	dh_fixperms -i
+	dh_makeshlibs -i
+	dh_installdeb -i
+	dh_shlibdeps -i
+	erlang-depends -i
+	dh_gencontrol -i
+	dh_md5sums -i
+	dh_builddeb -i
+
+# Build architecture-dependent files here.
+binary-arch: build-stamp install-stamp
+	dh_testdir -a
+	dh_testroot -a
+	dh_installdirs -a
+	dh_install -a
+	dh_installdocs -a
+	dh_installexamples -a
+	dh_installchangelogs -a
+	install debian/erlang-esdl.lintian-overrides \
+		$(CURDIR)/debian/erlang-esdl/usr/share/lintian/overrides/erlang-esdl
+	dh_strip -a
+	dh_compress -a -X.erl -X.beam -X.wav -X.bmp
+	dh_fixperms -a
+	dh_makeshlibs -a
+	dh_installdeb -a
+	dh_shlibdeps -a
+	erlang-depends -a
+	dh_gencontrol -a
+	dh_md5sums -a
+	dh_builddeb -a
+
+binary: binary-indep binary-arch
+
+# Probably it's not good to use one particular sf.net mirror
+get-orig-source:
+	wget -O esdl_1.2.orig.tar.gz \
+	        http://heanet.dl.sourceforge.net/sourceforge/esdl/esdl-1.2.src.tar.gz
+
+.PHONY: build build-indep build-arch clean binary-indep binary-arch binary install get-orig-source \
+	clean-patched patch unpatch
--- esdl-1.2.orig/debian/erlang-esdl-dev.install
+++ esdl-1.2/debian/erlang-esdl-dev.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/erlang/lib/esdl-*/include
+debian/tmp/usr/lib/erlang/lib/esdl-*/src/*.hrl
--- esdl-1.2.orig/debian/erlang-esdl.lintian-overrides
+++ esdl-1.2/debian/erlang-esdl.lintian-overrides
@@ -0,0 +1 @@
+erlang-esdl: virtual-package-depends-without-real-package-depends
--- esdl-1.2.orig/debian/erlang-esdl.install
+++ esdl-1.2/debian/erlang-esdl.install
@@ -0,0 +1,2 @@
+debian/tmp/usr/lib/erlang/lib/esdl-*/ebin
+debian/tmp/usr/lib/erlang/lib/esdl-*/priv
--- esdl-1.2.orig/debian/patches/series
+++ esdl-1.2/debian/patches/series
@@ -0,0 +1,3 @@
+driver.patch
+gl.patch
+pic.patch
--- esdl-1.2.orig/debian/patches/gl.patch
+++ esdl-1.2/debian/patches/gl.patch
@@ -0,0 +1,23 @@
+Patch removes unused includes of gl.hrl which in turn was moved to the
+wxErlang.
+
+--- esdl-1.2.orig/src/sdl_img.erl
++++ esdl-1.2/src/sdl_img.erl
+@@ -16,7 +16,6 @@
+ -module(sdl_img).
+ 
+ -include("sdl_img_funcs.hrl").
+--include("gl.hrl").
+ -include("sdl_util.hrl").
+ -include("sdl_video.hrl").
+ 
+--- esdl-1.2.orig/src/sdl_ttf.erl
++++ esdl-1.2/src/sdl_ttf.erl
+@@ -16,7 +16,6 @@
+ 
+ -include("sdl_ttf.hrl").
+ -include("sdl_ttf_funcs.hrl").
+--include("gl.hrl").
+ -include("sdl_util.hrl").
+ -include("sdl_video.hrl").
+ 
--- esdl-1.2.orig/debian/patches/pic.patch
+++ esdl-1.2/debian/patches/pic.patch
@@ -0,0 +1,18 @@
+
+--- esdl-1.2.orig/c_src/Makefile
++++ esdl-1.2/c_src/Makefile
+@@ -43,12 +43,12 @@
+   INCS                  = $(GL_INCS) $(SDL_INCS)  $(SDL_TTF_INCS) \
+                           $(SDL_IMAGE_INCS) $(ERL_INCS)
+ 
+-  CFLAGS		= -g -O2 -funroll-loops -Wall -ffast-math -fpic \
++  CFLAGS		= -g -O2 -funroll-loops -Wall -ffast-math -fPIC \
+ 			-fomit-frame-pointer $(USE_GL_INCLUDE_DIR) -DSHM \
+                         $(USE_SDL_TTF) $(USE_SDL_IMAGE) \
+ 			-DPTHREADS $(INCS)
+ 
+-  CLINKFLAGS 		=  -fpic -shared  
++  CLINKFLAGS 		=  -fPIC -shared  
+ 
+   SOEXT = so
+ 
--- esdl-1.2.orig/debian/patches/driver.patch
+++ esdl-1.2/debian/patches/driver.patch
@@ -0,0 +1,103 @@
+Patch fixes esdl_driver loading into Erlang R15B.
+
+--- esdl-1.2.orig/c_src/esdl_driver.c
++++ esdl-1.2/c_src/esdl_driver.c
+@@ -32,15 +32,20 @@
+ 
+ #include "esdl.h"
+ 
++#if ERL_DRV_EXTENDED_MAJOR_VERSION < 2
++typedef int ErlDrvSizeT;
++typedef int ErlDrvSSizeT;
++#endif
++
+ #define TEMP_BINARY_SIZE 512
+ 
+ static ErlDrvData sdl_driver_start(ErlDrvPort port, char *buff);
+ static void sdl_driver_stop(ErlDrvData handle);
+ static void sdl_driver_finish(void);
+-static int sdl_driver_control(ErlDrvData handle, unsigned int command, 
+-			      char* buf, int count, char** res, int res_size);
+-static int sdl_driver_debug_control(ErlDrvData handle, unsigned int command, 
+-				    char* buf, int count, char** res, int res_size);
++static ErlDrvSSizeT sdl_driver_control(ErlDrvData handle, unsigned int command, 
++			      char* buf, ErlDrvSizeT count, char** res, ErlDrvSizeT res_size);
++static ErlDrvSSizeT sdl_driver_debug_control(ErlDrvData handle, unsigned int command, 
++				    char* buf, ErlDrvSizeT count, char** res, ErlDrvSizeT res_size);
+ 
+ static void standard_outputv(ErlDrvData drv_data, ErlIOVec *ev);
+ 
+@@ -62,6 +67,17 @@
+     sdl_driver_control,    /* F_PTR control, port_control callback */
+     NULL,                  /* F_PTR timeout, reserved */
+     standard_outputv,	   /* F_PTR outputv, reserved */
++    NULL,
++    NULL,
++    NULL,
++    NULL,
++    ERL_DRV_EXTENDED_MARKER,
++    ERL_DRV_EXTENDED_MAJOR_VERSION,
++    ERL_DRV_EXTENDED_MINOR_VERSION,
++    0,
++    NULL,
++    NULL,
++    NULL
+ };
+ 
+ DRIVER_INIT(sdl_driver)
+@@ -176,9 +192,9 @@
+ {
+ }
+ 
+-static int
++static ErlDrvSSizeT
+ sdl_driver_control(ErlDrvData handle, unsigned op,
+-		   char* buf, int count, char** res, int res_size)
++		   char* buf, ErlDrvSizeT count, char** res, ErlDrvSizeT res_size)
+ {
+   sdl_data* sd = (sdl_data *) handle;
+   sdl_fun func;
+@@ -190,7 +206,7 @@
+   if(op < OPENGL_START) {
+      // fprintf(stderr, "Command:%d:%s: ", op, sd->str_tab[op]);fflush(stderr);
+      func = sd->fun_tab[op];
+-     func(sd, count, buf);
++     func(sd, (int)count, buf);
+   } else {
+       // fprintf(stderr, "Command:%d:gl_??\r\n", op); fflush(stderr);
+      gl_dispatch(sd, op, count, buf);
+@@ -198,12 +214,12 @@
+   }
+   // fprintf(stderr, "%s:%d: Eed %d\r\n", __FILE__,__LINE__,op); fflush(stderr);
+   (*res) = sd->buff;
+-  return sd->len;
++  return (ErlDrvSSizeT)(sd->len);
+ }
+ 
+-static int
++static ErlDrvSSizeT
+ sdl_driver_debug_control(ErlDrvData handle, unsigned op,
+-			 char* buf, int count, char** res, int res_size)
++			 char* buf, ErlDrvSizeT count, char** res, ErlDrvSizeT res_size)
+ {
+   sdl_data* sd = (sdl_data *) handle;
+   sdl_fun func;
+@@ -215,15 +231,15 @@
+   if(op < OPENGL_START) {
+      fprintf(stderr, "Command:%d:%s: ", op, sd->str_tab[op]);fflush(stderr);
+      func = sd->fun_tab[op];
+-     func(sd, count, buf);
++     func(sd, (int)count, buf);
+      if ((len = sd->len) >= 0) {
+ 	fprintf(stderr, "ok %d %p\r\n", len, sd->buff);fflush(stderr);
+ 	(*res) = sd->buff;
+-	return len;
++	return (ErlDrvSSizeT)len;
+      } else {
+ 	fprintf(stderr, "error\r\n");fflush(stderr);
+ 	*res = 0;
+-	return -1;
++	return (ErlDrvSSizeT)(-1);
+      }     
+   } else {
+       fprintf(stderr, "Command:%d ", op);fflush(stderr);
