jhbuild patch to support building GCJ and the java-gnome bindings
- From: Thomas Fitzsimmons <fitzsim redhat com>
- To: James Henstridge <james daa com au>
- Cc: gnome-devel-list gnome org
- Subject: jhbuild patch to support building GCJ and the java-gnome bindings
- Date: Wed, 05 May 2004 01:13:41 -0400
Hi James,
I'm trying to simplify the process of setting up a GCJ-based Java
development environment for GNOME hackers and potential AWT/Swing
hackers. As I said before on the GNU Classpath list, jhbuild is the
perfect tool for the job. GCJ's AWT implementation relies on GTK, and
its Java2D implementation relies on cairo. jhbuild greatly simplifies
building those packages and their dependencies. It has also proved to
be quite easy to extend.
The attached jhbuild patch adds to jhbuild support for four new module
types: gcj, gcjtest (GCJ testsuite modules), gdb and javagnome
(java-gnome bindings). It also adds a builddir config file option for
module types that support builddir != srcdir configurations.
With this patch and the new module types, I'm able to set up a complete
GCJ and java-gnome development environment very easily.
Are these changes acceptable for inclusion in jhbuild?
Tom
Index: jhbuild/config.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/config.py,v
retrieving revision 1.12
diff -u -r1.12 config.py
--- a/jhbuild/config.py 30 Apr 2004 01:31:00 -0000 1.12
+++ b/jhbuild/config.py 5 May 2004 04:15:55 -0000
@@ -33,7 +33,7 @@
'buildscript', 'nonetwork', 'alwaysautogen',
'nobuild', 'makeclean', 'makecheck', 'use_lib64',
'tinderbox_outputdir', 'sticky_date', 'tarballdir',
- 'pretty_print' ]
+ 'pretty_print', 'builddir' ]
def addpath(envvar, path):
'''Adds a path to an environment variable.'''
Index: jhbuild/defaults.jhbuildrc
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/defaults.jhbuildrc,v
retrieving revision 1.7
diff -u -r1.7 defaults.jhbuildrc
--- a/jhbuild/defaults.jhbuildrc 30 Apr 2004 01:31:00 -0000 1.7
+++ b/jhbuild/defaults.jhbuildrc 5 May 2004 04:15:55 -0000
@@ -21,6 +21,7 @@
prefix = '/opt/gnome2'
checkoutroot = os.path.join(os.environ['HOME'], 'cvs', 'gnome2')
tarballdir = None # will default to checkoutroot
+builddir = os.path.join(os.environ['HOME'], 'cvs', 'build')
# override environment variables, command line arguments, etc
autogenargs = '--disable-static --disable-gtk-doc'
Index: jhbuild/modtypes/__init__.py
===================================================================
RCS file: /cvs/gnome/jhbuild/jhbuild/modtypes/__init__.py,v
retrieving revision 1.3
diff -u -r1.3 __init__.py
--- a/jhbuild/modtypes/__init__.py 5 Feb 2004 13:39:12 -0000 1.3
+++ b/jhbuild/modtypes/__init__.py 5 May 2004 04:15:55 -0000
@@ -17,7 +17,7 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-for modname in ['base', 'mozilla', 'tarball']:
+for modname in ['base', 'mozilla', 'tarball', 'gcj', 'gdb', 'gcjtest', 'javagnome']:
exec 'import %s' % modname
from base import parse_xml_node
Index: modulesets/moduleset.dtd
===================================================================
RCS file: /cvs/gnome/jhbuild/modulesets/moduleset.dtd,v
retrieving revision 1.9
diff -u -r1.9 moduleset.dtd
--- a/modulesets/moduleset.dtd 29 Apr 2004 13:58:39 -0000 1.9
+++ b/modulesets/moduleset.dtd 5 May 2004 04:15:55 -0000
@@ -1,4 +1,4 @@
-<!ELEMENT moduleset (cvsroot*,(include|cvsmodule|metamodule|tarball|mozillamodule)*) >
+<!ELEMENT moduleset (cvsroot*,(include|cvsmodule|metamodule|tarball|mozillamodule|gcjmodule|gdbmodule|gcjtestmodule|javagnomemodule)*) >
<!ELEMENT cvsroot EMPTY >
<!ATTLIST cvsroot
@@ -40,6 +40,43 @@
autogenargs CDATA #IMPLIED
cvsroot CDATA #IMPLIED >
+<!ELEMENT gcjmodule (dependencies?,suggests?) >
+<!ATTLIST gcjmodule
+ id CDATA #REQUIRED
+ module CDATA #IMPLIED
+ revision CDATA #IMPLIED
+ checkoutdir CDATA #IMPLIED
+ builddir CDATA #IMPLIED
+ autogenargs CDATA #IMPLIED
+ cvsroot CDATA #IMPLIED >
+
+<!ELEMENT gdbmodule (dependencies?,suggests?) >
+<!ATTLIST gdbmodule
+ id CDATA #REQUIRED
+ module CDATA #IMPLIED
+ revision CDATA #IMPLIED
+ checkoutdir CDATA #IMPLIED
+ builddir CDATA #IMPLIED
+ autogenargs CDATA #IMPLIED
+ cvsroot CDATA #IMPLIED >
+
+<!ELEMENT gcjtestmodule (dependencies?,suggests?) >
+<!ATTLIST gcjtestmodule
+ id CDATA #REQUIRED
+ module CDATA #IMPLIED
+ revision CDATA #IMPLIED
+ checkoutdir CDATA #IMPLIED
+ cvsroot CDATA #IMPLIED >
+
+<!ELEMENT javagnomemodule (dependencies?,suggests?) >
+<!ATTLIST javagnomemodule
+ id CDATA #REQUIRED
+ module CDATA #IMPLIED
+ revision CDATA #IMPLIED
+ checkoutdir CDATA #IMPLIED
+ autogenargs CDATA #IMPLIED
+ cvsroot CDATA #IMPLIED >
+
<!-- Tarball sub-elements -->
<!ELEMENT source EMPTY >
<!ATTLIST source
Index: modulesets/moduleset.xsl
===================================================================
RCS file: /cvs/gnome/jhbuild/modulesets/moduleset.xsl,v
retrieving revision 1.2
diff -u -r1.2 moduleset.xsl
--- a/modulesets/moduleset.xsl 23 Apr 2003 10:40:14 -0000 1.2
+++ b/modulesets/moduleset.xsl 5 May 2004 04:15:55 -0000
@@ -11,7 +11,9 @@
<title>Module Set</title>
<style type="text/css">
<xsl:text>
- div.cvsmodule, div.mozillamodule {
+ div.cvsmodule, div.mozillamodule,
+ div.gcjmodule, div.gdbmodule,
+ div.gcjtestmodule, div.javagnomemodule {
padding: 0.5em;
margin: 0.5em;
background: #87CEFA;
@@ -227,4 +229,218 @@
</div>
</xsl:template>
+ <xsl:template match="gcjmodule">
+ <div class="{name(.)}">
+ <h2>
+ <xsl:value-of select="@id" />
+ <a name="{generate-id(.)}" />
+ </h2>
+ <table>
+ <tr>
+ <th align="left">Module:</th>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@module">
+ <xsl:value-of select="@module" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@revision">
+ <xsl:text> rv:</xsl:text>
+ <xsl:value-of select="@revision" />
+ </xsl:if>
+ </td>
+ </tr>
+ <xsl:if test="@checkoutdir">
+ <tr>
+ <th align="left">Checkout directory:</th>
+ <td><xsl:value-of select="@checkoutdir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@builddir">
+ <tr>
+ <th align="left">Build directory:</th>
+ <td><xsl:value-of select="@builddir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@autogenargs">
+ <tr>
+ <th align="left">Autogen args:</th>
+ <td><xsl:value-of select="@autogenargs" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@cvsroot">
+ <tr>
+ <th align="left">CVS Root:</th>
+ <td><xsl:value-of select="@cvsroot" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="dependencies">
+ <tr>
+ <th align="left" valign="top">Dependencies:</th>
+ <td><xsl:apply-templates select="dependencies" /></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="gdbmodule">
+ <div class="{name(.)}">
+ <h2>
+ <xsl:value-of select="@id" />
+ <a name="{generate-id(.)}" />
+ </h2>
+ <table>
+ <tr>
+ <th align="left">Module:</th>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@module">
+ <xsl:value-of select="@module" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@revision">
+ <xsl:text> rv:</xsl:text>
+ <xsl:value-of select="@revision" />
+ </xsl:if>
+ </td>
+ </tr>
+ <xsl:if test="@checkoutdir">
+ <tr>
+ <th align="left">Checkout directory:</th>
+ <td><xsl:value-of select="@checkoutdir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@builddir">
+ <tr>
+ <th align="left">Build directory:</th>
+ <td><xsl:value-of select="@builddir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@autogenargs">
+ <tr>
+ <th align="left">Autogen args:</th>
+ <td><xsl:value-of select="@autogenargs" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@cvsroot">
+ <tr>
+ <th align="left">CVS Root:</th>
+ <td><xsl:value-of select="@cvsroot" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="dependencies">
+ <tr>
+ <th align="left" valign="top">Dependencies:</th>
+ <td><xsl:apply-templates select="dependencies" /></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="gcjtestmodule">
+ <div class="{name(.)}">
+ <h2>
+ <xsl:value-of select="@id" />
+ <a name="{generate-id(.)}" />
+ </h2>
+ <table>
+ <tr>
+ <th align="left">Module:</th>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@module">
+ <xsl:value-of select="@module" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@revision">
+ <xsl:text> rv:</xsl:text>
+ <xsl:value-of select="@revision" />
+ </xsl:if>
+ </td>
+ </tr>
+ <xsl:if test="@checkoutdir">
+ <tr>
+ <th align="left">Checkout directory:</th>
+ <td><xsl:value-of select="@checkoutdir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@cvsroot">
+ <tr>
+ <th align="left">CVS Root:</th>
+ <td><xsl:value-of select="@cvsroot" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="dependencies">
+ <tr>
+ <th align="left" valign="top">Dependencies:</th>
+ <td><xsl:apply-templates select="dependencies" /></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </div>
+ </xsl:template>
+
+ <xsl:template match="javagnomemodule">
+ <div class="{name(.)}">
+ <h2>
+ <xsl:value-of select="@id" />
+ <a name="{generate-id(.)}" />
+ </h2>
+ <table>
+ <tr>
+ <th align="left">Module:</th>
+ <td>
+ <xsl:choose>
+ <xsl:when test="@module">
+ <xsl:value-of select="@module" />
+ </xsl:when>
+ <xsl:otherwise>
+ <xsl:value-of select="@id" />
+ </xsl:otherwise>
+ </xsl:choose>
+ <xsl:if test="@revision">
+ <xsl:text> rv:</xsl:text>
+ <xsl:value-of select="@revision" />
+ </xsl:if>
+ </td>
+ </tr>
+ <xsl:if test="@checkoutdir">
+ <tr>
+ <th align="left">Checkout directory:</th>
+ <td><xsl:value-of select="@checkoutdir" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@autogenargs">
+ <tr>
+ <th align="left">Autogen args:</th>
+ <td><xsl:value-of select="@autogenargs" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="@cvsroot">
+ <tr>
+ <th align="left">CVS Root:</th>
+ <td><xsl:value-of select="@cvsroot" /></td>
+ </tr>
+ </xsl:if>
+ <xsl:if test="dependencies">
+ <tr>
+ <th align="left" valign="top">Dependencies:</th>
+ <td><xsl:apply-templates select="dependencies" /></td>
+ </tr>
+ </xsl:if>
+ </table>
+ </div>
+ </xsl:template>
+
</xsl:stylesheet>
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2001-2004 James Henstridge
#
# gcj.py: module type definitions for the GNU Compiler for Java
#
# 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
import os
import base
from jhbuild.utils import cvs
class GCJModule(base.CVSModule):
def __init__(self,
cvsmodule,
revision=None,
autogenargs='',
dependencies=[],
suggests=[],
cvsroot=None,
builddir=None):
base.CVSModule.__init__(self,
cvsmodule,
revision=revision,
autogenargs=autogenargs,
dependencies=dependencies,
suggests=suggests,
cvsroot=cvsroot)
self.builddir = builddir
self.cvsroot = cvsroot
def get_builddir(self, buildscript):
return os.path.join(buildscript.config.builddir,
self.checkoutdir or self.cvsmodule)
def get_checkoutroot(self, buildscript):
return os.path.join(buildscript.config.checkoutroot, 'gcc')
# Create a custom version of cvs.CVSRoot.checkout that checks out a
# list of modules instead of just one.
def checkout(self, buildscript, modules, revision=None, date=None,
checkoutdir=None):
dir = buildscript.config.checkoutroot
os.chdir(dir)
cmd = 'cvs -z3 -q -d %s checkout -P ' % self.cvsroot
if checkoutdir:
cmd += '-d %s ' % checkoutdir
if revision:
cmd += '-r %s ' % revision
if date:
cmd += '-D "%s" ' % date
if not (revision or date):
cmd = cmd + '-A '
for updatemod in modules.split(" "):
res = buildscript.execute(cmd + updatemod, 'cvs')
if res != 0:
break
return res
# Create a custom version of cvs.CVSRoot.update that uses the
# gcc_update script to update the gcc source tree.
def update(self, buildscript, module, revision=None, date=None,
checkoutdir=None):
dir = self.get_checkoutroot(buildscript)
if not os.path.exists(dir):
return self.checkout(buildscript, 'gcc-core gcc-java gcc-g++ gcc/gcc/fixinc',
revision, date)
# gcc_update will not update the tree properly if a previous
# checkout attempt was aborted. Because gcc_update decides
# what to update based on the directories that are present in
# the top-level gcc directory, it is difficult to make the
# update process robust against checkout interruptions.
os.chdir(dir)
cmd = 'contrib/gcc_update --nostdflags -P '
if revision:
cmd += '-r %s ' % revision
if date:
cmd += '-D "%s" ' % date
if not (revision or date):
cmd = cmd + '-A '
return buildscript.execute(cmd, 'cvs')
# Override do_start to call get_checkoutroot rather than
# get_builddir.
def do_start(self, buildscript):
checkoutdir = self.get_checkoutroot(buildscript)
if not buildscript.config.nonetwork: # normal start state
return (self.STATE_CHECKOUT, None, None)
elif buildscript.config.nobuild:
return (self.STATE_DONE, None, None)
elif not buildscript.config.alwaysautogen and \
os.path.exists(os.path.join(checkoutdir, 'Makefile')):
return (self.STATE_BUILD, None, None)
else:
return (self.STATE_CONFIGURE, None, None)
# Override do_checkout to call get_checkoutroot rather than
# get_builddir and to call our custom update function.
def do_checkout(self, buildscript):
checkoutdir = self.get_checkoutroot(buildscript)
buildscript.set_action('Checking out', self)
res = self.update(buildscript, self.cvsmodule,
self.revision, buildscript.config.sticky_date,
self.cvsmodule)
if buildscript.config.nobuild:
nextstate = self.STATE_DONE
elif not buildscript.config.alwaysautogen and \
os.path.exists(os.path.join(checkoutdir, 'Makefile')):
nextstate = self.STATE_BUILD
else:
nextstate = self.STATE_CONFIGURE
# did the checkout succeed?
if res == 0 and os.path.exists(checkoutdir):
return (nextstate, None, None)
else:
return (nextstate, 'could not update module',
[self.STATE_FORCE_CHECKOUT])
# Override do_force_checkout to call get_checkoutroot rather than
# get_builddir and to call our custom checkout function.
def do_force_checkout(self, buildscript):
checkoutdir = self.get_checkoutroot(buildscript)
if buildscript.config.nobuild:
nextstate = self.STATE_DONE
else:
nextstate = self.STATE_CONFIGURE
buildscript.set_action('Checking out', self)
res = self.checkout(buildscript, 'gcc-core gcc-java gcc-g++ gcc/gcc/fixinc',
self.revision, buildscript.config.sticky_date)
if res == 0 and os.path.exists(checkoutdir):
return (nextstate, None, None)
else:
return (nextstate, 'could not checkout module',
[self.STATE_FORCE_CHECKOUT])
# Override do_configure to call get_checkoutroot as well as
# get_builddir and to change the binary directory to gcj-bin.
def do_configure(self, buildscript):
builddir = self.get_builddir(buildscript)
checkoutdir = self.get_checkoutroot(buildscript)
# Create the build directory, if it doesn't already exist
if not os.path.exists(builddir):
os.makedirs(builddir)
os.chdir(builddir)
cmd = os.path.join(checkoutdir, 'configure') + ' --prefix=%s' % buildscript.config.prefix \
+ ' --bindir=%s' % os.path.join(buildscript.config.prefix, 'gcj-bin')
buildscript.set_action('Configuring', self)
if buildscript.config.use_lib64:
cmd += " --libdir '${exec_prefix}/lib64'"
cmd += ' %s %s' % (self.autogenargs, buildscript.config.autogenargs)
if buildscript.config.makeclean:
nextstate = self.STATE_CLEAN
else:
nextstate = self.STATE_BUILD
if buildscript.execute(cmd) == 0:
return (nextstate, None, None)
else:
return (nextstate, 'could not configure module',
[self.STATE_FORCE_CHECKOUT])
# Override do_install to create a symbolic link from bin/gcj to
# gcj-bin/gcj, and likewise for gij.
def do_install(self, buildscript):
os.chdir(self.get_builddir(buildscript))
buildscript.set_action('Installing', self)
cmd = 'make %s install' % buildscript.config.makeargs
error = None
if buildscript.execute(cmd) != 0:
error = 'could not make module'
else:
buildscript.packagedb.add(self.name, self.revision or '')
os.symlink(os.path.join(buildscript.config.prefix, 'gcj-bin', 'gcj'), \
os.path.join(buildscript.config.prefix, 'bin', 'gcj'))
os.symlink(os.path.join(buildscript.config.prefix, 'gcj-bin', 'gij'), \
os.path.join(buildscript.config.prefix, 'bin', 'gij'))
return (self.STATE_DONE, error, [])
def parse_gcjmodule(node, config, dependencies, suggests, cvsroot):
id = node.getAttribute('id')
module = id
revision = None
checkoutdir = None
builddir = None
autogenargs = ''
if node.hasAttribute('module'):
module = node.getAttribute('module')
if node.hasAttribute('revision'):
revision = node.getAttribute('revision')
if node.hasAttribute('checkoutdir'):
checkoutdir = node.getAttribute('checkoutdir')
if node.hasAttribute('autogenargs'):
autogenargs = node.getAttribute('autogenargs')
if node.hasAttribute('builddir'):
builddir = node.getAttribute('builddir')
# override revision tag if requested.
revision = config.branches.get(module, revision)
autogenargs = config.module_autogenargs.get(module, autogenargs)
return GCJModule(module,
revision,
autogenargs,
dependencies,
suggests,
cvsroot,
builddir)
base.register_module_type('gcjmodule', parse_gcjmodule)
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2001-2004 James Henstridge
#
# gcjtest.py: module type definitions for libgcj testsuite modules
#
# 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
import os
import base
from jhbuild.utils import cvs
class GCJTestModule(base.CVSModule):
def __init__(self,
cvsmodule,
revision=None,
dependencies=[],
suggests=[],
cvsroot=None):
base.CVSModule.__init__(self,
cvsmodule,
revision=revision,
dependencies=dependencies,
suggests=suggests,
cvsroot=cvsroot)
def get_checkoutdir(self, buildscript):
return os.path.join(buildscript.config.checkoutroot,
'gcc', 'libjava', 'testsuite',
'libjava.' + self.cvsmodule)
# Override do_start to force next state to either STATE_CHECKOUT
# or STATE_DONE.
def do_start(self, buildscript):
if not buildscript.config.nonetwork: # normal start state
return (self.STATE_CHECKOUT, None, None)
else:
return (self.STATE_DONE, None, None)
# Override do_checkout to force next state to either
# STATE_FORCE_CHECKOUT or STATE_DONE, and to checkout in the
# directory returned by get_checkoutdir.
def do_checkout(self, buildscript):
checkoutdir = self.get_checkoutdir(buildscript)
cvsroot = cvs.CVSRoot(self.cvsroot, checkoutdir)
buildscript.set_action('Checking out', self)
res = cvsroot.update(buildscript, self.cvsmodule,
self.revision, buildscript.config.sticky_date,
checkoutdir=self.checkoutdir)
nextstate = self.STATE_DONE
# did the checkout succeed?
if res == 0 and os.path.exists(os.path.join(checkoutdir,
self.cvsmodule)):
return (nextstate, None, None)
else:
return (nextstate, 'could not update module',
[self.STATE_FORCE_CHECKOUT])
# Override do_force_checkout to force next state to STATE_DONE,
# and to checkout in the directory returned by get_checkoutdir.
def do_force_checkout(self, buildscript):
checkoutdir = self.get_checkoutdir(buildscript)
cvsroot = cvs.CVSRoot(self.cvsroot, checkoutdir)
nextstate = self.STATE_DONE
os.chdir(checkoutdir)
buildscript.set_action('Checking out', self)
res = cvsroot.checkout(buildscript, self.cvsmodule,
self.revision, buildscript.config.sticky_date,
checkoutdir=self.checkoutdir)
if res == 0 and os.path.exists(os.path.join(checkoutdir,
self.cvsmodule)):
return (nextstate, None, None)
else:
return (nextstate, 'could not checkout module',
[self.STATE_FORCE_CHECKOUT])
def parse_gcjtestmodule(node, config, dependencies, suggests, cvsroot):
id = node.getAttribute('id')
module = id
revision = None
checkoutdir = None
if node.hasAttribute('module'):
module = node.getAttribute('module')
if node.hasAttribute('revision'):
revision = node.getAttribute('revision')
if node.hasAttribute('checkoutdir'):
checkoutdir = node.getAttribute('checkoutdir')
# override revision tag if requested.
revision = config.branches.get(module, revision)
return GCJTestModule(module,
revision,
dependencies,
suggests,
cvsroot)
base.register_module_type('gcjtestmodule', parse_gcjtestmodule)
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2001-2004 James Henstridge
#
# gdb.py: module type definitions for the GNU Debugger
#
# 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
import os
import string
import base
from jhbuild.utils import cvs
class GDBModule(base.CVSModule):
def __init__(self,
cvsmodule,
revision=None,
autogenargs='',
dependencies=[],
suggests=[],
cvsroot=None,
builddir=None):
base.CVSModule.__init__(self,
cvsmodule,
revision=revision,
autogenargs=autogenargs,
dependencies=dependencies,
suggests=suggests,
cvsroot=cvsroot)
self.builddir = builddir
self.cvsroot = cvsroot
def get_builddir(self, buildscript):
return os.path.join(buildscript.config.builddir,
self.checkoutdir or self.cvsmodule)
def get_checkoutroot(self, buildscript):
return os.path.join(buildscript.config.checkoutroot, 'src')
# Override do_start to call get_checkoutroot rather than
# get_builddir.
def do_start(self, buildscript):
checkoutdir = self.get_checkoutroot(buildscript)
if not buildscript.config.nonetwork: # normal start state
return (self.STATE_CHECKOUT, None, None)
elif buildscript.config.nobuild:
return (self.STATE_DONE, None, None)
elif not buildscript.config.alwaysautogen and \
os.path.exists(os.path.join(checkoutdir, 'Makefile')):
return (self.STATE_BUILD, None, None)
else:
return (self.STATE_CONFIGURE, None, None)
# Override do_checkout to call get_checkoutroot rather than
# get_builddir.
def do_checkout(self, buildscript):
cvsroot = cvs.CVSRoot(self.cvsroot,
buildscript.config.checkoutroot)
checkoutdir = self.get_checkoutroot(buildscript)
buildscript.set_action('Checking out', self)
res = cvsroot.update(buildscript, self.cvsmodule,
self.revision, buildscript.config.sticky_date,
checkoutdir=self.checkoutdir)
if buildscript.config.nobuild:
nextstate = self.STATE_DONE
elif buildscript.config.alwaysautogen or \
not os.path.exists(os.path.join(checkoutdir, 'Makefile')):
nextstate = self.STATE_CONFIGURE
elif buildscript.config.makeclean:
nextstate = self.STATE_CLEAN
else:
nextstate = self.STATE_BUILD
# did the checkout succeed?
if res == 0 and os.path.exists(checkoutdir):
return (nextstate, None, None)
else:
return (nextstate, 'could not update module',
[self.STATE_FORCE_CHECKOUT])
# Override do_force_checkout to call get_checkoutroot rather than
# get_builddir.
def do_force_checkout(self, buildscript):
cvsroot = cvs.CVSRoot(self.cvsroot,
buildscript.config.checkoutroot)
checkoutdir = self.get_checkoutroot(buildscript)
if buildscript.config.nobuild:
nextstate = self.STATE_DONE
else:
nextstate = self.STATE_CONFIGURE
buildscript.set_action('Checking out', self)
res = cvsroot.checkout(buildscript, self.cvsmodule,
self.revision, buildscript.config.sticky_date,
checkoutdir=self.checkoutdir)
if res == 0 and os.path.exists(checkoutdir):
return (nextstate, None, None)
else:
return (nextstate, 'could not checkout module',
[self.STATE_FORCE_CHECKOUT])
# Override do_configure to call get_checkoutroot as well as
# get_builddir, and to remove --disable-static from autogenargs.
def do_configure(self, buildscript):
builddir = self.get_builddir(buildscript)
checkoutdir = self.get_checkoutroot(buildscript)
# Create the build directory, if it doesn't already exist
if not os.path.exists(builddir):
os.makedirs(builddir)
os.chdir(builddir)
cmd = os.path.join(checkoutdir, 'configure') + ' --prefix=%s' % buildscript.config.prefix
buildscript.set_action('Configuring', self)
if buildscript.config.use_lib64:
cmd += " --libdir '${exec_prefix}/lib64'"
# gdb cannot be built with --disable-static, so remove it from
# autogenargs if it is present.
config_autogenargs = string.replace(buildscript.config.autogenargs,
'--disable-static', '')
cmd += ' %s %s' % (self.autogenargs, config_autogenargs)
if buildscript.config.makeclean:
nextstate = self.STATE_CLEAN
else:
nextstate = self.STATE_BUILD
if buildscript.execute(cmd) == 0:
return (nextstate, None, None)
else:
return (nextstate, 'could not configure module',
[self.STATE_FORCE_CHECKOUT])
def parse_gdbmodule(node, config, dependencies, suggests, cvsroot):
id = node.getAttribute('id')
module = id
revision = None
checkoutdir = None
builddir = None
autogenargs = ''
if node.hasAttribute('module'):
module = node.getAttribute('module')
if node.hasAttribute('revision'):
revision = node.getAttribute('revision')
if node.hasAttribute('checkoutdir'):
checkoutdir = node.getAttribute('checkoutdir')
if node.hasAttribute('autogenargs'):
autogenargs = node.getAttribute('autogenargs')
if node.hasAttribute('builddir'):
builddir = node.getAttribute('builddir')
# override revision tag if requested.
revision = config.branches.get(module, revision)
autogenargs = config.module_autogenargs.get(module, autogenargs)
return GDBModule(module,
revision,
autogenargs,
dependencies,
suggests,
cvsroot,
builddir)
base.register_module_type('gdbmodule', parse_gdbmodule)
# jhbuild - a build script for GNOME 1.x and 2.x
# Copyright (C) 2001-2004 James Henstridge
#
# javagnome.py: module type definitions for the java-gnome language
# bindings
#
# 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
import os
import base
from jhbuild.utils import cvs
class JavaGnomeModule(base.CVSModule):
def __init__(self,
cvsmodule,
revision=None,
autogenargs='',
dependencies=[],
suggests=[],
cvsroot=None):
base.CVSModule.__init__(self,
cvsmodule,
revision=revision,
autogenargs=autogenargs,
dependencies=dependencies,
suggests=suggests,
cvsroot=cvsroot)
def do_configure(self, buildscript):
checkoutdir = self.get_builddir(buildscript)
os.chdir(checkoutdir)
buildscript.set_action('Configuring', self)
res = buildscript.execute('./genConfigure.in')
if res != 0:
return (nextstate, 'genConfigure.in failed',
[self.STATE_FORCE_CHECKOUT])
res = buildscript.execute('./genMakefile.in')
if res != 0:
return (nextstate, 'genMakefile.in failed',
[self.STATE_FORCE_CHECKOUT])
res = buildscript.execute('autoconf')
if res != 0:
return (nextstate, 'autoconf failed',
[self.STATE_FORCE_CHECKOUT])
cmd = './configure --prefix %s' % buildscript.config.prefix
if buildscript.config.use_lib64:
cmd += " --libdir '${exec_prefix}/lib64'"
cmd += ' %s %s' % (self.autogenargs, buildscript.config.autogenargs)
if buildscript.config.makeclean:
nextstate = self.STATE_CLEAN
else:
nextstate = self.STATE_BUILD
if buildscript.execute(cmd) == 0:
return (nextstate, None, None)
else:
return (nextstate, 'could not configure module',
[self.STATE_FORCE_CHECKOUT])
def parse_javagnomemodule(node, config, dependencies, suggests, cvsroot):
id = node.getAttribute('id')
module = id
revision = None
checkoutdir = None
builddir = None
autogenargs = ''
if node.hasAttribute('module'):
module = node.getAttribute('module')
if node.hasAttribute('revision'):
revision = node.getAttribute('revision')
if node.hasAttribute('checkoutdir'):
checkoutdir = node.getAttribute('checkoutdir')
if node.hasAttribute('autogenargs'):
autogenargs = node.getAttribute('autogenargs')
# override revision tag if requested.
revision = config.branches.get(module, revision)
autogenargs = config.module_autogenargs.get(module, autogenargs)
return JavaGnomeModule(module,
revision,
autogenargs,
dependencies,
suggests,
cvsroot)
base.register_module_type('javagnomemodule', parse_javagnomemodule)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]