Skip to content

Commit

Permalink
more documentation updates.
Browse files Browse the repository at this point in the history
2001-12-04  James Henstridge  <[email protected]>

	* README: more documentation updates.

	* gettext-changelog.patch: a patch to make gettextize not suck.

	* bootstrap.py (build_bootstraps): code to handle building
	required tools, such as autoconf, etc.

	* module.py (BuildScript.__init__): get rid of code setting up the
	environment from here.

	* jhbuild.py (addpath): move code that sets up the environment to
	this file.
  • Loading branch information
James Henstridge authored and James Henstridge committed Dec 5, 2001
1 parent 1438f16 commit aa1943a
Show file tree
Hide file tree
Showing 6 changed files with 346 additions and 64 deletions.
13 changes: 13 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
2001-12-04 James Henstridge <[email protected]>

* README: more documentation updates.

* gettext-changelog.patch: a patch to make gettextize not suck.

* bootstrap.py (build_bootstraps): code to handle building
required tools, such as autoconf, etc.

* module.py (BuildScript.__init__): get rid of code setting up the
environment from here.

* jhbuild.py (addpath): move code that sets up the environment to
this file.

* README: update readme to reflect changed command line args.

* jhbuild.py (main): rearrange the argument parsing a bit.
Expand Down
69 changes: 63 additions & 6 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,76 @@ This is another set of scripts for building GNOME 2. They are still a
little rough around the edges, but may still be useful to you.

They don't enforce any particular checkout, build or install
directories for your gnome2 setup. Currently, it doesn't handle
external modules that must be installed (such as gettext, libtool,
etc) -- those will need to be installed manually.
directories for your gnome2 setup (this is deduced from the config
file).

Once the dependency information is added, the script should be usable
for a stable gnome setup as well.
You must have python >= 1.5.2 installed for jhbuild to run.


Why use jhbuild?
----------------

I wrote jhbuild because there were a few features missing from
vicious-build-scripts that I wanted. The main one is dependency
handling.

With vicious-build-scripts, there is a list of modules that get built
in order. In contrast, jhbuild stores a list of modules along with
their dependencies. In the config file, you specify what modules you
want to end up with, and it will work out what dependencies need to be
built.

The other main feature of jhbuild is its error handling. If an error
occurs while building a module, you are given a number of options:
rerun the build stage, start a shell, give up on the module, or ignore
the error. If you give up on the module, then jhbuild will not
attempt to build any module that depends on it (taking into account
transitive dependencies, as needed). At the end of the build, a list
of unbuilt modules is printed.

If you wish to run a non interactive build, you can pass the
--no-interact option.


Configuring
-----------

To install the scripts run "make install", and then copy
sample.jhbuildrc to ~/.jhbuildrc and edit to match your setup. My rc
file is provided for reference as jamesh.jhbuildrc.

For people using vicious-build-scripts to build gnome 2.0, the
vbs-head.jhbuildrc sample configuration file might be a good one to
start with.

To build some gnome 2.0 modules, you may need a newer version of one
of the auto* tools, or pkg-config. If you are unsure, type the
following to check:
jhbuild bootstrap

This will check your tools, and optionally download and build the
required versions (they will be installed under the prefix given in
your .jhbuildrc file). Currently it checks for and builds the
following:
gettext 0.10.40 (applies the patch to fix the po/ChangeLog problem)
autoconf 2.52
libtool 1.4.2
automake 1.5
pkg-config 0.8.0

Bootstrapping should only need to be done once (unless the
requirements of some package change).


Using jhbuild
-------------

To build everything, just type 'jhbuild build', or just 'jhbuild'.
Some useful options that this command takes include:

--autogen always run autogen.sh
--clean run "make clean" before make when building
--no-cvs don't update source from cvs
--skip=MODULES skip building the given modules

If you just want to checkout the latest versions of everything, run:
Expand All @@ -32,7 +83,7 @@ If you just want to checkout the latest versions of everything, run:
If you want to build everything without updating from CVS (for
instance, when disconnected from the internet), use the following
command:
jhbuild compile
jhbuild build --no-cvs

(this command takes the same options as 'jhbuild build').

Expand All @@ -43,6 +94,12 @@ LD_LIBRARY_PATH, etc all configured), use the following command:
For example, to start a shell in the build environment:
jhbuild run bash

To build a single module with no dependencies, use the following
command:
jhbuild buildone modulename

(this command takes the same extra options as 'jhbuild build').


Error handling
--------------
Expand Down
138 changes: 138 additions & 0 deletions bootstrap.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@

import os, string
import urllib

_boldcode = os.popen('tput bold', 'r').read()
_normal = os.popen('tput rmso', 'r').read()

class Bootstrap:
def __init__(self, package, version, sourceurl, sourcesize, patch=None,
versioncheck=None):
self.package = package
self.version = version
self.sourceurl = sourceurl
self.sourcesize = sourcesize
self.patch = patch
self.versioncheck = versioncheck
def _bold(self, msg):
print '%s*** %s ***%s' % (_boldcode, msg, _normal)
def _execute(self, command):
print command
ret = os.system(command)
print
return ret
def wants_package(self):
self._bold('checking for %s %s' % (self.package, self.version))
if self.versioncheck:
out = os.popen(self.versioncheck, 'r').read()
if out == '':
print 'package not found'
elif string.find(out, self.version):
print 'package found'
return 0
else:
if out[-1] == '\n': out = out[:-1]
print 'might be okay:'
print out
val = raw_input('do you want to install %s %s [Y/n]? '
% (self.package, self.version))
if val and string.lower(val)[0] == 'n':
return 0
return 1
def build(self, config):
if not self.wants_package():
return

# get the source package
buildroot = config['checkoutroot']
localfile = os.path.join(buildroot, os.path.basename(self.sourceurl))
if not os.path.exists(localfile) or \
os.stat(localfile)[6] != self.sourcesize:
while 1:
self._bold('downloading %s' % self.sourceurl)
try:
urllib.urlretrieve(self.sourceurl, localfile)
if os.stat(localfile)[6] == self.sourcesize:
break # we got the file
print 'downloaded file does not match expected size'
except IOError:
print 'could not download file'
val = raw_input('try downloading again? ')
if val and string.lower(val)[0] == 'n':
return

# untar the source package
os.chdir(buildroot)
localfile = os.path.basename(self.sourceurl)
self._bold('untaring %s' % localfile)
ret = self._execute('zcat %s | tar xf -' % localfile)
if ret != 0:
print 'failed to untar', self.package
return

# change to package directory
assert localfile[-7:] == '.tar.gz', 'package name should end in .tar.gz'
os.chdir(localfile[:-7])

# is there a patch to apply?
if self.patch:
patchfile = os.path.join(os.path.basename(__file__), self.patch)
self._bold('applying patch %s' % self.patch)
ret = self._execute('patch -p1 < %s' % patchfile)
if ret != 0:
print 'failed to patch', self.package
return

# configure ...
self._bold('configuring %s' % self.package)
ret = self._execute('./configure --prefix %s' % config['prefix'])
if ret != 0:
print 'failed to configure', self.package
return

# make
self._bold('building %s' % self.package)
ret = self._execute('make')
if ret != 0:
print 'failed to build', self.package
return

# install
self._bold('installing %s' % self.package)
ret = self._execute('make install')
if ret != 0:
print 'failed to install', self.package
return

bootstraps = [
Bootstrap('gettext', '0.10.40',
'ftp://ftp.gnu.org/pub/gnu/gettext/gettext-0.10.40.tar.gz',
1352976,
'gettext-changelog.patch', # patch to unbreak gettext ...
'gettextize --version | head -1'),
Bootstrap('autoconf', '2.52',
'ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.52.tar.gz',
846656,
None,
'autoconf --version | head -1'),
Bootstrap('libtool', '1.4.2',
'ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.4.2.tar.gz',
1184578,
None,
'libtoolize --version'),
# some would argue that 1.4-p5 is a better choice, but ...
Bootstrap('automake', '1.5',
'ftp://ftp.gnu.org/pub/gnu/automake/automake-1.5.tar.gz',
526934,
None,
'automake --version | head -1'),
Bootstrap('pkg-config', '0.8.0',
'http://www.freedesktop.org/software/pkgconfig/releases/pkgconfig-0.8.0.tar.gz',
585852,
None,
'pkg-config --version')
]

def build_bootstraps(config):
for bootstrap in bootstraps:
bootstrap.build(config)
37 changes: 37 additions & 0 deletions gettext-changelog.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
This patch prevents gettextize from screwing up po/ChangeLog
The gettext maintainers were on crack when adding this `feature'

--- gettext-0.10.38/misc/gettextize.in.cl Wed May 23 00:57:18 2001
+++ gettext-0.10.38/misc/gettextize.in Thu Jul 12 09:56:35 2001
@@ -178,31 +178,14 @@
{ $echo "Copying file po/$file"; cp $file $srcdir/po/$file; }
done
DATE=`date +%Y-%m-%d`
-cat > $srcdir/po/ChangeLog.tmp <<EOF
-$DATE gettextize <[email protected]>
-
- * Makefile.in.in: Upgrade to gettext-${version}.
-EOF
if test -f $srcdir/po/cat-id-tbl.c; then
$echo "Removing po/cat-id-tbl.c"
rm -f $srcdir/po/cat-id-tbl.c
- $echo " * cat-id-tbl.c: Remove file." >> $srcdir/po/ChangeLog.tmp
fi
if test -f $srcdir/po/stamp-cat-id; then
$echo "Removing po/stamp-cat-id"
rm -f $srcdir/po/stamp-cat-id
- $echo " * stamp-cat-id: Remove file." >> $srcdir/po/ChangeLog.tmp
fi
-$echo >> $srcdir/po/ChangeLog.tmp
-if test -f $srcdir/po/ChangeLog; then
- $echo "Adding an entry to po/ChangeLog (backup is in po/ChangeLog~)"
- cat $srcdir/po/ChangeLog >> $srcdir/po/ChangeLog.tmp
- cp -p $srcdir/po/ChangeLog $srcdir/po/ChangeLog~
-else
- $echo "Creating po/ChangeLog"
-fi
-cp $srcdir/po/ChangeLog.tmp $srcdir/po/ChangeLog
-rm -f $srcdir/po/ChangeLog.tmp

echo
echo "Please add the files"
Loading

0 comments on commit aa1943a

Please sign in to comment.