Index: jhbuild/modtypes/waf.py
===================================================================
--- jhbuild/modtypes/waf.py	(revision 0)
+++ jhbuild/modtypes/waf.py	(revision 0)
@@ -0,0 +1,169 @@
+# jhbuild - a build script for GNOME 1.x and 2.x
+# Copyright (C) 2007  Gustavo Carneiro
+# Copyright (C) 2001-2006  James Henstridge
+#
+#   waf.py: waf module type definitions.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+__metaclass__ = type
+
+import os
+import re
+
+from jhbuild.errors import FatalError, BuildStateError
+from jhbuild.modtypes import \
+     Package, get_dependencies, get_branch, register_module_type,\
+     checkout, check_build_policy
+
+__all__ = [ 'WafModule' ]
+
+class WafModule(Package):
+    '''Base type for modules that are distributed with a WAF script.'''
+    type = 'waf'
+
+    STATE_CHECKOUT       = 'checkout'
+    STATE_FORCE_CHECKOUT = 'force_checkout'
+    STATE_CLEAN          = 'clean'
+    STATE_CONFIGURE      = 'configure'
+    STATE_BUILD          = 'build'
+    STATE_CHECK          = 'check'
+    STATE_DIST           = 'dist'
+    STATE_INSTALL        = 'install'
+
+    def __init__(self, name, branch, dependencies=[], after=[], waf_cmd='waf'):
+        Package.__init__(self, name, dependencies, after)
+        self.branch = branch
+        self.waf_cmd = waf_cmd
+
+    def get_srcdir(self, buildscript):
+        return self.branch.srcdir
+
+    def get_builddir(self, buildscript):
+        return self.get_srcdir(buildscript)
+
+    def get_revision(self):
+        return self.branch.tree_id()
+
+    def do_start(self, buildscript):
+        pass
+    do_start.next_state = STATE_CHECKOUT
+    do_start.error_states = []
+
+    def skip_checkout(self, buildscript, last_state):
+        # skip the checkout stage if the nonetwork flag is set
+        return buildscript.config.nonetwork
+
+    def do_checkout(self, buildscript):
+        checkout(self, buildscript)
+        check_build_policy(self, buildscript)
+    do_checkout.next_state = STATE_CONFIGURE
+    do_checkout.error_states = [STATE_FORCE_CHECKOUT]
+
+    def skip_force_checkout(self, buildscript, last_state):
+        return False
+
+    def do_force_checkout(self, buildscript):
+        buildscript.set_action('Checking out', self)
+        self.branch.force_checkout(buildscript)
+    do_force_checkout.next_state = STATE_CONFIGURE
+    do_force_checkout.error_states = [STATE_FORCE_CHECKOUT]
+
+    def do_configure(self, buildscript):
+        builddir = self.get_builddir(buildscript)
+        if buildscript.config.buildroot and not os.path.exists(builddir):
+            os.makedirs(builddir)
+        buildscript.set_action('Configuring', self)
+
+        cmd = '%s configure' % self.waf_cmd
+        cmd += ' --prefix %s' % buildscript.config.prefix
+
+        buildscript.execute(cmd, cwd=builddir)
+    do_configure.next_state = STATE_CLEAN
+    do_configure.error_states = [STATE_FORCE_CHECKOUT]
+
+    def skip_clean(self, buildscript, last_state):
+        return (not buildscript.config.makeclean or
+                buildscript.config.nobuild)
+
+    def do_clean(self, buildscript):
+        buildscript.set_action('Cleaning', self)
+        cmd = '%s clean' % (self.waf_cmd,)
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+    do_clean.next_state = STATE_BUILD
+    do_clean.error_states = [STATE_FORCE_CHECKOUT, STATE_CONFIGURE]
+
+    def skip_build(self, buildscript, last_state):
+        return buildscript.config.nobuild
+
+    def do_build(self, buildscript):
+        buildscript.set_action('Building', self)
+        cmd = '%s' % (self.waf_cmd,)
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+    do_build.next_state = STATE_CHECK
+    do_build.error_states = [STATE_FORCE_CHECKOUT, STATE_CONFIGURE]
+
+    def skip_check(self, buildscript, last_state):
+        return (not buildscript.config.makecheck or
+                buildscript.config.nobuild)
+
+    def do_check(self, buildscript):
+        buildscript.set_action('Checking', self)
+        cmd = '%s check' % (self.waf_cmd)
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+    do_check.next_state = STATE_DIST
+    do_check.error_states = [STATE_FORCE_CHECKOUT, STATE_CONFIGURE]
+
+    def skip_dist(self, buildscript, last_state):
+        return not (buildscript.config.makedist or buildscript.config.makedistcheck)
+
+    def do_dist(self, buildscript):
+        buildscript.set_action('Creating tarball for', self)
+        if buildscript.config.makedistcheck:
+            cmd = '%s distcheck' % (self.waf_cmd)
+        else:
+            cmd = '%s dist' % (self.waf_cmd,)
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+    do_dist.next_state = STATE_INSTALL
+    do_dist.error_states = [STATE_FORCE_CHECKOUT, STATE_CONFIGURE]
+
+    def skip_install(self, buildscript, last_state):
+        return buildscript.config.nobuild
+
+    def do_install(self, buildscript):
+        buildscript.set_action('Installing', self)
+        cmd = '%s install' % self.waf_cmd
+        buildscript.execute(cmd, cwd=self.get_builddir(buildscript))
+        buildscript.packagedb.add(self.name, self.get_revision() or '')
+    do_install.next_state = Package.STATE_DONE
+    do_install.error_states = []
+
+
+def parse_waf(node, config, uri, repositories, default_repo):
+    module_id = node.getAttribute('id')
+    waf_cmd = 'waf'
+    if node.hasAttribute('waf-command'):
+        waf_cmd = node.getAttribute('waf-command')
+
+    # override revision tag if requested.
+    dependencies, after = get_dependencies(node)
+    branch = get_branch(node, repositories, default_repo)
+    if config.module_checkout_mode.get(module_id):
+        branch.checkout_mode = config.module_checkout_mode[module_id]
+
+    return WafModule(module_id, branch, dependencies=dependencies, after=after,
+                     waf_cmd=waf_cmd)
+
+register_module_type('waf', parse_waf)
Index: jhbuild/modtypes/__init__.py
===================================================================
--- jhbuild/modtypes/__init__.py	(revision 1743)
+++ jhbuild/modtypes/__init__.py	(working copy)
@@ -227,3 +227,4 @@
 register_lazy_module_type('cvsmodule', 'jhbuild.modtypes.autotools')
 register_lazy_module_type('svnmodule', 'jhbuild.modtypes.autotools')
 register_lazy_module_type('archmodule', 'jhbuild.modtypes.autotools')
+register_lazy_module_type('waf', 'jhbuild.modtypes.waf')
Index: modulesets/bootstrap.modules
===================================================================
--- modulesets/bootstrap.modules	(revision 1743)
+++ modulesets/bootstrap.modules	(working copy)
@@ -7,6 +7,8 @@
       href="http://pkgconfig.freedesktop.org/releases/"/>
   <repository type="tarball" name="python"
       href="http://www.python.org/ftp/python/"/>
+  <repository type="svn" name="waf.googlecode.com"
+    href="http://waf.googlecode.com/svn/"/>
 
   <autotools id="gettext" autogen-sh="configure">
     <branch repo="ftp.gnu.org"
@@ -67,6 +69,10 @@
 	    size="8005915" md5sum="141c683447d5e76be1d2bd4829574f02" />
   </autotools>
 
+  <autotools id="waf" autogen-sh="utils/autogen.sh">
+    <branch repo="waf.googlecode.com" module="trunk" checkoutdir="waf"/>
+  </autotools>
+
   <metamodule id="meta-bootstrap">
     <dependencies>
       <dep package="gettext" />
@@ -79,6 +85,7 @@
       <dep package="automake-1.10" />
       <dep package="pkg-config" />
       <dep package="python" />
+      <dep package="waf" />
     </dependencies>
   </metamodule>
 
Index: modulesets/gnome-suites-2.22.modules
===================================================================
--- modulesets/gnome-suites-2.22.modules	(revision 1743)
+++ modulesets/gnome-suites-2.22.modules	(working copy)
@@ -642,7 +642,7 @@
     </suggests>
   </autotools>
 
-  <autotools id="gnome-python-desktop">
+  <waf id="gnome-python-desktop">
     <branch/>
     <dependencies>
       <dep package="gnome-python"/>
@@ -660,7 +660,7 @@
       </suggests>
       <dep package="evolution-data-server"/>
     </dependencies>
-  </autotools>
+  </waf>
 
   <autotools id="gnome-screensaver">
     <branch/>
@@ -1213,7 +1213,7 @@
     </dependencies>
   </autotools>
 
-  <autotools id="gnome-python">
+  <waf id="gnome-python">
     <branch/>
     <dependencies>
       <dep package="pygtk"/>
@@ -1221,7 +1221,7 @@
       <dep package="libgnomecanvas"/>
       <dep package="libgnomeui"/>
     </dependencies>
-  </autotools>
+  </waf>
 
 <!-- Admin -->
 
