~ubuntu-branches/ubuntu/natty/jhbuild/natty

« back to all changes in this revision

Viewing changes to jhbuild/modtypes/cmake.py

  • Committer: Bazaar Package Importer
  • Author(s): Emilio Pozuelo Monfort, Loic Minier, Emilio Pozuelo Monfort
  • Date: 2009-11-09 20:28:48 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20091109202848-m9ec7dmzptqtchtj
Tags: 2.28.0-1
[ Loic Minier ]
* Cleanups.
* Ship scripts.
* Don't set GNOME_MODULE as it equals the name of the source package.

[ Emilio Pozuelo Monfort ]
* New upstream release. Closes: #524504.
  - Use 'git rev-parse' rather than 'git-rev-parse'. Closes: #544642.
* Ship install-check. Closes: #441008.
* Uploaders list regenerated. Closes: #523542, #554071.
* debian/control.in,
  debian/rules:
  - Stop shipping a copy of subprocess.py. Require python >= 2.4.
  - Switch to python-support.
* debian/control.in:
  - Bump Standards-Version to 3.8.3, no changes needed.
  - Build depend on intltool >= 0.35.0.
  - Build depend on pkg-config, gnome-doc-utils and rarian-compat to build
    the documentation.
  - Make jhbuild arch any since install-check is a binary. Depend on
    ${shlibs:Depends}.
  - Recommend, and not suggest, git-core. Also recommend mercurial.
* debian/watch:
  - Added.
* debian/patches/01_import_from_pkgdatadir.patch:
  - Added, import jhbuild from pkgdatadir if everything else fails.
    This way we can ship the jhbuild private modules in /usr/sharejhbuild.
* debian/jhbuild.docs:
  - Removed, the necessary docs are now installed by the upstream Makefile.
* debian/rules:
  - Include autotools.mk and gnome.mk.
  - Remove all the manual build process, autotools.mk does everything now.
  - Install the jhbuild modules in /usr/share/jhbuild.
* debian/install:
  - Install the modulesets and patches from here since the upstream build
    system doesn't install them.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# jhbuild - a build script for GNOME 1.x and 2.x
 
2
# Copyright (C) 2001-2006  James Henstridge
 
3
#
 
4
#   cmake.py: cmake module type definitions.
 
5
#
 
6
# This program is free software; you can redistribute it and/or modify
 
7
# it under the terms of the GNU General Public License as published by
 
8
# the Free Software Foundation; either version 2 of the License, or
 
9
# (at your option) any later version.
 
10
#
 
11
# This program is distributed in the hope that it will be useful,
 
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
# GNU General Public License for more details.
 
15
#
 
16
# You should have received a copy of the GNU General Public License
 
17
# along with this program; if not, write to the Free Software
 
18
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
19
 
 
20
__metaclass__ = type
 
21
 
 
22
import os
 
23
 
 
24
from jhbuild.errors import BuildStateError
 
25
from jhbuild.modtypes import \
 
26
     Package, DownloadableModule, get_dependencies, get_branch, register_module_type
 
27
 
 
28
__all__ = [ 'CMakeModule' ]
 
29
 
 
30
class CMakeModule(Package, DownloadableModule):
 
31
    """Base type for modules that use CMake build system."""
 
32
    type = 'cmake'
 
33
 
 
34
    PHASE_CHECKOUT = DownloadableModule.PHASE_CHECKOUT
 
35
    PHASE_FORCE_CHECKOUT = DownloadableModule.PHASE_FORCE_CHECKOUT
 
36
    PHASE_CONFIGURE = 'configure'
 
37
    PHASE_BUILD = 'build'
 
38
    PHASE_DIST = 'dist'
 
39
    PHASE_INSTALL = 'install'
 
40
 
 
41
    def __init__(self, name, branch, dependencies=[], after=[], suggests=[]):
 
42
        Package.__init__(self, name, dependencies, after, suggests)
 
43
        self.branch = branch
 
44
 
 
45
    def get_srcdir(self, buildscript):
 
46
        return self.branch.srcdir
 
47
 
 
48
    def get_builddir(self, buildscript):
 
49
        if buildscript.config.buildroot:
 
50
            d = buildscript.config.builddir_pattern % (
 
51
                os.path.basename(self.get_srcdir(buildscript)))
 
52
            return os.path.join(buildscript.config.buildroot, d)
 
53
        else:
 
54
            return self.get_srcdir(buildscript)
 
55
 
 
56
    def get_revision(self):
 
57
        return self.branch.tree_id()
 
58
 
 
59
    def skip_configure(self, buildscript, last_phase):
 
60
        return buildscript.config.nobuild
 
61
    
 
62
    def do_configure(self, buildscript):
 
63
        buildscript.set_action(_('Configuring'), self)
 
64
        srcdir = self.get_srcdir(buildscript)
 
65
        builddir = self.get_builddir(buildscript)
 
66
        if not os.path.exists(builddir):
 
67
            os.mkdir(builddir)
 
68
        prefix = os.path.expanduser(buildscript.config.prefix)
 
69
        cmd = ['cmake', '-DCMAKE_INSTALL_PREFIX=%s' % prefix, srcdir]
 
70
        buildscript.execute(cmd, cwd = builddir, extra_env = self.extra_env)
 
71
    do_configure.depends = [PHASE_CHECKOUT]
 
72
    do_configure.error_phases = [PHASE_FORCE_CHECKOUT]
 
73
 
 
74
    def do_build(self, buildscript):
 
75
        buildscript.set_action(_('Building'), self)
 
76
        builddir = self.get_builddir(buildscript)
 
77
        buildscript.execute(os.environ.get('MAKE', 'make'), cwd = builddir,
 
78
                extra_env = self.extra_env)
 
79
    do_build.depends = [PHASE_CONFIGURE]
 
80
    do_build.error_phases = [PHASE_FORCE_CHECKOUT]
 
81
 
 
82
    def do_dist(self, buildscript):
 
83
        buildscript.set_action(_('Creating tarball for'), self)
 
84
        cmd = '%s package_source' % os.environ.get('MAKE', 'make')
 
85
        buildscript.execute(cmd, cwd = self.get_builddir(buildscript),
 
86
                extra_env = self.extra_env)
 
87
    do_dist.depends = [PHASE_CONFIGURE]
 
88
    do_dist.error_phases = [PHASE_FORCE_CHECKOUT, PHASE_CONFIGURE]
 
89
 
 
90
    def do_install(self, buildscript):
 
91
        buildscript.set_action(_('Installing'), self)
 
92
        builddir = self.get_builddir(buildscript)
 
93
        buildscript.execute([os.environ.get('MAKE', 'make'), 'install'],
 
94
                cwd = builddir,
 
95
                extra_env = self.extra_env)
 
96
        buildscript.packagedb.add(self.name, self.get_revision() or '')
 
97
    do_install.depends = [PHASE_BUILD]
 
98
 
 
99
    def xml_tag_and_attrs(self):
 
100
        return 'cmake', [('id', 'name', None)]
 
101
 
 
102
 
 
103
def parse_cmake(node, config, uri, repositories, default_repo):
 
104
    id = node.getAttribute('id')
 
105
    dependencies, after, suggests = get_dependencies(node)
 
106
    branch = get_branch(node, repositories, default_repo, config)
 
107
 
 
108
    return CMakeModule(id, branch, dependencies = dependencies, after = after,
 
109
            suggests = suggests)
 
110
 
 
111
register_module_type('cmake', parse_cmake)
 
112