~ubuntu-branches/ubuntu/lucid/jhbuild/lucid

« back to all changes in this revision

Viewing changes to jhbuild/modtypes/mesa.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
 
# Copyright (C) 2006-2007  Eric Anholt
4
 
#
5
 
#   perl.py: perl module type definitions.
6
 
#
7
 
# This program is free software; you can redistribute it and/or modify
8
 
# it under the terms of the GNU General Public License as published by
9
 
# the Free Software Foundation; either version 2 of the License, or
10
 
# (at your option) any later version.
11
 
#
12
 
# This program is distributed in the hope that it will be useful,
13
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15
 
# GNU General Public License for more details.
16
 
#
17
 
# You should have received a copy of the GNU General Public License
18
 
# along with this program; if not, write to the Free Software
19
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
20
 
 
21
 
__metaclass__ = type
22
 
 
23
 
import os
24
 
import glob
25
 
import platform
26
 
 
27
 
from jhbuild.errors import BuildStateError
28
 
from jhbuild.modtypes import \
29
 
     Package, get_dependencies, get_branch, register_module_type
30
 
 
31
 
__all__ = [ 'MesaModule' ]
32
 
 
33
 
class MesaModule(Package):
34
 
    """Base type for building Mesa."""
35
 
    type = 'mesa'
36
 
 
37
 
    STATE_CHECKOUT = 'checkout'
38
 
    STATE_FORCE_CHECKOUT = 'force_checkout'
39
 
    STATE_BUILD = 'build'
40
 
    STATE_INSTALL = 'install'
41
 
 
42
 
    def __init__(self, name, branch, makeargs='',
43
 
                 dependencies=[], after=[]):
44
 
        Package.__init__(self, name, dependencies, after)
45
 
        self.branch = branch
46
 
        self.makeargs = makeargs
47
 
 
48
 
    def get_srcdir(self, buildscript):
49
 
        return self.branch.srcdir
50
 
 
51
 
    def get_builddir(self, buildscript):
52
 
        return self.get_srcdir(buildscript)
53
 
 
54
 
    def get_revision(self):
55
 
        return self.branch.branchname
56
 
 
57
 
    def get_mesa_config(self):
58
 
        uname = platform.uname();
59
 
        if uname[0] == 'FreeBSD':
60
 
            if uname[4] == 'i386':
61
 
                config = 'freebsd-dri-x86'
62
 
            elif uname[4] == 'amd64':
63
 
                config = 'freebsd-dri-amd64'
64
 
            else:
65
 
                config = 'freebsd-dri'
66
 
        if uname[0] == 'Linux':
67
 
            if uname[4] == 'i386':
68
 
                config = 'linux-dri-x86'
69
 
            elif uname[4] == 'x86_64':
70
 
                config = 'linux-dri-x86_64'
71
 
            else:
72
 
                config = 'linux-dri'
73
 
        return config
74
 
 
75
 
    def do_start(self, buildscript):
76
 
        pass
77
 
    do_start.next_state = STATE_CHECKOUT
78
 
    do_start.error_states = []
79
 
 
80
 
    def skip_checkout(self, buildscript, last_state):
81
 
        # skip the checkout stage if the nonetwork flag is set
82
 
        return buildscript.config.nonetwork
83
 
 
84
 
    def do_checkout(self, buildscript):
85
 
        srcdir = self.get_srcdir(buildscript)
86
 
        buildscript.set_action('Checking out', self)
87
 
        self.branch.checkout(buildscript)
88
 
        # did the checkout succeed?
89
 
        if not os.path.exists(srcdir):
90
 
            raise BuildStateError('source directory %s was not created'
91
 
                                  % srcdir)
92
 
    do_checkout.next_state = STATE_BUILD
93
 
    do_checkout.error_states = [STATE_FORCE_CHECKOUT]
94
 
 
95
 
    def skip_force_checkout(self, buildscript, last_state):
96
 
        return False
97
 
 
98
 
    def do_force_checkout(self, buildscript):
99
 
        buildscript.set_action('Checking out', self)
100
 
        self.branch.force_checkout(buildscript)
101
 
    do_force_checkout.next_state = STATE_BUILD
102
 
    do_force_checkout.error_states = [STATE_FORCE_CHECKOUT]
103
 
 
104
 
    def skip_build(self, buildscript, last_state):
105
 
        return buildscript.config.nobuild
106
 
 
107
 
    def do_build(self, buildscript):
108
 
        buildscript.set_action('Building', self)
109
 
        builddir = self.get_builddir(buildscript)
110
 
        make = os.environ.get('MAKE', 'make')
111
 
        if (os.path.exists(builddir + '/configs/current')):
112
 
            buildscript.execute([make], cwd=builddir)
113
 
        else:
114
 
            buildscript.execute([make, self.get_mesa_config()], cwd=builddir)
115
 
    do_build.next_state = STATE_INSTALL
116
 
    do_build.error_states = [STATE_FORCE_CHECKOUT]
117
 
 
118
 
    def skip_install(self, buildscript, last_state):
119
 
        return buildscript.config.nobuild
120
 
 
121
 
    def do_install(self, buildscript):
122
 
        buildscript.set_action('Installing', self)
123
 
        builddir = self.get_builddir(buildscript)
124
 
        prefix = buildscript.config.prefix
125
 
 
126
 
        buildscript.execute(['mkdir', '-p',
127
 
                             prefix + '/lib/dri'],
128
 
                             cwd=builddir)
129
 
        for x in glob.glob(builddir + '/lib/libGL*'):
130
 
            buildscript.execute(['cp',
131
 
                                 x,
132
 
                                 prefix + '/lib'],
133
 
                                cwd=builddir)
134
 
        for x in glob.glob(builddir + '/lib/*_dri.so'):
135
 
            buildscript.execute(['cp',
136
 
                                 x,
137
 
                                 prefix + '/lib/dri'],
138
 
                                cwd=builddir)
139
 
        for x in glob.glob(builddir + '/include/GL/*.h'):
140
 
            buildscript.execute(['cp',
141
 
                                 x,
142
 
                                 prefix + '/include/GL'],
143
 
                                cwd=builddir)
144
 
        buildscript.packagedb.add(self.name, self.get_revision() or '')
145
 
    do_install.next_state = Package.STATE_DONE
146
 
    do_install.error_states = []
147
 
 
148
 
 
149
 
def parse_mesa(node, config, repositories, default_repo):
150
 
    id = node.getAttribute('id')
151
 
    makeargs = ''
152
 
    if node.hasAttribute('makeargs'):
153
 
        makeargs = node.getAttribute('makeargs')
154
 
 
155
 
    # override revision tag if requested.
156
 
    makeargs += ' ' + config.module_makeargs.get(id, config.makeargs)
157
 
 
158
 
    dependencies, after = get_dependencies(node)
159
 
    branch = get_branch(node, repositories, default_repo)
160
 
 
161
 
    return MesaModule(id, branch, makeargs,
162
 
                         dependencies=dependencies, after=after)
163
 
register_module_type('mesa', parse_mesa)