]> git.saurik.com Git - wxWidgets.git/blobdiff - debian/rules
documented that Freeze and Thaw are now recursive
[wxWidgets.git] / debian / rules
index 3e9d62b5e50671e7f806cd1db0533e857d3c380f..c2bf0f94937fe3f18851fc778907cc933f0ff670 100755 (executable)
@@ -5,24 +5,20 @@
 # variously stolen code :-)
 # It makes copious use of the debhelper utilities written by
 # Joey Hess and others.
+#
+# Significantly hacked up in July 2007 by Robin Dunn
+#
 
 #export DH_VERBOSE=1
 export DH_OPTIONS
 
 ifdef CONCURRENCY_LEVEL
-
   # A user who knows what they want, that's like gold...
   # respect their precious opinion of how much blue smoke to use.
   JOB_COUNT := $(CONCURRENCY_LEVEL)
-
 else ifdef DISTCC_HOSTS
-
  # Otherwise, if they have a cluster, try to put it to good use.
   JOB_COUNT := $(shell set $${DISTCC_HOSTS} > /dev/null 2>&1 ; echo $$\#)
-
- # Not much faster, but it might keep you warm in winter...
- #JOB_COUNT := $(shell set $${DISTCC_HOSTS} > /dev/null 2>&1 ; echo $$(($$\# + $$\#)))
-
 endif
 
 ifdef JOB_COUNT
@@ -31,8 +27,17 @@ else
   FAST_MAKE = $(MAKE)
 endif
 
--include debian/python-version
 
+# Find the python version(s) to build for
+PYVERS := $(shell pyversions -vr || pyversions -vs)
+ifeq ($(strip $(PYVERS)),)
+    PYVERS := $(shell python -c 'import sys; print sys.version[:3]')
+    NO_PYCENTRAL = 1
+    PY_BUILD_DEPS = python$(PYVERS), python$(PYVERS)-dbg, python$(PYVERS)-dev
+else
+    DEB_PYTHON_SYSTEM=pycentral
+    PY_BUILD_DEPS = python-all, python-all-dbg, python-all-dev, python-central
+endif
 
 # If another source package is to supply the common binary packages
 # for a particular Debian release, then define this variable to indicate
@@ -40,8 +45,7 @@ endif
 # all if this is to be the default (or only) wx source package for the
 # target release.
 #
-# for etch:
-#DEBIAN_WX_DEFAULT_VERSION = 2.6
+#DEBIAN_WX_DEFAULT_VERSION = 2.8
 
 
 # This will extract a flavour out of the name of the source directory
@@ -56,7 +60,14 @@ endif
 # to correctly set the release below.
 DEBIAN_WXFLAVOUR := $(shell pwd | sed -e 's@.*/wxwidgets[0-9.]\+-\?\(.*\)-[0-9.]\+-\?.*@\1@')
 
-release   := $(shell dpkg-parsechangelog | sed -n 's/^Source: wxwidgets//p')
+
+wx_major_version_number := $(shell sed -n 's/^wx_major_version_number=//p' configure.in)
+wx_minor_version_number := $(shell sed -n 's/^wx_minor_version_number=//p' configure.in)
+wx_release_number       := $(shell sed -n 's/^wx_release_number=//p' configure.in)
+wx_subrelease_number    := $(shell sed -n 's/^wx_subrelease_number=//p' configure.in)
+
+##release   := $(shell dpkg-parsechangelog | sed -n 's/^Source: wxwidgets//p' | sed 's/-ansi//')
+release  := $(wx_major_version_number).$(wx_minor_version_number)
 
 # This is broken completely now by bakefiles changes.  Until we add
 # some hocus pocus to the main tree, to export these values from it
@@ -67,13 +78,20 @@ release   := $(shell dpkg-parsechangelog | sed -n 's/^Source: wxwidgets//p')
 soversion := 0
 sorelease := $(release:%-$(DEBIAN_WXFLAVOUR)=%)-$(soversion)$(addprefix -,$(DEBIAN_WXFLAVOUR))
 
+# In some places we use the full version number, including the micro version,
+# for the development releases (which can be incompatible for the same major
+# and minor version) but just the major.minor for the stable releases (which
+# are supposed to be compatible), this variable contains the appropriate value
+ifeq ($(shell echo `echo $(release) | sed 's/.\+\.\(.\+\)/\1/'`%2 | bc),1)
+    # development release
+    compatible_release := $(release).$(wx_release_number)
+else
+    compatible_release := $(release)
+endif
+
 # Base value for alternative priorities.
 alt_prio  := $(subst .,,$(release))
 
-pytoolkit := gtk2
-pydir     := usr/lib/$(python_ver)/site-packages
-wxpydir   := $(pydir)/wx-$(release)-$(pytoolkit)-unicode
-
 cross_host  := i586-mingw32msvc
 cross_build := $(shell ./config.guess)
 
@@ -81,21 +99,69 @@ config_cache       = ../config_deb.cache
 config_cache_cross = ../config_deb_cross.cache
 
 
-# Packages to build:
-package_wxbase_lib      := libwxbase$(sorelease)
-package_wxbase_dev      := libwxbase$(release)-dev
-package_wxbase_dbg      := libwxbase$(release)-dbg
+# build options
+COMMON_CONFIGURE_OPTIONS = \
+    --prefix=/usr \
+    --cache-file=$(config_cache) \
+    --with-flavour=$(DEBIAN_WXFLAVOUR) \
+    --with-zlib=sys \
+    --disable-reserved_virtual \
 
-package_gtk_lib         := libwxgtk$(sorelease)
-package_gtk_dev         := libwxgtk$(release)-dev
-package_gtk_dbg         := libwxgtk$(release)-dbg
+BASE_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
+    --disable-gui \
 
+GTK_CONFIGURE_OPTIONS = $(COMMON_CONFIGURE_OPTIONS) \
+    --with-gtk \
+    --enable-mediactrl \
+    --enable-sound \
+    --with-sdl \
+    --enable-display \
+    --enable-geometry \
+    --enable-graphics_ctx \
+    --with-libjpeg=sys \
+    --with-libpng=sys \
+    --with-libtiff=sys \
 
 
+pytoolkit := gtk2
+PY_WX_CONFIG_OPTIONS = --version=$(release) --toolkit=$(pytoolkit) --static=no
 
-package_gtk_py_lib      := python-wxgtk$(release)
-package_gtk_py_ver       = python-wxversion
-package_gtk_py_tools     = python-wxtools
+WX_UNICODE := 1
+WX_OPENGL := 1
+
+ifeq ($(WX_UNICODE),1)
+    COMMON_CONFIGURE_OPTIONS += --enable-unicode
+    PY_WX_CONFIG_OPTIONS += --unicode
+    PY_UNICODE = UNICODE=1
+    wxpydir := wx-$(compatible_release)-$(pytoolkit)-unicode
+
+    # for compatibility with the existing 2.6 packages, we don't use "u" in
+    # the Unicode (default) package names
+    unicode_suffix :=
+else
+    # but we do need to use something for non-Unicode packages to distinguish
+    # them
+    unicode_suffix := -ansi
+    PY_UNICODE = UNICODE=0
+    wxpydir   := wx-$(compatible_release)-$(pytoolkit)
+endif
+
+ifeq ($(WX_OPENGL),1)
+    GTK_CONFIGURE_OPTIONS += --with-opengl
+else
+    GTK_CONFIGURE_OPTIONS += --without-opengl
+endif
+
+#---------------------------------------------------------------------------
+# Packages to build
+
+package_wxbase_lib      := libwxbase$(sorelease)$(unicode_suffix)
+package_wxbase_dev      := libwxbase$(release)$(unicode_suffix)-dev
+package_wxbase_dbg      := libwxbase$(release)$(unicode_suffix)-dbg
+
+package_gtk_lib         := libwxgtk$(sorelease)$(unicode_suffix)
+package_gtk_dev         := libwxgtk$(release)$(unicode_suffix)-dev
+package_gtk_dbg         := libwxgtk$(release)$(unicode_suffix)-dbg
 
 package_headers         := wx$(release)-headers
 package_i18n            := wx$(release)-i18n
@@ -103,31 +169,33 @@ package_doc             := wx$(release)-doc
 package_examples        := wx$(release)-examples
 package_common           = wx-common
 
-# The packages listed here are common to all wx versions, and may be provided
-# by another source package if more than one is in the release simultaneously.
-common_packages        := $(package_common) $(package_gtk_py_ver) $(package_gtk_py_tools)
-
+package_gtk_py_lib      := python-wxgtk$(release)$(unicode_suffix)
+package_gtk_py_ver       = python-wxversion
+package_gtk_py_tools     = python-wxtools
+package_gtk_py_addons    = python-wxaddons
+package_gtk_dbg_py      := python-wxgtk$(release)$(unicode_suffix)-dbg
 
-package_gtk_dbg_py      := python-wxgtk$(release)-dbg
 
+# The packages listed here are common to all wx versions, and may be provided
+# by another source package if more than one is in the release simultaneously.
+common_packages        := $(package_common) $(package_gtk_py_ver) $(package_gtk_py_tools) $(package_gtk_py_addons)
 
 
-package_msw_dev         := libwxmsw$(release)-dev
-package_msw_dbg         := libwxmsw$(release)-dbg
+package_msw_dev         := libwxmsw$(release)$(unicode_suffix)-dev
+package_msw_dbg         := libwxmsw$(release)$(unicode_suffix)-dbg
 package_headers_msw     := wx$(release)-headers-msw
 
 # The packages listed here will not be built by default.
-extra_packages := $(package_gtk_dbg_py)                                      \
-                 $(package_msw_dev) $(package_msw_dbg) $(package_headers_msw)
+extra_packages := $(package_msw_dev) $(package_msw_dbg) $(package_headers_msw)
 
 ifdef DEBIAN_WX_DEFAULT_VERSION
-
   extra_packages += $(common_packages)
-
 endif
 
 
-# Build directories:
+#---------------------------------------------------------------------------
+# Build directories
+
 objdir_wxbase_shared       = objs_wxbase_sh
 objdir_wxbase_debug        = objs_wxbase_d
 objdir_gtk_shared          = objs_gtk_sh
@@ -149,6 +217,9 @@ objdirs := $(objdir_wxbase_shared) $(objdir_wxbase_debug)                  \
           $(objdir_msw_shared) $(objdir_msw_static) $(objdir_msw_dbg)     \
           $(objdir_msw_install)
 
+#---------------------------------------------------------------------------
+# Build stamps:
+
 #      note that the i18n package is actually arch indep (once built)
 #      but must be built (and installed) during the arch any phase as
 #      it's pulled out of the wxGTK shared lib package.
@@ -157,11 +228,10 @@ objdirs := $(objdir_wxbase_shared) $(objdir_wxbase_debug)                  \
 #       all files for it are installed during the arch any phase.
 
 
-# Build stamps:
 build_arch_stamps = build-wxbase-shared-stamp build-wxbase-debug-stamp    \
                     build-gtk-shared-stamp build-gtk-shared-contrib-stamp \
                     build-gtk-debug-stamp build-gtk-debug-contrib-stamp   \
-                    build-i18n-stamp build-gtk-py-stamp
+                    build-i18n-stamp build-gtk-py-stamp build-gtk-dbg-py-stamp
 
 build_indep_stamps = build-examples-stamp build-doc-stamp
 
@@ -172,16 +242,14 @@ build_stamps_native := $(build_arch_stamps) $(build_indep_stamps)
 build_stamps := $(build_stamps_native) $(build_cross_stamps)
 
 
+#---------------------------------------------------------------------------
 # Install targets:
-install_all_arch = install-wxbase-lib install-wxbase-dev install-wxbase-dbg  \
-                   install-gtk-lib install-gtk-dev install-gtk-dbg        \
-                   install-headers install-i18n            \
-                   install-gtk-py
+install_all_arch = install-wxbase-lib install-wxbase-dev install-wxbase-dbg    \
+                   install-gtk-lib install-gtk-dev install-gtk-dbg             \
+                   install-headers install-i18n install-gtk-py install-gtk-dbg-py
 
 ifndef DEBIAN_WX_DEFAULT_VERSION
-
   install_all_arch += install-common
-
 endif
 
 install_all_indep = install-examples install-doc
@@ -193,27 +261,15 @@ install_all_native := $(install_all_arch) $(install_all_indep)
 install_all := $(install_all_native) $(install_all_cross)
 
 
-# wxPython uses this to build in-tree
-wxconfig     := $(shell pwd)/$(objdir_gtk_shared)/wx-config --no_rpath
-wxconfig-dbg := $(shell pwd)/$(objdir_gtk_debug)/wx-config --no_rpath
-
-# and this after it is installed.
-py_wxconfig  := wx-config --version=$(release) --toolkit=$(pytoolkit)     \
-                         --unicode --debug=no --static=no
-pyd_wxconfig := wx-config --version=$(release) --toolkit=$(pytoolkit)     \
-                         --unicode --debug --static=no
-
-
-#contrib_libs := $(subst CVS,,$(notdir $(wildcard contrib/include/wx/*)))
 
+#---------------------------------------------------------------------------
+# Setup Rules:
 
-# The Rules:
-
-debian/python-version:
-       echo python_ver := python$(shell python -c "import sys;print sys.version[:3]") > $@
-
-debian/control: $(addprefix debian/,control.in python-version)
-       sed -e 's/=V/$(release)/g;s/=SOV/$(sorelease)/g;s/=PY/$(python_ver)/g'\
+debian/control: debian/control.in debian/rules
+       sed -e 's/=V/$(release)/g;                                          '\
+'               s/=SOV/$(sorelease)/g;                                      '\
+'               s/=U/$(unicode_suffix)/g;                                   '\
+'               s/=PY_BUILD_DEPS/$(PY_BUILD_DEPS)/g                         '\
                < debian/control.in > debian/control
 
 control-files-stamp: debian/control
@@ -248,21 +304,13 @@ control-files-stamp: debian/control
        done;
        @for f in docs postinst prerm; do                                    \
                echo "generating control file $(package_gtk_py_lib).$$f";    \
-               sed -e 's/=PY/$(python_ver)/g;                              '\
+               sed -e 's/=PYVERS/$(PYVERS)/g;                              '\
 '                      s|=WXPYDIR|$(wxpydir)|g;                            '\
 '                      s/=V/$(release)/g;                                  '\
 '                      s/=PRIO/$(alt_prio)/g'                               \
                        < debian/python-wxgtk.$$f                            \
                        > debian/$(package_gtk_py_lib).$$f;                  \
        done;
-       @for f in postinst prerm; do                                         \
-               echo "generating control file $(package_gtk_dbg_py).$$f";    \
-               sed -e 's/=PY/$(python_ver)/g;                              '\
-'                      s/=V/$(release)/g;                                  '\
-'                      s/=PRIO/$(alt_prio)/g'                               \
-                       < debian/python-wxgtk-dbg.$$f                        \
-                       > debian/$(package_gtk_dbg_py).$$f;                  \
-       done;
        @echo "generating control file $(package_gtk_dbg_py).docs";
        @cp debian/python-wxgtk.docs debian/$(package_gtk_dbg_py).docs;
        @for f in docs doc-base; do                                          \
@@ -300,6 +348,9 @@ control-files-stamp: debian/control
                        > debian/lintian-override;                           \
        touch $@
 
+#---------------------------------------------------------------------------
+# wx Build rules
+
 build_arch: control-files-stamp $(build_arch_stamps)
 build_all: control-files-stamp $(build_stamps_native)
 
@@ -316,19 +367,16 @@ build: build_arch
 # libwxbase.  We need to configure it here in order to get the correct
 # config files to use it alone, but there is no point building it as the
 # wxgtk build is going to do that again anyway.  We'll move the relevant
-# files out when that is done.
+# files out when that is done.  
+#
+# TODO: Is this still necessary?  Can we just take the wxbase files
+# from the wxgui build now without special treatment?
 
 configure-wxbase-shared-stamp:
        dh_testdir
        mkdir -p $(objdir_wxbase_shared)
-       cd $(objdir_wxbase_shared)                                      \
-               && ../configure --prefix=/usr                           \
-                               --cache-file=$(config_cache)            \
-                               --with-flavour=$(DEBIAN_WXFLAVOUR)      \
-                               --disable-gui                           \
-                               --with-zlib=sys                         \
-                               --enable-unicode                        \
-                               --disable-reserved_virtual
+       cd $(objdir_wxbase_shared) \
+           && ../configure $(BASE_CONFIGURE_OPTIONS)
        touch $@
 
 build-wxbase-shared-stamp: configure-wxbase-shared-stamp
@@ -341,14 +389,7 @@ configure-wxbase-debug-stamp:
        dh_testdir
        mkdir -p $(objdir_wxbase_debug)
        cd $(objdir_wxbase_debug)                                       \
-               && ../configure --prefix=/usr                           \
-                               --cache-file=$(config_cache)            \
-                               --with-flavour=$(DEBIAN_WXFLAVOUR)      \
-                               --disable-gui                           \
-                               --enable-debug                          \
-                               --with-zlib=sys                         \
-                               --enable-unicode                        \
-                               --disable-reserved_virtual
+           && ../configure $(BASE_CONFIGURE_OPTIONS) --enable-debug
        touch $@
 
 build-wxbase-debug-stamp: configure-wxbase-debug-stamp
@@ -361,18 +402,7 @@ configure-gtk-shared-stamp:
        dh_testdir
        mkdir -p $(objdir_gtk_shared)
        cd $(objdir_gtk_shared) \
-               && ../configure --prefix=/usr                           \
-                               --cache-file=$(config_cache)            \
-                               --with-flavour=$(DEBIAN_WXFLAVOUR)      \
-                               --with-gtk                              \
-                               --with-opengl                           \
-                               --with-gnomeprint                       \
-                               --with-zlib=sys                         \
-                               --with-libjpeg=sys                      \
-                               --with-libpng=sys                       \
-                               --with-libtiff=sys                      \
-                               --enable-unicode                        \
-                               --disable-reserved_virtual
+           && ../configure $(GTK_CONFIGURE_OPTIONS)
        touch $@
 
 build-gtk-shared-stamp: configure-gtk-shared-stamp
@@ -385,19 +415,7 @@ configure-gtk-debug-stamp:
        dh_testdir
        mkdir -p $(objdir_gtk_debug)
        cd $(objdir_gtk_debug) \
-               && ../configure --prefix=/usr                           \
-                               --cache-file=$(config_cache)            \
-                               --with-flavour=$(DEBIAN_WXFLAVOUR)      \
-                               --with-gtk                              \
-                               --with-opengl                           \
-                               --with-gnomeprint                       \
-                               --with-zlib=sys                         \
-                               --with-libjpeg=sys                      \
-                               --with-libpng=sys                       \
-                               --with-libtiff=sys                      \
-                               --enable-debug                          \
-                               --enable-unicode                        \
-                               --disable-reserved_virtual
+           && ../configure $(GTK_CONFIGURE_OPTIONS) --enable-debug
        touch $@
 
 build-gtk-debug-stamp: configure-gtk-debug-stamp
@@ -432,26 +450,36 @@ build-gtk-py-stamp: build-gtk-shared-stamp purge-dbg-py
                && $(python_ver) ./setup.py     build                   \
                                                WX_CONFIG='$(wxconfig)' \
                                                WXPORT=$(pytoolkit)     \
-                                               UNICODE=1               \
+                                               $(PY_UNICODE)           \
                                                FLAVOUR=$(DEBIAN_WXFLAVOUR)
        touch $@
 
 build-doc-stamp: build-gtk-shared-stamp
        dh_testdir
-       cd $(objdir_gtk_shared)/utils/tex2rtf/src && $(FAST_MAKE)
-       rm -rf $(objdir_doc)
-       rm -rf $(objdir_doc_cruft)
-       mkdir $(objdir_doc)
-       mkdir $(objdir_doc_cruft)
-       cd $(objdir_doc_cruft) \
-               && LD_LIBRARY_PATH=../$(objdir_gtk_shared)/lib:$(LD_LIBRARY_PATH) \
-                  ../$(objdir_gtk_shared)/utils/tex2rtf/src/tex2rtf              \
-                  ../docs/latex/wx/manual.tex                                    \
-                  ../$(objdir_doc)/wx$(release)-manual.html                      \
-                  -twice -html
-       cp docs/latex/wx/*.gif $(objdir_doc)
-       rm -rf $(objdir_doc_cruft)
-       rm -f $(objdir_doc)/wx$(release)-manual.{con,hh*,htx,ref}
+       # the tarball may already have the generated docs in it
+       if [ ! -e docs/html/wx/index.html ]; then \
+               cd $(objdir_gtk_shared)/utils/tex2rtf/src && $(FAST_MAKE); \
+               cd -; \
+               rm -rf $(objdir_doc); \
+               rm -rf $(objdir_doc_cruft); \
+               mkdir $(objdir_doc); \
+               mkdir $(objdir_doc_cruft); \
+               cd $(objdir_doc_cruft); \
+               LD_LIBRARY_PATH=../$(objdir_gtk_shared)/lib:$(LD_LIBRARY_PATH) \
+                  ../$(objdir_gtk_shared)/utils/tex2rtf/src/tex2rtf           \
+                  ../docs/latex/wx/manual.tex                                 \
+                  ../$(objdir_doc)/wx$(release)-manual.html                   \
+                  -twice -html;                                               \
+               cd -; \
+               cp docs/latex/wx/*.gif $(objdir_doc); \
+               rm -rf $(objdir_doc_cruft); \
+               rm -f $(objdir_doc)/wx$(release)-manual.{con,hh*,htx,ref}; \
+       else \
+               echo Copying docs...; \
+               mkdir -p $(objdir_doc); \
+               cp docs/html/wx/* $(objdir_doc); \
+               mv $(objdir_doc)/index.html $(objdir_doc)/wx-$(release)-manual_contents.html; \
+       fi
        touch $@
 
 build-examples-stamp: build-gtk-shared-stamp
@@ -504,7 +532,7 @@ build-gtk-dbg-py-stamp: build-gtk-debug-stamp purge-release-py
                && $(python_ver) ./setup.py build                       \
                                            WX_CONFIG='$(wxconfig-dbg)' \
                                            WXPORT=$(pytoolkit)         \
-                                           UNICODE=1                   \
+                                           $(PY_UNICODE)               \
                                            FLAVOUR=$(addsuffix -,$(DEBIAN_WXFLAVOUR))dbg
        touch $@
 
@@ -559,16 +587,12 @@ build-msw-dbg-stamp: configure-msw-dbg-stamp
        cd $(objdir_msw_dbg) && $(FAST_MAKE)
        touch $@
 
+#---------------------------------------------------------------------------
+# Cleaning rules
 
 clean-py:
-       cd wxPython && rm -rf licence build* docs/xml-raw wx/*.py
+       cd wxPython && rm -rf licence build* docs/xml-raw wx/*.py src/__version__.py
 
-       # What to do about src/__version__.py ???
-
-
-# We do the equivalent of this above by removing build, unfortunately
-# its not enough by itself to get the tree properly clean again.
-#              && ./setup.py clean
 
 clean: debian/control clean-py
        dh_testdir
@@ -595,6 +619,12 @@ clean: debian/control clean-py
        rm -f debian/$(package_msw_dbg).*
        rm -f debian/lintian-override
        rm -f debian/unpack_examples.sh
+       find -name '*.py[co]' | xargs -r rm -f
+       rm -rf include/wx-$(release)
+
+
+#---------------------------------------------------------------------------
+# wx Install Rules
 
 install_arch: build_arch $(install_all_arch)
 
@@ -684,7 +714,7 @@ install-gtk-py-lib: build-gtk-py-stamp
                              WX_CONFIG='$(wxconfig)'                           \
                              SYS_WX_CONFIG='$(py_wxconfig)'                    \
                              WXPORT=$(pytoolkit)                               \
-                             UNICODE=1                                         \
+                             $(PY_UNICODE)                                     \
                              FLAVOUR=$(DEBIAN_WXFLAVOUR)
 
        mv debian/$(package_gtk_py_lib)/$(pydir)/wx.pth                         \
@@ -708,6 +738,8 @@ else
        rm debian/$(package_gtk_py_lib)/$(pydir)/wxversion.py
 endif
 
+
+
 install-gtk-py-tools: DH_OPTIONS=-p$(package_gtk_py_tools)
 install-gtk-py-tools: install-gtk-py-ver
        dh_testdir
@@ -746,7 +778,20 @@ endif
 
        rm -r debian/$(package_gtk_py_lib)/usr/bin
 
-install-gtk-py: install-gtk-py-tools
+install-gtk-py-addons: DH_OPTIONS=-p$(package_gtk_py_addons)
+install-gtk-py-addons: install-gtk-py-tools
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+ifndef DEBIAN_WX_DEFAULT_VERSION
+
+       dh_movefiles --sourcedir=debian/$(package_gtk_py_lib) $(pydir)/wxaddons
+else
+       rm -r debian/$(package_gtk_py_lib)/$(pydir)/wxaddons
+endif
+
+
+install-gtk-py: install-gtk-py-addons
 
 
 install-common: DH_OPTIONS=-p$(package_common)
@@ -755,10 +800,13 @@ install-common: install-gtk-shared-stamp
        dh_testroot
        dh_clean -k
 
-       dh_install $(objdir_gtk_install)/share/aclocal  usr/share
+       dh_install $(objdir_gtk_install)/share/bakefile/presets usr/share/bakefile
+       dh_install $(objdir_gtk_install)/share/bakefile/presets/wx*.bkl usr/share/bakefile/presets
+
+       dh_install $(objdir_gtk_install)/share/aclocal usr/share
        dh_installman debian/wx-config.1
 
-       dh_install $(objdir_gtk_shared)/utils/wxrc/wxrc usr/bin
+       dh_install $(objdir_gtk_shared)/utils/wxrc/wxrc usr/bin
        dh_installman debian/wxrc-tools.1
        dh_link usr/share/man/man1/wxrc-tools.1 usr/share/man/man1/wxrc.1
 
@@ -778,7 +826,13 @@ install-headers: install-gtk-shared-stamp
 
 #      dh_movefiles --sourcedir=$(objdir_univ_install)
        dh_install $(objdir_gtk_install)/include        usr
-       
+
+       # TODO:  Should probably use setup.py's install of the wxPython headers...
+       mkdir -p debian/$(package_headers)/usr/include/wx-$(release)/wx/wxPython
+       cp -p wxPython/include/wx/wxPython/*.h \
+           debian/$(package_headers)/usr/include/wx-$(release)/wx/wxPython/
+
+
 install-i18n: DH_OPTIONS=-p$(package_i18n)
 install-i18n: build-i18n-stamp install-gtk-shared-stamp
        dh_testdir
@@ -786,17 +840,20 @@ install-i18n: build-i18n-stamp install-gtk-shared-stamp
        dh_clean -k
        dh_install $(objdir_gtk_install)/share/locale   usr/share
 
+
 install-doc: DH_OPTIONS=-p$(package_doc)
 install-doc: build-doc-stamp
        dh_testdir
        dh_testroot
        dh_clean -k
+       dh_install $(objdir_doc) usr/share/doc/$(package_doc)
 
        @# Link this monstrosity with an overly obfuscated name
        @# to something that both people and browsers can expect to find.
        dh_link usr/share/doc/$(package_doc)/wx-manual.html/wx-$(release)-manual_contents.html \
                usr/share/doc/$(package_doc)/wx-manual.html/index.html
 
+
 install-examples: DH_OPTIONS=-p$(package_examples)
 install-examples: build-examples-stamp
        dh_testdir
@@ -815,7 +872,7 @@ install-gtk-dbg-py: build-gtk-dbg-py-stamp
                              WX_CONFIG='$(wxconfig-dbg)'                       \
                              SYS_WX_CONFIG='$(pyd_wxconfig)'                   \
                              WXPORT=$(pytoolkit)                               \
-                             UNICODE=1                                         \
+                             $(PY_UNICODE)                                     \
                              FLAVOUR=$(addsuffix -,$(DEBIAN_WXFLAVOUR))dbg
 
        mv debian/$(package_gtk_py_lib)/$(pydir)/wx.pth                         \
@@ -893,52 +950,69 @@ install-headers-msw:
        dh_install $(objdir_msw_install)/include/wx-$(release)/wx/msw  usr/$(cross_host)/include/wx-$(release)/wx
 
 
-binary-common:
-       dh_testdir
-       dh_testroot
-       dh_installdocs
-       dh_installchangelogs
-       dh_installexamples
-       dh_installmenu
-       dh_link
-
-       @# Don't strip debug libs at all, and strip cross libs elsewhere
-       @# with the cross host tools until dh_strip gets smarter.
-       dh_strip -N$(package_gtk_dbg) -N$(package_wxbase_dbg) \
-                -N$(package_msw_dev) -N$(package_msw_dbg)
-
-       dh_compress
-       dh_fixperms
+#---------------------------------------------------------------------------
+# Tying it all together
 
-       @# Don't do this for the dbg-py special build because dh_makeshlibs
-       @# will crap out if it is called with no packages to act on.
-       @if [ "x$(DH_OPTIONS)" != "-p$(package_gtk_dbg_py)" ]; then     \
-               echo "dh_makeshlibs -N$(package_gtk_py_lib) -V";        \
-               dh_makeshlibs -N$(package_gtk_py_lib) -V;               \
-       fi
 
-       dh_installdeb
-       dh_shlibdeps -ldebian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_dbg)/usr/lib
-       dh_gencontrol
-       dh_md5sums
-       dh_builddeb
-
-# Build architecture-independent files here.
-# Note that you currently can't build the indep packages without first
-# building the arch specific package files needed to create them.
 binary-indep: build_all install
-       $(MAKE) -f debian/rules \
-               DH_OPTIONS="-i $(addprefix -N,$(extra_packages))" \
-               binary-common
+       dh_testdir -i
+       dh_testroot -i
+       dh_installdocs -i
+       dh_installchangelogs -i
+       dh_installexamples -i
+       dh_installmenu -i
+ifdef NO_PYCENTRAL
+       dh_python -i
+else
+       dh_pycentral -i
+endif
+       dh_link -i
+       dh_compress -i
+       dh_fixperms -i
+       dh_installdeb -i
+       dh_gencontrol -i
+       dh_md5sums -i
+       dh_builddeb -i
+
 
-# Build just the architecture-dependent files here.
 binary-arch: build_arch install_arch
-       $(MAKE) -f debian/rules \
-               DH_OPTIONS="-a $(addprefix -N,$(extra_packages))" \
-               binary-common
+       dh_testdir -a
+       dh_testroot -a
+       dh_installdocs -a
+       dh_installchangelogs -a
+       dh_installexamples -a
+       dh_installmenu -a
+
+       rm -rf debian/$(package_gtk_dbg_py)/usr/share/doc/$(package_gtk_dbg_py)
+       ln -s $(package_gtk_py_lib) debian/$(package_gtk_dbg_py)/usr/share/doc/$(package_gtk_dbg_py)
+
+ifdef NO_PYCENTRAL
+       dh_python -a
+else
+       dh_pycentral -a
+endif
+
+# Don't strip debug libs at all, and strip cross libs elsewhere
+# with the cross host tools until dh_strip gets smarter.
+       dh_strip -p$(package_gtk_py_lib) --dbg-package=$(package_gtk_dbg_py) 
+       dh_strip -N$(package_gtk_dbg) -N$(package_wxbase_dbg) \
+                -N$(package_msw_dev) -N$(package_msw_dbg) \
+                -N$(package_gtk_py_lib) -N$(package_gtk_dbg_py)
+
+       dh_link -a
+       dh_compress -a
+       dh_fixperms -a
+       dh_makeshlibs -N$(package_gtk_py_lib) -N$(package_gtk_dbg_py) -V
+       dh_installdeb -a
+       dh_shlibdeps -ldebian/$(package_wxbase_lib)/usr/lib:debian/$(package_wxbase_dbg)/usr/lib:debian/$(package_gtk_lib)/usr/lib:debian/$(package_gtk_dbg)/usr/lib
+       dh_gencontrol -a
+       dh_md5sums -a
+       dh_builddeb -a
+
 
 # Build all packages target.
-binary: binary-arch binary-indep
+binary: binary-indep binary-arch 
+
 
 
 # This is a special target for building the wxMSW-cross packages.
@@ -952,12 +1026,6 @@ binary-cross: control-files-stamp $(install_all_cross)
                binary-common
 
 
-# Build wxPython against libwxgtk-dbg.  This package will conflict
-# with the release build one, but may be useful to some people.
-binary-dbg-py: control-files-stamp install-gtk-dbg-py
-       $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_dbg_py)" binary-common
-
-
 ############################################################################
 #
 # Some rules to build a subset of the complete list of packages that can be
@@ -966,17 +1034,21 @@ binary-dbg-py: control-files-stamp install-gtk-dbg-py
 # Debian policy.  Do not distribute packages built with these rules, they
 # are currently useful for rapid in-house testing by developers only.
 
+DH_OPTIONS_GTK := -p$(package_wxbase_lib) -p$(package_gtk_lib) -p$(package_headers)
+
 # libwxgtk shared lib package
-binary-gtk: control-files-stamp install-gtk-lib install-headers
-       $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_lib) -p$(package_headers)" binary-common
+binary-gtk: control-files-stamp install-gtk-lib install-wxbase-lib install-headers
+       $(MAKE) -f debian/rules DH_OPTIONS="$(DH_OPTIONS_GTK)" binary-common
 
-binary-gtk-dev: control-files-stamp install-gtk-dev install-headers
+binary-gtk-dev: control-files-stamp install-gtk-dev install-wxbase-dev install-headers
        $(MAKE) -f debian/rules \
-         DH_OPTIONS="-p$(package_gtk_lib) -p$(package_gtk_dev) -p$(package_headers)" \
-         binary-common
+           DH_OPTIONS="-p$(package_wxbase_dev) -p$(package_gtk_dev) $(DH_OPTIONS_GTK)" \
+           binary-common
 
-binary-gtk-dbg: control-files-stamp install-gtk-dbg install-headers
-       $(MAKE) -f debian/rules DH_OPTIONS="-p$(package_gtk_dbg) -p$(package_headers)" binary-common
+binary-gtk-dbg: control-files-stamp install-gtk-dbg install-wxbase-dbg install-headers
+       $(MAKE) -f debian/rules \
+           DH_OPTIONS="-p$(package_wxbase_dbg) -p$(package_gtk_dbg) -p$(package_headers)" \
+           binary-common
 
 
 # docs package