changeset 3365:cb9077953e4e

Grand lib -> gub, specs -> gub/specs, gub/specs/cross renaming.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Sun, 29 Apr 2007 23:28:01 +0200
parents 0bbe91ee5b8c
children 7d7c2146ad59
files GNUmakefile bin/cygwin-packager bin/gpkg bin/gub bin/installer-builder bin/test-gub gub.make gub/__init__.py gub/config_cache.py gub/context.py gub/cross.py gub/cygwin.py gub/darwintools.py gub/debian-arm.py gub/debian.py gub/distcc.py gub/freebsd.py gub/gubb.py gub/gup.py gub/installer.py gub/linux-arm-softfloat.py gub/linux.py gub/locker.py gub/mingw.py gub/mipsel.py gub/mirrors.py gub/misc.py gub/oslog.py gub/repository.py gub/settings.py gub/specs/__init__.py gub/specs/a52dec.py gub/specs/alien.py gub/specs/autoconf.py gub/specs/automake.py gub/specs/bash.py gub/specs/boost.py gub/specs/cross/__init__.py gub/specs/cross/binutils.py gub/specs/cross/gcc-core.py gub/specs/cross/gcc.py gub/specs/distcc.py gub/specs/e2fsprogs.py gub/specs/expat.py gub/specs/faac.py gub/specs/faad2.py gub/specs/ffmpeg.py gub/specs/flex.py gub/specs/fondu.py gub/specs/fontconfig.py gub/specs/fontforge.py gub/specs/freetype-config.py gub/specs/freetype.py gub/specs/gettext.py gub/specs/ghostscript.py gub/specs/git.py gub/specs/glib.py gub/specs/glibc-core.py gub/specs/glibc.py gub/specs/gmp.py gub/specs/guile-config.py gub/specs/guile.py gub/specs/hello.py gub/specs/icoutils.py gub/specs/imagemagick.py gub/specs/libdbi-drivers-sqlite3.py gub/specs/libdbi.py gub/specs/libgnugetopt.py gub/specs/libiconv.py gub/specs/libjpeg.py gub/specs/libpng.py gub/specs/libtool.py gub/specs/libxml2.py gub/specs/lilypad.py gub/specs/lilypond.py gub/specs/linux-headers.py gub/specs/mftrace.py gub/specs/netpbm.py gub/specs/nsis.py gub/specs/osx-lilypad.py gub/specs/pango.py gub/specs/pic.py gub/specs/pjproject.py gub/specs/pkg-config.py gub/specs/potrace.py gub/specs/python-config.py gub/specs/python.py gub/specs/python25.py gub/specs/qtopia-core.py gub/specs/regex.py gub/specs/scons.py gub/specs/sqlite.py gub/specs/texinfo.py gub/specs/texlive.py gub/specs/tslib.py gub/specs/urw-fonts.py gub/specs/xerces-c.py gub/specs/zlib.py gub/targetpackage.py gub/toolpackage.py gub/tools.py gub/versiondb.py gub/with-lock.py lib/config_cache.py lib/context.py lib/cross.py lib/cygwin.py lib/darwintools.py lib/debian-arm.py lib/debian.py lib/distcc.py lib/freebsd.py lib/gub.py lib/gup.py lib/installer.py lib/linux-arm-softfloat.py lib/linux.py lib/locker.py lib/mingw.py lib/mipsel.py lib/mirrors.py lib/misc.py lib/oslog.py lib/repository.py lib/settings.py lib/targetpackage.py lib/toolpackage.py lib/tools.py lib/versiondb.py lib/with-lock.py specs/a52dec.py specs/alien.py specs/autoconf.py specs/automake.py specs/bash.py specs/binutils.py specs/boost.py specs/distcc.py specs/e2fsprogs.py specs/expat.py specs/faac.py specs/faad2.py specs/ffmpeg.py specs/flex.py specs/fondu.py specs/fontconfig.py specs/fontforge.py specs/freetype-config.py specs/freetype.py specs/gcc-core.py specs/gcc.py specs/gettext.py specs/ghostscript.py specs/git.py specs/glib.py specs/glibc-core.py specs/glibc.py specs/gmp.py specs/guile-config.py specs/guile.py specs/hello.py specs/icoutils.py specs/imagemagick.py specs/libdbi-drivers-sqlite3.py specs/libdbi.py specs/libgnugetopt.py specs/libiconv.py specs/libjpeg.py specs/libpng.py specs/libtool.py specs/libxml2.py specs/lilypad.py specs/lilypond.py specs/linux-headers.py specs/mftrace.py specs/netpbm.py specs/nsis.py specs/osx-lilypad.py specs/pango.py specs/pic.py specs/pjproject.py specs/pkg-config.py specs/potrace.py specs/python-config.py specs/python.py specs/python25.py specs/qtopia-core.py specs/regex.py specs/scons.py specs/sqlite.py specs/texinfo.py specs/texlive.py specs/tslib.py specs/urw-fonts.py specs/xerces-c.py specs/zlib.py
diffstat 194 files changed, 10071 insertions(+), 10047 deletions(-) [+]
line wrap: on
line diff
--- a/GNUmakefile	Sun Apr 29 13:09:16 2007 +0200
+++ b/GNUmakefile	Sun Apr 29 23:28:01 2007 +0200
@@ -1,4 +1,4 @@
-sources = GNUmakefile $(wildcard *.make *.py specs/*.py lib/*.py)
+sources = GNUmakefile $(filter-out %~, $(wildcard *.make bin/* gub/*.py gub/specs/*.py gub/specs/cross/*.py))
 
 default: compilers
 
--- a/bin/cygwin-packager	Sun Apr 29 13:09:16 2007 +0200
+++ b/bin/cygwin-packager	Sun Apr 29 23:28:01 2007 +0200
@@ -25,14 +25,12 @@
 import optparse
 import os
 import sys
-
-sys.path.insert (0, 'lib/')
-
-import context
-import gup
-import settings as settings_mod
-import misc
-import cygwin
+#
+from gub import context
+from gub import gup
+import gub.settings
+from gub import misc
+from gub import cygwin
 
 class Cygwin_package (context.Os_context_wrapper):
     def __init__ (self, settings, name, branch):
@@ -325,7 +323,7 @@
 def main ():
     (options, commands)  = parse_command_line ()
     platform = 'cygwin'
-    settings = settings_mod.get_settings (platform)
+    settings = gub.settings.get_settings (platform)
     # We want to be able to specify a build number for cygwin packages
     # that are not distributed on lp.org
     settings.build = options.build
--- a/bin/gpkg	Sun Apr 29 13:09:16 2007 +0200
+++ b/bin/gpkg	Sun Apr 29 23:28:01 2007 +0200
@@ -27,9 +27,7 @@
 import re
 import string
 import sys
-
-sys.path.insert (0, 'lib/')
-
+#
 import gup
 import oslog
 
--- a/bin/gub	Sun Apr 29 13:09:16 2007 +0200
+++ b/bin/gub	Sun Apr 29 23:28:01 2007 +0200
@@ -24,17 +24,14 @@
 import re
 import string
 import sys
-
-sys.path.insert (0, 'lib/')
-
-import cross
-
+#
+from gub import cross
 ## fixme: double use of gub name.
-import gub
-import gup
-import misc
-import settings as settings_mod
-import locker
+from gub import gubb
+from gub import misc
+import gub.settings
+from gub import locker
+from gub import gup
 
 def get_cli_parser ():
     import optparse
@@ -61,7 +58,7 @@
                   type='choice',
                   default=None,
                   help='select target platform',
-                  choices=settings_mod.platforms.keys ())
+                  choices=gub.settings.platforms.keys ())
 
     p.add_option ('--inspect', action='store',
                   dest='inspect_key',
@@ -327,7 +324,7 @@
 
     ## UGH -> double work, see cross.change_target_packages () ?
     sdk_pkgs = [p for p in specs.values ()
-                if isinstance (p, gub.SdkBuildSpec)]
+                if isinstance (p, gubb.SdkBuildSpec)]
     cross_pkgs = [p for p in specs.values ()
                   if isinstance (p, cross.CrossToolSpec)]
 
@@ -343,7 +340,7 @@
         
 def get_settings (options):
     # FIXME, move (all these get_setting*) to constructors
-    settings = settings_mod.get_settings (options.platform)
+    settings = gub.settings.get_settings (options.platform)
     settings.set_branches (options.branches)
     settings.build_source = options.build_source
     settings.cpu_count = options.cpu_count
--- a/bin/installer-builder	Sun Apr 29 13:09:16 2007 +0200
+++ b/bin/installer-builder	Sun Apr 29 23:28:01 2007 +0200
@@ -28,11 +28,11 @@
 
 sys.path.insert (0, 'lib/')
 
-import gup
-import installer
-import settings as settings_mod
-import locker
-import versiondb
+from gub import gup
+from gub import installer
+import gub.settings
+from gub import locker
+from gub import versiondb
 
 def parse_command_line ():
     p = optparse.OptionParser ()
@@ -82,7 +82,7 @@
                   type='choice',
                   default=None,
                   help='select target platform',
-                  choices=settings_mod.platforms.keys ())
+                  choices=gub.settings.platforms.keys ())
 
     (options, args) = p.parse_args ()
     
@@ -209,7 +209,7 @@
 def main ():
     (options, commands)  = parse_command_line ()
 
-    settings = settings_mod.get_settings (options.platform)
+    settings = gub.settings.get_settings (options.platform)
 
     settings.set_branches (options.branches)
     for s in options.settings:
--- a/bin/test-gub	Sun Apr 29 13:09:16 2007 +0200
+++ b/bin/test-gub	Sun Apr 29 23:28:01 2007 +0200
@@ -244,7 +244,7 @@
 def real_main (options, args, handle_result):
     global log_file
 
-    log = 'log/test-gub.log'
+    log = 'log/test-gubb.log'
     if options.dry_run:
         log = ''
 
--- a/gub.make	Sun Apr 29 13:09:16 2007 +0200
+++ b/gub.make	Sun Apr 29 23:28:01 2007 +0200
@@ -1,7 +1,7 @@
 CWD:=$(shell pwd)
 PYTHON=python
-PYTHONPATH=lib/
-export PYTHONPATH
+#PYTHONPATH=gub
+#export PYTHONPATH
 
 ## must always have one host.
 GUB_DISTCC_ALLOW_HOSTS=127.0.0.1
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/__init__.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,21 @@
+"""
+    Copyright (c) 2005--2007
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+"""gub lib"""
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/config_cache.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,272 @@
+config_cache = {
+    'local': '',
+    'all': '''
+
+# FIXME: 32 bit only
+ac_16bit_type=${ac_16bit_type=short}
+ac_32bit_type=${ac_32bit_type=int}
+ac_64bit_type=${ac_64bit_type=none}
+ac_cv_c_long_size_t=${ac_cv_c_long_size_t=no}
+ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
+ac_cv_c_stack_direction=${ac_cv_c_stack_direction=-1}
+ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
+ac_cv_func_select=${ac_cv_func_select=yes} # but in mingw only if winsock2.h
+ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
+ac_cv_lib_dld_shl_load=${ac_cv_lib_dld_shl_load=no}
+ac_cv_search_dlopen=${ac_cv_search_dlopen="none required"}
+ac_cv_sizeof___int64=${ac_cv_sizeof___int64=0}
+# FIXME: 32 bit only
+ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
+ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
+ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
+ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
+ac_cv_sizeof_intmax_t=${ac_cv_sizeof_intmax_t=8}
+ac_cv_sizeof_intptr_t=${ac_cv_sizeof_intptr_t=4}
+ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
+ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=12}
+ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
+ac_cv_sizeof_ptrdiff_t=${ac_cv_sizeof_ptrdiff_t=4}
+ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
+ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4}
+ac_cv_sizeof_uintptr_t=${ac_cv_sizeof_uintptr_t=4}
+ac_cv_sizeof_unsigned___int64=${ac_cv_sizeof_unsigned___int64=0}
+ac_cv_sizeof_unsigned_char=${ac_cv_sizeof_unsigned_char=1}
+ac_cv_sizeof_unsigned_int=${ac_cv_sizeof_unsigned_int=4}
+ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=4}
+ac_cv_sizeof_unsigned_long_long=${ac_cv_sizeof_unsigned_long_long=8}
+ac_cv_sizeof_unsigned_short=${ac_cv_sizeof_unsigned_short=2}
+ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=4}
+ac_cv_spinlocks=${ac_cv_spinlocks=no}
+ac_cv_sprintf_count=${ac_cv_sprintf_count=yes}
+ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=yes}
+
+# libtool searches not only in the cross libpath
+#     /cygwin/usr/lib:/cygwin/usr/lib/w32api:/usr/i686-cygwin/lib
+# but also in /usr/lib.  there it finds libdl.a and adds -ldl
+# to LIBS
+# it seems that libtool is broken wrt cross compilation:
+#    sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+
+lt_cv_dlopen=${lt_cv_dlopen="dlopen"}
+''',
+    'arm' : '''
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+''',
+    'mipsel' : '''
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+''',
+    'freebsd6-x86' : '''
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=no}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-lc"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib "'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib "'"}
+
+
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+
+
+libc_cv_forced_unwind=${libc_cv_forced_unwind=yes}
+libc_cv_c_cleanup=${libc_cv_c_cleanup=yes}
+
+''',
+    'linux-x86' : '''
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+
+
+
+''',
+    'linux-64' : """
+# FIXME: clean type lengths from `all' section
+unset ac_16bit_type
+unset ac_32bit_type
+unset ac_64bit_type
+unset ac_cv_c_long_size_t
+unset ac_cv_c_long_time_t
+#
+unset ac_cv_sizeof___int64
+unset ac_cv_sizeof_char
+unset ac_cv_sizeof_char_p
+unset ac_cv_sizeof_double
+unset ac_cv_sizeof_float
+unset ac_cv_sizeof_int
+unset ac_cv_sizeof_intmax_t
+unset ac_cv_sizeof_intptr_t
+unset ac_cv_sizeof_long
+unset ac_cv_sizeof_long_double
+unset ac_cv_sizeof_long_long
+unset ac_cv_sizeof_ptrdiff_t
+unset ac_cv_sizeof_short
+unset ac_cv_sizeof_size_t
+unset ac_cv_sizeof_uintptr_t
+unset ac_cv_sizeof_unsigned___int64
+unset ac_cv_sizeof_unsigned_char
+unset ac_cv_sizeof_unsigned_int
+unset ac_cv_sizeof_unsigned_long
+unset ac_cv_sizeof_unsigned_long_long
+unset ac_cv_sizeof_unsigned_short
+unset ac_cv_sizeof_void_p
+
+
+ac_16bit_type=${ac_16bit_type=short}
+ac_32bit_type=${ac_32bit_type=int}
+ac_64bit_type=${ac_64bit_type=long}
+ac_cv_c_long_size_t=${ac_cv_c_long_size_t=yes}
+ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
+#
+ac_cv_sizeof___int64=${ac_cv_sizeof___int64=0}
+ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
+ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=8}
+ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
+ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
+ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
+ac_cv_sizeof_intmax_t=${ac_cv_sizeof_intmax_t=8}
+ac_cv_sizeof_intptr_t=${ac_cv_sizeof_intptr_t=8}
+ac_cv_sizeof_long=${ac_cv_sizeof_long=8}
+ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=16}
+ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
+ac_cv_sizeof_ptrdiff_t=${ac_cv_sizeof_ptrdiff_t=8}
+ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
+ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=8}
+ac_cv_sizeof_uintptr_t=${ac_cv_sizeof_uintptr_t=8}
+ac_cv_sizeof_unsigned___int64=${ac_cv_sizeof_unsigned___int64=0}
+ac_cv_sizeof_unsigned_char=${ac_cv_sizeof_unsigned_char=1}
+ac_cv_sizeof_unsigned_int=${ac_cv_sizeof_unsigned_int=4}
+ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=8}
+ac_cv_sizeof_unsigned_long_long=${ac_cv_sizeof_unsigned_long_long=8}
+ac_cv_sizeof_unsigned_short=${ac_cv_sizeof_unsigned_short=2}
+ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=8}
+
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+
+""",
+    'darwin-ppc' : '''
+ac_cv_c_bigendian=${ac_cv_c_bigendian=yes}
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_type_socklen_t=${ac_cv_type_socklen_t=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
+
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
+
+
+''',
+    'linux-ppc' : '''
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
+##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
+ac_cv_c_bigendian=${ac_cv_c_bigendian=yes}
+
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+
+''',
+
+    'darwin-x86' : '''
+ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
+ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
+ac_cv_type_socklen_t=${ac_cv_type_socklen_t=yes}
+
+glib_cv_uscore=${glib_cv_uscore=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
+
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
+''',
+
+    ## check me: ac_cv_file__dev_ptmx
+    'cygwin': '''
+ac_cv_func_mkfifo=${ac_cv_func_mkfifo=yes}
+ac_cv_have_dev_ptc=${ac_cv_have_dev_ptc=}
+ac_cv_have_dev_ptmx=${ac_cv_have_dev_ptmx=}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib/w32api %(system_root)s/lib"'"}
+''',
+    'mingw': '''
+ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
+ac_cv_func_memcmp_working=${ac_cv_func_memcmp_working=yes}
+ac_cv_func_mkfifo=${ac_cv_func_mkfifo=no}
+ac_cv_func_stat_empty_string_bug=${ac_cv_func_stat_empty_string_bug=no}
+ac_cv_have_dev_ptc=${ac_cv_have_dev_ptc=no}
+ac_cv_have_dev_ptmx=${ac_cv_have_dev_ptmx=no}
+ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
+ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
+ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
+ac_cv_exeext=${ac_cv_exeext=.exe}
+ac_exeext=${ac_exeext=}
+ac_cv_type_struct_sockaddr_storage=${ac_cv_type_struct_sockaddr_storage=yes}
+ac_cv_c_c99_format=${ac_cv_c_c99_format=no}
+lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
+lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib/w32api %(system_root)s/lib"'"}
+'''
+}
+
+config_cache['debian'] = config_cache['linux-x86']
+config_cache['debian-arm'] = config_cache['arm']
+config_cache['linux-arm-softfloat'] = config_cache['arm']
+config_cache['linux-arm-vfp'] = config_cache['arm']
+config_cache['freebsd-x86'] = config_cache['freebsd6-x86']
+config_cache['freebsd4-x86'] = config_cache['freebsd6-x86']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/context.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,222 @@
+import inspect
+import os
+import re
+import fnmatch
+
+def subst_method (func):
+    """Decorator to match Context.get_substitution_dict()"""
+    
+    func.substitute_me = True
+    return func
+
+def is_subst_method_in_class (method_name, klass):
+    bs = [k for k in klass.__bases__
+          if is_subst_method_in_class (method_name, k)]
+    if bs:
+        return True
+    
+    if (klass.__dict__.has_key (method_name)
+      and callable (klass.__dict__[method_name])
+      and klass.__dict__[method_name].__dict__.has_key ('substitute_me')):
+        return True
+
+    return False
+
+def typecheck_substitution_dict (d):
+    for (k, v) in d.items ():
+        if type (v) != type(''):
+            raise Exception ('type', (k, v))
+
+def recurse_substitutions (d):
+    for (k, v) in d.items ():
+        if type(v) != type(''):
+            del d[k]
+            continue
+
+        try:
+            while v.index ('%(') >= 0:
+                v = v % d
+        except ValueError:
+            pass
+        d[k] = v
+
+    return d
+
+class ConstantCall:
+    def __init__ (self, const):
+        self.const = const
+    def __call__ (self):
+        return self.const
+    
+class Context:
+    def __init__ (self, parent = None):
+        self._substitution_dict = None
+        self._parent = parent
+
+    def get_constant_substitution_dict (self):
+        d = {}
+        if self._parent:
+            d = self._parent.get_substitution_dict ()
+            d = d.copy ()
+            
+        ms = inspect.getmembers (self)
+        vars = dict((k, v) for (k, v) in ms if type (v) == type (''))
+
+        member_substs = {}
+        for (name, method) in ms:
+            try:
+                ccall = self.__dict__[name]
+                if isinstance (ccall, ConstantCall):
+                    method = ccall
+            except KeyError:
+                pass
+            
+            if (callable (method)
+                and is_subst_method_in_class (name, self.__class__)):
+                
+                val = method ()
+                self.__dict__[name] = ConstantCall (val)
+
+                member_substs[name] = val
+
+                if type (val) != type (''):
+                    print 'non string value ', val, 'for subst_method', name
+                    raise Exception
+        
+        d.update (vars)
+        d.update (member_substs)
+
+        d = recurse_substitutions (d)
+        return d
+
+    def get_substitution_dict (self, env={}):
+        if  self._substitution_dict == None:
+            self._substitution_dict = self.get_constant_substitution_dict ()
+
+        d = self._substitution_dict
+        if env:
+            d = d.copy ()
+            for (k, v) in env.items ():
+                try:
+                    if type (v) == type (''):
+                        d.update ({k: v % d})
+                except:
+                    print 'error substituting in', v
+                    print 'with', k
+                    raise 
+        return d
+    
+    def expand (self, s, env={}):
+        d = self.get_substitution_dict (env)
+        try:
+            e = s % d
+        except KeyError, v:
+            print 's=', s
+            raise v
+        except ValueError, v:
+            print 's=', s
+            raise v
+        return e
+
+class Os_context_wrapper (Context):
+    def __init__ (self, settings):
+        Context.__init__ (self, settings)
+        self.os_interface = settings.os_interface
+        self.verbose = settings.verbose ()
+        
+    def file_sub (self, re_pairs, name, to_name=None, env={}, must_succeed=False, use_re=True):
+        substs = []
+        for (frm, to) in re_pairs:
+            frm = self.expand (frm, env)
+            if type (to) ==type(''):
+                to = self.expand (to, env)
+
+            substs.append ((frm, to))
+
+        if to_name:
+            to_name = self.expand (to_name, env)
+            
+        return self.os_interface.file_sub (substs, self.expand (name, env), to_name, must_succeed, use_re=use_re)
+    
+    def log_command (self, str, env={}):
+        str = self.expand (str, env)
+        self.os_interface.log_command (str)
+        
+    def read_pipe (self, cmd, env={}, ignore_errors=False):
+        dict = self.get_substitution_dict (env)
+        return self.os_interface.read_pipe (cmd % dict, ignore_errors=ignore_errors)
+
+    def system (self, cmd, env={}, ignore_errors=False):
+        dict = self.get_substitution_dict (env)
+        cmd = self.expand (cmd, env)
+        self.os_interface.system (cmd, env=dict, ignore_errors=ignore_errors,
+                                  verbose=self.verbose)
+
+    def shadow_tree (self, src, dest):
+        src = self.expand (src)
+        dest = self.expand (dest)
+        self.os_interface.shadow_tree (src, dest)
+        
+    def dump (self, str, name, mode='w', env={},
+              expand_string=True, expand_name=True):
+        if expand_name:
+            name = self.expand (name, env)
+        if expand_string:
+            str = self.expand (str, env)
+            
+        return self.os_interface.dump (str, name, mode=mode)
+    
+    def locate_files (self, directory, pattern,
+                      include_dirs=True, include_files=True):
+        """
+        Find file using glob PATTERNs. DIRECTORY is expanded.
+
+        Results include DIRECTORY in the filenames.
+        """
+
+        ## find() is actually not portable across unices,
+        ## so we bake our own.
+        
+        directory = self.expand (directory)
+        directory = re.sub ( "/*$", '/', directory)
+        
+        results = []
+        for (root, dirs, files) in os.walk (directory):
+            relative_results = []
+            if include_dirs:
+                relative_results += dirs
+            if include_files:
+                relative_results += files
+                
+            results += [os.path.join (root, f)
+                        for f in (fnmatch.filter (relative_results, pattern))]
+
+        return results
+
+#
+# Tests.
+#
+if __name__=='__main__':
+    class TestBase(Context):
+        @subst_method
+        def bladir(self):
+            return 'foo'
+        
+    class TestClass(TestBase):
+        @subst_method
+        def name(self):
+            return self.__class__.__name__
+        
+        def bladir(self):
+            return 'derivedbladir'
+    class S: 
+        pass
+    
+    p = TestClass ()
+    from gub import settings
+    s = settings.Settings ('debian-arm')
+    c = Os_context_wrapper (s)
+
+    print c.locate_files ('/etc/', '*.conf')
+    
+    print p.expand ('%(name)s %(bladir)s')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/cross.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,183 @@
+import os
+#
+from gub import gubb
+from gub import misc
+
+from context import subst_method 
+class CrossToolSpec (gubb.BuildSpec):
+    """Package for cross compilers/linkers etc.
+    """
+
+    def configure_command (self):
+        return (gubb.BuildSpec.configure_command (self)
+            + misc.join_lines ('''
+--program-prefix=%(target_architecture)s-
+--prefix=%(cross_prefix)s
+--with-slibdir=/usr/lib
+--target=%(target_architecture)s
+--with-sysroot=%(system_root)s
+--disable-multilib
+'''))
+
+    def compile_command (self):
+        return self.native_compile_command ()
+        
+    def install_command (self):
+        return '''make DESTDIR=%(install_root)s prefix=/usr/cross install'''
+
+#    def gub_src_uploads (self):
+#        return '%(gub_cross_uploads)s'
+
+    def get_subpackage_names (self):
+        return ['doc', '']
+    
+    def license_file (self):
+        return ''
+
+#FIXME: merge fully with specs/binutils.py
+class Binutils (CrossToolSpec):
+    def install (self):
+        CrossToolSpec.install (self)
+        self.system ('rm %(install_root)s/usr/cross/lib/libiberty.a')
+    
+#FIXME: merge fully with specs/gcc
+class Gcc (CrossToolSpec):
+    def get_build_dependencies (self):
+        return ['cross/binutils']
+
+    @subst_method
+    def NM_FOR_TARGET(self):
+         return '%(tool_prefix)snm'
+
+    def get_subpackage_names (self):
+        # FIXME: why no -devel package?
+        return ['doc', 'runtime', '']
+
+    def languages (self):
+        return  ['c', 'c++']
+        
+    def configure_command (self):
+        cmd = CrossToolSpec.configure_command (self)
+        # FIXME: using --prefix=%(tooldir)s makes this
+        # uninstallable as a normal system package in
+        # /usr/i686-mingw/
+        # Probably --prefix=/usr is fine too
+
+        language_opt = (' --enable-languages=%s '
+                        % ','.join (self.languages ()))
+        cxx_opt = '--enable-libstdcxx-debug '
+
+        cmd += '''
+--with-as=%(cross_prefix)s/bin/%(target_architecture)s-as
+--with-ld=%(cross_prefix)s/bin/%(target_architecture)s-ld
+--enable-static
+--enable-shared '''
+
+        cmd += language_opt
+        if 'c++' in self.languages ():
+            cmd +=  ' ' + cxx_opt
+
+        return misc.join_lines (cmd)
+
+    def move_target_libs (self, libdir):
+        if not os.path.isdir (libdir):
+            return
+
+        files = []
+
+        ## .so* because version numbers trail .so extension. 
+        for suf in ['.la', '.so*', '.dylib']:
+            files += self.locate_files (libdir, 'lib*' + suf)
+            
+        for f in files:
+            (dir, file) = os.path.split (f)
+            target = self.expand ('%(install_prefix)s/%(dir)s', locals ())
+            if not os.path.isdir (target):
+                os.makedirs (target)
+            self.system ('mv %(f)s %(install_prefix)s/lib', locals ())
+
+    def install (self):
+        CrossToolSpec.install (self)
+        old_libs = self.expand ('%(install_root)s/usr/cross/%(target_architecture)s')
+
+        self.move_target_libs (old_libs)
+        self.move_target_libs (self.expand ('%(install_root)s/usr/cross/lib'))
+        if os.path.exists (self.expand ('cd %(install_root)s/usr/lib/libgcc_s.so.1')):
+            # FIXME: .so senseless for darwin.
+            self.system ('''
+cd %(install_root)s/usr/lib && ln -fs libgcc_s.so.1 libgcc_s.so
+''')
+
+def change_target_package (package):
+    pass
+
+def set_cross_dependencies (package_object_dict):
+    packs = package_object_dict.values ()
+    cross_packs = [p for p in packs if isinstance (p, CrossToolSpec)]
+    sdk_packs = [p for p in packs if isinstance (p, gubb.SdkBuildSpec)]
+    other_packs = [p for p in packs if (not isinstance (p, CrossToolSpec)
+                                        and not isinstance (p, gubb.SdkBuildSpec)
+                                        and not isinstance (p, gubb.BinarySpec))]
+    
+    sdk_names = [s.name() for s in sdk_packs]
+    cross_names = [s.name() for s in cross_packs]
+    for p in other_packs:
+        old_callback = p.get_build_dependencies
+        p.get_build_dependencies = misc.MethodOverrider (old_callback,
+                                                         lambda x,y: x+y, (cross_names,))
+
+    for p in other_packs + cross_packs:
+        old_callback = p.get_build_dependencies
+        p.get_build_dependencies = misc.MethodOverrider (old_callback,
+                                                         lambda x,y: x+y, (sdk_names,))
+
+    return packs
+
+cross_module_checksums = {}
+cross_module_cache = {}
+def get_cross_module (platform):
+    base = platform
+    try:
+        base = {
+            'darwin-ppc':'darwintools',
+            'darwin-x86':'darwintools',
+            'freebsd-x86': 'freebsd',
+            'freebsd4-x86': 'freebsd',
+            'freebsd6-x86': 'freebsd',
+            'linux-ppc' : 'linux',
+            'linux-x86' : 'linux',
+            'linux-64' : 'linux',
+            'local':'tools'}[platform]
+    except KeyError:
+        pass
+
+    if cross_module_cache.has_key (platform):
+        return cross_module_cache[platform]
+    
+    desc = ('.py', 'U', 1)
+    # FIXME: absolute path, should resolve in some way
+    file_name = 'gub/%s.py' % base
+    file = open (file_name)
+    print 'module-name: ' + file_name
+    import imp
+    module = imp.load_module (base, file, file_name, desc)
+
+    import md5
+    cross_module_checksums[platform] = md5.md5 (open (file_name).read ()).hexdigest ()
+    cross_module_cache[platform] = module
+    return module
+
+def get_cross_packages (settings):
+    mod = get_cross_module (settings.platform)
+    return mod.get_cross_packages (settings)
+
+def get_build_dependencies (settings):
+    mod = get_cross_module (settings.platform)
+    return mod.get_cross_build_dependencies (settings)
+
+def get_cross_checksum (platform):
+    try:
+        return cross_module_checksums[platform]
+    except KeyError:
+        print 'No cross module found'
+        return '0000'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/cygwin.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,381 @@
+import os
+import re
+
+from new import classobj
+from new import instancemethod
+#
+from gub import cross
+from gub import mirrors
+from gub import gubb
+#from gub import gup
+from gub import mingw
+from gub import misc
+
+# FIXME: setting binutil's tooldir and/or gcc's gcc_tooldir may fix
+# -luser32 (ie -L .../w32api/) problem without having to set LDFLAGS.
+class Binutils (cross.Binutils):
+    def makeflags (self):
+        return misc.join_lines ('''
+tooldir="%(cross_prefix)s/%(target_architecture)s"
+''')
+    def compile_command (self):
+        return (cross.Binutils.compile_command (self)
+                + self.makeflags ())
+    def configure_command (self):
+        return ( cross.Binutils.configure_command (self)
+                 + ' --disable-werror ')
+
+class W32api_in_usr_lib (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def get_build_dependencies (self):
+        return ['w32api']
+
+    def install (self):
+        self.system ('mkdir -p %(install_root)s/usr/lib')
+        self.system ('''
+tar -C %(system_root)s/usr/lib/w32api -cf- . | tar -C %(install_root)s/usr/lib -xf-
+''')
+
+class Libtool_fixup (gubb.NullBuildSpec):
+    def get_build_dependencies (self):
+        return ['libtool']
+    def untar (self):
+        self.file_sub ([('/usr/bin/sed', '/bin/sed')],
+                       '%(system_root)s/usr/bin/libtool')
+
+class Gcc (mingw.Gcc):
+    def get_build_dependencies (self):
+        return (mingw.Gcc.get_build_dependencies (self)
+                + ['cygwin', 'w32api-in-usr-lib'])
+    def makeflags (self):
+        return misc.join_lines ('''
+tooldir="%(cross_prefix)s/%(target_architecture)s"
+gcc_tooldir="%(cross_prefix)s/%(target_architecture)s"
+''')
+    def compile_command (self):
+        return (mingw.Gcc.compile_command (self)
+                + self.makeflags ())
+
+    def configure_command (self):
+        return (mingw.Gcc.configure_command (self)
+                + misc.join_lines ('''
+--with-newlib
+--enable-threads
+'''))
+
+
+def untar_cygwin_src_package_variant2 (self, file_name, split=False):
+    '''Unpack this unbelievably broken version of Cygwin source packages.
+
+foo[version][-split]-x.y.z-b.tar.bz2 contains
+foo[-split]-x.y.z.tar.[bz2|gz] and foo[version]-x.y.z-b.patch
+(and optionally foo[version]-x.y.z-b.patch2 ...).
+foo-x.y.z.tar.[bz2|gz] contains foo-x.y.z.  The patch contains patches
+against all foo split source balls, so applying it may fail partly and
+complain about missing files.'''
+
+    file_name = self.expand (file_name)
+    from gub import misc
+    t = misc.split_ball (file_name)
+    print 'split: ' + `t`
+    no_src = re.sub ('-src', '', file_name)
+    base = re.sub ('\.tar\..*', '', no_src)
+    # FIXME: use split iso custom ball_re macramee
+    ball_re = '^([a-z]+)([.0-9]+)?(-[a-z+]+)?(.*)(-[0-9]+)'
+    m = re.match (ball_re, base)
+    if m.group (3):
+        second_tarball = re.sub (ball_re, '\\1\\3\\4', base)
+    else:
+        second_tarball = re.sub (ball_re, '\\1\\4', base)
+    print 'second_tarball: ' + second_tarball
+    if split and m.group (3):
+        second_tarball_contents = re.sub (ball_re, '\\1\\3\\4', base)
+    else:
+        second_tarball_contents = re.sub (ball_re, '\\1\\4', base)
+    print 'second_tarball_contents: ' + second_tarball_contents
+    flags = '-jxf'
+    self.system ('''
+rm -rf %(allsrcdir)s/%(base)s
+tar -C %(allsrcdir)s %(flags)s %(downloads)s/%(file_name)s
+''',
+                 locals ())
+    tgz = 'tar.bz2'
+    if not os.path.exists (self.expand ('%s(allsrcdir)s/%(second_tarball)s.%(tgz)s',
+                                        locals ())):
+        flags = '-zxf'
+        tgz = 'tar.gz'
+    self.system ('''
+tar -C %(allsrcdir)s %(flags)s %(allsrcdir)s/%(second_tarball)s.%(tgz)s
+''',
+                 locals ())
+    if split:
+        return
+    if m.group (2):
+        patch = re.sub (ball_re, '\\1\\2\\4\\5.patch', base)
+    else:
+        patch = re.sub (ball_re, '\\1\\4\\5.patch', base)
+    print 'patch: ' + patch
+    self.system ('''
+cd %(allsrcdir)s && mv %(second_tarball_contents)s %(base)s
+cd %(srcdir)s && patch -p1 -f < %(allsrcdir)s/%(patch)s || true
+''',
+                 locals ())
+
+class Gcc_core (Gcc):
+    def untar (self):
+        gxx_file_name = re.sub ('-core', '-g++',
+                                self.expand (self.file_name ()))
+        untar_cygwin_src_package_variant2 (self, gxx_file_name, split=True)
+        untar_cygwin_src_package_variant2 (self, self.file_name ())
+
+# download-only package
+class Gcc_gxx (gubb.NullBuildSpec):
+    pass
+
+mirror = 'http://mirrors.kernel.org/sourceware/cygwin'
+def get_cross_packages (settings):
+    from gub import linux
+    cross_packs = [
+        Binutils (settings).with (version='2.17', format='bz2', mirror=mirrors.gnu),
+        W32api_in_usr_lib (settings).with (version='1.0',  strip_components=0),
+        Gcc (settings).with (version='4.1.1', mirror=mirrors.gcc_41, format='bz2'),
+        linux.Freetype_config (settings).with (version='2.1.9'),
+        linux.Python_config (settings).with (version='2.4.3'),
+# FIXME: using the binary libtool package is quite involved, it has
+# names of tools hardcoded and wrong (LD, NM, SED, GCC, GREP, ...)
+#        Libtool_fixup (settings).with (version='1.0'),
+        ]
+    return cross_packs
+
+def change_target_package (package):
+    cross.change_target_package (package)
+    package.get_build_dependencies \
+            = misc.MethodOverrider (package.get_build_dependencies,
+                                    lambda d, extra: d + extra, (['cygwin'],))
+
+    def cyg_defs (d):
+        k = 'runtime'
+        if not d.has_key (k):
+            k = ''
+        d[k].append ('/usr/bin/cyg*dll')
+        d[k].append ('/etc/postinstall')
+        return d
+
+    package.get_subpackage_definitions \
+        = misc.MethodOverrider (package.get_subpackage_definitions, cyg_defs)
+
+    def enable_static (d):
+        return d.replace ('--disable-static', '--enable-static')
+
+    package.configure_command \
+        = misc.MethodOverrider (package.configure_command, enable_static)
+
+    def install (whatsthis, lst):
+	package = lst[0]
+        package.post_install_smurf_exe ()
+        package.install_readmes ()
+
+    package.install \
+        = misc.MethodOverrider (package.install, install, ([package],))
+
+    ## TODO : get_dependency_dict
+        
+    # FIXME: why do cross packages get here too?
+    if isinstance (package, cross.CrossToolSpec):
+        return package
+        
+    gubb.change_target_dict (package, {
+            'DLLTOOL': '%(tool_prefix)sdlltool',
+            'DLLWRAP': '%(tool_prefix)sdllwrap',
+            'LDFLAGS': '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api',
+            })
+
+def get_cygwin_package (settings, name, dict, skip):
+    cross = [
+        'base-passwd', 'bintutils',
+        'gcc', 'gcc-core', 'gcc-g++',
+        'gcc-mingw', 'gcc-mingw-core', 'gcc-mingw-g++',
+        'gcc-runtime', 'gcc-core-runtime',
+        ]
+    cycle = ['base-passwd']
+    # FIXME: These packages are not needed for [cross] building,
+    # but most should stay as distro's final install dependency.
+    unneeded = [
+        'autoconf', 'autoconf2.13', 'autoconf2.50', 'autoconf2.5',
+        'automake', 'automake1.9',
+        'ghostscript-base', 'ghostscript-x11',
+        '-update-info-dir',
+        'libguile12', 'libguile16',
+        'libxft', 'libxft1', 'libxft2',
+        'libbz2-1',
+        'perl',
+        'tcltk',
+        'x-startup-scripts',
+        'xorg-x11-bin-lndir',
+        'xorg-x11-etc',
+        'xorg-x11-fnts',
+        'xorg-x11-libs-data',
+        ]
+    blacklist = cross + cycle + skip + unneeded
+    if name in blacklist:
+        name += '::blacklisted'
+    package_class = classobj (name, (gubb.BinarySpec,), {})
+    package = package_class (settings)
+    package.name_dependencies = []
+    if dict.has_key ('requires'):
+        deps = re.sub ('\([^\)]*\)', '', dict['requires']).split ()
+        deps = [x.strip ().lower ().replace ('_', '-') for x in deps]
+
+        deps = filter (lambda x: x not in blacklist, deps)
+        package.name_dependencies = deps
+
+    def get_build_dependencies (self):
+        return self.name_dependencies
+    package.get_build_dependencies = instancemethod (get_build_dependencies,
+                                                     package, package_class)
+    package.ball_version = dict['version']
+    package.url = (mirror + '/' + dict['install'].split ()[0])
+    package.format = 'bz2'
+    from gub import repository
+    package.vc_repository = repository.TarBall (settings.downloads,
+                                                package.url,
+                                                package.ball_version,
+                                                strip_components=0)
+    return package
+
+## UGH.   should split into parsing  package_file and generating gub specs.
+def get_cygwin_packages (settings, package_file, skip=[]):
+    dist = 'curr'
+
+    dists = {'test': [], 'curr': [], 'prev' : []}
+    chunks = open (package_file).read ().split ('\n\n@ ')
+    for i in chunks[1:]:
+        lines = i.split ('\n')
+        name = lines[0].strip ()
+        name = name.lower ()
+        packages = dists['curr']
+        records = {
+            'sdesc': name,
+            'version': '0-0',
+            'install': 'urg 0 0',
+            }
+        j = 1
+        while j < len (lines) and lines[j].strip ():
+            if lines[j][0] == '#':
+                j = j + 1
+                continue
+            elif lines[j][0] == '[':
+                packages.append (get_cygwin_package (settings, name,
+                                                     records.copy (),
+                                                     skip))
+                packages = dists[lines[j][1:5]]
+                j = j + 1
+                continue
+
+            try:
+                key, value = [x.strip () for x in lines[j].split (': ', 1)]
+            except:
+                print lines[j], package_file
+                raise 'URG'
+            if (value.startswith ('"')
+              and value.find ('"', 1) == -1):
+                while 1:
+                    j = j + 1
+                    value += '\n' + lines[j]
+                    if lines[j].find ('"') != -1:
+                        break
+            records[key] = value
+            j = j + 1
+        packages.append (get_cygwin_package (settings, name, records, skip))
+
+    # debug
+    names = [p.name () for p in dists[dist]]
+    names.sort ()
+    return dists[dist]
+
+# FIXME: this really sucks, should translate or something
+# There also is the problem that gub build-dependencies
+# use unsplit packages.
+guile_source = [
+    'guile',
+    'guile-devel',
+    'libguile17',
+    ]
+fontconfig_source = [
+    'fontconfig',
+    'libfontconfig1',
+    'libfontconfig-devel',
+    'fontconfig-devel',
+    ]
+libtool_source = [
+    'libltdl3',
+    'libtool',
+    'libtool1.5',
+    ]
+
+## FIXME: c&p debian.py
+class Dependency_resolver:
+    def __init__ (self, settings):
+        self.settings = settings
+        self.packages = {}
+        self.source = fontconfig_source + guile_source + libtool_source
+        self.load_packages ()
+        
+    def grok_setup_ini (self, file, skip=[]):
+        for p in get_cygwin_packages (self.settings, file, skip):
+            self.packages[p.name ()] = p
+
+    def load_packages (self):
+        url = mirror + '/setup.ini'
+
+        # FIXME: download/offline update
+        file = self.settings.downloads + '/setup.ini'
+        if not os.path.exists (file):
+            misc.download_url (url, self.settings.downloads)
+            # arg
+            # self.file_sub ([('\':"', "':'")], file)
+            s = open (file).read ()
+            open (file, 'w').write (s.replace ('\':"', "':'"))
+        self.grok_setup_ini (file, self.source)
+
+        # support one extra local setup.ini, that overrides the default
+        local_file = self.settings.uploads + '/cygwin/setup.ini'
+        if os.path.exists (local_file):
+            ## FIXME: using the generated setup.ini to install the
+            ## actual to be distributed cygwin packages with cygwin
+            ## names does not work.
+            ##
+            ## After building gub installs the gub packages, using GUB
+            ## naming.
+            #self.grok_setup_ini (local_file)
+            self.grok_setup_ini (local_file, self.source)
+
+    def get_packages (self):
+        return self.packages
+        
+dependency_resolver = None
+
+def init_dependency_resolver (settings):
+    global dependency_resolver
+    dependency_resolver = Dependency_resolver (settings)
+
+def get_packages ():
+    return dependency_resolver.get_packages ()
+
+gub_to_distro_dict = {
+    'expat-devel': ['expat'],
+    'fontconfig-runtime' : ['libfontconfig1'],
+    'fontconfig-devel' : ['libfontconfig-devel'],
+    'freetype' : ['libfreetype26'],
+    'freetype-devel' : ['libfreetype2-devel'],
+    'gettext' : ['libintl8', 'libintl3'],
+    'gmp-devel': ['gmp'],
+    'guile-runtime' : ['libguile17', 'libguile12'],
+#    'libtool': ['libtool1.5'],
+    'libtool-runtime': ['libltdl3'],
+    'libiconv-devel': ['libiconv2'],
+    'pango': ['pango-runtime'],
+    'python-devel': ['python'],
+    'python-runtime': ['python'],
+    'texlive-devel': ['libkpathsea-devel'],
+    'texlive-runtime': ['libkpathsea4']
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/darwintools.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,318 @@
+import glob
+import re
+import os
+#
+from gub import misc
+from gub import context
+from gub import cross
+from gub import mirrors
+from gub import gubb
+from gub import repository
+
+darwin_sdk_version = '0.4'
+class Odcctools (cross.CrossToolSpec):
+    def configure (self):
+        cross.CrossToolSpec.configure (self)
+
+        ## remove LD64 support.
+        self.file_sub ([('ld64','')],
+                       self.builddir () + '/Makefile')
+
+## change to sdk package
+class Python (gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.NullBuildSpec.__init__ (self, settings)
+        self.version = (lambda: '2.3')
+        self.vc_branch = ''
+        self.format = ''
+        self.has_source = False
+
+    def srcdir (self):
+        return '%(allsrcdir)s/python-darwin'
+
+    def package (self):
+        gubb.BuildSpec.package (self)
+        
+    def install (self):
+        self.system ('mkdir -p %(install_root)s/usr/cross/bin/')
+        self.dump ('''#!/bin/sh
+if test "$1" == "--cflags"; then
+  echo "-I%(system_root)s/System/Library/Frameworks/Python.framework/Versions/%(version)s/include/python%(version)s"
+fi
+if test "$1" == "--ldflags"; then
+  echo ""
+fi
+''', '%(install_root)s/usr/cross/bin/python-config')
+        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
+        
+class Darwin_sdk (gubb.SdkBuildSpec):
+    def patch (self):
+        self.system ('''
+rm %(srcdir)s/usr/lib/libgcc*
+rm %(srcdir)s/usr/lib/libstdc\+\+*
+rm %(srcdir)s/usr/lib/libltdl*
+rm %(srcdir)s/usr/include/ltdl.h
+rm -f %(srcdir)s/usr/lib/gcc/*-apple-darwin*/*/*dylib
+rm -rf %(srcdir)s/usr/lib/gcc
+''')
+
+        ## ugh, need to have gcc/3.3/machine/limits.h
+        ### self.system ('rm -rf %(srcdir)s/usr/include/gcc')
+        ##self.system ('rm -rf %(srcdir)s/usr/include/machine/limits.h')
+
+        ## limits.h symlinks into GCC.
+        
+        pat = self.expand ('%(srcdir)s/usr/lib/*.la')
+        for a in glob.glob (pat):
+            self.file_sub ([(r' (/usr/lib/.*\.la)', r'%(system_root)s\1')], a)
+
+
+class Gcc (cross.Gcc):
+    def patch (self):
+        self.file_sub ([('/usr/bin/libtool', '%(cross_prefix)s/bin/%(target_architecture)s-libtool')],
+                       '%(srcdir)s/gcc/config/darwin.h')
+
+        self.file_sub ([('--strip-underscores', '--strip-underscore')],
+                       "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl")
+
+    def configure_command (self):
+        c = cross.Gcc.configure_command (self)
+#                c = re.sub ('enable-shared', 'disable-shared', c)
+        return c
+    
+
+    def configure (self):
+        cross.Gcc.configure (self)
+
+    def rewire_gcc_libs (self):
+        skip_libs = ['libgcc_s']
+        for l in self.locate_files ("%(install_root)s/usr/lib/", '*.dylib'):
+            found_skips = [s for s in  skip_libs if l.find (s) >= 0]
+            if found_skips:
+                continue
+            
+            id = self.read_pipe ('%(tool_prefix)sotool -L %(l)s', locals ()).split()[1]
+            id = os.path.split (id)[1]
+            self.system ('%(tool_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(l)s', locals ())
+        
+    def install (self):
+        cross.Gcc.install (self)
+        self.rewire_gcc_libs ()
+
+    def get_build_dependencies (self):
+        return ['odcctools']
+    
+class Gcc__darwin (Gcc):
+    def configure (self):
+        cross.Gcc.configure (self)
+
+    def install (self):
+        ## UGH ?
+        ## Gcc.install (self)
+
+        cross.Gcc.install (self)
+        self.rewire_gcc_libs ()
+        
+class Rewirer (context.Os_context_wrapper):
+    def __init__ (self, settings):
+        context.Os_context_wrapper.__init__ (self,settings)
+        self.ignore_libs = None
+
+    def get_libaries (self, name):
+        lib_str = self.read_pipe ('''
+%(cross_prefix)s/bin/%(target_architecture)s-otool -L %(name)s
+''',
+                     locals (), ignore_errors=True)
+
+        libs = []
+        for l in lib_str.split ('\n'):
+            m = re.search (r"\s+(.*) \(.*\)", l)
+            if not m:
+                continue
+            if self.ignore_libs.has_key (m.group (1)):
+                continue
+
+            libs.append (m.group (1))
+
+        return libs
+
+    def rewire_mach_o_object (self, name, substitutions):
+        if not substitutions:
+            return
+        changes = ' '.join (['-change %s %s' % (o, d)
+                  for (o, d) in substitutions])
+        self.system ('''
+%(cross_prefix)s/bin/%(target_architecture)s-install_name_tool %(changes)s %(name)s ''',
+              locals ())
+
+    def rewire_mach_o_object_executable_path (self, name):
+        orig_libs = ['/usr/lib']
+
+        libs = self.get_libaries (name)
+        subs = []
+        for l in libs:
+
+            ## ignore self.
+            print os.path.split (l)[1], os.path.split (name)[1]
+            
+            if os.path.split (l)[1] == os.path.split (name)[1]:
+                continue
+            
+            for o in orig_libs:
+                if re.search (o, l):
+                    newpath = re.sub (o, '@executable_path/../lib/', l); 
+                    subs.append ((l, newpath))
+                elif l.find (self.expand ('%(targetdir)s')) >= 0:
+                    print 'found targetdir in linkage', l
+                    raise 'abort'
+
+        self.rewire_mach_o_object (name, subs)
+
+    def rewire_binary_dir (self, dir):
+        if not os.path.isdir (dir):
+            print dir
+            raise 'Not a directory'
+
+        (root, dirs, files) = os.walk (dir).next ()
+        files = [os.path.join (root, f) for f in files]
+
+        skip_libs = ['libgcc_s']
+        for f in files:
+            found_skips = [s for s in  skip_libs if f.find (s) >= 0]
+            if found_skips:
+                continue
+
+            if os.path.isfile (f):
+                self.rewire_mach_o_object_executable_path(f)
+
+    def set_ignore_libs_from_tarball (self, tarball):
+        file_str = self.read_pipe ('tar tzf %(tarball)s', locals())
+        files = file_str.split ('\n')
+        self.set_ignore_libs_from_files (files)
+        
+    def set_ignore_libs_from_files (self, files):
+        self.ignore_libs = dict ((k.strip()[1:], True)
+             for k in files
+             if re.match (r'^\./usr/lib/', k))
+
+    def rewire_root (self, root):
+        if self.ignore_libs == None:
+            raise 'error: should init with file_manager.'
+
+        self.rewire_binary_dir (root + '/usr/lib')
+        for d in glob.glob (root + '/usr/lib/pango/*/modules/'):
+            self.rewire_binary_dir (d)
+
+        self.rewire_binary_dir (root + '/usr/bin')
+
+class Package_rewirer:
+    def __init__ (self, rewirer, package):
+        self.rewirer = rewirer
+        self.package = package
+
+    def rewire (self):
+        self.rewirer.rewire_root (self.package.install_root ())
+
+def get_cross_packages (settings):
+    packages = []
+
+    sdk = Darwin_sdk (settings)
+
+    os_version = 7
+    if settings.platform == 'darwin-x86':
+        os_version = 8
+
+    sdk.vc_repository = repository.TarBall (settings.downloads,
+                                            url='http://lilypond.org/download/gub-sources/darwin%d-sdk-0.4.tar.gz' % os_version,
+                                            version='0.4')
+
+
+    packages.append (sdk)
+    packages.append (Python (settings))
+        
+    packages += [Odcctools (settings).with (version='20060413',
+#    packages += [Odcctools (settings).with (version='20060608',
+                                            mirror=mirrors.opendarwin,
+                                            format='bz2')]
+
+    if settings.target_architecture.startswith ("powerpc"):
+        packages.append (Gcc (settings).with (version='4.1.1',
+                                              mirror=mirrors.gcc_41,
+                                              format='bz2'))
+    else:
+        packages.append (Gcc (settings).with (version='4.2-20070207',
+                                              mirror=mirrors.gcc_snap,
+                                              format='bz2'))
+
+    return packages
+
+def strip_build_dep (old_val, what):
+    deps = old_val
+
+    for w in what:
+        if w in deps:
+            deps.remove (w)
+    deps.sort()
+    return deps                     
+
+    
+def strip_dependency_dict (old_val, what):
+    d = dict((k,[p for p in deps if p not in what])
+             for (k, deps) in old_val.items ())
+
+    return d
+
+def change_target_package (p):
+    cross.change_target_package (p)
+    p.get_build_dependencies = misc.MethodOverrider (p.get_build_dependencies,
+                                                     strip_build_dep, (['zlib', 'zlib-devel'],))
+    p.get_dependency_dict = misc.MethodOverrider (p.get_dependency_dict,
+                                                  strip_dependency_dict, (['zlib', 'zlib-devel'],))
+    gubb.change_target_dict (p, {
+
+            ## We get a lot of /usr/lib/ -> @executable_path/../lib/
+            ## we need enough space in the header to do these relocs.
+            'LDFLAGS': '-Wl,-headerpad_max_install_names ',
+
+            ## UGH: gettext fix for ptrdiff_t
+            'CPPFLAGS' : '-DSTDC_HEADERS',
+            })
+
+        
+def system (c):
+    s = os.system (c)
+    if s:
+        raise 'barf'
+
+def get_darwin_sdk ():
+    def system (s):
+        print s
+        if os.system (s):
+            raise 'barf'
+        
+    host  = 'maagd'
+    version = '0.4'
+    darwin_version  = 8
+
+    dest =        'darwin%(darwin_version)d-sdk-%(version)s' % locals()
+    
+    system ('rm -rf %s' % dest)
+    os.mkdir (dest)
+    
+    src = '/Developer/SDKs/'
+
+    if darwin_version == 7:
+        src += 'MacOSX10.3.9.sdk'
+    else:
+        src += 'MacOSX10.4u.sdk'
+    
+    cmd =  ('rsync -a -v %s:%s/ %s/ ' % (host, src, dest))
+    system (cmd)
+    system ('chmod -R +w %s '  % dest)
+    system ('tar cfz %s.tar.gz %s '  % (dest, dest))
+
+if __name__== '__main__':
+    import sys
+    if len (sys.argv) > 1:
+        get_darwin_sdk ()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/debian-arm.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,35 @@
+import os
+import re
+#
+from gub import cross
+from gub import mirrors
+from gub import gubb
+from gub import linux
+from gub import misc
+from gub import targetpackage
+
+class Debian_arm_runtime (gubb.BinarySpec, gubb.SdkBuildSpec):
+    pass
+
+def get_cross_packages (settings):
+    from gub import debian
+    return debian.get_cross_packages (settings)
+    #return get_cross_packages_pre_eabi (settings)
+
+def get_cross_packages_pre_eabi (settings):
+    binutils_version = '2.16.1'
+    gcc_version = '3.4.3' # only change
+    guile_version = '1.6.7'
+    kernel_version = '2.5.999-test7-bk-17'
+    libc6_version = '2.3.2.ds1-22sarge4'
+    python_version = '2.4.1'
+    from gub import debian
+    return debian._get_cross_packages (settings,
+                                       binutils_version, gcc_version,
+                                       guile_version,
+                                       kernel_version, libc6_version,
+                                       python_version)
+
+def change_target_package (p):
+    cross.change_target_package (p)
+    return p
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/debian.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,301 @@
+import glob
+import os
+import re
+import string
+#
+from gub import cross
+from gub import mirrors
+#from gub import gup
+#import gub.gup as gup
+from gub import gubb
+from gub import linux
+from gub import misc
+from gub import settings
+
+from new import classobj
+from new import instancemethod
+
+mirror = 'http://ftp.de.debian.org/debian'
+
+class Libc6 (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+        # Ugh, rewire absolute names and symlinks.
+        i = self.expand ('%(srcdir)s/lib64')
+        if os.path.islink (i):
+            s = os.readlink (i)
+            if s.startswith ('/'):
+                os.remove (i)
+                os.symlink (s[1:], i)
+
+    def patch (self):
+        self.system ('cd %(srcdir)s && rm -rf usr/sbin/ sbin/ bin/ usr/bin')
+
+class Libc6_dev (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+        # FIXME: this rewiring breaks ld badly, it says
+        #     i686-linux-ld: cannot find /home/janneke/bzr/gub/target/i686-linux/system/lib/libc.so.6 inside /home/janneke/bzr/gub/target/i686-linux/system/
+        # although that file exists.  Possibly rewiring is not necessary,
+        # but we can only check on non-linux platform.
+        # self.file_sub ([(' /', ' %(system_root)s/')],
+        #               '%(srcdir)s/root/usr/lib/libc.so')
+
+        for i in ('pthread.h', 'bits/sigthread.h'):
+            self.file_sub ([('__thread', '___thread')],
+                           '%(srcdir)s/usr/include/%(i)s',
+                           env=locals ())
+            
+        self.system ('rm -rf  %(srcdir)s/usr/include/asm/  %(srcdir)s/usr/include/linux ')
+            
+class Linux_kernel_headers (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.BinarySpec.__init__ (self, settings)
+        self.with (version='2.5.999-test7-bk-17',
+                   strip_components=0,
+                   mirror=mirrors.lilypondorg_deb,
+                   format='deb')
+    def get_subpackage_names (self):
+        return ['']
+
+class Libdbi0_dev (gubb.BinarySpec, gubb.SdkBuildSpec):
+    pass
+
+class Libqt4_dev (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+        for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
+            self.file_sub ([('includedir', 'deepqtincludedir')],
+                           '%(srcdir)s/usr/lib/pkgconfig/%(i)s',
+                           env=locals ())
+
+class Gcc (cross.Gcc):
+    def patch (self):
+        cross.Gcc.patch (self)
+        # KUCH
+        if self.vc_repository._version == '4.1.1':
+            self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch
+''')
+        # KUCH, KUCH
+        if (self.vc_repository._version == '3.4.3'
+            and self.settings.platform == 'arm'):
+            self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.3-arm-softvfp-jcn.patch
+''')
+        
+
+    ## TODO: should detect whether libc supports TLS 
+    def configure_command (self):
+        return cross.Gcc.configure_command (self) + ' --disable-tls '
+
+# http://ftp.de.debian.org/debian/pool/main/l/linux-kernel-headers/
+
+def _get_cross_packages (settings,
+                         binutils_version, gcc_version,
+                         guile_version, kernel_version, libc6_version,
+                         python_version):
+    configs = []
+    if not settings.platform.startswith ('linux'):
+        configs = [
+            linux.Guile_config (settings).with (version=guile_version),
+            linux.Python_config (settings).with (version=python_version),
+            ]
+
+    return [
+        Libc6 (settings).with (version=libc6_version, strip_components=0,
+                               mirror=mirrors.lilypondorg_deb, format='deb'),
+        Libc6_dev (settings).with (version=libc6_version, strip_components=0,
+                                   mirror=mirrors.lilypondorg_deb,
+                                   format='deb'),
+        Linux_kernel_headers (settings).with (version=kernel_version,
+                                              strip_components=0,
+                                              mirror=mirrors.lilypondorg_deb,
+                                              format='deb'),
+        
+        cross.Binutils (settings).with (version=binutils_version,
+                                        format='bz2', mirror=mirrors.gnu),
+        Gcc (settings).with (version=gcc_version,
+                             mirror=mirrors.gcc, format='bz2'),
+        ] + configs
+
+# FIXME: determine libc6_version, kernel_version from
+# Packages/Dependency_resolver.
+def get_cross_packages_stable (settings):
+    binutils_version = '2.16.1'
+    gcc_version = '4.1.1'
+    guile_version = '1.6.7'
+    kernel_version = '2.5.999-test7-bk-17'
+    libc6_version = '2.3.2.ds1-22sarge4'
+    python_version = '2.4.1'
+    return _get_cross_packages (settings,
+                                binutils_version, gcc_version,
+                                guile_version, kernel_version, libc6_version,
+                                python_version)
+
+# FIXME: determine libc6_version, kernel_version from
+# Packages/Dependency_resolver.
+def get_cross_packages_unstable (settings):
+    binutils_version = '2.16.1'
+    gcc_version = '4.1.1'
+    guile_version = '1.8.0'
+    kernel_version = '2.6.18-6'
+    libc6_version = '2.3.6.ds1-9'
+    python_version = '2.4.1'
+    return _get_cross_packages (settings,
+                                binutils_version, gcc_version,
+                                guile_version, kernel_version, libc6_version,
+                                python_version)
+
+def get_cross_packages (settings):
+    if settings.debian_branch == 'stable':
+        return get_cross_packages_stable (settings)
+    return get_cross_packages_unstable (settings)
+
+def change_target_package (p):
+    cross.change_target_package (p)
+
+def get_debian_packages (settings, package_file):
+    if settings.verbose:
+        print ('parsing: %s...' % package_file)
+    return map (lambda j: get_debian_package (settings, j),
+          open (package_file).read ().split ('\n\n')[:-1])
+
+def get_debian_package (settings, description):
+    s = description[:description.find ('\nDescription')]
+    d = dict (map (lambda line: line.split (': ', 1),
+           map (string.strip, s.split ('\n'))))
+    # FIXME: should blacklist toplevel gub-builder.py argument iso lilypond
+    blacklist = [
+        'binutils',
+        'cpp',
+        'gcc-3.3',
+        'cpp-3.3',
+        'gcc',
+        'gcc-3.4',
+        'libgcc1',
+        'libgcc1-3.4',
+        'lilypond',
+        'libstdc++6',
+        'libstdc++-dev',
+        'libtool',
+        'perl',
+        'perl-modules',
+        'perl-base',
+#        'pkg-config',
+        ]
+    if d['Package'] in blacklist:
+        d['Package'] += '::blacklisted'
+    package_class = classobj (d['Package'], (gubb.BinarySpec,), {})
+    package = package_class (settings)
+    package.name_dependencies = []
+    if d.has_key ('Depends'):
+        deps = map (string.strip,
+              re.sub ('\([^\)]*\)', '',
+                  d['Depends']).split (', '))
+        # FIXME: BARF, ignore choices
+        deps = filter (lambda x: x.find ('|') == -1, deps)
+        # FIXME: how to handle Provides: ?
+        # FIXME: BARF, fixup libc Provides
+        deps = map (lambda x: re.sub ('libc($|-)', 'libc6\\1', x), deps)
+        deps = map (lambda x: re.sub ('liba52-dev', 'liba52-0.7.4-dev', x), deps)
+        deps = map (lambda x: re.sub ('libpng12-0-dev', 'libpng12-dev', x), deps)
+        # FIXME: ugh, skip some
+        deps = filter (lambda x: x not in blacklist, deps)
+        package.name_dependencies = deps
+
+    def get_build_dependencies (self):
+        return self.name_dependencies
+    package.get_build_dependencies = instancemethod (get_build_dependencies,
+                                                     package, package_class)
+    package.ball_version = d['Version']
+    package.url = mirror + '/' + d['Filename']
+    package.format = 'deb'
+
+    from gub import repository
+    package.vc_repository = repository.TarBall (settings.downloads,
+                                                package.url,
+                                                package.ball_version,
+                                                strip_components=0)
+    return package
+
+## FIXME: c&p cygwin.py
+class Dependency_resolver:
+    def __init__ (self, settings):
+        self.settings = settings
+        self.packages = {}
+        self.load_packages ()
+        
+    def grok_packages_file (self, file):
+        for p in get_debian_packages (self.settings, file):
+            self.package_fixups (p)
+            self.packages[p.name ()] = p
+
+    def package_fixups (self, package):
+        if package.name () == 'libqt4-dev':
+            def untar (whatsthis):
+                gubb.BinarySpec.untar (package)
+                for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
+                    package.file_sub ([
+                            ('includedir', 'deepqtincludedir'),
+                            ('(-I|-L) */usr',
+                             '''\\1%(system_root)s/usr''' % locals ()),
+                            ],
+                                      '%(srcdir)s/usr/lib/pkgconfig/%(i)s',
+                                      env=locals ())
+            package.untar = misc.MethodOverrider (package.untar, untar)
+
+    def load_packages (self):
+        p = gup.DependencyManager (self.settings.system_root,
+                                   self.settings.os_interface)
+#        arch = settings.platform
+#        if settings.platform == 'debian':
+#            arch = 'i386'
+	arch = self.settings.package_arch
+        branch = self.settings.debian_branch
+        packages_path = '/dists/%(branch)s/main/binary-%(arch)s/Packages.gz' \
+                        % locals ()
+        url = mirror + packages_path
+        base = self.settings.downloads + '/Packages'
+        file = '.'.join ((base, arch, branch))
+
+        # FIXME: download/offline update
+        if not os.path.exists (file):
+            misc.download_url (url, self.settings.downloads)
+            os.system ('gunzip  %(base)s.gz' % locals ())
+            os.system ('mv %(base)s %(file)s' % locals ())
+        self.grok_packages_file (file)
+
+    def get_packages (self):
+        return self.packages
+        
+dependency_resolver = None
+
+def init_dependency_resolver (settings):
+    global dependency_resolver
+    dependency_resolver = Dependency_resolver (settings)
+
+def debian_name_to_dependency_names (name):
+    return dependency_resolver.get_dependencies (name)
+
+def get_packages ():
+    return dependency_resolver.get_packages ()
+
+#FIXME: stable/unstable?
+gub_to_distro_dict = {
+    'fontconfig' : ['libfontconfig1'],
+    'fontconfig-devel' : ['libfontconfig1-dev'],
+    'freetype' : ['libfreetype6'],
+    'freetype-devel' : ['libfreetype6-dev'],
+    'gettext' : ['gettext'],
+    'gettext-devel' : ['gettext'],
+    'gmp-devel': ['libgmp3-dev'],
+    'gmp-runtime': ['libgmp3'],
+    'ghostscript': ['gs'],
+    'guile-runtime' : ['guile-1.6-libs'],
+    'libtool-runtime': ['libltdl3'],
+    'libiconv-devel': ['libiconv2'],
+    'pango': ['libpango1.0-0'],
+    'python-devel': ['python2.4-dev'],
+    'python-runtime': ['python2.4'],
+    }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/distcc.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,35 @@
+#!/usr/bin/env python
+
+import os
+import re
+import socket
+import sys
+import telnetlib
+
+def live_hosts (hosts, port = 3633):
+    live = []
+    for h in hosts:
+        try:
+            t = telnetlib.Telnet (h, port)
+            t.close ()
+        except socket.error:
+            continue
+
+        live.append ('%s:%d' % (h,port))
+
+    if live:
+        print 'DISTCC live hosts: ', live
+    return live
+
+
+def main ():
+    exe_name = os.path.split (sys.argv[0])[1]
+    path_comps = [c for c in os.environ['PATH'].split (':')
+                  if not re.search ('distcc', c)]
+    os.environ['PATH'] = ':'.join (path_comps)
+    argv = ['distcc', exe_name] + sys.argv[1:]
+    os.execvp ('distcc', argv)
+
+if __name__ == '__main__':
+    main ()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/freebsd.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,73 @@
+import os
+import re
+
+from gub import cross
+from gub import mirrors
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+
+class Binutils (cross.Binutils):
+    def configure_command (self):
+        # Add --program-prefix, otherwise we get
+        # i686-freebsd-FOO iso i686-freebsd4-FOO.
+        return (cross.Binutils.configure_command (self)
+            + misc.join_lines ('''
+--program-prefix=%(tool_prefix)s
+'''))
+
+class Gcc (cross.Gcc):
+    def configure_command (self):
+        # Add --program-prefix, otherwise we get
+        # i686-freebsd-FOO iso i686-freebsd4-FOO.
+        return (cross.Gcc.configure_command (self)
+            + misc.join_lines ('''
+--program-prefix=%(tool_prefix)s
+'''))
+
+class Freebsd_runtime (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+    def patch (self):
+        self.system ('rm -rf %(srcdir)s/usr/include/g++')
+
+def _get_cross_packages (settings, libc_version):
+    return (
+        Freebsd_runtime (settings).with (version=libc_version,
+                                         strip_components=0,
+                                         mirror=mirrors.lilypondorg),
+        Binutils (settings).with (version='2.16.1', format='bz2', mirror=mirrors.gnu),
+        Gcc (settings).with (version='4.1.1', mirror=mirrors.gcc_41,
+                             format='bz2'),
+        )
+
+def get_cross_packages_41 (settings):
+    return _get_cross_packages (settings, '4.10-2')
+
+def get_cross_packages_61 (settings):
+    return _get_cross_packages (settings, '6.1-RELEASE')
+
+def get_cross_packages (settings):
+    return get_cross_packages_41 (settings)
+
+    if settings.target_architecture == 'i686-freebsd4':
+        return get_cross_packages_41 (settings)
+    return get_cross_packages_61 (settings)
+
+def change_target_package (package):
+    cross.change_target_package (package)
+
+        
+    
+# FIXME: download from sane place.
+def get_sdk():
+    '''
+
+#FIXME: how to get libc+kernel headers package contents on freebsd?
+# * remove zlib.h, zconf.h or include libz and remove Zlib from src packages?
+# * remove gmp.h, or include libgmp and remove Gmp from src packages?
+# bumb version number by hand, sync with freebsd.py
+freebsd-runtime:
+	ssh xs4all.nl tar -C / --exclude=zlib.h --exclude=zconf.h --exclude=gmp.h -czf public_html/freebsd-runtime-4.10-2.tar.gz /usr/lib/{lib{c,c_r,m}{.a,.so{,.*}},crt{i,n,1}.o} /usr/include
+
+    '''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/gubb.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,867 @@
+import glob
+import pickle
+import os
+import re
+#
+from gub import misc
+from gub import repository
+from gub.context import *
+
+class PackageSpec:
+    "How to package part of an install_root."
+    
+    def __init__ (self, os_interface):
+        self._dict = {}
+        self._os_interface = os_interface
+        self._file_specs = []
+        self._dependencies = []
+        self._conflicts = []
+        
+    def set_dict (self, dict, sub_name):
+        self._dict = dict.copy ()
+        self._dict['sub_name'] = sub_name
+        if sub_name:
+            sub_name = '-' + sub_name
+        s = ('%(name)s' % dict) + sub_name
+        self._dict['split_name'] = s
+        self._dict['split_ball'] = ('%(gub_uploads)s/%(split_name)s%(ball_suffix)s.%(platform)s.gup') % self._dict
+        self._dict['split_hdr'] = ('%(gub_uploads)s/%(split_name)s%(vc_branch_suffix)s.%(platform)s.hdr') % self._dict
+        self._dict['conflicts_string'] = ';'.join (self._conflicts)
+        self._dict['dependencies_string'] = ';'.join (self._dependencies)
+        self._dict['source_name'] = self.name ()
+        if sub_name:
+            self._dict['source_name'] = self.name ()[:-len (sub_name)]
+        
+    def expand (self, s):
+        return s % self._dict
+    
+    def dump_header_file (self):
+        hdr = self.expand ('%(split_hdr)s')
+        self._os_interface.dump (pickle.dumps (self._dict), hdr)
+        
+    def clean (self):
+        base = self.expand ('%(install_root)s/')
+        for f in self._file_specs:
+            self._os_interface.system ('rm -rf %s%s ' % (base, f))
+
+    def create_tarball (self):
+        cmd = 'tar -C %(install_root)s/%(packaging_suffix_dir)s --ignore-failed --exclude="*~" -zcf %(split_ball)s '
+
+        path = os.path.normpath (self.expand ('%(install_root)s'))
+        globs  = []
+        for f in self._file_specs:
+            f = re.sub ('/+', '/', f)
+            if f.startswith ('/'):
+                f = f[1:]
+                
+            for exp in glob.glob (os.path.join (path, f)):
+                globs.append (exp.replace (path, './').replace ('//', '/'))
+
+        if not globs:
+            globs.append ('thisreallysucks-but-lets-hope-I-dont-exist/')
+            
+        cmd += ' '.join (globs) 
+        cmd = self.expand (cmd)
+        self._os_interface.system (cmd)
+
+    def dict (self):
+        return self._dict
+
+    def name (self):
+        return "%(split_name)s" % self._dict
+    
+class BuildSpec (Os_context_wrapper):
+    def __init__ (self, settings):
+        Os_context_wrapper.__init__(self, settings)
+
+        self.verbose = settings.verbose ()
+        self.settings = settings
+        self.url = ''
+        self.has_source = True
+        self._dependencies = None
+        self._build_dependencies = None
+        
+        self.spec_checksum = '0000' 
+        self.cross_checksum = '0000'
+        
+        # TODO: move to PackageSpec, always instantiate.
+        # then remove all if self.vc_repository checks
+        self.vc_repository = None
+        
+        self.split_packages = []
+        self.so_version = '1'
+
+    @subst_method
+    def LD_PRELOAD (self):
+        return '%(topdir)s/librestrict/librestrict.so'
+    
+    def get_substitution_dict (self, env={}):
+        dict = {
+            'CPATH': '',
+            'CPLUS_INCLUDE_PATH': '',
+            'C_INCLUDE_PATH': '',
+            'LIBRARY_PATH': '/empty-means-cwd-in-feisty',
+            }
+        dict.update (env)
+        d = Os_context_wrapper.get_substitution_dict (self, dict).copy ()
+        return d
+          
+    def class_invoke_version (self, klas, name):
+        name_version = name + '_' + self.version ().replace ('.', '_')
+        if klas.__dict__.has_key (name_version):
+            klas.__dict__[name_version] (self)
+
+    def download (self):
+        if self.vc_repository:
+            self.vc_repository.download ()
+
+    def get_repodir (self):
+        return self.settings.downloads + '/' + self.name ()
+    
+    def get_conflict_dict (self):
+        """subpackage -> list of confict dict."""
+        return {'': [], 'devel': [], 'doc': [], 'runtime': []}
+  
+    def get_dependency_dict (self):
+        """subpackage -> list of dependency dict."""
+        # FIMXE: '' always depends on runtime?
+        return {'': [], 'devel': [], 'doc': [], 'runtime': []}
+  
+    def broken_for_distcc (self):
+        """Set to true if package can't handle make -jX """
+        return False
+    
+    @subst_method
+    def name (self):
+        file = self.__class__.__name__.lower ()
+        file = re.sub ('__.*', '', file)
+        file = re.sub ('_', '-', file)
+
+        ## UGH ? what happens if xx is in a normal name?!
+        file = re.sub ('xx', '++', file)
+        return file
+
+    @subst_method
+    def pretty_name (self):
+        name = self.__class__.__name__
+        name = re.sub ('__.*', '', name)
+        return name
+    
+    @subst_method
+    def file_name (self):
+        if self.url:
+            file = re.sub ('.*/([^/]+)', '\\1', self.url)
+        else:
+            file = self.name ()
+        return file
+
+    @subst_method
+    def source_checksum (self):
+        if self.vc_repository:
+            return self.vc_repository.get_checksum ().replace ('/', '-')
+        
+        return self.version () 
+
+    @subst_method
+    def license_file (self):
+        return '%(srcdir)s/COPYING'
+    
+    @subst_method
+    def basename (self):
+        return misc.ball_basename (self.file_name ())
+
+    @subst_method
+    def packaging_suffix_dir (self):
+        return ''
+
+    @subst_method
+    def full_version (self):
+        return self.version ()
+
+    @subst_method
+    def build_dependencies_string (self):
+        deps = self.get_build_dependencies ()
+        return ';'.join (deps)
+
+    @subst_method
+    def ball_suffix (self):
+        b = '-%(version)s'
+        if self.vc_repository and self.vc_repository.is_tracking ():
+            try:
+                b = '-' + self.vc_repository.branch
+            except AttributeError:
+                pass
+        return b
+
+    @subst_method
+    def vc_branch (self):
+        b = ''
+        if self.vc_repository and self.vc_repository.is_tracking ():
+            try:
+                b = self.vc_repository.branch
+            except AttributeError:
+                pass
+        return b
+    
+    @subst_method
+    def vc_branch_suffix (self):
+        b = ''
+        if self.vc_repository and self.vc_repository.is_tracking ():
+            try:
+                b = '-' + self.vc_repository.branch
+            except AttributeError:
+                pass
+        return b
+        
+    @subst_method
+    def version (self):
+        # kugh, must construct using vc_repository in __init__
+        if not self.vc_repository :
+            print 'need version, but repository not yet set: ', self.name ()
+            raise 'urg'
+        return self.vc_repository.version ()
+
+    @subst_method
+    def name_version (self):
+        return '%s-%s' % (self.name (), self.version ())
+
+    @subst_method
+    def srcdir (self):
+        return '%(allsrcdir)s/%(name)s%(ball_suffix)s'
+
+    @subst_method
+    def builddir (self):
+        return '%(allbuilddir)s/%(name)s%(ball_suffix)s'
+
+    @subst_method
+    def install_root (self):
+        return '%(installdir)s/%(name)s-%(version)s-root'
+
+    @subst_method
+    def install_prefix (self):
+        return self.install_root () + '/usr'
+
+    @subst_method
+    def install_command (self):
+        return '''make DESTDIR=%(install_root)s install'''
+
+    @subst_method
+    def configure_command (self):
+        return '%(srcdir)s/configure --prefix=%(install_prefix)s'
+
+    @subst_method
+    def compile_command (self):
+        return 'make'
+
+    @subst_method
+    def native_compile_command (self):
+        c = 'make'
+
+        job_spec = ' '
+        if self.settings.native_distcc_hosts:
+            job_spec = '-j%d ' % (2*len (self.settings.native_distcc_hosts.split (' ')))
+
+            ## do this a little complicated: we don't want a trace of
+            ## distcc during configure.
+            c = 'DISTCC_HOSTS="%s" %s' % (self.settings.native_distcc_hosts, c)
+            c = 'PATH="%(native_distcc_bindir)s:$PATH" ' + c
+        elif self.settings.cpu_count_str != '1':
+            job_spec += ' -j%s ' % self.settings.cpu_count_str
+
+        c += job_spec
+        return c
+
+
+    @subst_method
+    def src_package_ball (self):
+        return '%(src_package_uploads)s/%(name)s%(ball_suffix)s-src.%(platform)s.tar.gz'
+
+    @subst_method
+    def src_package_uploads (self):
+        return '%(gub_uploads)s'
+
+    @subst_method
+    def stamp_file (self):
+        return '%(statusdir)s/%(name)s-%(version)s-%(source_checksum)s'
+
+    @subst_method
+    def rsync_command (self):
+        return "rsync --exclude .git --exclude _darcs --exclude .svn --exclude CVS -v -a %(downloads)s/%(name)s-%(version)s/ %(srcdir)s"
+
+    def get_stamp_file (self):
+        stamp = self.expand ('%(stamp_file)s')
+        return stamp
+
+    def is_done (self, stage, stage_number):
+        f = self.get_stamp_file ()
+        if os.path.exists (f):
+            return int (open (f).read ()) >= stage_number
+        return False
+
+    def set_done (self, stage, stage_number):
+        open (self.get_stamp_file (),'w'). write ('%d' % stage_number) 
+
+    def autoupdate (self, autodir=0):
+        if not autodir:
+            autodir = self.srcdir ()
+        if os.path.isdir (os.path.join (self.srcdir (), 'ltdl')):
+            self.system ('''
+rm -rf %(autodir)s/libltdl
+cd %(autodir)s && libtoolize --force --copy --automake --ltdl
+''', locals ())
+        else:
+            self.system ('''
+cd %(autodir)s && libtoolize --force --copy --automake
+''', locals ())
+        if os.path.exists (os.path.join (autodir, 'bootstrap')):
+            self.system ('''
+cd %(autodir)s && ./bootstrap
+''', locals ())
+        elif os.path.exists (os.path.join (autodir, 'autogen.sh')):
+
+            ## --noconfigure ??
+            ## is --noconfigure standard for autogen? 
+            self.system ('''
+cd %(autodir)s && bash autogen.sh  --noconfigure
+''', locals ())
+        else:
+            aclocal_opt = ''
+            if os.path.exists (self.expand ('%(system_root)s/usr/share/aclocal')):
+                aclocal_opt = '-I %(system_root)s/usr/share/aclocal'
+                
+            headcmd = ''
+            for c in ('configure.in','configure.ac'):
+                try:
+                    str = open (self.expand ('%(srcdir)s/' + c)).read ()
+                    m = re.search ('A[CM]_CONFIG_HEADER', str)
+                    str = 0   ## don't want to expand str
+                    if m:
+                        headcmd = self.expand ('cd %(autodir)s && autoheader %(aclocal_opt)s', env=locals ())
+                        break
+                    
+                except IOError:
+                    pass
+                
+            self.system ('''
+cd %(autodir)s && aclocal %(aclocal_opt)s
+%(headcmd)s
+cd %(autodir)s && autoconf %(aclocal_opt)s
+''', locals ())
+            if os.path.exists (self.expand ('%(srcdir)s/Makefile.am')):
+                self.system ('''
+cd %(srcdir)s && automake --add-missing --foreign
+''', locals ())
+
+
+    def configure (self):
+        self.system ('''
+mkdir -p %(builddir)s
+cd %(builddir)s && %(configure_command)s
+''')
+
+    def install_license (self):
+        if self.expand ('%(license_file)s'):
+            self.system ('mkdir -p %(install_root)s/license/', ignore_errors=True)
+            self.system ('cp %(license_file)s %(install_root)s/license/%(name)s')
+        
+    def broken_install_command (self):
+        """For packages that do not honor DESTDIR.
+        """
+
+        # FIXME: use sysconfdir=%(install_PREFIX)s/etc?  If
+        # so, must also ./configure that way
+        return misc.join_lines ('''make install
+bindir=%(install_prefix)s/bin
+aclocaldir=%(install_prefix)s/share/aclocal
+datadir=%(install_prefix)s/share
+exec_prefix=%(install_prefix)s
+gcc_tooldir=%(install_prefix)s
+includedir=%(install_prefix)s/include
+infodir=%(install_prefix)s/share/info
+libdir=%(install_prefix)s/lib
+libexecdir=%(install_prefix)s/lib
+mandir=%(install_prefix)s/share/man
+prefix=%(install_prefix)s
+sysconfdir=%(install_prefix)s/etc
+tooldir=%(install_prefix)s
+''')
+
+    def kill_libtool_installation_test (self, file):
+        self.file_sub ([(r'if test "\$inst_prefix_dir" = "\$destdir"; then',
+                         'if false && test "$inst_prefix_dir" = "$destdir"; then')],
+                       file, must_succeed=True)
+        
+    def update_libtool (self):
+        lst = self.locate_files ('%(builddir)s', 'libtool')
+        if lst:
+            new = self.expand ('%(system_root)s/usr/bin/libtool')
+            if not os.path.exists (new):
+                self.log_command ("Cannot update libtool: no such file: %(new)s" % locals ())
+                raise 'barf'
+            for i in lst:
+                self.system ('cp %(new)s %(i)s', locals ())
+                self.kill_libtool_installation_test (i)
+                self.system ('chmod 755  %(i)s', locals ())
+
+    def install (self):
+        self.system ('''
+rm -rf %(install_root)s
+cd %(builddir)s && %(install_command)s
+rm -f %(install_root)s/%(packaging_suffix_dir)s/usr/share/info/dir %(install_root)s/%(packaging_suffix_dir)s/usr/cross/info/dir %(install_root)s/%(packaging_suffix_dir)s/usr/info/dir
+''')
+        self.install_license ()
+        self.libtool_installed_la_fixups ()
+
+    def libtool_installed_la_fixups (self):
+        for la in misc.find (self.expand ('%(install_root)s'), '\.la$'):
+            (dir, base) = os.path.split (la)
+            base = base[3:-3]
+            dir = re.sub (r"^\./", "/", dir)
+            full_la = self.expand ("%(install_root)s/%(la)s", locals())
+
+            self.file_sub ([(''' *-L *[^\"\' ][^\"\' ]*''', ''),
+                    ('''( |=|\')(/[^ ]*usr/lib|%(targetdir)s.*)/lib([^ \'/]*)\.(a|la|so)[^ \']*''',
+                    '\\1-l\\3 '),
+                    ('^old_library=.*',
+                    """old_library='lib%(base)s.a'"""),
+                    ],
+                   full_la, env=locals ())
+            if self.settings.platform.startswith ('mingw'):
+                self.file_sub ([('library_names=.*',
+                                 "library_names='lib%(base)s.dll.a'")],
+                               full_la, env=locals())
+
+    def compile (self):
+        self.system ('cd %(builddir)s && %(compile_command)s')
+
+    # FIXME: should not misusde patch for auto stuff
+    def patch (self):
+        if not os.path.exists ('%(srcdir)s/configure' \
+                               % self.get_substitution_dict ()):
+            self.autoupdate ()
+
+    @subst_method
+    def is_sdk_package (self):
+        return 'false'
+
+    def rewire_symlinks (self):
+        for f in self.locate_files ('%(install_root)s', '*'):
+            if os.path.islink (f):
+                s = os.readlink (f)
+                if s.startswith ('/') and self.settings.system_root not in s:
+
+                    new_dest = os.path.join (self.settings.system_root, s[1:])
+                    os.remove (f)
+                    print 'changing absolute link %s -> %s' % (f, new_dest)
+                    os.symlink (new_dest, f)
+
+    def package (self):
+        self.rewire_symlinks ()
+        
+        ps = self.get_packages ()
+        for p in ps:
+            p.create_tarball ()
+            p.dump_header_file ()
+            p.clean ()
+            
+    def get_build_dependencies (self):
+        return []
+
+    def get_subpackage_definitions (self):
+        d = {
+            'devel': [
+            '/usr/bin/*-config',
+            '/usr/include',
+            '/usr/cross/include',
+            '/usr/share/aclocal',
+            '/usr/lib/lib*.a',
+            '/usr/lib/pkgconfig',
+            ],
+            'doc': [
+            '/usr/share/doc',
+            '/usr/share/gtk-doc',
+            '/usr/share/info',
+            '/usr/share/man',
+            '/usr/cross/info',
+            '/usr/cross/man',
+            ],
+            'runtime': ['/usr/lib', '/usr/share'],
+            '' : ['/'],
+            }
+        return d
+    
+    def get_subpackage_names (self):
+        return ['devel', 'doc', '']
+
+    ## FIXME: patch in via MethodOverride
+    def description_dict (self):
+        return {}
+
+    ## FIXME: patch in via MethodOverride
+    def category_dict (self):
+        return {'': 'interpreters',
+                'runtime': 'libs',
+                'devel': 'devel libs',
+                'doc': 'doc'}
+    
+    def get_packages (self):
+        defs = dict (self.get_subpackage_definitions ())
+
+        ps = []
+
+        conflict_dict = self.get_conflict_dict ()
+        dep_dict = self.get_dependency_dict ()
+        descr_dict = self.description_dict ()
+        category_dict = self.category_dict ()
+        
+        for sub in self.get_subpackage_names ():
+            filespecs = defs[sub]
+            
+            p = PackageSpec (self.os_interface)
+            if sub:
+                p._dependencies = [self.expand ("%(name)s")]
+
+            p._file_specs = filespecs
+            p.set_dict (self.get_substitution_dict (), sub)
+
+            conflict_str = ';'.join (conflict_dict.get (sub, []))
+            if p._dict.has_key ('conflicts_string'):
+                conflict_str = p._dict['conflicts_string'] + ';' + conflict_str
+            p._dict['conflicts_string'] = conflict_str
+
+            dep_str = ';'.join (dep_dict.get (sub, []))
+            if p._dict.has_key ('dependencies_string'):
+                dep_str = p._dict['dependencies_string'] + ';' + dep_str
+            p._dict['dependencies_string'] = dep_str
+
+	    ## FIXME make generic: use cross.get_subpackage_dict_methods () or similar.
+            desc_str = descr_dict.get (sub, '')
+            p._dict['description'] = desc_str
+
+            cat_str = category_dict.get (sub, '')
+            p._dict['category'] = cat_str
+            
+            ps.append (p)
+
+        return ps
+    
+    def src_package (self):
+        # URG: basename may not be source dir name, eg,
+        # package libjpeg uses jpeg-6b.  Better fix at untar
+        # stage?
+        dir_name = re.sub (self.expand ('%(allsrcdir)s/'), '',
+                           self.expand ('%(srcdir)s'))
+        self.system ('''
+tar -C %(allsrcdir)s --exclude "*~" --exclude "*.orig"  -zcf %(src_package_ball)s %(dir_name)s
+''',
+                     locals ())
+
+    def clean (self):
+        self.system ('rm -rf  %(stamp_file)s %(install_root)s', locals ())
+        if self.vc_repository and self.vc_repository.is_tracking ():
+            return
+
+        self.system ('''rm -rf %(srcdir)s %(builddir)s''', locals ())
+
+    def untar (self):
+        if not self.has_source:
+            return False
+        if not (self.vc_repository and self.vc_repository.is_tracking ()) :
+            self.system ('rm -rf %(srcdir)s %(builddir)s %(install_root)s')
+
+        if self.vc_repository:
+            self.vc_repository.update_workdir (self.expand ('%(srcdir)s'))
+            
+        if (os.path.isdir (self.expand ('%(srcdir)s'))):
+            self.system ('chmod -R +w %(srcdir)s', ignore_errors=True)
+
+    def pre_install_smurf_exe (self):
+        for i in self.locate_files ('%(builddir)s', '*.exe'):
+            base = os.path.splitext (i)[0]
+            self.system ('''mv %(i)s %(base)s''', locals ())
+
+    def post_install_smurf_exe (self):
+        for i in (self.locate_files ('%(install_root)s/bin', '*')
+                  + self.locate_files ('%(install_root)s/usr/bin', '*')):
+            if (not os.path.islink (i)
+                and not os.path.splitext (i)[1]
+                and self.read_pipe ('file -b %(i)s', locals ()).startswith ('MS-DOS executable PE')):
+                self.system ('''mv %(i)s %(i)s.exe''', locals ())
+
+    def install_readmes (self):
+        self.system ('''
+mkdir -p %(install_root)s/usr/share/doc/%(name)s
+''')
+        for i in glob.glob ('%(srcdir)s/[A-Z]*'
+                            % self.get_substitution_dict ()):
+            import shutil
+            if (os.path.isfile (i)
+                and not os.path.basename (i).startswith ('Makefile')
+                and not os.path.basename (i).startswith ('GNUmakefile')):
+                shutil.copy2 (i, '%(install_root)s/usr/share/doc/%(name)s'
+                              % self.get_substitution_dict ())
+
+    def build_version (self):
+        "the version in the shipped package."
+        # FIXME: ugly workaround needed for lilypond package...
+        return '%(version)s'
+
+    def build_number (self):
+        # FIXME: actually need the packages' build number here...
+        build_number_file = '%(topdir)s/buildnumber-%(lilypond_branch)s.make'
+        d = misc.grok_sh_variables (self.expand (build_number_file))
+        b = '%(INSTALLER_BUILD)s' % d
+        return b
+
+    # TODO: junk this, always set repo in __init__
+    def with_vc (self, repo):
+        self.vc_repository = repo
+        return self
+
+    def with_tarball (self, mirror='', version='', format='gz', strip_components=1, name=''):
+        return self.with_vc (self.get_tarball (mirror, version, format, strip_components, name))
+
+    def get_tarball (self, mirror, version, format='gz', strip_components=1, name=''):
+        if not name:
+            name = self.name ()
+        if not format:
+            format = self.__dict__.get ('format', 'gz')
+        if not mirror:
+            mirror = self.__dict__.get ('url', '')
+        if not version and self.version:
+            version = self.ball_version
+
+        from gub import repository
+        return repository.NewTarBall (self.settings.downloads, mirror, name, version, format, strip_components)
+
+    # TODO: junk this, use TarBall ()or Version ()
+    def with (self,
+              mirror='',
+              version='',
+              strip_components=1,
+              format='',
+              name=''):
+
+        if not name:
+            name = self.name ()
+        if not format:
+            format = self.__dict__.get ('format', 'gz')
+        if not mirror:
+            mirror = self.__dict__.get ('url', '')
+        if not version and self.version:
+            version = self.ball_version
+
+        self.format = format
+        self.ball_version = version
+        self.url = mirror
+
+        ball_version = version
+        package_arch = self.settings.package_arch
+        if mirror:
+            self.vc_repository = repository.TarBall (self.settings.downloads,
+                                                     # Hmm, better to construct
+                                                     # mirror later?
+                                                     mirror % locals (),
+                                                     version,
+                                                     strip_components=strip_components)
+        else:
+            self.vc_repository = repository.Version (version)
+
+        self.ball_version = version
+
+        ## don't do substitution. We want to postpone
+        ## generating the dict until we're sure it doesn't change.
+
+        return self
+
+class BinarySpec (BuildSpec):
+    def configure (self):
+        pass
+
+    def patch (self):
+        pass
+
+    def compile (self):
+        pass
+
+    def install (self):
+        
+        """Install package into %(install_root). Any overrides should
+        follow this command, since it will erase the old install_root first."""
+        
+        self.system ('mkdir -p %(install_root)s')
+
+        _verbose = ''
+        if self.verbose:
+            _verbose = ' -v'
+        self.system ('tar -C %(srcdir)s -cf- . | tar -C %(install_root)s%(_verbose)s -xf-', env=locals ())
+        self.libtool_installed_la_fixups ()
+
+    def get_subpackage_names (self):
+        # FIXME: splitting makes that cygwin's gettext + -devel subpackage
+        # gets overwritten by cygwin's gettext-devel + '' base package
+        return ['']
+
+    # FIXME: no src packages for binary specs
+    # They used to work, but now they fail?
+    def src_package (self):
+        pass
+
+class NullBuildSpec (BuildSpec):
+    """Placeholder for downloads """
+
+    def compile (self):
+        pass
+    def configure (self):
+        pass
+    def install (self):
+        self.system ('mkdir -p %(install_root)s')
+    def untar (self):
+        pass
+    def patch (self):
+        pass
+    def src_package (self):
+        pass
+
+class SdkBuildSpec (NullBuildSpec):
+    def untar (self):
+        BuildSpec.untar (self)
+
+    def get_subpackage_names (self):
+        return ['']
+    
+    ## UGH: should store superclass names of each package.
+    def is_sdk_package (self):
+        return 'true'
+    
+    def install_root (self):
+        return self.srcdir ()
+
+class Change_target_dict:
+    def __init__ (self, package, override):
+        self._target_dict_method = package.get_substitution_dict
+        self._add_dict = override
+
+    def target_dict (self, env={}):
+        env_copy = env.copy ()
+        env_copy.update (self._add_dict)
+        d = self._target_dict_method (env_copy)
+        return d
+
+    def append_dict (self, env={}):
+        d = self._target_dict_method ()
+        for (k,v) in self._add_dict.items ():
+            d[k] += v
+
+        d.update (env)
+        d = recurse_substitutions (d)
+        return d
+
+def change_target_dict (package, add_dict):
+    """Override the get_substitution_dict() method of PACKAGE."""
+    try:
+        package.get_substitution_dict = Change_target_dict (package, add_dict).target_dict
+    except AttributeError:
+        pass
+
+def append_target_dict (package, add_dict):
+    """Override the get_substitution_dict() method of PACKAGE."""
+    try:
+        package.get_substitution_dict = Change_target_dict (package, add_dict).append_dict
+    except AttributeError:
+        pass
+
+def get_class_from_spec_file (settings, file_name, name):
+    import imp
+
+    print 'reading spec', file_name
+    file = open (file_name)
+    desc = ('.py', 'U', 1)
+    module = imp.load_module (name, file, file_name, desc)
+    # cross/gcc.py:Gcc will be called: cross/Gcc.py,
+    # to distinguish from specs/gcc.py:Gcc.py
+    base = os.path.basename (name)
+    class_name = (base[0].upper () + base[1:]).replace ('-', '_')
+    full = class_name + '__' + settings.platform.replace ('-', '__')
+
+    d = module.__dict__
+    print 'full:', full
+    klass = None
+    while full:
+        if d.has_key (full):
+            klass = d[full]
+            break
+        full = full[:max (full.rfind ('__'), 0)]
+
+#    dropped feature:
+#    version = xxx at toplevel of spec file
+#    mirror = xxx at toplevel of spec file
+#    for i in init_vars.keys ():
+#        if d.has_key (i):
+#            init_vars[i] = d[i]
+
+    print klass.__dict__
+    print klass
+    return klass
+
+def get_build_spec (flavour, settings, url):
+    """
+    Return BuildSpec instance to build package from URL.
+
+    URL can be partly specified (eg: only a name, `lilypond'),
+    defaults are taken from the spec file.
+    """
+    name = url
+    if url.find (':') >= 0:
+        name = os.path.basename (url)
+    init_vars = {'format':None, 'version':None, 'url': None,}
+    if misc.is_ball (name):
+        ball = name
+        name, version_tuple, format = misc.split_ball (ball)
+        version = misc.version_to_string (version_tuple)
+        if not version:
+            name = url
+        elif (url.startswith ('/')
+              or url.startswith ('file://')
+              or url.startswith ('ftp://')
+              or url.startswith ('http://')):
+            init_vars['url'] = url
+        if version:
+            init_vars['version'] = version
+        if format:
+            init_vars['format'] = format
+
+    file_name = settings.specdir + '/' + name + '.py'
+    klass = None
+    checksum = '0000'
+    
+    if os.path.exists (file_name):
+        klass = get_class_from_spec_file (settings, file_name, name)
+        if klass:
+            import md5
+            checksum = md5.md5 (open (file_name).read ()).hexdigest ()
+#   else:
+#       # FIXME: make a --debug-must-have-spec option
+#       ## yes: sucks for cygwin etc. but need this for debugging the rest.
+#       raise Exception ("no such spec: " + url)
+
+    if not klass:
+        print 'NO SPEC for', name
+        from new import classobj
+        # Without explicit spec will only work if URL
+        # includes version and format, eg,
+        # URL=libtool-1.5.22.tar.gz
+        klass = classobj (name, (flavour,), {})
+    package = klass (settings)
+    package.spec_checksum = checksum
+    from gub import cross
+    package.cross_checksum = cross.get_cross_checksum (settings.platform)
+
+    # Initialise building package from url, without spec
+    # test:
+    # bin/gub -p linux-64 ftp://ftp.gnu.org/pub/gnu/bison/bison-2.3.tar.gz
+    if init_vars['version']:
+        package.with (format=init_vars['format'],
+                      mirror=init_vars['url'],
+                      version=init_vars['version'])
+    return package
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/gup.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,497 @@
+import gdbm as dbmodule
+#import dbhash as dbmodule
+
+import pickle
+import os
+import re
+import string
+import fcntl
+import sys
+import glob
+
+#
+from gub.misc import * # FIXME
+
+from gub import cross
+from gub import targetpackage
+from gub import locker
+from gub import gubb ## ugh
+
+class GupException (Exception):
+    pass
+
+class FileManager:
+
+    """FileManager handles a tree, and keeps track of files,
+    associating files with a package name"""
+
+    def __init__ (self, root, os_interface, dbdir=None, clean=False):
+        self.root = os.path.normpath (root)
+        if dbdir:
+            self.config = dbdir
+        else:
+            self.config = self.root + '/etc/gup'
+
+        self.config = os.path.normpath (self.config)
+        self.os_interface = os_interface
+        self.verbose = True
+        self.is_distro = False
+
+        ## lock must be outside of root, otherwise we can't rm -rf root
+        self.lock = locker.Locker (self.root + '.lock')
+        if clean:
+            os_interface.system ('rm -fr %s' % self.config)
+            os_interface.system ('rm -fr %s' % self.root)
+            
+        self.make_dirs ()
+        self._file_package_db = dbmodule.open (self.config
+                           + '/files.db', 'c')
+        self._package_file_db = dbmodule.open (self.config
+                           + '/packages.db', 'c')
+
+    def __repr__ (self):
+        name = self.__class__.__name__
+        root = self.root
+        distro =  self.is_distro
+        return '%(name)s: %(root)s, distro: %(distro)d'  % locals()
+
+    def make_dirs (self):
+        if not os.path.isdir (self.config):
+            self.os_interface.system ('mkdir -p %s' % self.config)
+        if not os.path.isdir (self.root):
+            self.os_interface.system ('mkdir -p %s' % self.root)
+        
+    def tarball_files (self, ball):
+        flag = tar_compression_flag (ball)
+        str = self.os_interface.read_pipe ('tar -t%(flag)sf "%(ball)s"'
+                                           % locals ())
+        lst = str.split ('\n')
+        return lst
+
+    def installed_files (self, package):
+        return self._package_file_db[package].split ('\n')
+
+    def is_installed (self, name):
+        return self._package_file_db.has_key (name)
+
+    def install_tarball (self, ball, name):
+        self.os_interface.log_command ('installing package %(name)s from %(ball)s\n'
+                                       % locals ())
+
+        flag = tar_compression_flag (ball)
+        root = self.root
+        lst = self.tarball_files (ball)
+
+        conflicts = False
+        for f in lst:
+            if (self._file_package_db.has_key (f)
+                and not os.path.isdir (self.root + '/' +  f)):
+                print 'already have file %s: %s' % (f, self._file_package_db[f])
+                conflicts = True
+
+        if conflicts and not self.is_distro:
+            raise Exception ('abort')
+
+        self.os_interface.system ('tar -C %(root)s -x%(flag)sf %(ball)s'
+                                  % locals ())
+
+        self._package_file_db[name] = '\n'.join (lst)
+        for f in lst:
+            # ignore directories.
+            if not f.endswith ('/'):
+                self._file_package_db[f] = name
+            if f.endswith ('.la'):
+                self.libtool_la_fixup (root, f)
+            if f.endswith ('.pc'):
+                self.pkgconfig_pc_fixup (root, f)
+
+    def libtool_la_fixup (self, root, file):
+        # avoid using libs from build platform, by adding
+        # %(system_root)s
+        if file.startswith ('./'):
+            file = file[2:]
+        dir = os.path.dirname (file)
+        self.os_interface.file_sub ([('^libdir=.*',
+                                      """libdir='%(root)s/%(dir)s'""" % locals ()
+                                      ),],
+                                    '%(root)s/%(file)s' % locals ())
+
+    def pkgconfig_pc_fixup (self, root, file):
+        # avoid using libs from build platform, by adding
+        # %(system_root)s
+        if file.startswith ('./'):
+            file = file[2:]
+        dir = os.path.dirname (file)
+        self.os_interface.file_sub ([('(-I|-L) */usr',
+                                      '''\\1%(root)s/usr''' % locals ()
+                                      ),],
+                                    '%(root)s/%(file)s' % locals ())
+
+    def uninstall_package (self, name):
+        self.os_interface.log_command ('uninstalling package: %s\n' % name)
+
+        lst = self.installed_files (name)
+
+        dirs = []
+        files = []
+        for i in lst:
+            f = os.path.join (self.root, i)
+            if os.path.islink (f):
+                files.append (f)
+            elif (not os.path.exists (f)
+               and not self.is_distro):
+                print 'FileManager: uninstall: %s' % name
+                print 'FileManager: no such file: %s' % f
+            elif os.path.isdir (f):
+                dirs.append (f)
+            else:
+                files.append (f)
+
+        for f in files:
+            os.unlink (f)
+
+        for d in reversed (dirs):
+            try:
+                os.rmdir (d)
+            except OSError:
+                print 'warning: %s not empty' % d
+
+        for f in lst:
+
+            ## fixme (?)  -- when is f == ''
+            if not f or f.endswith ('/'):
+                continue
+
+            try:
+                del self._file_package_db[f]
+            except:
+                print 'db delete failing for ', f
+        del self._package_file_db[name]
+
+    def installed_packages (self):
+        names = self._package_file_db.keys ()
+        return names
+
+class PackageDictManager:
+    """
+
+    A dict of PackageName ->  (Key->Value dict)
+
+    which can be read off the disk.
+    """
+    def __init__ (self, os_interface):
+        self._packages = {}
+
+        ## ugh mi 
+        self.verbose = False
+        
+        ## ugh: mi overwrite.
+        self.os_interface = os_interface
+    def register_package_dict (self, d):
+        nm = d['name']
+        if d.has_key ('split_name'):
+            nm = d['split_name']
+        if (self._packages.has_key (nm)):
+            if self._packages[nm]['spec_checksum'] != d['spec_checksum']:
+                self.os_interface.log_command ('******** checksum of %s changed!\n\n' % nm)
+
+            ## UGH ; need to look at installed hdr.
+            if self._packages[nm]['cross_checksum'] != d['cross_checksum']:
+                self.os_interface.log_command ('******** checksum of cross changed for %s\n' % nm)
+            return
+
+        self._packages[nm] = d
+   
+        
+    def register_package_header (self, package_hdr, branch_dict):
+        if self.verbose:
+            self.os_interface.log_command ('reading package header: %s\n'
+                                           % `package_hdr`)
+
+        str = open (package_hdr).read ()
+
+        d = pickle.loads (str)
+
+        if branch_dict.has_key (d['basename']):
+            if branch_dict[d['basename']] != d['vc_branch']:
+                suffix = d['vc_branch']
+                print 'ignoring header: ' + package_hdr
+                branch = branch_dict[d['basename']]
+                print 'branch: %(branch)s, suffix: %(suffix)s' % locals ()
+                return
+        elif d['vc_branch']:
+            sys.stdout.write ('No branch for package %s, ignoring header: %s\n' % (d['basename'], package_hdr))
+            return
+        
+        name = d['split_name']
+        if 0:
+          ## FIXME ?
+          if self._package_dict_db.has_key (name):
+              if str != self._package_dict_db[name]:
+                  self.os_interface.log_command ("package header changed for %s\n" % name)
+
+              return
+
+        self.register_package_dict (d)
+
+    def unregister_package_dict (self, name):
+        del self._packages[name]
+
+    def is_registered (self, package):
+        return self._packages.has_key (package)
+
+    def package_dict (self, package_name):
+        return self._packages[package_name]
+
+    def get_all_packages (self):
+        return self._packages.values ()
+
+    def is_installable (self, name):
+        d = self._packages[name]
+        ball = '%(split_ball)s' % d
+        hdr = '%(split_hdr)s' % d
+        return os.path.exists (ball) and os.path.exists (hdr)
+
+    def read_package_headers (self, s, branch_dict):
+        if os.path.isdir (s) and not s.endswith ('/'):
+            s += '/'
+            
+        for f in glob.glob ('%(s)s*hdr' % locals ()):
+            self.register_package_header (f, branch_dict)
+
+
+## FIXME: MI
+class PackageManager (FileManager, PackageDictManager):
+
+
+    """PackageManager is a FileManager, which also associates a
+    key/value dict with each package.
+
+    Such dicts come either from either 
+
+    1. A build spec (ie. a python object)
+
+    2. A pickled dict on disk, a package header
+
+    3. 
+    """
+
+    
+    def __init__ (self, root, os_interface, **kwargs):
+        FileManager.__init__ (self, root, os_interface, **kwargs)
+        PackageDictManager.__init__ (self, os_interface)
+        
+        self._package_dict_db = dbmodule.open (self.config
+                           + '/dicts.db', 'c')
+        for k in self._package_dict_db.keys ():
+            v = self._package_dict_db[k]
+            self.register_package_dict (pickle.loads (v))
+
+    def installed_package_dicts (self):
+        names = self._package_file_db.keys ()
+        return [self._packages[p] for p in names]
+
+    def install_package (self, name):
+        if self.is_installed (name):
+            return
+        self.os_interface.log_command ('installing package: %s\n'
+                                       % name)
+        if self._package_file_db.has_key (name):
+            print 'already have package ', name
+            raise Exception ('abort')
+        d = self._packages[name]
+        ball = '%(split_ball)s' % d
+        self.install_tarball (ball, name)
+        self._package_dict_db[name] = pickle.dumps (d)
+
+    def uninstall_package (self, name):
+        FileManager.uninstall_package (self, name)
+        del self._package_dict_db[name]
+
+    def source_name (self, name):
+        return self._packages [name]['source_name']
+
+    
+def is_string (x):
+    return type (x) == type ('')
+
+class DependencyManager (PackageManager):
+
+    """Manage packages that have dependencies and
+    build_dependencies in their package dicts"""
+
+    def __init__ (self, root, os_interface, **kwargs):
+        PackageManager.__init__ (self, root, os_interface, **kwargs)
+        self.include_build_deps = True
+
+    def dependencies (self, name):
+        assert is_string (name)
+        try:
+            return self.dict_dependencies (self._packages[name])
+        except KeyError:
+            print 'unknown package', name
+            return []
+
+    def dict_dependencies (self, dict):
+        deps = dict['dependencies_string'].split (';')
+        if self.include_build_deps:
+            deps += dict['build_dependencies_string'].split (';')
+
+        deps = [d for d in deps if d]
+        return deps
+
+
+################
+# UGh moveme
+
+
+def topologically_sorted_one (todo, done, dependency_getter,
+                              recurse_stop_predicate=None):
+    sorted = []
+    if done.has_key (todo):
+        return sorted
+
+    done[todo] = 1
+
+    deps = dependency_getter (todo)
+    for d in deps:
+        if recurse_stop_predicate and recurse_stop_predicate (d):
+            continue
+
+        assert type (d) == type (todo)
+
+        sorted += topologically_sorted_one (d, done, dependency_getter,
+                                            recurse_stop_predicate=recurse_stop_predicate)
+
+    sorted.append (todo)
+    return sorted
+
+def topologically_sorted (todo, done, dependency_getter,
+             recurse_stop_predicate=None):
+    s = []
+    for t in todo:
+        s += topologically_sorted_one (t, done, dependency_getter,
+                                       recurse_stop_predicate)
+
+    return s
+
+
+################################################################
+# UGH
+# this is too hairy. --hwn
+
+def gub_to_distro_deps (deps, gub_to_distro_dict):
+    distro = []
+    for i in deps:
+        if i in gub_to_distro_dict.keys ():
+            distro += gub_to_distro_dict[i]
+        else:
+            distro += [i]
+    return distro
+
+def get_base_package_name (name):
+    name = re.sub ('-devel$', '', name)
+
+    # breaks mingw dep resolution, mingw-runtime
+    ##name = re.sub ('-runtime$', '', name)
+    name = re.sub ('-doc$', '', name)
+    return name
+
+def get_source_packages (settings, todo):
+    """TODO is a list of (source) buildspecs.
+
+Generate a list of BuildSpec needed to build TODO, in
+topological order
+    
+"""
+
+    ## don't confuse callers by not modifying argument
+    todo = todo[:]
+
+    cross_packages = cross.get_cross_packages (settings)
+    spec_dict = dict ((p.name (), p) for p in cross_packages)
+    todo += spec_dict.keys ()
+    if cross_packages:
+        # see linux.py
+        print 'get_cross_packages is deprecated, update to get_build_dependencies.'
+    else:
+        todo += cross.get_build_dependencies (settings)
+
+    def name_to_dependencies_via_gub (name):
+        name = get_base_package_name (name)
+        if spec_dict.has_key (name):
+            spec = spec_dict[name]
+        else:
+            spec = targetpackage.get_build_spec (settings, name)
+            spec_dict[name] = spec
+        return map (get_base_package_name, spec.get_build_dependencies ())
+
+    def name_to_dependencies_via_distro (distro_packages, name):
+        if spec_dict.has_key (name):
+            spec = spec_dict[name]
+        else:
+            if name in todo or name not in distro_packages.keys ():
+                spec = targetpackage.get_build_spec (settings, name)
+            else:
+                spec = distro_packages[name]
+            spec_dict[name] = spec
+        return spec.get_build_dependencies ()
+
+    def name_to_dependencies_via_cygwin (name):
+        return name_to_dependencies_via_distro (cygwin.get_packages (), name)
+
+    def name_to_dependencies_via_debian (name):
+        return name_to_dependencies_via_distro (debian.get_packages (), name)
+
+    name_to_deps = name_to_dependencies_via_gub
+    if settings.platform == 'cygwin':
+        from gub import cygwin
+        cygwin.init_dependency_resolver (settings)
+        name_to_deps = name_to_dependencies_via_cygwin
+    elif settings.platform in ('debian-arm', 'debian', 'mipsel'):
+        from gub import debian
+        debian.init_dependency_resolver (settings)
+        name_to_deps = name_to_dependencies_via_debian
+
+    spec_names = topologically_sorted (todo, {}, name_to_deps)
+    spec_dict = dict ((n, spec_dict[n]) for n in spec_names)
+
+    # Fixup for build from url: spec_dict key is full url,
+    # change to base name
+    for name in spec_dict.keys ():
+        spec = spec_dict[name]
+        if name != spec.name ():
+            spec_dict[spec.name ()] = spec
+
+    cross.set_cross_dependencies (spec_dict)
+
+    if settings.is_distro:
+        def obj_to_dependency_objects (obj):
+            return [spec_dict[n] for n in obj.get_build_dependencies ()]
+    else:
+        def obj_to_dependency_objects (obj):
+            return [spec_dict[get_base_package_name (n)]
+                    for n in obj.get_build_dependencies ()]
+
+    sorted_specs = topologically_sorted (spec_dict.values (), {},
+                                         obj_to_dependency_objects)
+
+    # Make sure we build dependencies in order
+    sorted_names = [o.name () for o in sorted_specs]
+    return (sorted_names, spec_dict)
+
+def get_target_manager (settings):
+    target_manager = DependencyManager (settings.system_root,
+                      settings.os_interface)
+    return target_manager
+
+def add_packages_to_manager (target_manager, settings, package_object_dict):
+    
+    ## Ugh, this sucks: we now have to have all packages
+    ## registered at the same time.
+    
+    for spec in package_object_dict.values ():
+        for package in spec.get_packages ():
+            target_manager.register_package_dict (package.dict ())
+
+    return target_manager
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/installer.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,346 @@
+import os
+import re
+import time
+
+from gub import context
+from gub import darwintools
+from gub import gup
+from gub import targetpackage
+
+from context import subst_method
+from misc import *
+
+class Installer (context.Os_context_wrapper):
+    def __init__ (self, settings):
+        context.Os_context_wrapper.__init__ (self, settings)
+        
+        self.settings = settings
+        self.strip_command \
+            = '%(cross_prefix)s/bin/%(target_architecture)s-strip' 
+        self.no_binary_strip = []
+        self.no_binary_strip_extensions = ['.la', '.py', '.def', '.scm', '.pyc']
+        self.installer_uploads = settings.uploads
+        self.installer_version = None
+        self.installer_build = None
+        self.checksum = '0000'
+
+    @context.subst_method
+    def version (self):
+        return self.settings.installer_version
+
+    def strip_prefixes (self):
+        return ['', 'usr/']
+        
+    def strip_unnecessary_files (self):
+        "Remove unnecessary cruft."
+
+        delete_me = ''
+        for p in self.strip_prefixes ():
+            delete_me += p + '%(i)s '
+
+        for i in (
+            'bin/autopoint',
+            'bin/glib-mkenums',
+            'bin/guile-*',
+            'bin/*-config',
+            'bin/*gettext*',
+            'bin/gs??',
+            'bin/gsdj500',
+            'bin/dbftops',
+            'bin/dvipdf',
+            'bin/pf2afm',
+            'bin/printafm',
+            'bin/pv.sh',
+            'bin/unix-lpr.sh',
+            'bin/wftopfa',
+            'bin/idle',
+            'bin/font2c',
+            'bin/fixmswrd.pl',
+            'bin/dumphint',
+            
+            'bin/[cd]jpeg',
+            'bin/envsubst*',
+            'bin/glib-genmarshal*',
+            'bin/gobject-query*',
+            'bin/gspawn-win32-helper*',
+            'bin/gspawn-win32-helper-console*',
+            'bin/msg*',
+            'bin/pango-querymodules*',
+            'bin/xmlwf',
+            'cross',
+            'doc',
+            'include',
+            'info',
+            'lib/gettext',
+            'lib/gettext/hostname*',
+            'lib/gettext/urlget*',
+            'lib/glib-2.0/include/glibconfig.h',
+            'lib/glib-2.0',
+            'lib/libc.*',
+            'lib/libm.*',
+            'lib/pkgconfig',
+            'lib/*~',
+            'lib/*.a',
+            'lib/python*/distutils/command/wininst-6*',
+            'lib/python*/distutils/command/wininst-7.1*',
+            'man',
+            'share/doc',
+            'share/guile/*/ice-9/debugger/',
+            'share/gettext/intl',
+            'share/ghostscript/*/{Resource,doc,examples}/',
+            'share/gs/*/{Resource,doc,examples}/',
+            'share/gtk-doc',
+            'share/info',
+            'share/fonts/',
+            'share/man',
+            'share/omf',
+            'share/libtool/',
+
+            # prune harder
+            'lib/python*/bsddb',
+            'lib/python*/compiler',
+            'lib/python*/curses',
+            'lib/python*/distutils',
+            'lib/python*/email',
+            'lib/python*/hotshot',
+            'lib/python*/idlelib',
+            'lib/python*/lib-old',
+            'lib/python*/lib-tk',
+            'lib/python*/logging',
+            'lib/python*/test',
+# xml2ly needs xml.dom
+#                        'lib/python*/xml',
+            'share/lilypond/*/make',
+            'share/gettext',
+            'usr/share/aclocal',
+            'share/lilypond/*/tex',
+            'share/lilypond/*/fonts/source',
+# Keep svg fonts.  They are needed for usable/sharable svg output.
+#                        'share/lilypond/*/fonts/svg',
+            'share/lilypond/*/fonts/tfm',
+            'share/lilypond/*/fonts/type1/feta[0-9]*pfa',
+            'share/lilypond/*/fonts/type1/feta-braces-[a-z]*pfa',
+            'share/lilypond/*/fonts/type1/parmesan*pfa',
+            'share/omf',
+            ## 2.6 installer: leave c059*
+            'share/gs/fonts/[a-bd-z]*',
+            'share/gs/fonts/c[^0][^5][^9]*',
+            'share/gs/Resource',                        
+            ):
+
+            self.system ('cd %(installer_root)s && rm -rf ' + delete_me, {'i': i })
+
+    def strip_dir (self, dir):
+        from gub import misc
+        misc.map_command_dir (self.expand (dir),
+                              self.expand ('%(strip_command)s'),
+                              self.no_binary_strip,
+                              self.no_binary_strip_extensions)
+        
+    def strip (self):
+        self.strip_unnecessary_files ()
+        self.strip_dir ('%(installer_root)s/usr/bin')
+        self.strip_dir ('%(installer_root)s/usr/lib')
+
+    def use_install_root_manager (self, manager):
+        pass
+    
+    def create (self):
+        self.system ("mkdir %(installer_root)s/license/", ignore_errors=True)
+        self.system ("cp %(sourcefiledir)s/gubb.license %(installer_root)s/license/README", ignore_errors=True)
+
+    def write_checksum (self):
+        open (self.expand ('%(installer_checksum_file)s'), 'w').write (self.checksum)
+
+
+class DarwinRoot (Installer):
+    def __init__ (self, settings):
+        Installer.__init__ (self, settings)
+        self.strip_command += ' -S '
+        self.rewirer = darwintools.Rewirer (self.settings)
+
+    def use_install_root_manager (self, package_manager):
+        tarball = package_manager.package_dict ('darwin-sdk')['split_ball']
+        self.package_manager = package_manager
+        self.rewirer.set_ignore_libs_from_tarball (tarball)
+
+    def create (self):
+        Installer.create (self)
+        self.rewirer.rewire_root (self.expand ('%(installer_root)s'))
+        
+    
+class DarwinBundle (DarwinRoot):
+    def __init__ (self, settings):
+        DarwinRoot.__init__ (self, settings)
+        self.darwin_bundle_dir = '%(targetdir)s/LilyPond.app'
+        
+    def create (self):
+        DarwinRoot.create (self)
+        
+        osx_lilypad_version = self.package_manager.package_dict ('osx-lilypad')['version']
+
+        ## cpu_type = self.expand ('%(platform)s').replace ('darwin-', '')
+        cpu_type = 'ppc'
+        installer_version = self.settings.installer_version
+        installer_build = self.settings.installer_build
+        
+        bundle_zip = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.%(platform)s.tar.bz2', locals ())
+        self.system ('''
+rm -f %(bundle_zip)s 
+rm -rf %(darwin_bundle_dir)s
+tar -C %(targetdir)s -zxf %(downloads)s/osx-lilypad-%(cpu_type)s-%(osx_lilypad_version)s.tar.gz
+cp %(darwin_bundle_dir)s/Contents/Resources/subprocess.py %(installer_root)s/usr/share/lilypond/current/python/
+cp -pR --link %(installer_root)s/usr/* %(darwin_bundle_dir)s/Contents/Resources/
+mkdir -p %(darwin_bundle_dir)s/Contents/Resources/license/
+cp -pR --link %(installer_root)s/license*/* %(darwin_bundle_dir)s/Contents/Resources/license/
+''', locals ())
+        self.file_sub (
+            [('2.[0-9]+.[0-9]+-[0-9]',
+             '%(installer_version)s-%(installer_build)s'),
+            ('Build from .*',
+             'Build from %s' % time.asctime()),
+            ],
+            '%(darwin_bundle_dir)s/Contents/Info.plist',
+            env=locals (),
+            must_succeed=True)
+
+        majmin = '.'.join (installer_version.split ('.')[:2])
+        self.file_sub (
+            [('doc/v2.6/',
+             'doc/v%(majmin)s/'),
+            ],
+            '%(darwin_bundle_dir)s/Contents/Resources/Credits.html',
+            env=locals (),
+            must_succeed=True)
+        
+        self.file_sub (
+            [('2.6.0', installer_version),
+            ],
+            '%(darwin_bundle_dir)s/Contents/Resources/Welcome-to-LilyPond-MacOS.ly',
+            env=locals ())
+        
+        self.system ('cd %(darwin_bundle_dir)s/../ && tar cjf %(bundle_zip)s LilyPond.app',
+                     locals ())
+        
+        self.log_command ("Created %(bundle_zip)s\n", locals()) 
+        self.write_checksum ()
+        
+class MingwRoot (Installer):
+    def __init__ (self, settings):
+        Installer.__init__ (self, settings)
+        self.strip_command += ' -g '
+    
+class Nsis (MingwRoot):
+    def create (self):
+        MingwRoot.create (self)
+        
+        # FIXME: build in separate nsis dir, copy or use symlink
+        installer = os.path.basename (self.expand ('%(installer_root)s'))
+        ns_dir = self.expand ('%(installer_db)s')
+
+        self.dump (r'''
+!define INSTALLER_VERSION "%(installer_version)s"
+!define INSTALLER_BUILD "%(installer_build)s"
+!define INSTALLER_OUTPUT_DIR "%(ns_dir)s"
+!define ROOT "%(installer)s"
+!define PRETTY_NAME "%(pretty_name)s"
+!define CANARY_EXE "%(name)s"
+!define NAME "%(name)s"
+
+!addincludedir "${INSTALLER_OUTPUT_DIR}"
+OutFile "${INSTALLER_OUTPUT_DIR}/setup.exe"
+''',
+                   '%(ns_dir)s/definitions.nsh',
+                   env=locals ())
+        
+        self.system (r'''cp %(nsisdir)s/*.nsh %(ns_dir)s
+cp %(nsisdir)s/*.bat.in %(ns_dir)s
+cp %(nsisdir)s/*.nsi %(ns_dir)s
+cp %(nsisdir)s/*.sh.in %(ns_dir)s''', locals ())
+
+        root = self.expand ('%(installer_root)s')
+        files = [f.replace (root, '').replace ('/', '\\')
+                 for f in self.locate_files (root, '*')]
+
+        self.dump ('\r\n'.join (files) + '\r\n',
+                   '%(installer_root)s/files.txt',
+                   expand_string=False)
+
+        PATH = os.environ['PATH']
+        PATH = '%(local_prefix)s/bin:' + PATH
+        
+        self.system ('cd %(targetdir)s && makensis -NOCD %(ns_dir)s/definitions.nsh %(ns_dir)s/%(name)s.nsi', locals ())
+
+        final = '%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.exe'
+        self.system ('mv %(ns_dir)s/setup.exe %(installer_uploads)s/%(final)s', locals ())
+
+
+class Linux_installer (Installer):
+    def __init__ (self, settings):
+        Installer.__init__ (self, settings)
+        self.bundle_tarball = '%(targetdir)s/%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.tar.bz2'
+
+    def strip_prefixes (self):
+        return Installer.strip_prefixes (self)
+
+    def create_tarball (self):
+        self.system ('tar --owner=0 --group=0 -C %(installer_root)s -jcf %(bundle_tarball)s .', locals ())
+
+def create_shar (orig_file, hello, head, target_shar):
+    length = os.stat (orig_file)[6]
+
+    tarflag = tar_compression_flag (orig_file)
+
+    base_orig_file = os.path.split (orig_file)[1]
+    script = open (head).read ()
+
+    header_length = 0
+    header_length = len (script % locals ()) + 1
+
+    f = open (target_shar, 'w')
+    f.write (script % locals())
+    f.close ()
+
+        
+    cmd = 'cat %(orig_file)s >> %(target_shar)s' % locals ()
+    print 'invoking ', cmd
+    stat = os.system (cmd)
+    if stat:
+        raise 'create_shar() failed'
+    os.chmod (target_shar, 0755)
+
+class Shar (Linux_installer):
+    def create (self):
+        Linux_installer.create (self)
+        self.create_tarball ()
+        
+        target_shar = self.expand ('%(installer_uploads)s/%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.sh')
+
+        head = self.expand ('%(sourcefiledir)s/sharhead.sh')
+        tarball = self.expand (self.bundle_tarball)
+
+        hello = self.expand ("version %(installer_version)s release %(installer_build)s")
+        create_shar (tarball, hello, head, target_shar)
+        self.write_checksum ()
+        system ('rm %(tarball)s' % locals ())
+        
+def get_installer (settings, args=[]):
+
+    installer_class = {
+        'debian-arm' : Shar,
+        'darwin-ppc' : DarwinBundle,
+        'darwin-x86' : DarwinBundle,
+        'freebsd-x86' : Shar,
+        'freebsd4-x86' : Shar,
+        'freebsd6-x86' : Shar,
+        'linux-arm-softfloat' : Shar,
+        'linux-arm-vfp' : Shar,
+        'linux-x86' : Shar,
+        'linux-64' : Shar,
+        'linux-ppc' : Shar,
+        'mingw' : Nsis,
+#        'mingw' : MingwRoot,
+        'mipsel' : Shar,
+    }
+
+    return installer_class[settings.platform] (settings)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/linux-arm-softfloat.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,187 @@
+from gub import cross
+from gub import gubb
+from gub import linux
+from gub import targetpackage
+
+from gub.specs.cross import gcc
+from gub.specs import glibc
+
+binutils_format = 'bz2'
+gcc_format = 'bz2'
+
+'''
+Configured with: /work/GNU/CodeSourcery/src/gcc-3.4.0/configure 
+--target=arm-linux 
+--host=i686-host_pc-linux-gnu 
+--prefix=/usr/local/arm/gnu/release-3.4.0-vfp 
+--with-headers=/usr/local/arm/gnu/release-3.4.0-vfp/arm-linux/include 
+--with-local-prefix=/usr/local/arm/gnu/release-3.4.0-vfp/arm-linux 
+--disable-nls 
+--enable-threads=posix 
+--enable-symvers=gnu 
+--enable-__cxa_atexit 
+--enable-languages=c,c++ 
+--enable-shared 
+--enable-c99 
+--enable-clocale=gnu 
+--enable-long-long
+'''
+
+code_sourcery = 'http://www.codesourcery.com/public/gnu_toolchain/%(name)s/arm-%(ball_version)s-%(name)s.src.tar.%(format)s'
+
+class Arm_none_elf (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def install (self):
+        self.system ('''
+mv %(srcdir)s/*gz %(downloads)s
+mkdir -p %(install_root)s
+''')
+
+class Gcc (gcc.Gcc):
+    def patch (self):
+        gcc.Gcc.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-lib1asm.patch
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-nolibfloat.patch
+''')
+    def configure_command (self):
+        return (gcc.Gcc.configure_command (self)
+                + misc.join_lines ('''
+--with-float=soft
+#--with-fpu=vfp
+'''))
+
+class Gcc_core (gcc.Gcc_core):
+    def patch (self):
+        gcc.Gcc_core.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-lib1asm.patch
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-nolibfloat.patch
+''')
+    def configure_command (self):
+        return (gcc.Gcc_core.configure_command (self)
+                + misc.join_lines ('''
+--with-float=soft
+#--with-fpu=vfp
+'''))
+
+class Glibc (glibc.Glibc):
+    def patch (self):
+        glibc.Glibc.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-wordexp-inline.patch
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-linux-2.4.23-arm-bus-isa.patch
+''')
+    def configure_command (self):
+        return (glibc.Glibc.configure_command (self)
+                + misc.join_lines ('''
+--without-fp
+'''))
+
+class Glibc_core (glibc.Glibc_core):
+    def patch (self):
+        glibc.Glibc_core.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-wordexp-inline.patch
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-linux-2.4.23-arm-bus-isa.patch
+''')
+    def configure_command (self):
+        return (glibc.Glibc_core.configure_command (self)
+                + misc.join_lines ('''
+--without-fp
+'''))
+
+#FIXME, c&p linux.py
+from gub import mirrors
+from gub import misc
+def _get_cross_packages (settings,
+                         linux_version, binutils_version, gcc_version,
+                         glibc_version, guile_version, python_version):
+    configs = []
+    if not settings.platform.startswith ('linux'):
+        configs = [
+            linux.Guile_config (settings).with (version=guile_version),
+            linux.Python_config (settings).with (version=python_version),
+            ]
+
+    from gub import linux_headers
+    from gub import debian
+    from gub.cross import binutils
+    import gcc
+    import glibc
+    headers = linux_headers.Linux_headers (settings)\
+        .with_tarball (mirror=mirrors.linux_2_6,
+                       version=linux_version,
+                       format='bz2')
+    if settings.package_arch == 'arm':
+        headers = debian.Linux_kernel_headers (settings)\
+            .with (version=linux_version,
+                   strip_components=0,
+                   mirror=mirrors.lilypondorg_deb,
+                   format='deb')
+    sdk = []
+    if binutils_version in ('2004-q1a',):
+        sdk += Arm_none_elf (settings).with (version=binutils_version,
+                                             format='bz2',
+                                             mirror=code_sourcery,
+                                             strip_components=0),
+    return sdk + [
+        headers,
+        binutils.Binutils (settings).with (version=binutils_version,
+                                           format=binutils_format,
+                                           mirror=mirrors.gnu),
+        Gcc_core (settings).with (version=gcc_version,
+                                  mirror=(mirrors.gcc
+                                          % {'name': 'gcc',
+                                             'ball_version': gcc_version,
+                                             'format': gcc_format,}),
+                                  format='bz2'),
+        Glibc_core (settings).with (version=glibc_version,
+                                    mirror=(mirrors.glibc_2_3_snapshots
+                                            % {'name': 'glibc',
+                                               'ball_version': glibc_version,
+                                               'format': 'bz2',}),
+                                    format='bz2'),
+        Gcc (settings).with (version=gcc_version,
+                                 mirror=mirrors.gcc, format=gcc_format),
+        Glibc (settings).with (version=glibc_version,
+                               mirror=mirrors.glibc_2_3_snapshots,
+                               format='bz2'),
+        ] + configs
+
+
+
+def get_cross_packages (settings):
+    return get_cross_packages_pre_eabi (settings)
+    #return get_code_sourcery_2004_q1a (settings)
+
+def get_code_sourcery_2004_q1a (settings):
+    global binutils_format, gcc_format
+    binutils_format = gcc_format = 'gz'
+    linux_version = '2.5.999-test7-bk-17'
+    binutils_version = '2004-q1a'
+    gcc_version = '2004-q1a'
+    glibc_version = '2.3-20070416'
+    guile_version = '1.6.7'
+    python_version = '2.4.1'
+    return _get_cross_packages (settings,
+                                linux_version, binutils_version,
+                                gcc_version, glibc_version,
+                                guile_version, python_version)
+
+def get_cross_packages_pre_eabi (settings):
+    #linux_version = '2.5.75'
+    linux_version = '2.5.999-test7-bk-17'
+    #linux_version = '2.4.34'
+    binutils_version = '2.16.1'
+    gcc_version = '3.4.6'
+    glibc_version = '2.3-20070416'
+    guile_version = '1.6.7'
+    python_version = '2.4.1'
+    return _get_cross_packages (settings,
+                                linux_version, binutils_version,
+                                gcc_version, glibc_version,
+                                guile_version, python_version)
+
+def change_target_package (p):
+    cross.change_target_package (p)
+    return p
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/linux.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,19 @@
+def change_target_package (package):
+    from gub import cross
+    from gub import gubb
+    from gub import targetpackage
+    cross.change_target_package (package)
+    if isinstance (package, targetpackage.TargetBuildSpec):
+        gubb.change_target_dict (package,
+                                {'LD': '%(target_architecture)s-ld --as-needed, ',})
+        gubb.append_target_dict (package,
+                                {'LDFLAGS': ' -Wl,--as-needed ' })
+    return package
+
+def get_cross_packages (settings):
+    # obsolete
+    return []
+
+def get_cross_build_dependencies (settings):
+    return ['linux-headers', 'glibc']
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/locker.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,52 @@
+"""
+    Copyright (c) 2005--2007
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import os
+import fcntl
+
+class LockedError (Exception):
+    pass
+    
+class Locker:
+    def __init__ (self, lock_file_name):
+        self.lock_file = None
+        self.lock_file_name = None
+        
+        lock_file = open (lock_file_name, 'a')
+        lock_file.write ('')
+
+        try:
+            fcntl.flock (lock_file.fileno (),
+                         fcntl.LOCK_EX | fcntl.LOCK_NB)
+        except IOError:
+            raise LockedError ("Can't acquire lock: " + lock_file_name)
+
+        self.lock_file_name = lock_file_name
+        self.lock_file = lock_file
+
+    def unlock (self):
+        if self.lock_file_name:
+            os.remove (self.lock_file_name)
+            
+        if self.lock_file:
+            fcntl.flock (self.lock_file.fileno(), fcntl.LOCK_UN)
+	
+    def __del__ (self):
+	self.unlock ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/mingw.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,75 @@
+import os
+import re
+
+from gub import mirrors
+from gub import gubb
+from gub import cross
+
+class Gcc (cross.Gcc):
+    def patch (self):
+        for f in ['%(srcdir)s/gcc/config/i386/mingw32.h',
+                  '%(srcdir)s/gcc/config/i386/t-mingw32']:
+            self.file_sub ([('/mingw/include','/usr/include'),
+                            ('/mingw/lib','/usr/lib'),
+                            ], f)
+
+# UGH: MI
+class Mingw_runtime (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def install (self):
+        self.system ('''
+mkdir -p %(install_root)s/usr/share
+tar -C %(srcdir)s/ -cf - . | tar -C %(install_root)s/usr -xf -
+mv %(install_root)s/usr/doc %(install_root)s/share
+''', locals ())
+
+class Cygcheck (gubb.BinarySpec):
+    "Only need the cygcheck.exe binary."
+    def __init__ (self, settings):
+        gubb.BinarySpec.__init__ (self, settings)
+        self.with (version='1.5.18-1', mirror=mirrors.cygwin_bin, format='bz2')
+        
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+
+        file = self.expand ('%(srcdir)s/usr/bin/cygcheck.exe')
+        cygcheck = open (file).read ()
+        self.system ('rm -rf %(srcdir)s/')
+        self.system ('mkdir -p %(srcdir)s/usr/bin/')
+        open (file, 'w').write (cygcheck)
+
+    def basename (self):
+        f = gubb.BinarySpec.basename (self)
+        f = re.sub ('-1$', '', f)
+        return f
+
+
+# UGH: MI
+class W32api (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def untar (self):
+        gubb.BinarySpec.untar (self)
+        self.system ('''
+cd  %(srcdir)s/ && mkdir usr && mv include lib usr/
+''')
+
+def get_cross_packages (settings):
+    return [cross.Binutils (settings).with (version='2.16.1',
+                                            mirror=mirrors.gnu,
+                                            format='bz2'),
+            Gcc (settings).with (version='4.1.1',
+                                 mirror=mirrors.gcc_41),
+            Mingw_runtime (settings).with (version='3.9',
+                                           strip_components=0,
+                                           mirror=mirrors.mingw),
+            W32api (settings).with (version='3.6',
+                                    strip_components=0,
+                                    mirror=mirrors.mingw)
+            ]
+
+def change_target_package (p):
+    cross.change_target_package (p)
+
+    gubb.change_target_dict (p,
+                    {
+            'DLLTOOL': '%(tool_prefix)sdlltool',
+            'DLLWRAP': '%(tool_prefix)sdllwrap',
+            })
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/mipsel.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,65 @@
+
+#
+from gub import cross
+from gub import mirrors
+from gub import gubb
+from gub import linux
+from gub import misc
+from gub import targetpackage
+
+class Mipsel_runtime (gubb.BinarySpec, gubb.SdkBuildSpec):
+    pass
+
+class Gcc_34 (cross.Gcc):
+    def languages (self):
+        return  ['c']
+        
+    def configure_command (self):
+        return misc.join_lines (cross.Gcc.configure_command (self)
+                               + '''
+--program-suffix=-3.4
+--with-ar=%(cross_prefix)s/bin/%(target_architecture)s-ar
+--with-nm=%(cross_prefix)s/bin/%(target_architecture)s-nm
+''')
+
+    def configure (self):
+        cross.Gcc.configure (self)
+        #FIXME: --with-ar, --with-nm does not work?
+        for i in ('ar', 'nm', 'ranlib'):
+            self.system ('cd %(cross_prefix)s/bin && ln -sf %(target_architecture)s-%(i)s %(target_architecture)s-%(i)s-3.4', env=locals ())
+                
+    def install (self):
+        cross.Gcc.install (self)
+        # get rid of duplicates
+        self.system ('''
+rm -f %(install_root)s/usr/lib/libgcc_s.so
+rm -f %(install_root)s/usr/lib/libgcc_s.so.1
+rm -f %(install_root)s/usr/cross/lib/libiberty.a
+rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libiberty.a
+rm -rf %(install_root)s/usr/cross/info
+rm -rf %(install_root)s/usr/cross/man
+rm -rf %(install_root)s/usr/cross/share/locale
+''')
+        if 'c++' in self.languages ():
+            self.system ('''
+rm -rf %(install_root)s/usr/lib/libsupc++.la
+rm -rf %(install_root)s/usr/lib/libstdc++.la
+rm -rf %(install_root)s/usr/lib/libstdc++.so.6
+rm -rf %(install_root)s/usr/lib/libstdc++.so
+rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libsupc++.a
+rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libstdc++.a
+rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/debug/libstdc++.a
+''')
+
+def get_cross_packages (settings):
+    from gub import debian
+    return debian.get_cross_packages (settings) + [
+        Gcc_34 (settings).with (version='3.4.6',
+                             mirror=(mirrors.gnubase
+                                     + '/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2'),
+                             format='bz2'),
+        ]
+
+def change_target_package (package):
+    cross.change_target_package (package)
+    return package
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/mirrors.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,106 @@
+
+def untar_flags (tarball):
+    flags = ''
+    if tarball.endswith ('.tar.gz') or tarball.endswith ('.tgz'):
+        flags = '-xzf'
+    elif tarball.endswith ('.tar.bz2'):
+        flags = '-jxf'
+    elif tarball.endswith ('.tar'):
+        flags = '-xf'
+    return flags
+
+gtk = 'ftp://ftp.gtk.org/pub/gtk/v%(gtk_version)s/%(name)s-%(ball_version)s.tar.%(format)s'
+gnome_213 ='http://ftp.gnome.org/pub/GNOME/platform/2.13/2.13.90/sources/%(name)s-%(ball_version)s.tar.%(format)s'
+
+gnome_214 ='http://ftp.gnome.org/pub/GNOME/platform/2.14/2.14.3/sources/%(name)s-%(ball_version)s.tar.%(format)s'
+
+gnome_216 ='http://ftp.gnome.org/pub/GNOME/platform/2.16/2.16.2/sources/%(name)s-%(ball_version)s.tar.%(format)s'
+
+gnome_218 ='http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/%(name)s-%(ball_version)s.tar.%(format)s'
+
+gnubase = 'ftp://ftp.gnu.org/pub/gnu'
+    # FIXME: find complete GNU mirror
+    # base = 'ftp://dl.xs4all.nl/pub/mirror/gnu'
+    # base = 'ftp://sunsite.dk/pub/gnu'
+gnu = gnubase + '/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+gcc = gnubase + '/%(name)s/%(name)s-%(ball_version)s/%(name)s-%(ball_version)s.tar.%(format)s'
+glibc = gnubase + '/glibc/%(name)s-%(ball_version)s.tar.%(format)s'
+alphabase = 'ftp://alpha.gnu.org/pub/gnu'
+alpha = alphabase + '/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+nongnu_savannah = 'http://download.savannah.nongnu.org/releases/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+nongnu          = 'ftp://ftp.gnu.org/pub/gnu/non-gnu/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+freetype = 'http://download.savannah.gnu.org/releases/freetype/%(name)s-%(ball_version)s.tar.%(format)s'
+
+fontconfig = 'http://www.fontconfig.org/release/%(name)s-%(ball_version)s.tar.%(format)s'
+
+lilypondorg = 'http://lilypond.org/download/gub-sources/%(name)s-%(ball_version)s.tar.%(format)s'
+lilypondorg_deb = 'http://lilypond.org/download/gub-sources/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
+
+jantien = 'http://www.xs4all.nl/~jantien/%(name)s-%(ball_version)s.tar.%(format)s'
+
+opendarwin = 'http://www.opendarwin.org/downloads/%(name)s-%(ball_version)s.tar.%(format)s'
+# mesh is broken today
+#'http://mesh.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+sf = 'http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+libpng = 'http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s-config.tar.%(format)s'
+
+mingw = 'http://surfnet.dl.sourceforge.net/sourceforge/mingw/%(name)s-%(ball_version)s.tar.%(format)s'
+
+lp = 'http://lilypond.org/mingw/uploads/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
+
+zlib = 'http://www.zlib.net/%(name)s-%(ball_version)s.tar.%(format)s'
+
+sourceforge = sf
+
+sourceforge_homepage = 'http://%(name)s.sourceforge.net/%(name)s-%(ball_version)s.tar.%(format)s'
+
+fondu = 'http://%(name)s.sourceforge.net/%(name)s_src-%(ball_version)s.tgz'
+
+python = 'http://python.org/ftp/python/%(ball_version)s/Python-%(ball_version)s.tar.%(format)s' 
+
+cygwin_bin = 'http://mirrors.kernel.org/sourceware/cygwin/release/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+# FIXME: s/nl/%(gps-location)s/
+linux_2_4 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.4/linux-%(ball_version)s.tar.%(format)s'
+linux_2_5 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.5/linux-%(ball_version)s.tar.%(format)s'
+linux_2_6 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.6/linux-%(ball_version)s.tar.%(format)s'
+
+cygwin = 'http://mirrors.kernel.org/sourceware/cygwin/release/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
+
+cygwin_gcc = 'http://mirrors.kernel.org/sourceware/cygwin/release/gcc/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
+
+# FIXME:  %(version)s should probably be %(ball_version)s for download,
+# to include possible '-xyz' version part.
+cups = 'http://ftp.easysw.com/pub/%(name)s/%(version)s/espgs-%(version)s-source.tar.%(format)s'
+jpeg = 'ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz'
+
+freebsd_ports = 'ftp://ftp.uk.freebsd.org/pub/FreeBSD/ports/local-distfiles/lioux/%(name)s-%(version)s.tar.%(format)s'
+
+freedesktop = 'http://%(name)s.freedesktop.org/releases/%(name)s-%(version)s.tar.%(format)s'
+
+glibc_deb = 'http://ftp.debian.org/debian/pool/main/g/glibc/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
+
+lkh_deb = 'http://ftp.debian.org/debian/pool/main/l/linux-kernel-headers/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
+
+libdbi_deb = 'http://ftp.debian.org/debian/pool/main/libd/libdbi/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
+
+gcc_41 = 'ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-%(ball_version)s/gcc-%(ball_version)s.tar.bz2'
+gcc_snap = 'ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/%(ball_version)s/gcc-%(ball_version)s.tar.bz2'
+
+boost_1_33_1 = 'http://surfnet.dl.sourceforge.net/sourceforge/boost/boost_1_33_1.tar.%(format)s'
+
+gnucvs =  ':pserver:anoncvs@cvs.sv.gnu.org:/cvsroot/%(name)s'
+
+redhat_snapshots = 'ftp://sources.redhat.com/pub/%(name)s/snapshots/%(name)s-%(ball_version)s.tar.%(format)s'
+
+#glibc_2_3_snapshots = redhat_snapshots
+glibc_2_3_snapshots = lilypondorg
+
+berlios = 'http://download.berlios.de/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
+
+xerces_c = 'http://apache.cs.uu.nl/dist/xml/%(name)s/source/%(name)s-src_%(ball_version)s.tar.%(format)s'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/misc.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,233 @@
+# misc utils
+import os
+import re
+import string
+import sys
+import urllib
+ 
+def join_lines (str):
+    return str.replace ('\n', ' ')
+
+
+def bind(function, arg1):
+    def bound(*args, **kwargs):
+        return function(arg1, *args, **kwargs)
+
+    return bound
+
+def read_pipe (cmd, ignore_errors=False):
+    print 'executing pipe %s' % cmd
+    pipe = os.popen (cmd)
+
+    val = pipe.read ()
+    if pipe.close () and not ignore_errors:
+        raise SystemFailed ("Pipe failed: %s" % cmd)
+    
+    return val
+
+def grok_sh_variables_str (str):
+    dict = {}
+    for i in str.split ('\n'):
+        m = re.search ('^([^ =]+) *=\s*(.*)$', i)
+        if m:
+            k = m.group (1)
+            s = m.group (2)
+            dict[k] = s
+    return dict
+
+
+def grok_sh_variables (file):
+    return grok_sh_variables_str (open (file).read ())
+
+def itoa (x):
+    if type (x) == int:
+        return "%d" % x
+    return x
+
+def version_to_string (t):
+    return '%s-%s' % (string.join (map (itoa, t[:-1]), '.'), t[-1])
+
+def split_version (s):
+    m = re.match ('^(([0-9].*)-([0-9]+))$', s)
+    if m:
+        return m.group (2), m.group (3)
+    return s, '0'
+
+def string_to_version (s):
+    s = re.sub ('([^0-9][^0-9]*)', ' \\1 ', s)
+    s = re.sub ('[ _.-][ _.-]*', ' ', s)
+    s = s.strip ()
+    def atoi (x):
+        if re.match ('^[0-9]+$', x):
+            return int (x)
+        return x
+    return tuple (map (atoi, (string.split (s, ' '))))
+
+def is_ball (s):
+    return re.match ('^(.*?)-([0-9].*(-[0-9]+)?)(\.[a-z]*)?(\.tar\.(bz2|gz)|\.gu[bp])$', s)
+
+def split_ball (s):
+    m = is_ball (s)
+    if not m:
+        return (s, (0, 0), '')
+    return (m.group (1), string_to_version (string.join (split_version (m.group (2)), '-')), m.group (6))
+
+def list_append (lists):
+    return reduce (lambda x,y: x+y, lists, [])
+
+def uniq (list):
+    u = []
+    done = {}
+    for e in list:
+        if done.has_key (e):
+            continue
+
+        done[e] = 1
+        u.append (e)
+
+    return u
+
+
+
+def intersect (l1, l2):
+    return [l for l in l1 if l in l2]
+
+def bind_method (func, obj):
+    return lambda *args: func (obj, *args)
+
+
+def tar_compression_flag (ball):
+    compression_flag = ''
+    if ball.endswith ('gub'):
+        compression_flag = 'z'
+    elif ball.endswith ('gup'):
+        compression_flag = 'z'
+    elif ball.endswith ('bz2'):
+        compression_flag = 'j'
+    elif ball.endswith ('gz'):
+        compression_flag = 'z'
+    return compression_flag
+
+
+def file_is_newer (f1, f2):
+    return (not os.path.exists (f2)
+        or os.stat (f1).st_mtime > os.stat (f2).st_mtime)
+
+def find (dir, pattern):
+    """
+    Find files under DIR match the regex pattern.
+    """
+    
+    if type('') == type(pattern):
+        pattern = re.compile (pattern)
+
+    dir = re.sub ( "/*$", '/', dir)
+    results = []
+    for (root, dirs, files) in os.walk (dir):
+        root = root.replace (dir, '')
+        files = [os.path.join (root, f) for f in files if pattern.search (f)]
+        
+        results += files
+        
+    return results
+
+def download_url (url, dest_dir):
+    bufsize = 1024 * 50
+    filename = os.path.split (urllib.splithost (url)[1])[1]
+
+    if not os.path.isdir (dest_dir):
+        raise Exception ("not a dir", dest_dir)
+
+    out_filename = dest_dir + '/' + filename
+    print 'downloading', url
+    try:
+        output = open (out_filename, 'w')
+        opener = urllib.URLopener ()
+        url_stream = opener.open (url)
+        while True:
+            contents = url_stream.read (bufsize)
+            output.write (contents)
+            sys.stderr.write ('.')
+            sys.stderr.flush ()
+
+            if not contents:
+                break
+        sys.stderr.write ('\n')
+    except:
+        os.unlink (out_filename)
+        raise
+    
+def forall (generator):
+    v = True
+    try:
+        while v:
+            v = v and generator.next()
+    except StopIteration:
+        pass
+
+    return v
+            
+class SystemFailed (Exception):
+    pass
+
+
+def system (cmd, ignore_errors=False):
+    print 'Executing command %s' % cmd
+    stat = os.system (cmd)
+    if stat and not ignore_errors:
+        raise SystemFailed ('Command failed ' + `stat`)
+
+def file_mod_time (path):
+    import stat
+    return os.stat (path)[stat.ST_MTIME]
+
+
+def map_command_dir (dir, command, filter_out=[], extension_filter_out=[]):
+    import os
+    if not os.path.isdir (dir):
+        raise ('warning: no such dir: %(dir)s' % locals ())
+    (root, dirs, files) = os.walk (dir).next ()
+    for file in files:
+        if (os.path.basename (file) not in filter_out
+          and (os.path.splitext (file)[1] not in extension_filter_out)):
+            system ('%(command)s %(root)s/%(file)s' % locals (),
+                    ignore_errors=True)
+
+def ball_basename (ball):
+    s = ball
+    s = re.sub ('.tgz', '', s)
+    s = re.sub ('-src\.tar.*', '', s)
+    s = re.sub ('\.tar.*', '', s)
+    s = re.sub ('_%\(package_arch\)s.*', '', s)
+    s = re.sub ('_%\(version\)s', '-%(version)s', s)
+    return s
+
+class MethodOverrider:
+    """Override a object method with a function defined outside the
+class hierarchy.
+    
+    Usage:
+
+    def new_func (old_func, arg1, arg2, .. ):
+        ..do stuff..
+        pass
+    
+    old = obj.func
+    p.func = MethodOverrider (old,
+                              new_func,
+                              (arg1, arg2, .. ))
+    """
+    def __init__ (self, old_func, new_func, extra_args=()):
+        self.new_func = new_func
+        self.old_func = old_func
+        self.args = extra_args
+    def __call__ (self):
+        all_args = (self.old_func (),) + self.args  
+        return apply (self.new_func, all_args)
+
+def testme ():
+    print forall (x for x in [1, 1])
+    
+if __name__ =='__main__':
+    testme ()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/oslog.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,144 @@
+import subprocess
+import sys
+import os
+import time
+import re
+import stat
+
+from misc import SystemFailed
+
+def now ():
+    return time.asctime (time.localtime ())
+
+class Os_commands:
+    '''Encapsulate OS/File system commands for proper logging.'''
+
+    def __init__ (self, logfile):
+        self.log_file = open (logfile, 'a')
+        self.log_file.write ('\n\n * Starting build: %s\n' %  now ())
+
+
+    ## TODO:
+    ## capture complete output of CMD, by polling output, and copying to tty.
+    def system_one (self, cmd, env, ignore_errors):
+        '''Run CMD with environment vars ENV.'''
+
+        self.log_command ('invoking %s\n' % cmd)
+
+        proc = subprocess.Popen (cmd, shell=True, env=env,
+                                 stderr=subprocess.STDOUT)
+
+        stat = proc.wait()
+
+        if stat and not ignore_errors:
+            m = 'Command barfed: %s\n' % cmd
+            self.log_command (m)
+
+            raise SystemFailed (m)
+
+        return 0
+
+    def log_command (self, str):
+        '''Write STR in the build log.'''
+
+        sys.stderr.write (str)
+        if self.log_file:
+            self.log_file.write (str)
+            self.log_file.flush ()
+
+
+    def system (self, cmd, env={}, ignore_errors=False, verbose=False):
+        '''Run os commands, and run multiple lines as multiple
+commands.
+'''
+
+        call_env = os.environ.copy ()
+        call_env.update (env)
+
+        if verbose:
+            keys = env.keys()
+            keys.sort()
+            for k in keys:
+                sys.stderr.write ('%s=%s\n' % (k, env[k]))
+
+            sys.stderr.write ('export %s\n' % ' '.join (keys))
+        for i in cmd.split ('\n'):
+            if i:
+                self.system_one (i, call_env, ignore_errors)
+
+        return 0
+
+    def dump (self, str, name, mode='w'):
+        dir = os.path.split (name)[0]
+        if not os.path.exists (dir):
+            self.system ('mkdir -p %s' % dir)
+
+        self.log_command ("Writing %s (%s)\n" % (name, mode))
+
+        f = open (name, mode)
+        f.write (str)
+        f.close ()
+
+    def file_sub (self, re_pairs, name, to_name=None,
+                  must_succeed=False, use_re=True):
+        '''Substitute RE_PAIRS in file NAME.
+If TO_NAME is specified, the output is sent to there.
+'''
+
+        self.log_command ('substituting in %s\n' % name)
+        self.log_command (''.join (map (lambda x: "'%s' -> '%s'\n" % x,
+                     re_pairs)))
+
+        s = open (name).read ()
+        t = s
+        for frm, to in re_pairs:
+            new_text = ''
+            if use_re:
+                new_text = re.sub (re.compile (frm, re.MULTILINE), to, t)
+            else:
+                new_text = t.replace (frm, to)
+
+            if (t == new_text and must_succeed):
+                raise Exception ('nothing changed!')
+            t = new_text
+
+        if s != t or (to_name and name != to_name):
+            stat_info = os.stat(name)
+            mode = stat.S_IMODE(stat_info[stat.ST_MODE])
+
+            if not to_name:
+                self.system ('mv %(name)s %(name)s~' % locals ())
+                to_name = name
+            h = open (to_name, 'w')
+            h.write (t)
+            h.close ()
+            os.chmod (to_name, mode)
+
+    def read_pipe (self, cmd, ignore_errors=False, silent=False):
+        if not silent:
+            self.log_command ('Reading pipe: %s\n' % cmd)
+
+        pipe = os.popen (cmd, 'r')
+        output = pipe.read ()
+        status = pipe.close ()
+
+        # successful pipe close returns None
+        if not ignore_errors and status:
+            raise Exception ('read_pipe failed')
+        return output
+
+    def shadow_tree (self, src, target):
+        '''Symlink files from SRC in TARGET recursively'''
+
+        target = os.path.abspath (target)
+        src = os.path.abspath (src)
+
+        self.log_command ("Shadowing %s to %s\n" % (src, target))
+        os.makedirs (target)
+        (root, dirs, files) = os.walk(src).next()
+        for f in files:
+            os.symlink (os.path.join (root, f),
+                  os.path.join (target, f))
+        for d in dirs:
+            self.shadow_tree (os.path.join (root, d),
+                     os.path.join (target, d))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/repository.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,665 @@
+
+"""
+    Copyright (c) 2005--2007
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import os
+import re
+import md5
+import time
+import urllib
+
+from gub import misc
+from gub import locker
+from gub import mirrors
+
+## Rename to Source/source.py?
+
+class Repository: 
+    def __init__ (self):
+        self.system = misc.system
+        self.read_pipe = misc.read_pipe
+        
+    def download (self):
+        pass
+
+    def get_checksum (self):
+        """A checksum that characterizes the entire repository.
+        Typically a hash of all source files."""
+
+        return '0'
+
+    def get_file_content (self, file_name):
+        return ''
+
+    def is_tracking (self):
+        "Whether download will fetch newer versions if available"
+        
+        return False
+    
+    def update_workdir (self, destdir):
+        "Populate (preferably update) DESTDIR with sources of specified version/branch"
+
+        pass
+
+    ## Version should be human-readable version.
+    def version  (self):
+        """A human-readable revision number. It need not be unique over revisions."""
+        return '0'
+
+class Version:
+    def __init__ (self, version):
+        self._version = version
+
+    def download (self):
+        pass
+
+    def get_checksum (self):
+        return self.version ()
+
+    def is_tracking (self):
+        return False
+
+    def update_workdir (self, destdir):
+        pass
+
+    def version (self):
+        return self._version
+
+class Darcs (Repository):
+    def __init__ (self, dir, source=''):
+        Repository.__init__ (self)
+        self.dir = dir + '.darcs'
+        self.source = source
+
+    def darcs_pipe (self, cmd):
+
+        dir = self.dir
+        return self.read_pipe ('cd %(dir)s && darcs %(cmd)s' % locals ())
+
+    def darcs (self, cmd):
+        dir = self.dir
+        return self.system ('cd %(dir)s && darcs %(cmd)s' % locals ())
+
+    def get_revision_description (self):
+        return self.darcs_pipe ('changes --last=1')
+    
+    def download (self):
+        dir = self.dir
+        source = self.source
+
+        if os.path.exists (dir + '/_darcs'):
+            self.darcs ('pull -a %(source)s' % locals ())
+        else:
+            self.system ('darcs get %(source)s %(dir)s' % locals ())
+        
+    def is_tracking (self):
+        return True
+
+    ## UGH.
+    def xml_patch_name (self, patch):
+        name_elts =  patch.getElementsByTagName ('name')
+        try:
+            return name_elts[0].childNodes[0].data
+        except IndexError:
+            return ''
+
+    def get_checksum (self):
+        import xml.dom.minidom
+        xml_string = self.darcs_pipe ('changes --xml ')
+        dom = xml.dom.minidom.parseString(xml_string)
+        patches = dom.documentElement.getElementsByTagName('patch')
+        patches = [p for p in patches if not re.match ('^TAG', self.xml_patch_name (p))]
+
+        patches.sort ()
+        release_hash = md5.new ()
+        for p in patches:
+            release_hash.update (p.toxml ())
+
+        return release_hash.hexdigest ()        
+
+    def update_workdir (self, destdir):
+        self.system ('mkdir -p %(destdir)s' % locals ())
+        dir = self.dir
+        
+        self.system ('rsync --exclude _darcs -av %(dir)s/* %(destdir)s/' % locals())
+
+    def get_file_content (self, file):
+        dir = self.dir
+        return open ('%(dir)s/%(file)s' % locals ()).read ()
+
+    
+class TarBall (Repository):
+    def __init__ (self, dir, url, version, strip_components=1):
+        Repository.__init__ (self)
+        if not os.path.isdir (dir):
+            self.system ('mkdir -p %s' % dir)
+
+        self.dir = dir
+        self.url = url
+        self._version = version
+        self.branch = None
+        self.strip_components = strip_components
+        
+    def is_tracking (self):
+        return False
+
+    def _file_name (self):
+        return re.search ('.*/([^/]+)$', self.url).group (1)
+    
+    def _is_downloaded (self):
+        name = os.path.join (self.dir, self._file_name  ())
+        return os.path.exists (name)
+    
+    def download (self):
+        if self._is_downloaded ():
+            return
+        misc.download_url (self.url, self.dir)
+
+    def get_checksum (self):
+        from gub import misc
+        return misc.ball_basename (self._file_name ())
+    
+    def update_workdir_deb (self, destdir):
+        if os.path.isdir (destdir):
+            self.system ('rm -rf %s' % destdir)
+
+        tarball = self.dir + '/' + self._file_name ()
+        strip_components = self.strip_components
+        self.system ('mkdir %s' % destdir)       
+        self.system ('ar p %(tarball)s data.tar.gz | tar -C %(destdir)s --strip-component=%(strip_components)d -zxf -' % locals ())
+        
+    def update_workdir_tarball (self, destdir):
+        
+        tarball = self.dir + '/' + self._file_name ()
+        flags = mirrors.untar_flags (tarball)
+
+        if os.path.isdir (destdir):
+            self.system ('rm -rf %s' % destdir)
+
+        self.system ('mkdir %s' % destdir)       
+        strip_components = self.strip_components
+        self.system ('tar -C %(destdir)s --strip-component=%(strip_components)d %(flags)s %(tarball)s' % locals ())
+
+    def update_workdir (self, destdir):
+        if '.deb' in self._file_name () :
+            self.update_workdir_deb (destdir)
+        else:
+            self.update_workdir_tarball (destdir)
+
+    def version (self):
+        from gub import misc
+        return self._version
+
+class NewTarBall (TarBall):
+    def __init__ (self, dir, mirror, name, ball_version, format='gz',
+                  strip_components=1):
+        TarBall.__init__ (self, dir, mirror % locals (), ball_version,
+                          strip_components)
+
+class RepositoryException (Exception):
+    pass
+
+class Git (Repository):
+    def __init__ (self, git_dir, source='', branch='', revision=''):
+        Repository.__init__ (self)
+        
+        self.repo_dir = os.path.normpath (git_dir) + '.git'
+        self.checksums = {}
+        self.local_branch = ''
+        self.remote_branch = branch
+        self.source = source
+        self.revision = revision
+
+        self.repo_url_suffix = re.sub ('.*://', '', source)
+
+        if self.repo_url_suffix:
+            # FIXME: logic copied foo times
+            fileified_suffix = re.sub ('/', '-', self.repo_url_suffix)
+            # FIXME: projection, where is this used?
+            self.repo_url_suffix = '-' + re.sub ('[:+]+', '-', fileified_suffix)
+        
+        if ':' in branch:
+            (self.remote_branch,
+             self.local_branch) = tuple (branch.split (':'))
+
+            self.local_branch = self.local_branch.replace ('/', '--')
+            self.branch = self.local_branch
+        elif source:
+            self.branch = branch
+
+            if branch:
+                self.local_branch = branch + self.repo_url_suffix
+                self.branch = self.local_branch
+        else:
+            self.branch = branch
+            self.local_branch = branch
+            
+    def version (self):
+        return self.revision
+
+    def is_tracking (self):
+        return self.branch != ''
+    
+    def __repr__ (self):
+        b = self.local_branch
+        if not b:
+            b = self.revision
+        
+        return '#<GitRepository %s#%s>' % (self.repo_dir, b)
+
+    def get_revision_description (self):
+        return self.git_pipe ('log --max-count=1 %s' % self.local_branch)  
+
+    def get_file_content (self, file_name):
+        committish = self.git_pipe ('log --max-count=1 --pretty=oneline %(local_branch)s'
+                                    % self.__dict__).split (' ')[0]
+        m = re.search ('^tree ([0-9a-f]+)',
+                       self.git_pipe ('cat-file commit %(committish)s'  % locals ()))
+
+        treeish = m.group (1)
+        for f in self.git_pipe ('ls-tree -r %(treeish)s' %
+                                locals ()).split ('\n'):
+            (info, name) = f.split ('\t')
+            (mode, type, fileish) = info.split (' ')
+
+            if name == file_name:
+                return self.git_pipe ('cat-file blob %(fileish)s ' % locals ())
+
+        raise RepositoryException ('file not found')
+        
+    def get_branches (self):
+        branch_lines = self.read_pipe (self.git_command () + ' branch -l ').split ('\n')
+
+        branches =  [b[2:] for b in branch_lines]
+        return [b for b in branches if b]
+
+    def git_command (self, dir, repo_dir):
+        if repo_dir:
+            repo_dir = '--git-dir %s' % repo_dir
+
+        c = 'git %(repo_dir)s' % locals ()
+        if dir:
+            c = 'cd %s && %s' % (dir, c)
+
+        return c
+        
+    def git (self, cmd, dir='', ignore_errors=False,
+             repo_dir=''):
+
+        if repo_dir == '' and dir == '':
+            repo_dir = self.repo_dir
+        
+        gc = self.git_command (dir, repo_dir)
+        cmd = '%(gc)s %(cmd)s' % locals ()
+            
+        self.system (cmd, ignore_errors=ignore_errors)
+
+    def git_pipe (self, cmd, ignore_errors=False,
+                  dir='', repo_dir=''):
+
+        if repo_dir == '' and dir == '':
+            repo_dir = self.repo_dir
+            
+        gc = self.git_command (dir, repo_dir)
+        return self.read_pipe ('%(gc)s %(cmd)s' % locals ())
+        
+    def download (self):
+        repo = self.repo_dir
+        source = self.source
+        revision = self.revision
+        
+        if not os.path.isdir (self.repo_dir):
+            self.git ('--git-dir %(repo)s clone --bare -n %(source)s %(repo)s' % locals ())
+
+            for (root, dirs, files) in os.walk ('%(repo)s/refs/heads/' % locals ()):
+                for f in files:
+                    self.system ('mv %s %s%s' % (os.path.join (root, f),
+                                                 os.path.join (root, f),
+                                                 self.repo_url_suffix))
+
+
+                head = open ('%(repo)s/HEAD' % locals ()).read ()
+                head = head.strip ()
+                head += self.repo_url_suffix
+
+                open ('%(repo)s/HEAD' % locals (), 'w').write (head)
+
+            return
+
+        if revision:
+            contents = self.git_pipe ('ls-tree %(revision)s' % locals (),
+                                      ignore_errors=True)
+
+            if contents:
+                return
+            
+            self.git ('--git-dir %(repo)s http-fetch -v -c %(revision)s' % locals ())
+
+        refs = '%s:%s' % (self.remote_branch, self.branch)
+
+        self.git ('fetch --update-head-ok %(source)s %(refs)s ' % locals ())
+        self.checksums = {}
+
+    def get_checksum (self):
+        if self.revision:
+            return self.revision
+        
+        branch = self.local_branch
+        if self.checksums.has_key (branch):
+            return self.checksums[branch]
+
+        repo_dir = self.repo_dir
+        if os.path.isdir (repo_dir):
+            ## can't use describe: fails in absence of tags.
+            cs = self.git_pipe ('rev-list  --max-count=1 %(branch)s' % locals ())
+            cs = cs.strip ()
+            self.checksums[branch] = cs
+            return cs
+        else:
+            return 'invalid'
+
+    def all_files (self):
+        branch = self.branch
+        str = self.git_pipe ('ls-tree --name-only -r %(branch)s' % locals ())
+        return str.split ('\n')
+
+    def update_workdir (self, destdir):
+
+        repo_dir = self.repo_dir
+        branch = self.local_branch
+        revision = self.revision
+        
+        if os.path.isdir (destdir + '/.git'):
+            self.git ('pull %(repo_dir)s %(branch)s' % locals (), dir=destdir)
+        else:
+            self.system ('git-clone -l -s %(repo_dir)s %(destdir)s' % locals ())
+
+        if not revision:
+            revision = open ('%(repo_dir)s/refs/heads/%(branch)s' % locals ()).read ()
+
+        if not branch:
+            branch = 'gub_build'
+            
+        open ('%(destdir)s/.git/refs/heads/%(branch)s' % locals (), 'w').write (revision)
+        self.git ('checkout %(branch)s' % locals (), dir=destdir) 
+
+class CVS(Repository):
+    cvs_entries_line = re.compile ("^/([^/]*)/([^/]*)/([^/]*)/([^/]*)/")
+    #tag_dateformat = '%Y/%m/%d %H:%M:%S'
+
+    def __init__ (self, dir,
+                  source='', module='', tag='HEAD'):
+        Repository.__init__ (self)
+        self.repo_dir = os.path.normpath (dir) + '.cvs'
+        self.module = module
+        self.checksums = {}
+        self.source = source
+        self.tag = tag
+        self.branch = tag # for vc_version_suffix
+        if not os.path.isdir (self.repo_dir):
+            self.system ('mkdir -p %s' % self.repo_dir)
+            
+    def _checkout_dir (self):
+        return '%s/%s' % (self.repo_dir, self.tag)
+
+    def is_tracking (self):
+        return True ##FIXME
+
+    def get_revision_description (self):
+        try:
+            contents = get_file_content ('ChangeLog')
+            entry_regex = re.compile ('\n([0-9])')
+            entries = entry_regex.split (contents)
+            descr = entries[0]
+            
+            changelog_rev = ''
+            
+            for (name, version, date, dontknow) in self.cvs_entries (self.repo_dir + '/CVS'):
+                if name == 'ChangeLog':
+                    changelog_rev  = version
+                    break
+
+            return ('ChangeLog rev %(changelog_rev)s\n%(description)s' %
+                    locals ())
+        
+        except IOError:
+            return ''
+
+    def get_checksum (self):
+        if self.checksums.has_key (self.tag):
+            return self.checksums[self.tag]
+        
+        file = '%s/%s/.vc-checksum' % (self.repo_dir, self.tag)
+
+        if os.path.exists (file):
+            cs = open (file).read ()
+            self.checksums[self.tag] = cs
+            return cs
+        else:
+            return '0'
+        
+    def get_file_content (self, file_name):
+        return open (self._checkout_dir () + '/' + file_name).read ()
+        
+    def read_cvs_entries (self, dir):
+        checksum = md5.md5()
+
+        latest_stamp = 0
+        for d in self.cvs_dirs (dir):
+            for e in self.cvs_entries (d):
+                (name, version, date, dontknow) = e
+                checksum.update (name + ':' + version)
+
+                if date == 'Result of merge':
+                    raise Exception ("repository has been altered")
+                
+                stamp = time.mktime (time.strptime (date))
+                latest_stamp = max (stamp, latest_stamp)
+
+        version_checksum = checksum.hexdigest ()
+        time_stamp = latest_stamp
+
+        return (version_checksum, time_stamp)
+    
+    def update_workdir (self, destdir):
+        dir = self._checkout_dir ()
+        ## TODO: can we get deletes from vc?
+        self.system ('rsync -av --delete --exclude CVS %(dir)s/ %(destdir)s' % locals ())
+        
+    def download (self):
+        suffix = self.tag
+        rev_opt = '-r ' + self.tag
+        source = self.source
+        dir = self._checkout_dir ()
+        lock_dir = locker.Locker (dir + '.lock')
+        module = self.module
+        cmd = ''
+        if os.path.isdir (dir + '/CVS'):
+            cmd += 'cd %(dir)s && cvs -q up -dCAP %(rev_opt)s' % locals()
+        else:
+            repo_dir = self.repo_dir
+            cmd += 'cd %(repo_dir)s/ && cvs -d %(source)s -q co -d %(suffix)s %(rev_opt)s %(module)s''' % locals ()
+
+        self.system (cmd)
+
+        (cs, stamp) = self.read_cvs_entries (dir)
+
+        open (dir + '/.vc-checksum', 'w').write (cs)
+        open (dir + '/.vc-timestamp', 'w').write ('%d' % stamp)
+        
+    def cvs_dirs (self, branch_dir):
+        retval =  []
+        for (base, dirs, files) in os.walk (branch_dir):
+            retval += [os.path.join (base, d) for d in dirs
+                       if d == 'CVS']
+            
+        return retval
+
+    def cvs_entries (self, dir):
+        entries_str =  open (os.path.join (dir, 'Entries')).read ()
+
+        entries = []
+        for e in entries_str.split ('\n'):
+            m = self.cvs_entries_line.match (e)
+            if m:
+                entries.append (tuple (m.groups ()))
+        return entries
+        
+    def all_cvs_entries (self, dir):
+        ds = self.cvs_dirs (dir)
+        es = []
+        for d in ds:
+            
+            ## strip CVS/
+            basedir = os.path.split (d)[0]
+            for e in self.cvs_entries (d):
+                file_name = os.path.join (basedir, e[0])
+                file_name = file_name.replace (self.repo_dir + '/', '')
+
+                es.append ((file_name,) + e[1:])
+            
+
+        return es
+
+    def all_files (self, branch):
+        entries = self.all_cvs_entries (self.repo_dir + '/' + branch)
+        return [e[0] for e in entries]
+    
+# FIXME: why are cvs, darcs, git so complicated?
+class SimpleRepo (Repository):
+    def __init__ (self, dir, repository, source, branch, revision='HEAD'):
+        Repository.__init__ (self)
+        self.repository = repository
+        self.dir = os.path.normpath (dir) + self.repository
+        self.source = source
+        self.revision = revision
+        self.branch = branch
+        if not os.path.isdir (self.dir):
+            self.system ('mkdir -p %(dir)s' % self.__dict__)
+
+    def is_tracking (self):
+        ## FIXME, probably wrong.
+        return self.revision == 'HEAD'
+
+    def update_workdir (self, destdir):
+        working = self._checkout_dir ()
+        self._copy_working_dir (working, destdir)
+
+    def download (self):
+        working = self._checkout_dir ()
+        if not os.path.isdir (working + '/' + self.repository):
+            self._checkout ()
+        if self._current_revision () != self.revision:
+            self._update (working, self.revision)
+
+    def _copy_working_dir (self, working, copy):
+        repository = self.repository
+        self.system ('rsync -av --exclude %(repository)s %(working)s/ %(copy)s'
+                     % locals ())
+
+    def _checkout_dir (self):
+        revision = self.revision
+        dir = self.dir
+        branch = self.branch
+        if branch:
+            branch += '-'
+        return '%(dir)s/%(branch)s%(revision)s' % locals ()
+
+    def get_file_content (self, file_name):
+        return open (self._checkout_dir () + '/' + file_name).read ()
+
+    def get_checksum (self):
+        return self._current_revision ()
+
+    def version (self):
+        return self.revision
+
+class Subversion (SimpleRepo):
+    def __init__ (self, dir, source, branch, module, revision='HEAD'):
+        SimpleRepo.__init__ (self, dir, '.svn', source, branch, revision)
+        self.module = module
+
+    def _current_revision (self):
+        working = self._checkout_dir ()
+        revno = self.read_pipe ('cd %(working)s && svn info' % locals ())
+        m = re.search  ('.*Revision: ([0-9]*).*', revno)
+        assert m
+        return m.group (1)
+        
+    def _checkout (self):
+        dir = self.dir
+        source = self.source
+        branch = self.branch
+        module = self.module
+        revision = self.revision
+        rev_opt = '-r %(revision)s ' % locals ()
+        cmd = 'cd %(dir)s && svn co %(rev_opt)s %(source)s/%(branch)s/%(module)s %(branch)s-%(revision)s''' % locals ()
+        self.system (cmd)
+        
+    def _update (self, working, revision):
+        rev_opt = '-r %(revision)s ' % locals ()
+        cmd = 'cd %(working)s && svn up %(rev_opt)s' % locals ()
+        self.system (cmd)
+
+class Bazaar (SimpleRepo):
+    def __init__ (self, dir, source, revision='HEAD'):
+        # FIXME: multi-branch repos not supported for now
+        SimpleRepo.__init__ (self, dir, '.bzr', source, '', revision)
+
+    def _current_revision (self):
+        working = self._checkout_dir ()
+        revno = self.read_pipe ('cd %(working)s && bzr revno' % locals ())
+        assert revno
+        return revno[:-1]
+
+    def _checkout (self):
+        dir = self.dir
+        source = self.source
+        revision = self.revision
+        rev_opt = '-r %(revision)s ' % locals ()
+        cmd = ('cd %(dir)s && bzr branch %(rev_opt)s %(source)s %(revision)s'''
+               % locals ())
+        self.system (cmd)
+        
+    def _update (self, working, revision):
+        rev_opt = '-r %(revision)s ' % locals ()
+        cmd = 'cd %(working)s && bzr pull %(rev_opt)s' % locals ()
+        self.system (cmd)
+
+def get_repository_proxy (dir, branch):
+    m = re.search (r"(.*)\.(bzr|git|cvs|svn|darcs)", dir)
+    
+    dir = m.group (1)
+    type = m.group (2)
+
+    if type == 'bzr':
+        return Bazaar (dir, branch=branch)
+    elif type == 'cvs':
+        return CVS (dir, branch=branch)
+    elif type == 'darcs':
+        return Darcs (dir)
+    elif type == 'git':
+        return Git (dir, branch=branch)
+    elif type == 'svn':
+        return Subversion (dir, branch=branch)
+    else:
+        raise UnknownVcSystem('repo format unknown: ' + dir)
+
+    return Repository('', '')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/settings.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,177 @@
+import os
+import re
+from gub import oslog
+from gub import distcc
+from gub import gubb
+
+from context import *
+
+platforms = {
+    'debian-arm': 'arm-linux',
+    'cygwin': 'i686-cygwin',
+    'darwin-ppc': 'powerpc-apple-darwin7',
+    'darwin-x86': 'i686-apple-darwin8',
+    'debian': 'i686-linux',
+    'freebsd-x86': 'i686-freebsd4',
+    
+    'freebsd4-x86': 'i686-freebsd4',
+    'freebsd6-x86': 'i686-freebsd6',
+    'linux-arm-softfloat': 'armv5te-softfloat-linux',
+    'linux-arm-vfp': 'arm-linux',
+    'linux-x86': 'i686-linux',
+    'linux-64': 'x86_64-linux',
+    'linux-ppc': 'powerpc-linux',
+    'local': 'local',
+    'mingw': 'i686-mingw32',
+    'mipsel': 'mipsel-linux',
+}
+
+distros = ('debian-arm', 'cygwin', 'debian', 'mipsel')
+            
+class Settings (Context):
+    def __init__ (self, platform):
+        Context.__init__ (self)
+        self.platform = platform
+        self.target_architecture = platforms[self.platform]
+        self.cpu = self.target_architecture.split ('-')[0]
+        self.build_source = False
+        self.is_distro = platform in distros
+
+        self.target_gcc_flags = '' 
+        self.topdir = os.getcwd ()
+        self.logdir = self.topdir + '/log'
+        self.downloads = self.topdir + '/downloads'
+        self.patchdir = self.topdir + '/patches'
+        self.sourcefiledir = self.topdir + '/sourcefiles'
+        # FIXME: absolute path
+        self.specdir = self.topdir + '/gub/specs'
+        self.nsisdir = self.topdir + '/nsis'
+        self.gtk_version = '2.8'
+
+        self.tool_prefix = self.target_architecture + '-'
+        self.system_root = self.topdir + '/target/' + self.platform
+        self.targetdir = self.system_root + '/gubfiles'
+
+        ## Patches are architecture dependent, 
+        ## so to ensure reproducibility, we unpack for each
+        ## architecture separately.
+        self.allsrcdir = os.path.join (self.targetdir, 'src')
+        
+        self.allbuilddir = self.targetdir + '/build'
+        self.statusdir = self.targetdir + '/status'
+
+        ## Safe uploads, so that we can rm -rf target/*
+        ## and still cheaply construct a (partly) system root
+        ## from .gub packages.
+        self.uploads = self.topdir + '/uploads'
+        self.gub_uploads = self.uploads + '/' + self.platform
+
+        ## FIXME
+##        self.gub_cross_uploads = '%s/%s-cross' % (self.uploads, self.platform)
+
+        self.distcc_hosts = ''
+        
+        self.core_prefix = self.system_root + '/usr/cross/core'
+        # FIXME: rename to target_root?
+        self.cross_prefix = self.system_root + '/usr/cross'
+        self.installdir = self.targetdir + '/install'
+        self.local_prefix = self.topdir + '/target/local/usr'
+        self.cross_distcc_bindir = self.topdir + '/target/cross-distcc/bin'
+        self.native_distcc_bindir = self.topdir + '/target/native-distcc/bin'
+        
+	if self.target_architecture.startswith ('x86_64'):
+	    self.package_arch = 'amd64'
+            self.debian_branch = 'unstable'
+	else:
+            self.package_arch = re.sub ('-.*', '', self.target_architecture)
+            self.package_arch = re.sub ('i[0-9]86', 'i386', self.package_arch)
+            self.package_arch = re.sub ('arm.*', 'arm', self.package_arch)
+#            self.package_arch = re.sub ('powerpc.*', 'ppc', self.package_arch)
+            self.debian_branch = 'stable'
+        
+        self.keep_build = False
+        self.use_tools = False
+        self.build_autopackage = self.allbuilddir + '/autopackage'
+
+        if not os.path.isdir ('log'):
+            os.mkdir ('log')
+            
+        self.os_interface = oslog.Os_commands ('log/build-%s.log'
+                                               % self.target_architecture)
+        self.create_dirs ()
+        self.build_architecture = self.os_interface.read_pipe ('gcc -dumpmachine',
+                                                               silent=True)[:-1]
+
+        try:
+            self.cpu_count_str = '%d' % os.sysconf ('SC_NPROCESSORS_ONLN')
+        except ValueError:
+            self.cpu_count_str = '1'
+
+        ## make sure we don't confuse build or target system.
+        self.LD_LIBRARY_PATH = '%(system_root)s/'
+        
+    def verbose (self):
+        try:
+            return self.options.verbose
+        except AttributeError:
+            return False
+    
+    def create_dirs (self): 
+        for a in (
+            'downloads',
+            'logdir',
+            'gub_uploads',
+#            'gub_cross_uploads',
+            'specdir',
+            'allsrcdir',
+            'statusdir',
+            'system_root',
+            'core_prefix',
+            'cross_prefix',
+            'targetdir',
+            'local_prefix',
+            'topdir',
+            ):
+            dir = self.__dict__[a]
+            if os.path.isdir (dir):
+                continue
+
+            self.os_interface.system ('mkdir -p %s' % dir)
+
+
+    def set_distcc_hosts (self, options):
+        def hosts (xs):
+            return reduce (lambda x,y: x+y,
+                           [ h.split (',') for h in xs], [])
+        
+        self.cross_distcc_hosts = ' '.join (distcc.live_hosts (hosts (options.cross_distcc_hosts)))
+
+        self.native_distcc_hosts = ' '.join (distcc.live_hosts (hosts (options.native_distcc_hosts), port=3634))
+
+
+
+    def set_branches (self, bs):
+        "set branches, takes a list of name=branch strings."
+
+        self.branch_dict = {}
+        for b in bs:
+            (name, br) = tuple (b.split ('='))
+
+            self.branch_dict[name] = br
+            self.__dict__['%s_branch' % name]= br
+
+            
+def get_settings (platform):
+    settings = Settings (platform)
+    
+    if platform not in platforms.keys ():
+        raise 'unknown platform', platform
+        
+    if platform == 'darwin-ppc':
+        settings.target_gcc_flags = '-D__ppc__'
+    elif platform == 'mingw':
+        settings.target_gcc_flags = '-mwindows -mms-bitfields'
+
+    return settings
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/a52dec.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,12 @@
+from gub import targetpackage
+
+a52 = 'http://liba52.sourceforge.net/files/%(name)s-%(ball_version)s.tar.%(format)s'
+
+class A52dec (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=a52, version='0.7.4')
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + ' CFLAGS=-fPIC')
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/alien.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,19 @@
+
+## untested.
+        Alien (settings).with (version="8.60",
+                   mirror="http://www.kitenet.net/programs/alien/alien_8.60.tar.gz",
+                   format="gz"),
+
+
+class Alien (ToolBuildSpec):
+    def srcdir (self):
+        return '%(allsrcdir)s/alien'
+    def patch (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+
+    def configure (self):
+        ToolBuildSpec.configure (self)
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/alien.patch')
+    def configure_command (self):
+        return 'perl Makefile.PL'
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/autoconf.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,8 @@
+from gub import mirrors
+from gub import toolpackage
+
+class Autoconf(toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+	toolpackage.ToolBuildSpec.__init__ (self, settings)
+	self.with (mirror=mirrors.gnu,
+		   version="2.59", format='bz2')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/automake.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,8 @@
+from gub import mirrors
+from gub import toolpackage
+
+class Automake (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+	toolpackage.ToolBuildSpec.__init__ (self, settings)
+	self.with (mirror=mirrors.gnu,
+		   version="1.10", format='gz')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/bash.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,11 @@
+from gub import targetpackage
+
+class Bash (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='3.2',
+                   mirror='ftp://ftp.cwru.edu/pub/bash/bash-3.2.tar.gz',
+                   format='bz2')
+
+    def get_build_dependencies (self):
+        return ['libtool', 'gettext-devel']
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/boost.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,91 @@
+from gub import mirrors
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+#
+import os
+
+# TODO: AutoToolSpec
+class BjamBuildSpec (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        gubb.append_target_dict (self, {'CFLAGS': ''})
+    def get_substitution_dict (self, env={}):
+        # FIXME: how to add settings to dict?
+        dict = targetpackage.TargetBuildSpec.get_substitution_dict (self, env)
+        dict['CFLAGS'] = ''
+        return dict
+    def patch (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+    def configure_command (self):
+        return 'true'
+    def compile_command (self):
+# FIXME: WTF, where has python_version gone?
+# only static because dynamic libs fail on linux-64..?
+#<runtime-link>static/dynamic
+# --without-test because is only available as shared lib
+
+# FIXME: how to add settings to dict?
+#'-sGCC=%(tool_prefix)sgcc %(CFLAGS)s
+#'-sGXX=%(tool_prefix)sg++ %(CFLAGS)s
+
+        return misc.join_lines ('''
+bjam
+'-sTOOLS=gcc'
+'-sGCC=%(tool_prefix)sgcc -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
+'-sGXX=%(tool_prefix)sg++ -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
+'-sNO_BZIP2=1'
+'-sNO_ZLIB=1'
+'-sBUILD=release <optimization>space <inlining>on <debug-symbols>off <runtime-link>static'
+'-sPYTHON_VERSION=2.4'
+'-scxxflags=-fPIC'
+--without-python
+--without-test
+--with-python-root=/dev/null
+--layout=system
+--builddir=%(builddir)s
+--with-python-root=/dev/null
+--prefix=/usr
+--exec-prefix=/usr
+--libdir=/usr/lib
+--includedir=/usr/include
+''')
+    def install_command (self):
+        return (self.compile_command ()
+                + ' install').replace ('=/usr', '=%(install_root)s/usr')
+
+class Boost (BjamBuildSpec):
+    def __init__ (self,settings):
+        BjamBuildSpec.__init__ (self, settings)
+        self.with (version='1.33.1', mirror=mirrors.boost_1_33_1, format='bz2')
+        gubb.change_target_dict (self, {'CFLAGS': '-DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'})
+    def get_substitution_dict (self, env={}):
+        dict = BjamBuildSpec.get_substitution_dict (self, env)
+        dict['CFLAGS'] = '-DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
+        return dict
+    def license_file (self):
+        return '%(srcdir)s/LICENSE_1_0.txt'
+    def install (self):
+        BjamBuildSpec.install (self)
+        # Bjam `installs' header files by using symlinks to the source dir?
+        for i in self.locate_files ('%(install_root)s/usr/include/boost',
+                                    '*'):
+            if os.path.islink (i):
+                s = os.readlink (i)
+                self.system ('''
+rm %(i)s
+cp %(s)s %(i)s
+''',
+                             locals ())
+        cwd = os.getcwd ()
+        os.chdir (self.expand ('%(install_root)s/usr/lib'))
+        for i in self.locate_files ('%(install_root)s/usr/lib', 'libboost_*-s.a'):
+            f = os.path.basename (i)
+            os.symlink (f, f.replace ('-s.a', '.a'))
+        os.chdir (cwd)
+        
+class Boost__linux_arm_softfloat (BjamBuildSpec):
+    def configure_command (self):
+        self.system ('''
+cp -f boost/config/platform/linux.hpp boost/config/platform/linux-gnueabi.hpp
+''')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/cross/binutils.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,8 @@
+from gub import cross
+from gub import mirrors
+
+class Binutils (cross.Binutils):
+    def __init__ (self, settings):
+        cross.Binutils.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.gnu, version='2.16.1', format='bz2')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/cross/gcc-core.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,49 @@
+from gub import cross
+from gub.specs.cross import gcc
+from gub import mirrors
+from gub import misc
+        
+class Gcc_core (gcc.Gcc):
+    def __init__ (self, settings):
+        gcc.Gcc.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.gnu,
+                           version='4.1.1', format='bz2', name='gcc')
+    def get_build_dependencies (self):
+        return filter (lambda x: x != 'cross/gcc-core' and x != 'glibc-core',
+                       gcc.Gcc.get_build_dependencies (self))
+    def get_subpackage_names (self):
+        return ['']
+    def name (self):
+        return 'gcc-core'
+    def file_name (self):
+        return 'gcc-core'
+    def get_conflict_dict (self):
+        return {'': ['cross/gcc', 'cross/gcc-devel', 'cross/gcc-doc', 'cross/gcc-runtime']}
+    def configure_command (self):
+        return (misc.join_lines (gcc.Gcc.configure_command (self) + '''
+--prefix=%(cross_prefix)s
+--prefix=/usr
+--with-newlib
+--enable-threads=no
+--without-headers
+--disable-shared
+''')
+                .replace ('enable-shared', 'disable-shared')
+                .replace ('disable-static', 'enable-static')
+                .replace ('enable-threads=posix', 'enable-threads=no'))
+    def compile_command (self):
+        return (cross.Gcc.compile_command (self) + ' all-gcc')
+    def compile (self):
+        cross.Gcc.compile (self)
+    def install_command (self):
+        return (gcc.Gcc.install_command (self)
+                .replace (' install', ' install-gcc')
+                #+ ' prefix=/usr/cross/core'
+                )
+    def install (self):
+        # cross.Gcc moves libs into system lib places, which will
+        # make gcc-core conflict with gcc.
+        cross.CrossToolSpec.install (self)
+    def languages (self):
+        return  ['c']
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/cross/gcc.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,37 @@
+from gub import cross
+from gub import misc
+from gub import mirrors
+
+class Gcc (cross.Gcc):
+    def __init__ (self, settings):
+        cross.Gcc.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2')
+    def get_build_dependencies (self):
+        return (cross.Gcc.get_build_dependencies (self)
+                + ['cross/gcc-core', 'glibc-core'])
+    #FIXME: what about apply_all (%(patchdir)s/%(version)s)?
+    def patch (self):
+        if self.vc_repository._version == '4.1.1':
+            self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch
+''')
+    def get_conflict_dict (self):
+        return {'': ['cross/gcc-core'], 'doc': ['cross/gcc-core'], 'runtime': ['cross/gcc-core']}
+    def configure_command (self):
+        return (cross.Gcc.configure_command (self)
+                + misc.join_lines ('''
+--with-local-prefix=%(system_root)s/usr
+--disable-multilib
+--disable-nls
+--enable-threads=posix
+--enable-__cxa_atexit
+--enable-symvers=gnu
+--enable-c99 
+--enable-clocale=gnu 
+--enable-long-long
+'''))
+    def install (self):
+        cross.Gcc.install (self)
+        self.system ('''
+mv %(install_root)s/usr/cross/lib/gcc/%(target_architecture)s/%(version)s/libgcc_eh.a %(install_root)s/usr/lib
+''')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/distcc.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,10 @@
+from toolpackage import ToolBuildSpec
+
+class Distcc (ToolBuildSpec):
+    def patch (self):
+        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/distcc-substitute.patch")
+
+    def __init__ (self,s):
+        ToolBuildSpec.__init__ (self,s)
+        self.with (version='2.18.3',
+             mirror="http://distcc.samba.org/ftp/distcc/distcc-%(version)s.tar.bz2"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/e2fsprogs.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,10 @@
+from gub import mirrors
+from gub import targetpackage
+
+class E2fsprogs (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.sf, version='1.38')
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' install-libs')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/expat.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,49 @@
+from gub import mirrors
+from gub import misc
+from gub import targetpackage
+from gub import toolpackage
+
+class Expat (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.95.8', mirror=mirrors.sf, format='gz')
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def patch (self):
+        self.system ("rm %(srcdir)s/configure")
+        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/expat-1.95.8-mingw.patch")
+        self.system ("touch %(srcdir)s/tests/xmltest.sh.in")
+        targetpackage.TargetBuildSpec.patch (self)
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        # # FIXME: libtool too old for cross compile
+        self.update_libtool ()
+
+    def makeflags (self):
+        return misc.join_lines ('''
+CFLAGS="-O2 -DHAVE_EXPAT_CONFIG_H"
+EXEEXT=
+RUN_FC_CACHE_TEST=false
+''')
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+            + self.makeflags ())
+
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + self.makeflags ())
+
+class Expat__local (toolpackage.ToolBuildSpec):
+    def __init__ (self,settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='1.95.8', mirror=mirrors.sf, format='gz')
+
+    def patch (self):
+        toolpackage.ToolBuildSpec.patch (self)
+        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/expat-1.95.8-mingw.patch")
+
+    def get_build_dependencies (self):
+        return ['libtool']            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/faac.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,7 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Faac (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.sf, version='1.24')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/faad2.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,15 @@
+from gub import targetpackage
+
+faac = 'http://surfnet.dl.sourceforge.net/sourceforge/faac/%(name)s-%(ball_version)s.tar.%(format)s'
+
+class Faad2 (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=faac, version='2.5')
+    def patch (self):
+        self.system ('''
+cd %(srcdir)s && patch -p0 < %(patchdir)s/faad2-2.5.patch
+mkdir %(srcdir)s/plugins/bmp
+''')        
+        self.autoupdate ()
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/ffmpeg.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,50 @@
+from gub import misc
+from gub import repository
+from gub import targetpackage
+
+class Ffmpeg (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        # FIXME: fixed version for svn, what a mess
+        self.revision = '6017'
+        repo = repository.Subversion (
+            dir=self.get_repodir (),
+            source='svn://svn.mplayerhq.hu/ffmpeg',
+            branch='trunk',
+            module='.',
+            revision=self.revision)
+        def fixed_version (self):
+            return self.version ()
+        from new import instancemethod
+        repo.version = instancemethod (fixed_version, repo, type (repo))
+        self.with_vc (repo)
+    def version (self):
+        return self.revision
+    def get_build_dependencies (self):
+        return ['faac', 'faad2', 'a52dec']
+    def configure_command (self):
+        #FIXME: this is autoconf
+        #targetpackage.TargetBuildSpec.configure_command (self)
+        return misc.join_lines ('''
+CC=%(tool_prefix)sgcc CFLAGS=-fPIC %(srcdir)s/configure
+--prefix=/usr
+--cross-prefix=%(cross_prefix)s/bin/%(tool_prefix)s
+--cpu=%(cpu)s
+--enable-faad
+--enable-a52
+--enable-a52bin
+--enable-pp
+--enable-shared
+--enable-pthreads
+--enable-gpl
+--disable-audio-beos
+--disable-v4l
+--disable-dv1394
+--disable-ffserver
+--disable-ffplay
+--disable-debug
+--disable-opts
+''')
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' INSTALLSTRIP=')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/flex.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,16 @@
+from gub import toolpackage
+from gub import mirrors
+
+class Flex (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version="2.5.4a",
+                   mirror=mirrors.nongnu, format='gz'),
+    def srcdir (self):
+        return '%(allsrcdir)s/flex-2.5.4'
+    def install_command (self):
+        return self.broken_install_command ()
+    def packaging_suffix_dir (self):
+        return ''
+    def patch (self):
+        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/flex-2.5.4a-FC4.patch")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/fondu.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,27 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Fondu (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version="060102",
+             mirror='http://fondu.sourceforge.net/fondu_src-060102.tgz')
+
+    def srcdir (self):
+        return '%(allsrcdir)s/' + ('fondu-%s' % self.version())
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
+    
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+        self.file_sub ([('wilprefix', 'prefix')],
+                       '%(srcdir)s/Makefile.in')
+        
+class Fondu__darwin (Fondu):
+    def patch(self):
+        Fondu.patch (self)
+        self.file_sub ([('/System/Library/',
+                '%(system_root)s/System/Library/')],
+               '%(srcdir)s/Makefile.in')
+        
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/fontconfig.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,208 @@
+from gub import mirrors
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+from gub import toolpackage
+from gub import repository
+
+fc_version = "0596d7296c94b2bb9817338b8c1a76da91673fb9"
+
+class Fontconfig (targetpackage.TargetBuildSpec):
+    '''Generic font configuration library 
+Fontconfig is a font configuration and customization library, which
+does not depend on the X Window System.  It is designed to locate
+fonts within the system and select them according to requirements
+specified by applications.'''
+
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_vc (repository.Git (self.get_repodir (),
+                                      source="git://anongit.freedesktop.org/git/fontconfig",
+                                      revision=fc_version))
+
+    def get_build_dependencies (self):
+        return ['libtool', 'expat-devel', 'freetype-devel']
+
+    def get_dependency_dict (self):
+        return {'': ['expat', 'freetype', 'libtool']}
+
+    def configure_command (self):
+        # FIXME: system dir vs packaging install
+
+        ## UGH  - this breaks  on Darwin!
+        ## UGH2 - the added /cross/ breaks Cygwin; possibly need
+        ## Freetype_config package (see Guile_config, Python_config)
+        return (targetpackage.TargetBuildSpec.configure_command (self) 
+                + misc.join_lines ('''
+--with-arch=%(target_architecture)s
+--with-freetype-config="%(system_root)s/usr/cross/bin/freetype-config
+--prefix=%(system_root)s/usr
+"'''))
+
+    def configure (self):
+        self.system ('''
+rm -f %(srcdir)s/builds/unix/{unix-def.mk,unix-cc.mk,ftconfig.h,freetype-config,freetype2.pc,config.status,config.log}
+''')
+
+        targetpackage.TargetBuildSpec.configure (self)
+
+        ## FIXME: libtool too old for cross compile
+        self.update_libtool ()
+        self.file_sub ([('DOCSRC *=.*', 'DOCSRC=')],
+                       '%(builddir)s/Makefile')
+
+    def compile (self):
+
+        # help fontconfig cross compiling a bit, all CC/LD
+        # flags are wrong, set to the target's root
+
+        ## we want native freetype-config flags here. 
+        cflags = '-I%(srcdir)s -I%(srcdir)s/src ' \
+                 + self.read_pipe ('%(local_prefix)s/bin/freetype-config --cflags')[:-1]
+
+        libs = self.read_pipe ('%(local_prefix)s/bin/freetype-config --libs')[:-1]
+        for i in ('fc-case', 'fc-lang', 'fc-glyphname', 'fc-arch'):
+            self.system ('''
+cd %(builddir)s/%(i)s && make "CFLAGS=%(cflags)s" "LIBS=%(libs)s" CPPFLAGS= LDFLAGS= INCLUDES= 
+''', locals ())
+
+        targetpackage.TargetBuildSpec.compile (self)
+        
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.dump ('''set FONTCONFIG_FILE=$INSTALLER_PREFIX/etc/fonts/fonts.conf
+set FONTCONFIG_PATH=$INSTALLER_PREFIX/etc/fonts
+''', 
+             '%(install_root)s/usr/etc/relocate/fontconfig.reloc')
+        
+        
+class Fontconfig__mingw (Fontconfig):
+    def patch (self):
+        Fontconfig.patch (self)
+        self.file_sub ([('<cachedir>@FC_CACHEDIR@</cachedir>', '')],
+                       '%(srcdir)s/fonts.conf.in')
+
+    def configure (self):
+        Fontconfig.configure (self)
+        self.dump ('''
+#define sleep(x) _sleep (x)
+''',
+                   '%(builddir)s/config.h',
+                   mode='a')
+
+class Fontconfig__darwin (Fontconfig):
+    def configure_command (self):
+        cmd = Fontconfig.configure_command (self)
+        cmd += ' --with-add-fonts=/Library/Fonts,/System/Library/Fonts '
+        return cmd
+
+    def configure (self):
+        Fontconfig.configure (self)
+        self.file_sub ([('-Wl,[^ ]+ ', '')],
+               '%(builddir)s/src/Makefile')
+
+class Fontconfig__linux (Fontconfig):
+    def configure (self):
+        Fontconfig.configure (self)
+        self.file_sub ([
+            ('^sys_lib_search_path_spec="/lib/* ',
+            'sys_lib_search_path_spec="%(system_root)s/usr/lib /lib '),
+            # FIXME: typo: dl_search (only dlsearch exists).
+            # comment-out for now
+            #('^sys_lib_dl_search_path_spec="/lib/* ',
+            # 'sys_lib_dl_search_path_spec="%(system_root)s/usr/lib /lib ')
+            ],
+               '%(builddir)s/libtool')
+
+class Fontconfig__freebsd (Fontconfig__linux):
+    pass
+
+class Fontconfig__local (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (mirror="git://anongit.freedesktop.org/git/fontconfig",
+                   version=fc_version)
+        
+    def get_build_dependencies (self):
+        return ['libtool', 'freetype', 'expat']
+
+    def compile_command (self):
+        return (toolpackage.ToolBuildSpec.compile_command (self)
+                + ' DOCSRC="" ')
+
+    def install_command (self):
+        return (toolpackage.ToolBuildSpec.install_command (self)
+                + ' DOCSRC="" ')
+
+class Fontconfig__cygwin (Fontconfig):
+    def __init__ (self, settings):
+        Fontconfig.__init__ (self, settings)
+        self.with (mirror=mirrors.fontconfig, version='2.4.1')
+
+    def get_subpackage_definitions (self):
+        d = dict (Fontconfig.get_subpackage_definitions (self))
+        # urg, must remove usr/share. Because there is no doc package,
+        # runtime iso '' otherwise gets all docs.
+        d['runtime'] = ['/usr/lib']
+        return d
+
+    def get_subpackage_names (self):
+        #return ['devel', 'doc', '']
+        return ['devel', 'runtime', '']
+
+    def get_build_dependencies (self):
+        return ['libtool', 'libfreetype2-devel', 'expat']
+    
+    def get_dependency_dict (self):
+        return {
+            '': ['libfontconfig1'],
+            'devel': ['libfontconfig1', 'libfreetype2-devel'],
+            'runtime': ['expat', 'libfreetype26', 'zlib'],
+            }
+
+    def category_dict (self):
+        return {'': 'libs',
+                'runtime': 'libs',
+                'devel': 'devel libs',
+                'doc': 'doc'}
+
+    def description_dict (self):
+        # FIXME: fairly uninformative description for packages,
+        # unlike, eg, guile-devel.  This is easier, though.
+        d = {}
+        for i in self.get_subpackage_names ():
+            d[i] = self.get_subpackage_doc (i)
+        return d
+
+    def get_subpackage_doc (self, split):
+        flavor = {'': 'executables',
+                  'devel': 'development',
+                  'doc': 'documentation',
+                  'runtime': 'runtime'}[split]
+        return (Fontconfig.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
+                % locals ())
+
+    def configure_command (self):
+        return (Fontconfig.configure_command (self)
+                + ' --sysconfdir=/etc --localstatedir=/var')
+
+    def xxx_noconfig_configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + misc.join_lines ('''
+--with-arch=%(target_architecture)s
+--with-freetype-config="%(system_root)s/usr/bin/freetype-config
+--prefix=%(system_root)s/usr
+"''')
+                + ' --sysconfdir=/etc --localstatedir=/var')
+
+    def install (self):
+        self.pre_install_smurf_exe ()
+        Fontconfig.install (self)
+        name = 'fontconfig-postinstall.sh'
+        postinstall = '''#! /bin/sh
+# cleanup silly symlink of previous packages
+rm -f /usr/X11R6/bin/fontconfig-config
+'''
+        self.dump (postinstall,
+                   '%(install_root)s/etc/postinstall/%(name)s',
+                   env=locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/fontforge.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,33 @@
+from gub import toolpackage 
+import re
+
+class Fontforge (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (mirror='http://lilypond.org/download/gub-sources/fontforge_full-%(version)s.tar.bz2',
+                   version="20060501")
+
+
+    def get_build_dependencies (self):
+        return ['freetype']
+
+    def patch (self):
+        toolpackage.ToolBuildSpec.patch (self)
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/fontforge-20060501-srcdir.patch')
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/fontforge-20060501-execprefix.patch')
+
+    def configure_command (self):
+        return (toolpackage.ToolBuildSpec.configure_command (self)
+                + ' --without-freetype-src ')
+
+    def srcdir (self):
+        return re.sub ('_full', '', toolpackage.ToolBuildSpec.srcdir (self))
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE' 
+        
+    def install_command (self):
+        return self.broken_install_command ()
+
+    def packaging_suffix_dir (self):
+        return ''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/freetype-config.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,31 @@
+from gub import gubb
+
+class Freetype_config (gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.SdkBuildSpec.__init__ (self, settings)
+        self.has_source = False
+        self.with (version='2.1.9')
+    def untar (self):
+        pass
+    def install (self):
+        gubb.SdkBuildSpec.install (self)
+        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
+        
+        ft_version = self.version ()
+        prefix = '%(system_root)s/usr'
+        exec_prefix = '${prefix}'
+        includedir = '/usr/include'
+        libdir = '/usr/lib'
+        enable_shared = 'yes'
+        wl = '-Wl,'
+        hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
+        LIBZ = '-lz'
+
+        import re
+        import os
+        s = open (self.expand ('%(sourcefiledir)s/freetype-config.in')).read ()
+        s = re.sub (r'@(\w+?)@', r'%(\1)s', s)
+        s = s % locals ()
+        file = self.expand ('%(install_prefix)s/cross/bin/freetype-config')
+        self.dump (s, file)
+        os.chmod (file, 0755)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/freetype.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,74 @@
+from gub import mirrors
+from gub import gubb
+from gub import targetpackage
+from gub import toolpackage
+
+class Freetype (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='2.1.10', mirror=mirrors.nongnu_savannah)
+
+    def license_file (self):
+        return '%(srcdir)s/docs/LICENSE.TXT'
+
+    def get_build_dependencies (self):
+        return ['libtool-devel', 'zlib-devel']
+
+    def get_subpackage_names (self):
+        return ['devel', '']
+
+    def get_dependency_dict (self):
+        return {'': ['zlib']}
+
+    def configure (self):
+#                self.autoupdate (autodir=os.path.join (self.srcdir (),
+#                                                       'builds/unix'))
+
+        self.system ('''
+        rm -f %(srcdir)s/builds/unix/{unix-def.mk,unix-cc.mk,ftconfig.h,freetype-config,freetype2.pc,config.status,config.log}
+''')
+        targetpackage.TargetBuildSpec.configure (self)
+
+        ## FIXME: libtool too old for cross compile
+        self.update_libtool ()
+
+        self.file_sub ([('^LIBTOOL=.*', 'LIBTOOL=%(builddir)s/libtool --tag=CXX')], '%(builddir)s/Makefile')
+
+    def munge_ft_config (self, file):
+        self.file_sub ([('\nprefix=[^\n]+\n',
+                         '\nlocal_prefix=yes\nprefix=%(system_root)s/usr\n')],
+                       file, must_succeed=True)
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.system ('mkdir -p %(install_root)s/usr/cross/bin/')
+        self.system ('mv %(install_root)s/usr/bin/freetype-config %(install_root)s/usr/cross/bin/freetype-config')
+        self.munge_ft_config ('%(install_root)s/usr/cross/bin/freetype-config')
+
+class Freetype__mingw (Freetype):
+    def configure (self):
+        Freetype.configure (self)
+        self.dump ('''
+# libtool will not build dll if -no-undefined flag is not present
+LDFLAGS:=$(LDFLAGS) -no-undefined
+''',
+             '%(builddir)s/Makefile',
+             mode='a')
+
+class Freetype__local (toolpackage.ToolBuildSpec, Freetype):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='2.1.10', mirror=mirrors.nongnu_savannah)
+
+    def get_build_dependencies (self):
+        # local is not split
+        #return ['libtool-devel']
+        return ['libtool']
+
+    # FIXME, mi-urg?
+    def license_file (self):
+        return Freetype.license_file (self)
+
+    def install (self):
+        toolpackage.ToolBuildSpec.install (self)
+        self.munge_ft_config ('%(install_root)s/%(local_prefix)s/bin/.freetype-config')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/gettext.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,79 @@
+from gub import mirrors
+from gub import targetpackage
+from gub import toolpackage
+
+class Gettext (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + ' --disable-threads --disable-csharp --disable-java ')
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+
+        ## FIXME: libtool too old for cross compile
+        self.update_libtool ()
+        self.file_sub ([
+                ('(SUBDIRS *=.*)examples', r'\1 '),
+                ],
+                       '%(builddir)s/gettext-tools/Makefile')
+
+class Gettext__freebsd (Gettext):
+    def get_dependency_dict (self):
+        d = Gettext.get_dependency_dict (self)
+        if self.settings.target_architecture == 'i686-freebsd4':
+            d[''].append ('libgnugetopt')
+        return d
+
+    def get_build_dependencies (self):
+        if self.settings.target_architecture == 'i686-freebsd4':
+            return ['libgnugetopt'] + Gettext.get_build_dependencies (self)
+        return Gettext.get_build_dependencies (self)
+
+class Gettext__mingw (Gettext):
+    def __init__ (self, settings):
+        Gettext.__init__ (self, settings)
+        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
+
+    def config_cache_overrides (self, str):
+        return (re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
+               str)
+            + '''
+# only in additional library -- do not feel like patching right now
+gl_cv_func_mbrtowc=${gl_cv_func_mbrtowc=no}
+jm_cv_func_mbrtowc=${jm_cv_func_mbrtowc=no}
+''')
+
+    def configure_command (self):
+        return Gettext.configure_command (self) + ' --disable-libasprintf'
+
+    def configure (self):
+        Gettext.configure (self)
+        self.file_sub ( [(' gettext-tools ', ' ')],
+                        '%(builddir)s/Makefile')
+
+    def install (self):
+        ## compile of gettext triggers configure in between.  (hgwurgh.)
+        self.update_libtool ()
+        Gettext.install (self)
+
+class Gettext__local (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__(self,settings)
+        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def configure (self):
+        toolpackage.ToolBuildSpec.configure (self)
+        self.file_sub ([
+                ('(SUBDIRS *=.*)examples', r'\1 '),
+                ],
+                       '%(builddir)s/gettext-tools/Makefile')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/ghostscript.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,247 @@
+import os
+import re
+
+from gub import mirrors
+from gub import repository
+from gub import misc
+from gub import targetpackage
+
+class Ghostscript (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        repo = repository.Subversion (
+            dir=self.get_repodir (),
+            source='http://svn.ghostscript.com:8080/ghostscript',
+            branch='trunk',
+            module='gs',
+            ## 8.56
+            revision='7881')
+
+        ## ugh: nested, with self shadow?
+        def version_from_VERSION (self):
+            s = self.get_file_content ('src/version.mak')
+            d = misc.grok_sh_variables_str (s)
+            v = '%(GS_VERSION_MAJOR)s.%(GS_VERSION_MINOR)s' % d
+            return v
+
+        from new import instancemethod
+        repo.version = instancemethod (version_from_VERSION, repo, type (repo))
+
+        self.with_vc (repo)
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE' 
+
+    def get_build_dependencies (self):
+        return ['libjpeg-devel', 'libpng-devel']
+
+    def get_dependency_dict (self):
+        return {'': ['libjpeg', 'libpng']}
+
+    def get_subpackage_names (self):
+        return ['doc', '']
+    
+    def srcdir (self):
+        return re.sub ('-source', '',
+                       targetpackage.TargetBuildSpec.srcdir (self))
+
+    def builddir (self):
+        return re.sub ('-source', '',
+                       targetpackage.TargetBuildSpec.builddir (self))
+
+    def name (self):
+        return 'ghostscript'
+
+    # FIXME: C&P.
+    def ghostscript_version (self):
+        return '.'.join (self.ball_version.split ('.')[0:2])
+
+    def patch (self):
+        disable_re = "(DEVICE_DEVS[0-9]+)=([^\n]+(%s))" %'|'.join (['tiff',
+                                                                    'pcx',
+                                                                    'uniprint',
+                                                                    'deskjet',
+                                                                    'djet500',
+                                                                    'bmp',
+                                                                    'pbm',
+                                                                    'bjc200',
+                                                                    'cdeskjet',
+                                                                    'faxg3',
+                                                                    'cljet5'])
+        
+
+        ## generate Makefile.in
+        self.system ('cd %(srcdir)s && ./autogen.sh --help')
+
+        self.file_sub ([(disable_re,
+                         r'#\1= -DISABLED- \2 ')],
+                       '%(srcdir)s/Makefile.in')
+
+
+        
+    def fixup_arch (self):
+        substs = []
+        arch = self.settings.target_architecture
+
+        cache_size = 1024*1024
+        big_endian = 0
+        can_shift = 1
+        
+        if arch.find ('powerpc') >= 0:
+            big_endian = 1
+            can_shift = 1
+            cache_size = 2097152
+        elif re.search ('i[0-9]86', arch):
+            big_endian = 0
+            can_shift = 0
+            cache_size = 1048576
+            
+        substs = [('#define ARCH_CAN_SHIFT_FULL_LONG .',
+             '#define ARCH_CAN_SHIFT_FULL_LONG %d' % can_shift),
+             ('#define ARCH_CACHE1_SIZE [0-9]+',
+             '#define ARCH_CACHE1_SIZE %d' % cache_size),
+             ('#define ARCH_IS_BIG_ENDIAN [0-9]',
+             '#define ARCH_IS_BIG_ENDIAN %d' % big_endian)]
+        
+        self.file_sub (substs, '%(builddir)s/obj/arch.h')
+
+    def compile_command (self):
+        return targetpackage.TargetBuildSpec.compile_command (self) + " INCLUDE=%(system_root)s/usr/include/ PSDOCDIR=/usr/share/doc/ PSMANDIR=/usr/share/man "
+        
+    def compile (self):
+        self.system ('''
+cd %(builddir)s && (mkdir obj || true)
+cd %(builddir)s && make CC=cc CCAUX=cc C_INCLUDE_PATH= CFLAGS= CPPFLAGS= GCFLAGS= LIBRARY_PATH= obj/genconf obj/echogs obj/genarch obj/arch.h
+''')
+        self.fixup_arch ()
+        targetpackage.TargetBuildSpec.compile (self)
+        
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+            + misc.join_lines ('''
+--with-drivers=FILES
+--without-x
+--disable-cups
+--without-ijs
+--without-omni
+--disable-compile-inits
+'''))
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        self.file_sub ([
+            ('-Dmalloc=rpl_malloc', ''),
+            ('GLSRCDIR=./src', 'GLSRCDIR=%(srcdir)s/src'),
+            ('PSSRCDIR=./src', 'PSSRCDIR=%(srcdir)s/src'),
+            ('PSLIBDIR=./lib', 'PSLIBDIR=%(srcdir)s/lib'),
+            ('ICCSRCDIR=icclib', 'ICCSRCDIR=%(srcdir)s/icclib'),
+            # ESP-specific: addonsdir, omit zillion of
+            # warnings (any important ones may be noticed
+            # easier).
+            ('ADDONSDIR=./addons', 'ADDONSDIR=%(srcdir)s/addons'),
+            (' -Wmissing-prototypes ', ' '),
+            (' -Wstrict-prototypes ', ' '),
+            (' -Wmissing-declarations ', ' '),
+
+            ## ugh:  GS compile adds another layer of shell expansion. Yuck.
+            (r'\$\${ORIGIN}', '\\$${ORIGIN}'),
+            ],
+               '%(builddir)s/Makefile')
+
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' install_prefix=%(install_root)s'
+                + ' mandir=/usr/share/man/ '
+                + ' docdir=/usr/share/doc/ghostscript/doc '
+                + ' exdir=/usr/share/doc/ghostscript/examples '
+                )
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.system ('mkdir -p %(install_root)s/usr/etc/relocate/')
+        self.dump ('''
+
+prependdir GS_FONTPATH=$INSTALLER_PREFIX/share/ghostscript/%(version)s/fonts
+prependdir GS_FONTPATH=$INSTALLER_PREFIX/share/gs/fonts
+prependdir GS_LIB=$INSTALLER_PREFIX/share/ghostscript/%(version)s/Resource
+prependdir GS_LIB=$INSTALLER_PREFIX/share/ghostscript/%(version)s/lib
+
+''', '%(install_root)s/usr/etc/relocate/gs.reloc')
+
+class Ghostscript__mingw (Ghostscript):
+    def __init__ (self, settings):
+        Ghostscript.__init__ (self, settings)
+        # Configure (compile) without -mwindows for console
+        # FIXME: should add to CPPFLAGS...
+        self.target_gcc_flags = '-mms-bitfields -D_Windows -D__WINDOWS__'
+
+    def patch (self):
+        Ghostscript.patch (self)
+        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.15-cygwin.patch")
+        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-make.patch")
+        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-gs_dll.h.patch")
+        self.file_sub ([('unix__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_unix_cache.$(OBJ)',
+                         'unix__= $(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gsdll.$(OBJ) $(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_win32.$(OBJ)')],
+                       '%(srcdir)s/src/unix-aux.mak',
+                       use_re=False, must_succeed=True)
+#        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-unix-aux.mak.patch")
+
+    def configure (self):
+        Ghostscript.configure (self)
+        self.file_sub ([('^(EXTRALIBS *=.*)', '\\1 -lwinspool -lcomdlg32 -lz')],
+               '%(builddir)s/Makefile')
+
+        self.file_sub ([('^unix__=.*', misc.join_lines ('''unix__=
+$(GLOBJ)gp_mswin.$(OBJ)
+$(GLOBJ)gp_wgetv.$(OBJ)
+$(GLOBJ)gp_stdia.$(OBJ)
+$(GLOBJ)gsdll.$(OBJ)
+$(GLOBJ)gp_ntfs.$(OBJ)
+$(GLOBJ)gp_win32.$(OBJ)
+'''))],
+               '%(srcdir)s/src/unix-aux.mak')
+        self.file_sub ([('^(LIB0s=.*)', misc.join_lines ('''\\1
+$(GLOBJ)gp_mswin.$(OBJ)
+$(GLOBJ)gp_wgetv.$(OBJ)
+$(GLOBJ)gp_stdia.$(OBJ)
+$(GLOBJ)gsdll.$(OBJ)
+$(GLOBJ)gp_ntfs.$(OBJ)
+$(GLOBJ)gp_win32.$(OBJ)
+'''))],
+               '%(srcdir)s/src/lib.mak')
+
+        self.dump ('''
+GLCCWIN=$(CC) $(CFLAGS) -I$(GLOBJDIR)
+PSCCWIN=$(CC) $(CFLAGS) -I$(GLOBJDIR)
+include $(GLSRCDIR)/win32.mak
+include $(GLSRCDIR)/gsdll.mak
+include $(GLSRCDIR)/winplat.mak
+include $(GLSRCDIR)/pcwin.mak
+''',
+             '%(builddir)s/Makefile',
+             mode='a')
+
+    def install (self):
+        Ghostscript.install (self)
+        if self.settings.lilypond_branch == 'lilypond_2_6':
+            self.lily_26_kludge()
+
+    def lily_26_kludge (self):
+        gs_prefix = '/usr/share/ghostscript/%(ghostscript_version)s'
+        fonts = ['c059013l', 'c059016l', 'c059033l', 'c059036l']
+        for i in self.read_pipe ('locate %s.pfb' % fonts[0]).split ('\n'):
+            dir = os.path.dirname (i)
+            if os.path.exists (dir + '/' + fonts[0] + '.afm'):
+                break
+        fonts_string = ','.join (fonts)
+        self.system ('''
+mkdir -p %(install_root)s/%(gs_prefix)s/fonts
+cp %(dir)s/{%(fonts_string)s}{.afm,.pfb} %(install_root)s/%(gs_prefix)s/fonts
+''', locals ())
+
+class Ghostscript__freebsd (Ghostscript):
+    def get_dependency_dict (self):
+        d = Ghostscript.get_dependency_dict (self)
+        d[''].append ('libiconv')
+        return d
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/git.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,86 @@
+from gub import toolpackage
+from gub import targetpackage
+from gub import repository
+
+class Git__local (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (mirror='http://kernel.org/pub/software/scm/git/git-%(version)s.tar.bz2',
+                   version='1.5.1.2')
+    def patch (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+        self.file_sub ([('git describe','true')],
+                       '%(srcdir)s/GIT-VERSION-GEN')
+
+    def configure (self):
+        self.dump ('prefix=%(system_root)s/usr', '%(builddir)s/config.mak')
+
+    def wrap_executables (self):
+        # GIT executables use ancient unix style smart name-based
+        # functionality switching.  Did Linus not read or understand
+        # Standards.texi?
+        pass
+
+class Git (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        source = 'git://repo.or.cz/git/mingw.git'
+        repo = repository.Git (self.get_repodir (),
+                               branch=settings.git_branch,
+                               source=source)
+        self.with_vc (repo)
+
+        ## strip -mwindows.
+        self.target_gcc_flags = ' -mms-bitfields '
+
+    def version (self):
+        return '1.5.0'
+
+    def get_dependency_dict (self):
+        return {'': [
+            'zlib',
+            'regex',
+            ]}
+
+    def get_subpackage_names (self):
+        return ['']
+
+    def get_build_dependencies (self):
+        return ['zlib-devel',
+                'regex-devel',
+                ]
+
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+        self.system ('rm -rf %(builddir)s')
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+        self.file_sub ([('git describe','true')],
+                        '%(srcdir)s/GIT-VERSION-GEN')
+
+
+class Git__mingw (Git):
+    def __init__ (self, settings):
+        Git.__init__ (self, settings)
+        self.target_gcc_flags = ' -mms-bitfields '
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        self.file_sub ([('CFLAGS = -g',
+                         'CFLAGS = -I compat/ -g')],
+                       '%(builddir)s/config.mak.autogen')
+        self.file_sub ([('-lsocket',
+                         '-lwsock32'),
+                        ('TRACK_CFLAGS *=', 'XXX_TRACK_CFLAGS = '),
+                        ],
+                       '%(builddir)s/Makefile')
+
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+                + ' uname_S=MINGW'
+                + ' SHELL_PATH=/bin/sh')
+
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' uname_S=MINGW'
+                + ' SHELL_PATH=/bin/sh')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/glib.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,79 @@
+from gub import mirrors
+from gub import toolpackage
+from gub import targetpackage
+
+class Glib (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+
+
+        ## 2.12.4 : see bug  http://bugzilla.gnome.org/show_bug.cgi?id=362918
+        self.with (#version='2.12.4',   mirror=mirrors.gnome_216,
+            version='2.10.3',
+		   mirror=mirrors.gnome_214,
+		   format='bz2')
+
+    def get_build_dependencies (self):
+        return ['gettext-devel', 'libtool']
+
+    def get_dependency_dict (self):
+        d = targetpackage.TargetBuildSpec.get_dependency_dict (self)
+        d[''].append ('gettext')
+        return d
+    
+    def config_cache_overrides (self, str):
+        return str + '''
+glib_cv_stack_grows=${glib_cv_stack_grows=no}
+'''
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+
+        ## FIXME: libtool too old for cross compile
+        self.update_libtool ()
+        
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.system ('rm %(install_root)s/usr/lib/charset.alias',
+                     ignore_errors=True)
+        
+class Glib__darwin (Glib):
+    def configure (self):
+        Glib.configure (self)
+        self.file_sub ([('nmedit', '%(target_architecture)s-nmedit')],
+                       '%(builddir)s/libtool')
+        
+class Glib__mingw (Glib):
+    def get_dependency_dict (self):
+        d = Glib.get_dependency_dict (self)
+        d[''].append ('libiconv')
+        return d
+    
+    def get_build_dependencies (self):
+        return Glib.get_build_dependencies (self) + ['libiconv-devel']
+
+class Glib__freebsd (Glib):
+    def get_dependency_dict (self):
+        d = Glib.get_dependency_dict (self)
+        d[''].append ('libiconv')
+        return d
+    
+    def get_build_dependencies (self):
+        return Glib.get_build_dependencies (self) + ['libiconv-devel']
+    
+    def configure_command (self):
+        return Glib.configure_command (self) + ' --disable-threads'
+        
+class Glib__local (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='2.10.3',
+                   mirror=mirrors.gnome_214,
+                   format='bz2')
+
+    def install (self):
+        toolpackage.ToolBuildSpec.install(self)
+        self.system ('rm %(install_root)s/%(packaging_suffix_dir)s/usr/lib/charset.alias',
+                         ignore_errors=True)
+
+    def get_build_dependencies (self):
+        return ['gettext-devel', 'libtool']            
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/glibc-core.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,42 @@
+from gub import mirrors
+from gub import misc
+from gub import repository
+from gub import targetpackage
+from gub.specs import glibc
+
+# Hmm? TARGET_CFLAGS=-O --> targetpackage.py
+
+class Glibc_core (glibc.Glibc):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        #self.with_tarball (mirror=mirrors.gnu, version='2.3.6')
+        self.with_tarball (mirror=mirrors.lilypondorg,
+                           version='2.3-20070416', format='bz2', name='glibc')
+    def get_build_dependencies (self):
+        return ['cross/gcc-core']
+    def get_subpackage_names (self):
+        return ['']
+    def get_conflict_dict (self):
+        return {'': ['glibc', 'glibc-devel', 'glibc-doc', 'glibc-runtime']}
+    def patch (self):
+        glibc.Glibc.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-core-install.patch
+''')
+    def compile_command (self):
+        return (glibc.Glibc.compile_command (self)
+                + ' lib')
+    def install_command (self):
+        return glibc.Glibc.install_command (self)
+    def install_command (self):
+        return (glibc.Glibc.install_command (self)
+                    .replace (' install ', ' install-lib-all install-headers '))
+    def install (self):
+        glibc.Glibc.install (self)
+        self.system ('''
+mkdir -p %(install_root)s/usr/include/gnu
+touch %(install_root)s/usr/include/gnu/stubs.h
+cp %(srcdir)s/include/features.h %(install_root)s/usr/include
+mkdir -p %(install_root)s/usr/include/bits
+cp %(builddir)s/bits/stdio_lim.h %(install_root)s/usr/include/bits
+''')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/glibc.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,68 @@
+from gub import mirrors
+from gub import misc
+from gub import repository
+from gub import targetpackage
+#
+import os
+
+# Hmm? TARGET_CFLAGS=-O --> targetpackage.py
+
+class Glibc (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        #self.with_tarball (mirror=mirrors.gnu, version='2.3.6')
+        self.with_tarball (mirror=mirrors.lilypondorg, version='2.3-20070416',
+                           format='bz2')
+    def get_build_dependencies (self):
+        return ['cross/gcc', 'glibc-core']
+    def get_conflict_dict (self):
+        return {'': ['glibc-core'], 'devel': ['glibc-core'], 'doc': ['glibc-core'], 'runtime': ['glibc-core']}
+    def patch (self):
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-powerpc-initfini.patch
+''')
+    def configure_command (self):
+        add_ons = ''
+        for i in ('linuxthreads',):
+            # FIXME cannot expand in *_command ()
+            #if os.path.exists (self.expand ('%(srcdir)s/') + i):
+            if 1: #self.version () != '2.4':
+                add_ons += ' --enable-add-ons=' + i
+        return ('BUILD_CC=gcc '
+                + misc.join_lines (targetpackage.TargetBuildSpec.configure_command (self) + '''
+--disable-profile
+--disable-debug
+--without-cvs
+--without-gd
+--without-tls
+--without-__thread
+''')
+                + add_ons)
+    def FIXME_DOES_NOT_WORK_get_substitution_dict (self, env={}):
+        d = targetpackage.TargetBuildSpec.get_substitution_dict (self, env)
+        d['SHELL'] = '/bin/bash'
+        return d
+    def linuxthreads (self):
+        return repository.NewTarBall (dir=self.settings.downloads,
+                                      mirror=mirrors.glibc,
+                                      name='glibc-linuxthreads',
+                                      ball_version=self.version (),
+                                      format='bz2',
+                                      strip_components=0)
+    def download (self):
+        targetpackage.TargetBuildSpec.download (self)
+        if self.version () == '2.3.6':
+            self.linuxthreads ().download ()
+    def untar (self):
+        targetpackage.TargetBuildSpec.untar (self)
+        if self.version () == '2.3.6':
+            self.linuxthreads ().update_workdir (self.expand ('%(srcdir)s/urg-do-not-mkdir-or-rm-me'))
+            self.system ('mv %(srcdir)s/urg-do-not-mkdir-or-rm-me/* %(srcdir)s')
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+                + ' SHELL=/bin/bash')
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' install_root=%(install_root)s')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/gmp.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,107 @@
+import re
+
+from gub import mirrors
+from gub import targetpackage
+from toolpackage import ToolBuildSpec
+
+class Gmp (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='4.2.1',
+                   mirror="http://ftp.sunet.se/pub/gnu/gmp/gmp-%(version)s.tar.bz2",
+                   format="bz2")
+        if not self.settings.platform.startswith ('darwin'):
+            self.target_architecture = re.sub ('i[0-9]86-', 'i386-', settings.target_architecture)
+
+    def get_dependency_dict (self):
+        return { '': [],
+                 'devel' : ['gmp'],
+                 'doc' : [], }
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def configure_command (self):
+        c = targetpackage.TargetBuildSpec.configure_command (self)
+
+        c += ' --disable-cxx '
+        return c
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        # # FIXME: libtool too old for cross compile
+        self.update_libtool ()
+        # automake's Makefile.in's too old for new libtool,
+        # but autoupdating breaks even more.  This nice
+        # hack seems to work.
+        self.file_sub ([('#! /bin/sh', '#! /bin/sh\ntagname=CXX')],
+               '%(builddir)s/libtool')
+        
+class Gmp__darwin (Gmp):
+    def patch (self):
+
+        ## powerpc/darwin cross barfs on all C++ includes from
+        ## a C linkage file.
+        ## don't know why. Let's patch C++ completely from GMP.
+
+        self.file_sub ([('__GMP_DECLSPEC_XX std::[oi]stream& operator[<>][^;]+;$', ''),
+                ('#include <iosfwd>', ''),
+                ('<cstddef>','<stddef.h>')
+                ],
+               '%(srcdir)s/gmp-h.in')
+        Gmp.patch (self)
+
+    def install (self):
+        Gmp.install (self)
+        self.file_sub ([('using std::FILE;','')],
+                       '%(install_root)s/usr/include/gmp.h')
+
+class Gmp__darwin__x86 (Gmp__darwin):
+    def configure_command (self):
+
+        ## bypass oddball assembler errors. 
+        c = Gmp__darwin.configure_command (self)
+        c = re.sub ('host=[^ ]+', 'host=none-apple-darwin8', c)
+        c = re.sub ('--target=[^ ]+', ' ', c)
+        return c
+
+class Gmp__cygwin (Gmp):
+    def __init__ (self,settings):
+        Gmp.__init__ (self, settings)
+        self.with (version='4.1.4')
+
+    def patch (self):
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gmp-4.1.4-1.patch
+''')
+
+class Gmp__mingw (Gmp):
+    def __init__ (self,settings):
+        Gmp.__init__ (self, settings)
+        
+        # Configure (compile) without -mwindows for console
+        self.target_gcc_flags = '-mms-bitfields'
+        
+    def patch (self):
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/gmp-4.1.4-1.patch
+''')
+
+    def configure (self):
+        Gmp.configure (self)
+
+    def install (self):
+        Gmp.install (self)
+        self.system ('''
+mv %(install_root)s/usr/lib/*dll %(install_root)s/usr/bin || true
+''')
+
+class Gmp__local (ToolBuildSpec):
+    def __init__ (self, s):
+        ToolBuildSpec.__init__ (self, s)
+        self.with (version='4.2.1',
+                   mirror="ftp://ftp.gnu.org/gnu/gmp/gmp-%(version)s.tar.bz2")
+
+    def get_build_dependencies (self):
+        return ['libtool']            
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/guile-config.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,32 @@
+from gub import gubb
+
+class Guile_config (gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.SdkBuildSpec.__init__ (self, settings)
+        self.has_source = False
+        self.with (version='1.8.0')
+
+    def untar (self):
+        pass
+
+    def install (self):
+        gubb.SdkBuildSpec.install (self)
+        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
+        
+        import os
+        version = self.version ()
+	#FIXME: c&p guile.py
+        self.dump ('''\
+#! /bin/sh
+test "$1" = "--version" && echo "%(target_architecture)s-guile-config - Guile version %(version)s"
+#prefix=$(dirname $(dirname $0))
+prefix=%(system_root)s/usr
+test "$1" = "compile" && echo "-I$prefix/include"
+#test "$1" = "link" && echo "-L$prefix/lib -lguile -lgmp"
+# KUCH, debian specific, and [mipsel] reading .la is broken?
+test "$1" = "link" && echo "-L$prefix/lib -lguile -lguile-ltdl  -ldl -lcrypt -lm"
+exit 0
+''',
+             '%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config')
+        os.chmod ('%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config'
+                  % self.get_substitution_dict (), 0755)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/guile.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,386 @@
+import re
+import os
+#
+from gub import misc
+from gub import targetpackage
+from gub import repository
+
+class Guile (targetpackage.TargetBuildSpec):
+    def set_mirror (self):
+        source = 'git://repo.or.cz/guile.git'
+        source = 'http://lilypond.org/vc/guile.git'
+
+        repo = repository.Git (self.get_repodir (),
+                               branch='branch_release-1-8', 
+                               source=source)
+        repo.version = lambda: '1.8.2'
+        self.with_vc (repo)
+        self.so_version = '17'
+
+    def autogen_sh (self):
+        self.file_sub ([(r'AC_CONFIG_SUBDIRS\(guile-readline\)', '')],
+                       '%(srcdir)s/configure.in')
+        self.file_sub ([(r'guile-readline', '')],
+                       '%(srcdir)s/Makefile.am')
+        self.dump ('',
+                   '%(srcdir)s/doc/ref/version.texi')
+        self.dump ('',
+                   '%(srcdir)s/doc/tutorial/version.texi')
+        
+    def license_file (self):
+        return '%(srcdir)s/COPYING.LIB' 
+ 
+    def get_subpackage_names (self):
+        return ['doc', 'devel', 'runtime', '']
+
+    def get_dependency_dict (self):
+        return {
+            '' : ['guile-runtime'],
+            'runtime': ['gmp', 'gettext', 'libtool-runtime'],
+            'devel': ['guile-runtime'],
+            'doc': ['texinfo'],
+            }
+
+    def get_build_dependencies (self):
+        return ['gettext-devel', 'gmp-devel', 'libtool']
+        
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.set_mirror ()
+
+    # FIXME: C&P.
+    def guile_version (self):
+        return '.'.join (self.ball_version.split ('.')[0:2])
+
+    def patch (self):
+        self.autogen_sh()
+
+        ## Don't apply patch twice.
+        if None == re.search ('reloc_p=', open (self.expand ('%(srcdir)s/configure.in')).read()):
+            self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/guile-reloc.patch')
+            self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/guile-cexp.patch')
+            self.dump ('''#!/bin/sh
+exec %(local_prefix)s/bin/guile "$@"
+''', "%(srcdir)s/pre-inst-guile.in")
+            
+        self.autoupdate ()
+
+    def configure_flags (self):
+        return misc.join_lines ('''
+--without-threads
+--with-gnu-ld
+--enable-deprecated
+--enable-discouraged
+--disable-error-on-warning
+--enable-relocation
+--disable-rpath
+''')
+        
+    def configure_command (self):
+        return ('GUILE_FOR_BUILD=%(local_prefix)s/bin/guile '
+                + targetpackage.TargetBuildSpec.configure_command (self)
+                + self.configure_flags ())
+
+    def compile_command (self):
+        return ('preinstguile=%(local_prefix)s/bin/guile ' +
+                targetpackage.TargetBuildSpec.compile_command (self))
+    
+    def compile (self):
+
+        ## Ugh : broken dependencies barf with make -jX
+        self.system ('cd %(builddir)s/libguile && make scmconfig.h')
+        # No -L %(system_root)s in `guile-config link'
+        self.system ('cd %(builddir)s/libguile && make libpath.h')
+        self.file_sub ([('''-L *%(system_root)s''', '-L')],
+                       '%(builddir)s/libguile/libpath.h')
+        targetpackage.TargetBuildSpec.compile (self)
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        self.update_libtool ()
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        majmin_version = '.'.join (self.expand ('%(version)s').split ('.')[0:2])
+        
+        self.dump ("prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/%(majmin_version)s\n",
+                   '%(install_root)s/usr/etc/relocate/guile.reloc',
+                   env=locals())
+        
+        ## can't assume that /usr/bin/guile is the right one.
+        version = self.read_pipe ('''\
+GUILE_LOAD_PATH=%(install_prefix)s/share/guile/* guile -e main -s  %(install_prefix)s/bin/guile-config --version 2>&1\
+''').split ()[-1]
+	#FIXME: c&p linux.py
+        self.dump ('''\
+#! /bin/sh
+test "$1" = "--version" && echo "%(target_architecture)s-guile-config - Guile version %(version)s"
+#test "$1" = "compile" && echo "-I $%(system_root)s/usr/include"
+#test "$1" = "link" && echo "-L%(system_root)s/usr/lib -lguile -lgmp"
+#prefix=$(dirname $(dirname $0))
+prefix=%(system_root)s/usr
+test "$1" = "compile" && echo "-I$prefix/include"
+test "$1" = "link" && echo "-L$prefix/lib -lguile -lgmp"
+exit 0
+''',
+             '%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config')
+        os.chmod ('%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config' % self.get_substitution_dict (), 0755)
+
+
+    
+class Guile__mingw (Guile):
+    def __init__ (self, settings):
+        Guile.__init__ (self, settings)
+        # Configure (compile) without -mwindows for console
+        self.target_gcc_flags = '-mms-bitfields'
+
+
+    def get_build_dependencies (self):
+        return Guile.get_build_dependencies (self) +  ['regex-devel']
+        
+    def get_dependency_dict (self):
+        d = Guile.get_dependency_dict (self)
+        d['runtime'].append ('regex')
+        return d
+
+# FIXME: ugh, C&P to Guile__freebsd, put in cross-Guile?
+    def configure_command (self):
+        # watch out for whitespace
+        builddir = self.builddir ()
+        srcdir = self.srcdir ()
+
+
+# don't set PATH_SEPARATOR; it will fuckup tool searching for the
+# build platform.
+
+        return (Guile.configure_command (self)
+           + misc.join_lines ('''
+LDFLAGS=-L%(system_root)s/usr/lib
+CC_FOR_BUILD="
+C_INCLUDE_PATH=
+CPPFLAGS=
+LIBRARY_PATH=
+LDFLAGS=
+cc
+-I%(builddir)s
+-I%(srcdir)s
+-I%(builddir)s/libguile
+-I.
+-I%(srcdir)s/libguile"
+'''))
+
+    def config_cache_overrides (self, str):
+        return str + '''
+guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
+guile_cv_exeext=${guile_cv_exeext=}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(system_root)s/usr/lib"}
+'''
+
+    def configure (self):
+        if 0: # using patch
+            targetpackage.TargetBuildSpec.autoupdate (self)
+
+        if 1:
+            self.file_sub ([('''^#(LIBOBJS=".*fileblocks.*)''',
+                    '\\1')],
+                   '%(srcdir)s/configure')
+
+        Guile.configure (self)
+
+        ## probably not necessary, but just be sure.
+        for el in self.locate_files ('%(builddir)s', "Makefile"):
+            self.file_sub ([('PATH_SEPARATOR = .', 'PATH_SEPARATOR = ;'),
+                            ], el)
+            
+        self.file_sub ([
+            #('^(allow_undefined_flag=.*)unsupported', '\\1'),
+            ('-mwindows', ''),
+            ],
+               '%(builddir)s/libtool')
+
+        if os.path.exists (self.expand ('%(builddir)s/guile-readline/libtool')):
+            self.file_sub ([
+                #('^(allow_undefined_flag=.*)unsupported', '\\1'),
+                ('-mwindows', ''),
+                ],
+                           '%(builddir)s/guile-readline/libtool')
+
+    def install (self):
+        Guile.install (self)
+        # dlopen-able .la files go in BIN dir, BIN OR LIB package
+        self.system ('''mv %(install_root)s/usr/lib/lib*[0-9].la %(install_root)s/usr/bin''')
+
+class Guile__linux (Guile):
+    def compile_command (self):
+        # FIXME: when not x-building, guile runs guile without
+        # setting the proper LD_LIBRARY_PATH.
+        return ('export LD_LIBRARY_PATH=%(builddir)s/libguile/.libs:$LD_LIBRARY_PATH;'
+                + Guile.compile_command (self))
+
+class Guile__linux__ppc (Guile__linux):
+    def config_cache_overrides (self, str):
+        return str + "\nguile_cv_have_libc_stack_end=no\n"
+
+class Guile__freebsd (Guile):
+    def config_cache_settings (self):
+        return Guile.config_cache_settings (self) + '\nac_cv_type_socklen_t=yes'
+    def configure_command (self):
+        # watch out for whitespace
+        builddir = self.builddir ()
+        srcdir = self.srcdir ()
+        return (
+            ''' guile_cv_use_csqrt="no" '''
+           + Guile.configure_command (self)
+           + misc.join_lines ('''\
+CC_FOR_BUILD="
+C_INCLUDE_PATH=
+CPPFLAGS=
+LIBRARY_PATH=
+cc
+-I%(builddir)s
+-I%(srcdir)s
+-I%(builddir)s/libguile
+-I.
+-I%(srcdir)s/libguile"
+'''))
+
+class Guile__darwin (Guile):
+    def install (self):
+        Guile.install (self)
+        pat = self.expand ('%(install_root)s/usr/lib/libguile-srfi*.dylib')
+        import glob
+        for f in glob.glob (pat):
+            directory = os.path.split (f)[0]
+            src = os.path.basename (f)
+            dst = os.path.splitext (os.path.basename (f))[0] + '.so'
+
+            self.system ('cd %(directory)s && ln -s %(src)s %(dst)s', locals())
+ 
+class Guile__darwin__x86 (Guile__darwin):
+    def configure (self):
+        Guile__darwin.configure (self)
+        self.file_sub ([('guile-readline', '')],
+                       '%(builddir)s/Makefile')
+        
+class Guile__cygwin (Guile):
+    def __init__ (self, settings):
+        Guile.__init__ (self, settings)
+        self.with (version='1.8.1')
+
+    # Using gub dependencies only would be nice, but
+    # we need to a lot of gup.gub_to_distro_deps ().
+    def GUB_get_dependency_dict (self):
+        d = Guile.get_dependency_dict (self)
+        d['runtime'].append ('cygwin')
+        return d
+
+    # Using gub dependencies only would be nice, but
+    # we need to a lot of gup.gub_to_distro_deps ().
+    def GUB_get_build_dependencies (self):
+        return Guile.get_build_dependencies (self) + ['libiconv-devel']
+
+    # FIXME: uses mixed gub/distro dependencies
+    def get_dependency_dict (self):
+        d = Guile.get_dependency_dict (self)
+        d[''] += ['cygwin']
+        d['devel'] += ['cygwin'] + ['bash']
+        d['runtime'] += ['cygwin', 'crypt', 'libreadline6']
+        return d
+ 
+    # FIXME: uses mixed gub/distro dependencies
+    def get_build_dependencies (self):
+        return ['crypt', 'libgmp-devel', 'gettext-devel', 'libiconv', 'libtool', 'readline']
+
+    def config_cache_overrides (self, str):
+        return str + '''
+guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
+guile_cv_exeext=${guile_cv_exeext=}
+libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(system_root)s/usr/lib"}
+'''
+    def configure (self):
+        if 1:
+            self.file_sub ([('''^#(LIBOBJS=".*fileblocks.*)''', '\\1')],
+                           '%(srcdir)s/configure')
+        Guile.configure (self)
+
+        ## ugh code dup. 
+        ## probably not necessary, but just be sure.
+        for i in self.locate_files ('%(builddir)s', "Makefile"):
+            self.file_sub ([
+                ('PATH_SEPARATOR = .', 'PATH_SEPARATOR = ;'),
+                ], i)
+
+        self.file_sub ([
+            ('^(allow_undefined_flag=.*)unsupported', '\\1'),
+            ],
+               '%(builddir)s/libtool')
+        self.file_sub ([
+            ('^(allow_undefined_flag=.*)unsupported', '\\1'),
+            ],
+               '%(builddir)s/guile-readline/libtool')
+
+    def patch (self):
+        pass
+
+    # FIXME: we do most of this for all cygwin packages
+    def category_dict (self):
+        return {'': 'interpreters',
+                'runtime': 'libs',
+                'devel': 'devel libs',
+                'doc': 'doc'}
+
+    def description_dict (self):
+        return {
+            '': """The GNU extension language and Scheme interpreter - executables
+Guile, the GNU Ubiquitous Intelligent Language for Extension, is a scheme
+implementation designed for real world programming, supporting a
+rich Unix interface, a module system, and undergoing rapid development.
+
+`guile' is a scheme interpreter that can execute scheme scripts (with a
+#! line at the top of the file), or run as an inferior scheme
+process inside Emacs.
+""",
+            'runtime': '''The GNU extension language and Scheme interpreter - runtime
+Guile shared object libraries and the ice-9 scheme module.  Guile is
+the GNU Ubiquitous Intelligent Language for Extension.
+''',
+            'devel': """The GNU extension language and Scheme interpreter - development
+`libguile.h' etc. C headers, aclocal macros, the `guile-snarf' and
+`guile-config' utilities, and static `libguile.a' libraries for Guile,
+the GNU Ubiquitous Intelligent Language for Extension.
+""",
+            'doc': """The GNU extension language and Scheme interpreter - documentation
+This package contains the documentation for guile, including both
+a reference manual (via `info guile'), and a tutorial (via `info
+guile-tut').
+""",
+    }
+
+from gub import toolpackage
+class Guile__local (toolpackage.ToolBuildSpec, Guile):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.set_mirror ()
+
+    def get_build_dependencies (self):
+        return (toolpackage.ToolBuildSpec.get_build_dependencies (self)
+                + Guile.get_build_dependencies (self)
+                + ['automake'])
+
+    def patch (self):
+        self.autogen_sh ()
+        self.autoupdate ()
+
+    def configure_command (self):
+        return (toolpackage.ToolBuildSpec.configure_command (self)
+                + self.configure_flags ())
+
+    def configure (self):
+        toolpackage.ToolBuildSpec.configure (self)
+        self.update_libtool ()
+
+    def install (self):
+        toolpackage.ToolBuildSpec.install (self)
+
+        ## don't want local GUILE headers to interfere with compile.
+        self.system ("rm -rf %(install_root)s/%(packaging_suffix_dir)s/usr/include/ %(install_root)s/%(packaging_suffix_dir)s/usr/bin/guile-config ")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/hello.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,7 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Hello (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.lilypondorg, version='1.0')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/icoutils.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,22 @@
+from gub import toolpackage
+
+class Icoutils (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+	from gub import mirrors
+        self.with (version='0.26.0', mirror=mirrors.nongnu_savannah)
+    def get_build_dependencies (self):
+        return ['libpng-devel']
+    def get_dependency_dict (self):
+        return {'': ['libpng']}
+    def configure_command (self):
+        return (toolpackage.ToolBuildSpec.configure_command (self)
+                + ' --with-libintl-prefix=%(system_root)s/usr/ ')
+
+class Icoutils__darwin (Icoutils):
+    def patch (self):
+        for f in 'wrestool', 'icotool':
+            self.file_sub ([(r'\$\(LIBS\)', '$(INTLLIBS) $(LIBS)')],
+                           '%(srcdir)s/' + f + "/Makefile.in")
+
+Icoutils__darwin__x86 = Icoutils__darwin
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/imagemagick.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,9 @@
+from gub import toolpackage
+
+class Imagemagick (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (mirror='ftp://ftp.nluug.nl/pub/ImageMagick/ImageMagick-%(version)s-1.tar.bz2',
+                   version='6.3.1')
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libdbi-drivers-sqlite3.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,47 @@
+from gub import mirrors
+from gub import misc
+from gub import repository
+from gub import targetpackage
+
+class Libdbi_drivers_sqlite3 (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        #self.with (version='0.8.1', mirror=mirrors.sf, format='gz')
+        self.with_vc (repository.NewTarBall (self.settings.downloads, mirrors.sf, 'libdbi-drivers', '0.8.2'))
+
+    def get_build_dependencies (self):
+        return ['sqlite', 'libdbi', 'libtool']
+
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + misc.join_lines ('''
+--disable-docs
+--with-dbi-incdir=%(system_root)s/usr/include
+--with-sqlite3
+--with-sqlite3-libdir=%(system_root)s/usr/include
+--with-sqlite3-incdir=%(system_root)s/usr/include
+'''))
+
+    def configure (self):
+        self.system ('''
+mkdir -p %(builddir)s/doc/include
+cd %(builddir)s && touch doc/Makefile.in doc/include/Makefile.in
+''')
+        targetpackage.TargetBuildSpec.configure (self)
+        self.update_libtool ()
+
+    def makeflags (self):
+        return ' doc_DATA= html_DATA='
+
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+                + self.makeflags ())
+
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + self.makeflags ())
+
+class Libdbi_drivers_sqlite3__debian__arm (Libdbi_drivers_sqlite3):
+    def get_build_dependencies (self):
+        return ['sqlite3-dev', 'libdbi', 'libtool']
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libdbi.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,13 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Libdbi (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='0.8.1', mirror=mirrors.sf, format='gz')
+
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+        self.file_sub ([('SUBDIRS *=.*', 'SUBDIRS = src include')],
+                       '%(srcdir)s/Makefile.in')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libgnugetopt.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,28 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Libgnugetopt (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.3', format='bz2', mirror=mirrors.freebsd_ports)
+
+    def patch (self):
+        self.dump ('''
+prefix = /usr
+libdir = $(prefix)/lib
+includedir = $(prefix)/include
+install: all
+\tinstall -d $(DESTDIR)/$(libdir)/
+\tinstall -m 644 libgnugetopt.so.1 $(DESTDIR)/$(libdir)/
+\tinstall -d $(DESTDIR)/$(includedir)/
+\tinstall -m 644 getopt.h $(DESTDIR)/$(includedir)/
+''',
+             '%(srcdir)s/Makefile', mode='a')
+
+    def configure (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+
+    def license_file (self):
+
+        ## is (L)GPL, but doesn't distribute license file.
+        return '' 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libiconv.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,25 @@
+from gub import targetpackage
+from gub import mirrors
+
+class Libiconv (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.11', mirror=mirrors.gnu)
+    
+    def broken_for_distcc (self):
+        return True
+    
+    def get_build_dependencies (self):
+        return ['gettext-devel', 'libtool']
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        # # FIXME: libtool too old for cross compile
+        self.update_libtool ()
+        
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.system ('rm %(install_root)s/usr/lib/charset.alias')
+
+    def license_file (self):
+        return '%(srcdir)s/COPYING.LIB'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libjpeg.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,85 @@
+import re
+import os
+
+from gub import mirrors
+from gub import misc
+from gub import targetpackage
+
+class Libjpeg (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='v6b', mirror=mirrors.jpeg)
+
+    def name (self):
+        return 'libjpeg'
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def get_subpackage_names (self):
+        return ['devel', '']
+    
+    def srcdir (self):
+        return re.sub (r'src\.v', '-', targetpackage.TargetBuildSpec.srcdir(self))
+
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                .replace ('--config-cache', '--cache-file=config.cache'))
+    
+    def update_libtool (self):
+        self.system ('''
+cd %(builddir)s && %(srcdir)s/ltconfig --srcdir %(srcdir)s %(srcdir)s/ltmain.sh %(target_architecture)s'''
+              , locals ())
+        
+        targetpackage.TargetBuildSpec.update_libtool (self)
+
+    def patch (self):
+        self.system ('cp %(sourcefiledir)s/jpeg.license %(license_file)s')
+
+    def configure (self):
+        guess = self.expand ('%(system_root)s/usr/share/libtool/config.guess')
+        sub = self.expand ('%(system_root)s/usr/share/libtool/config.sub')
+        for file in sub, guess:
+            if os.path.exists (file):
+                self.system ('cp -pv %(file)s %(srcdir)s',  locals ())
+
+        targetpackage.TargetBuildSpec.configure (self)
+        self.update_libtool ()
+        self.file_sub (
+            [
+            (r'(\(INSTALL_[A-Z]+\).*) (\$[^ ]+)$',
+            r'\1 $(DESTDIR)\2'),
+            ],
+            '%(builddir)s/Makefile')
+
+    def install_command (self):
+        return misc.join_lines ('''
+mkdir -p %(install_root)s/usr/include %(install_root)s/usr/lib
+&& make DESTDIR=%(install_root)s install-headers install-lib
+''')
+
+class Libjpeg__darwin (Libjpeg):
+    def update_libtool (self):
+        arch = 'powerpc-apple'
+        self.system ('''
+cd %(builddir)s && %(srcdir)s/ltconfig --srcdir %(srcdir)s %(srcdir)s/ltmain.sh %(arch)s
+''', locals ())
+        targetpackage.TargetBuildSpec.update_libtool (self)
+
+class Libjpeg__mingw (Libjpeg):
+    def configure (self):
+        Libjpeg.configure (self)
+        # libtool will not build dll if -no-undefined flag is
+        # not present
+        self.file_sub ([('-version-info',
+                '-no-undefined -version-info')],
+             '%(builddir)s/Makefile')
+
+class Libjpeg__linux (Libjpeg):
+    def compile (self):
+        Libjpeg.compile (self)
+        self.file_sub ([('^#define (HAVE_STDLIB_H) *', '''#ifdef \\1
+#define \\1
+#endif''')],
+               '%(builddir)s/jconfig.h')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libpng.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,65 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Libpng (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.2.8', mirror=mirrors.libpng)
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE' 
+
+    def get_dependency_dict (self):
+        return {'':['zlib']}
+    
+    def get_build_dependencies (self):
+        return ['zlib-devel']
+
+    def name (self):
+        return 'libpng'
+
+    def patch (self):
+        self.file_sub ([('(@INSTALL.*)@PKGCONFIGDIR@',
+                r'\1${DESTDIR}@PKGCONFIGDIR@')],
+               '%(srcdir)s/Makefile.in')
+        self.file_sub ([('(@INSTALL.*)@PKGCONFIGDIR@',
+                r'\1${DESTDIR}@PKGCONFIGDIR@')],
+               '%(srcdir)s/Makefile.am')
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        # # FIXME: libtool too old for cross compile
+        self.update_libtool ()
+
+    def compile_command (self):
+        c = targetpackage.TargetBuildSpec.compile_command (self)
+        ## need to call twice, first one triggers spurious Automake stuff.                
+        return '(%s) || (%s)' % (c,c)
+    
+class Libpng__mingw (Libpng):
+    def configure (self):
+        # libtool will not build dll if -no-undefined flag is
+        # not present
+        self.file_sub ([('-version-info',
+                '-no-undefined -version-info')],
+             '%(srcdir)s/Makefile.am')
+        self.autoupdate ()
+        Libpng.configure (self)
+
+from gub import toolpackage 
+
+class Libpng__local (toolpackage.ToolBuildSpec, Libpng):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='1.2.8', mirror=mirrors.libpng)
+
+    def get_build_dependencies (self):
+        return ['libtool']
+
+    def patch (self):
+        Libpng.patch (self)
+
+    # FIXME, mi-urg?
+    def license_file (self):
+        return Libpng.license_file (self)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libtool.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,74 @@
+from gub import targetpackage
+from gub import gubb
+from gub import mirrors
+from gub import toolpackage
+
+
+# FIXME, need for WITH settings when building dependency 'libtool'
+# This works without libtool.py:
+#    ./gub-builder.py -p mingw build http://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.20.tar.gz
+
+class Libtool (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.5.20', mirror=mirrors.gnu)
+        self.so_version = '3'
+
+    def get_subpackage_names (self):
+        return ['devel', 'doc', 'runtime', '']
+
+    def get_dependency_dict (self):
+        return { '': ['libtool-runtime'],
+                 'devel' : ['libtool'],
+                 'doc' : [],
+                 'runtime': [],}
+
+    def get_subpackage_definitions (self):
+        d = targetpackage.TargetBuildSpec.get_subpackage_definitions (self)
+        d['devel'].append ('/usr/bin/libtool*')
+        d['devel'].append ('/usr/share/libltdl')
+        return d
+
+class Libtool__darwin (Libtool):
+    def install (self):
+        Libtool.install (self)
+
+        ## necessary for programs that load dynamic modules.
+        self.dump ("prependdir DYLD_LIBRARY_PATH=$INSTALLER_PREFIX/lib",
+                   '%(install_root)s/usr/etc/relocate/libtool.reloc')
+
+class Libtool__cygwin (Libtool):
+    def __init__ (self, settings):
+        Libtool.__init__ (self, settings)
+        self.with (version='1.5.22')
+        # FIXME: next to impossible to untar and patch automatically
+        # should call for sanity on cygwin-apps@cygwin.com?
+        #self.with (version='1.5.23a',
+        #          mirror='http://mirrors.kernel.org/sourceware/cygwin/release/libtool/libtool1.5/libtool1.5-%(version)s-1-src.tar.bz2',)
+        # FIXME: build lib package naming: lib<NAME><MAJOR-SO-VERSION> into gub
+
+    def only_for_cygwin_untar (self):
+        cygwin.untar_cygwin_src_package_variant2 (self, self.file_name ())
+
+    def get_dependency_dict (self):
+        d = Libtool.get_dependency_dict (self)
+        d[''].append ('cygwin')
+        return d
+
+    # FIXME: we do most of this for all cygwin packages
+    def category_dict (self):
+        return {'': 'interpreters',
+                'runtime': 'libs',
+                'devel': 'devel libs',
+                'doc': 'doc'}
+
+class Libtool__local (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='1.5.20', mirror=mirrors.gnu)
+    def configure (self):
+        gubb.BuildSpec.configure (self)
+    def wrap_executables (self):
+        # The libtool script calls the cross compilers, and moreover,
+        # it is copied.  Two reasons why it cannot be wrapped.
+        pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/libxml2.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,10 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Libxml2 (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.gnome_218, version='2.6.27')
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + ' --without-python')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/lilypad.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,40 @@
+from gub import mirrors
+from gub import targetpackage
+from gub import misc
+
+class LilyPad (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='0.0.7-1',
+                   mirror='http://lilypond.org/download/gub-sources/lilypad-0.0.7-1-src.tar.bz2',
+                   format='bz2')
+
+    def patch (self):
+        ## windres doesn't handle --nostdinc
+        self.file_sub ([('--nostdinc',' '),
+                (r'rc\.res:', r'rc.res.o:')],
+               "%(srcdir)s/Make.rules.in")
+    def makeflags (self):
+        # FIXME: better fix Makefile
+        return misc.join_lines ('''
+ALL_OBJS='$(OBJS)'
+WRC=%(cross_prefix)s/bin/%(target_architecture)s-windres
+CPPFLAGS=-I%(system_root)s/usr/include
+RC='$(WRC) $(CPPFLAGS)'
+LIBWINE=
+LIBPORT=
+MKINSTALLDIRS=%(srcdir)s/mkinstalldirs
+INSTALL_PROGRAM=%(srcdir)s/install-sh
+''')
+
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+           + self.makeflags ())
+
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.broken_install_command (self)
+           + self.makeflags ())
+    def license_file (self):
+        return ''
+
+Lilypad = LilyPad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/lilypond.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,498 @@
+import os
+import re
+#
+from gub import repository
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+
+
+from context import *
+
+class LilyPond (targetpackage.TargetBuildSpec):
+    '''A program for printing sheet music
+LilyPond lets you create music notation.  It produces
+beautiful sheet music from a high-level description file.'''
+
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+
+
+        try:
+            source = os.environ['GUB_LILYPOND_SOURCE']
+        except KeyError:         
+            source = 'git://git.sv.gnu.org/lilypond.git'
+        
+        repo = repository.Git (self.get_repodir (),
+                               branch=settings.lilypond_branch,
+                               source=source)
+
+        ## ugh: nested, with self shadow?
+        def version_from_VERSION (self):
+            s = self.get_file_content ('VERSION')
+            d = misc.grok_sh_variables_str (s)
+            v = '%(MAJOR_VERSION)s.%(MINOR_VERSION)s.%(PATCH_LEVEL)s' % d
+            return v
+
+        from new import instancemethod
+        repo.version = instancemethod (version_from_VERSION, repo, type (repo))
+
+        self.with_vc (repo)
+
+        # FIXME: should add to C_INCLUDE_PATH
+        builddir = self.builddir ()
+        self.target_gcc_flags = (settings.target_gcc_flags
+                                 + ' -I%(builddir)s' % locals ())
+
+    def get_dependency_dict (self):
+        return {'': [
+            'fontconfig',
+            'gettext', 
+            'guile-runtime',
+            'pango',
+            'python-runtime',
+            'ghostscript'
+            ]}
+    
+    def get_subpackage_names (self):
+        return ['']
+    
+    def broken_for_distcc (self):
+        ## mf/ is broken
+        return True
+
+    def get_build_dependencies (self):
+        return ['fontconfig-devel',
+                'freetype-devel',
+                'gettext-devel',
+                'ghostscript',
+                'guile-devel',
+                'pango-devel',
+                'python-devel',
+                'urw-fonts']
+
+    def rsync_command (self):
+        c = targetpackage.TargetBuildSpec.rsync_command (self)
+        c = c.replace ('rsync', 'rsync --delete --exclude configure')
+        return c
+
+    def configure_command (self):
+        ## FIXME: pickup $target-guile-config
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + misc.join_lines ('''
+--enable-relocation
+--disable-documentation
+--enable-static-gxx
+--with-ncsb-dir=%(system_root)s/usr/share/fonts/default/Type1
+'''))
+
+    def configure (self):
+        self.autoupdate ()
+
+    def do_configure (self):
+        if not os.path.exists (self.expand ('%(builddir)s/FlexLexer.h')):
+            flex = self.read_pipe ('which flex')
+            flex_include_dir = os.path.split (flex)[0] + "/../include"
+            self.system ('''
+mkdir -p %(builddir)s
+cp %(flex_include_dir)s/FlexLexer.h %(builddir)s/
+''', locals ())
+            
+        self.config_cache ()
+        self.system ('''
+mkdir -p %(builddir)s 
+cd %(builddir)s && %(configure_command)s''')
+        self.file_sub ([(' -O2 ', ' -O2 -Werror ')],
+                       '%(builddir)s/config.make')
+
+    def compile (self):
+        d = self.get_substitution_dict ()
+        if (misc.file_is_newer ('%(srcdir)s/config.make.in' % d,
+                                '%(builddir)s/config.make' % d)
+            or misc.file_is_newer ('%(srcdir)s/GNUmakefile.in' % d,
+                                   '%(builddir)s/GNUmakefile' % d)
+            or misc.file_is_newer ('%(srcdir)s/config.hh.in' % d,
+                                   '%(builddir)s/config.hh' % d)
+            or misc.file_is_newer ('%(srcdir)s/configure' % d,
+                                   '%(builddir)s/config.make' % d)
+
+            ## need to reconfigure if dirs were added.
+            or (len (self.locate_files ('%(builddir)s', "GNUmakefile"))
+                != len (self.locate_files ('%(srcdir)s', "GNUmakefile")) + 1)):
+
+            self.do_configure ()
+            self.system ('touch %(builddir)s/config.hh')
+            
+        targetpackage.TargetBuildSpec.compile (self)
+
+    def name_version (self):
+        # FIXME: make use of branch for version explicit, use
+        # name-branch for src /build dir, use name-version for
+        # packaging.
+        try:
+            return self.build_version ()
+        except:
+            return targetpackage.TargetBuildSpec.name_version (self)
+
+    def build_version (self):
+        d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
+        v = '%(MAJOR_VERSION)s.%(MINOR_VERSION)s.%(PATCH_LEVEL)s' % d
+        return v
+
+    def pretty_name (self):
+        return 'LilyPond'
+    
+    def build_number (self):
+        from gub import versiondb
+        db = versiondb.VersionDataBase (self.settings.lilypond_versions)
+        v = tuple (map (int, self.build_version ().split ('.')))
+        b = db.get_next_build_number (v)
+        return ('%d' % b)
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        # FIXME: This should not be in generic package, for installers only.
+        self.installer_install_stuff ()
+
+    def installer_install_stuff (self):
+        # FIXME: is it really the installer version that we need here,
+        # or do we need the version of lilypond?
+        installer_version = self.build_version ()
+        # WTF, current.
+        self.system ("cd %(install_root)s/usr/share/lilypond && mv %(installer_version)s current",
+                     locals ())
+
+        self.system ("cd %(install_root)s/usr/lib/lilypond && mv %(installer_version)s current",
+                     locals ())
+
+        self.system ('mkdir -p %(install_root)s/usr/etc/fonts/')
+        fc_conf_file = open (self.expand ('%(install_root)s/usr/etc/fonts/local.conf'), 'w')
+        fc_conf_file.write ('''
+<fontconfig>
+<selectfont>
+ <rejectfont>
+ <pattern>
+  <patelt name="scalable"><bool>false</bool></patelt>
+ </pattern>
+ </rejectfont>
+</selectfont>
+
+<cachedir>~/.lilypond-fonts.cache-2</cachedir>
+</fontconfig>
+''' % locals ())
+
+    def gub_name (self):
+        nv = self.name_version ()
+        p = self.settings.platform
+        return '%(nv)s.%(p)s.gub' % locals ()
+
+    def autoupdate (self, autodir=0):
+        autodir = self.srcdir ()
+
+        if (misc.file_is_newer (self.expand ('%(autodir)s/configure.in', locals ()),
+                                self.expand ('%(builddir)s/config.make',locals ()))
+            or misc.file_is_newer (self.expand ('%(autodir)s/stepmake/aclocal.m4', locals ()),
+                                   self.expand ('%(autodir)s/configure', locals ()))):
+            self.system ('''
+            cd %(autodir)s && bash autogen.sh --noconfigure
+            ''', locals ())
+            self.do_configure ()
+
+class LilyPond__cygwin (LilyPond):
+
+    def get_subpackage_names (self):
+        return ['doc', '']
+
+    def get_dependency_dict (self):
+        return {
+            '' :
+            [
+            'glib2',
+            'guile-runtime',
+            'fontconfig-runtime', ## 'libfontconfig1',
+            'libfreetype26',
+            'libiconv2',
+            'libintl8', 'libintl3',
+            'pango-runtime',
+            'python',
+            ]
+            + [
+            'bash',
+            'coreutils',
+            'cygwin',
+            'findutils',
+            'ghostscript',
+            ],
+            'doc': ['texinfo'],
+            }
+
+    def get_build_dependencies (self):
+
+        #FIXME: aargh, MUST specify bash, coreutils etc here too.
+        # If get_dependency_dict () lists any packages not
+        # part of build_dependencies, we get:
+
+	# Using version number 2.8.6 unknown package bash
+        # installing package: bash
+        # Traceback (most recent call last):
+        #   File "installer-builder.py", line 171, in ?
+        #     main ()
+        #   File "installer-builder.py", line 163, in main
+        #     run_installer_commands (cs, settings, commands)
+        #   File "installer-builder.py", line 130, in run_installer_commands
+        #     build_installer (installer_obj, args)
+        #   File "installer-builder.py", line 110, in build_installer
+        #     install_manager.install_package (a)
+        #   File "lib/gup.py", line 236, in install_package
+        #     d = self._packages[name]
+        # KeyError: 'bash'
+
+        return [
+            'gettext-devel',
+            ## FIXME: for distro we don't use get_base_package_name,
+            ## so we cannot use split-package names for gub/source
+            ## build dependencies
+            ##'guile-devel',
+            'guile',
+            'python',
+            'fontconfig', ##'libfontconfig-devel',
+            'libfreetype2-devel',
+            # cygwin bug: pango-devel should depend on glib2-devel
+            'pango-devel', 'glib2-devel',
+            'urw-fonts'] + [
+            'bash',
+            'coreutils',
+            'findutils',
+            'ghostscript',
+            ]
+
+    def configure_command (self):
+        return LilyPond.configure_command (self).replace ('--enable-relocation',
+                                                          '--disable-relocation')
+
+    def compile (self):
+        self.system ('''
+        cp -pv %(system_root)s/usr/share/gettext/gettext.h %(system_root)s/usr/include''')
+        LilyPond.compile (self)
+
+    def compile_command (self):
+        ## UGH - * sucks.
+        python_lib = "%(system_root)s/usr/bin/libpython*.dll"
+        LDFLAGS = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
+
+        ## UGH. 
+        return (LilyPond.compile_command (self)
+                + misc.join_lines ('''
+LDFLAGS="%(LDFLAGS)s %(python_lib)s"
+'''% locals ()))
+
+    def install (self):
+        ##LilyPond.install (self)
+        targetpackage.TargetBuildSpec.install (self)
+        self.install_doc ()
+
+    def install_doc (self):
+        installer_build = self.build_number ()
+        installer_version = self.build_version ()
+        docball = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.documentation.tar.bz2', env=locals ())
+        infomanball = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.info-man.tar.bz2', env=locals ())
+
+
+        if not os.path.exists (docball):
+            ## can't run make, because we need the right variables (BRANCH, etc.)
+            raise Exception ("cannot find docball %s" % docball)
+            
+        self.system ('''
+mkdir -p %(install_root)s/usr/share/doc/lilypond
+tar -C %(install_root)s/usr/share/doc/lilypond -jxf %(docball)s
+tar -C %(install_root)s -jxf %(infomanball)s
+find %(install_root)s/usr/share/doc/lilypond -name '*.signature' -exec rm '{}' ';'
+find %(install_root)s/usr/share/doc/lilypond -name '*.ps' -exec rm '{}' ';'
+mkdir -p %(install_root)s/usr/share/info/lilypond
+cd %(install_root)s/usr/share/info/lilypond && ln -sf ../../doc/lilypond/Documentation/user/*png .
+''',
+                  locals ())
+
+    def category_dict (self):
+        return {'': 'publishing', 'doc': 'doc'}
+
+    def description_dict (self):
+        # FIXME: fairly uninformative description for packages,
+        # unlike, eg, guile-devel.  This is easier, though.
+        d = {}
+        for i in self.get_subpackage_names ():
+            d[i] = self.get_subpackage_doc (i)
+        return d
+
+    def get_subpackage_doc (self, split):
+        flavor = {'': 'executables', 'doc': 'documentation'}[split]
+        return (LilyPond.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
+                % locals ())
+        
+## shortcut: take python out of dependencies
+class LilyPond__no_python (LilyPond):
+    def get_build_dependencies (self):
+        d = LilyPond.get_build_dependencies (self)
+        d.remove ('python-devel')
+        return d
+
+    def get_dependency_dict (self):
+        d = LilyPond.get_dependency_dict (self)
+        d[''].remove ('python-runtime')
+        return d
+
+    def do_configure (self):
+        self.system ('mkdir -p %(builddir)s', ignore_errors=True) 
+        self.system ('touch %(builddir)s/Python.h') 
+        LilyPond.do_configure (self)
+        self.dump ('''
+all:
+	true
+
+install:
+	-mkdir -p $(DESTDIR)/usr/lib/lilypond/%(version)s
+''', '%(builddir)s/python/GNUmakefile')
+        
+class LilyPond__mingw (LilyPond):
+    def get_dependency_dict (self):
+        d = LilyPond.get_dependency_dict (self)
+        d[''].append ('lilypad')        
+        return d
+
+    def get_build_dependencies (self):
+        return LilyPond.get_build_dependencies (self) + ['lilypad']
+
+    ## ugh c&p
+    def compile_command (self):
+
+        ## UGH - * sucks.
+        python_lib = "%(system_root)s/usr/bin/libpython*.dll"
+        LDFLAGS = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
+
+        ## UGH. 
+        return (LilyPond.compile_command (self)
+                + misc.join_lines ('''
+LDFLAGS="%(LDFLAGS)s %(python_lib)s"
+'''% locals ()))
+    
+    def do_configure (self):
+        LilyPond.do_configure (self)
+
+        ## huh, why ? --hwn
+        self.config_cache ()
+
+        ## for console: no -mwindows
+        self.file_sub ([(' -mwindows', ' '),
+
+                ## gdb doesn't work on windows anyway.
+                (' -g ', ' '),
+                ],
+               '%(builddir)s/config.make')
+
+    def compile (self):
+        self.system ('cd %(builddir)s/lily && rm -f out/lilypond', ignore_errors=True)
+        LilyPond.compile (self)
+        self.system ('cd %(builddir)s/lily && mv out/lilypond out/lilypond-console')
+        self.system ('cd %(builddir)s/lily && make MODULE_LDFLAGS="-mwindows" && mv out/lilypond out/lilypond-windows')
+        self.system ('cd %(builddir)s/lily && touch out/lilypond')
+
+    def install (self):
+        LilyPond.install (self)
+        self.system ('''
+rm -f %(install_prefix)s/bin/lilypond-windows
+install -m755 %(builddir)s/lily/out/lilypond-windows %(install_prefix)s/bin/lilypond-windows.exe
+rm -f %(install_prefix)s/bin/lilypond
+install -m755 %(builddir)s/lily/out/lilypond-console %(install_prefix)s/bin/lilypond.exe
+cp %(install_root)s/usr/lib/lilypond/*/python/* %(install_root)s/usr/bin
+cp %(install_root)s/usr/share/lilypond/*/python/* %(install_root)s/usr/bin
+''')
+        import glob
+        for i in glob.glob (self.expand ('%(install_root)s/usr/bin/*')):
+            header = open (i).readline().strip ()
+            if header.endswith ('guile'):
+                self.system ('mv %(i)s %(i)s.scm', locals ())
+            elif header.endswith ('python') and not i.endswith ('.py'):
+                self.system ('mv %(i)s %(i)s.py', locals ())
+
+        for i in self.locate_files ('%(install_root)s', "*.ly"):
+            s = open (i).read ()
+            open (i, 'w').write (re.sub ('\r*\n', '\r\n', s))
+
+
+## please document exactly why if this is switched back.
+#        self.file_sub ([(r'gs-font-load\s+#f', 'gs-font-load #t')],
+#        '%(install_root)s/usr/share/lilypond/current/scm/lily.scm')
+
+class LilyPond__debian (LilyPond):
+    def get_dependency_dict (self):
+        from gub import debian, gup
+        return {'': gup.gub_to_distro_deps (LilyPond.get_dependency_dict (self)[''],
+                                            debian.gub_to_distro_dict)}
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+
+    def get_build_dependencies (self):
+        #FIXME: aargh, MUST specify gs,  etc here too.
+        return [
+            'gettext',
+            'guile-1.6-dev',
+            'libfontconfig1-dev',
+            'libfreetype6-dev',
+            'libglib2.0-dev',
+            'python2.4-dev',
+            'libpango1.0-dev',
+            'zlib1g-dev',
+            'urw-fonts',
+            ] + ['gs']
+
+##
+class LilyPond__darwin (LilyPond):
+    def get_dependency_dict (self):
+        d = LilyPond.get_dependency_dict (self)
+
+        deps = d['']
+        deps.remove ('python-runtime')
+        deps += [ 'fondu', 'osx-lilypad']
+
+        d[''] = deps
+        return d
+
+    def get_build_dependencies (self):
+        return LilyPond.get_build_dependencies (self) + [ 'fondu', 'osx-lilypad']
+
+    def compile_command (self):
+        return LilyPond.compile_command (self) + " TARGET_PYTHON=/usr/bin/python "
+    
+    def configure_command (self):
+        cmd = LilyPond.configure_command (self)
+        cmd += ' --enable-static-gxx '
+
+        return cmd
+
+    def do_configure (self):
+        LilyPond.do_configure (self)
+
+        make = self.expand ('%(builddir)s/config.make')
+
+        if re.search ("GUILE_ELLIPSIS", open (make).read ()):
+            return
+        self.file_sub ([('CONFIG_CXXFLAGS = ',
+                         'CONFIG_CXXFLAGS = -DGUILE_ELLIPSIS=... '),
+
+## optionally: switch off for debugging.
+#                                (' -O2 ', '')
+                ],
+               '%(builddir)s/config.make')
+
+#Hmm
+Lilypond = LilyPond
+Lilypond__cygwin = LilyPond__cygwin
+Lilypond__darwin = LilyPond__darwin
+Lilypond__debian = LilyPond__debian
+Lilypond__mingw = LilyPond__mingw
+Lilypond__freebsd = LilyPond
+Lilypond__debian_arm = LilyPond__debian
+Lilypond__mipsel = LilyPond__debian
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/linux-headers.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,41 @@
+from gub import gubb
+from gub import mirrors
+
+class Linux_headers (gubb.BinarySpec, gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.BinarySpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.linux_2_4,
+                           version='2.4.34', format='bz2')
+    def get_subpackage_names (self):
+        return ['']
+    def patch (self):
+        self.system ('''
+cd %(srcdir)s && yes yes | make ARCH=%(package_arch)s oldconfig symlinks include/linux/version.h
+#cd %(srcdir)s && yes yes | make ARCH=i386 oldconfig
+#cd %(srcdir)s && make ARCH=%(package_arch)s symlinks include/linux/version.h
+cd %(srcdir)s && mv include .include
+cd %(srcdir)s && rm -rf *
+cd %(srcdir)s && mkdir usr
+cd %(srcdir)s && mv .include usr/include
+cd %(srcdir)s && rm -f\
+ usr/include/scsi/sg.h\
+ usr/include/scsi/scsi.h\
+ usr/include/scsi/scsi_ioctl.h\
+ usr/include/net/route.h
+''')
+
+from gub import debian
+class Linux_headers__debian (debian.Linux_kernel_headers):
+    def __init__ (self, settings):
+        debian.Linux_kernel_headers.__init__ (self, settings)
+        self.with (name='linux-kernel-headers')
+
+Linux_headers__linux__ppc = Linux_headers__debian
+#Linux_headers__linux__64 = Linux_headers__debian
+Linux_headers__linux__arm__softfloat = Linux_headers__debian
+Linux_headers__linux__arm__vfp = Linux_headers__debian
+
+class Linux_headers__linux__64 (Linux_headers__debian):
+    def __init__ (self, settings):
+        Linux_headers__debian.__init__ (self, settings)
+        self.with (version='2.6.18-6', name='linux-kernel-headers')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/mftrace.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,8 @@
+from toolpackage import ToolBuildSpec
+
+class Mftrace (ToolBuildSpec):
+    def __init__ (self, settings):
+        ToolBuildSpec.__init__ (self, settings)
+        self.with (version='1.2.14',
+                   mirror="http://lilypond.org/download/sources/mftrace/mftrace-%(version)s.tar.gz")
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/netpbm.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,64 @@
+from gub import mirrors
+from gub import toolpackage
+from gub import repository
+
+class Netpbm (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+
+        # https://svn.sourceforge.net/svnroot/netpbm/advanced netpbm
+
+        repo = repository.Subversion (
+            dir=self.get_repodir (),
+            source='https://svn.sourceforge.net/svnroot/',
+            branch='netpbm',
+            module='stable',
+            revision="172")
+
+        
+        # self.with_vc (repo)
+        self.with (mirror='http://lilypond.org/download/gub-sources/netpbm-patched-10.35.tar.bz2',
+                   version='10.35')
+
+    def configure (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+        self.dump ('\n'*3 + 'static\n' + '\n'*18, '%(builddir)s/answers')
+
+        self.system ('cd %(builddir)s && %(srcdir)s/configure < answers')
+
+    def compile (self):
+        self.system ('''cd %(builddir)s && make CC=gcc \
+        CFLAGS="-O2 -fPIC"  \
+        LDFLAGS="-L%(builddir)s/pbm -L%(builddir)s/pgm -L%(builddir)s/pnm -L%(builddir)s/ppm" \
+        LADD="-lm" \
+        LINUXSVGALIB="NONE" \
+        XML2LIBS="NONE"
+
+''')
+    def install (self):
+        self.system ('mkdir -p %(install_root)s/')
+        self.system ('cd %(builddir)s && make package pkgdir=%(install_root)s/usr LINUXSVGALIB="NONE" XML2LIBS="NONE"')
+        self.system ('''rm -rf %(install_root)s/usr/misc 
+rm -rf %(install_root)s/usr/README
+rm -rf %(install_root)s/usr/VERSION
+rm -rf %(install_root)s/usr/link
+rm -rf %(install_root)s/usr/misc
+rm -rf %(install_root)s/usr/man
+rm -rf %(install_root)s/usr/pkginfo
+rm -rf %(install_root)s/usr/config_template
+''')
+    def packaging_suffix_dir (self):
+        return ''
+
+    def license_file (self):
+        return '%(srcdir)s/README'
+    
+        foo = '''
+        X11LIB=%{_libdir}/libX11.so \
+        JPEGINC_DIR=%{_includedir} \
+        PNGINC_DIR=%{_includedir} \
+        TIFFINC_DIR=%{_includedir} \
+        JPEGLIB_DIR=%{_libdir} \
+        PNGLIB_DIR=%{_libdir} \
+        TIFFLIB_DIR=%{_libdir} \
+        '''
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/nsis.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,50 @@
+from toolpackage import ToolBuildSpec
+import os
+from gub import repository
+
+class Nsis (ToolBuildSpec):
+    def __init__ (self, settings):
+        ToolBuildSpec.__init__(self, settings)
+
+        if 1:
+            self.with (version='2.23',
+                       mirror="http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(version)s-src.tar.%(format)s",
+                       
+                       format="bz2")
+        else:
+            repo = repository.CVS (
+                self.get_repodir (),
+                source=':pserver:anonymous@nsis.cvs.sourceforge.net:/cvsroot/nsis',
+                module='NSIS',
+                tag='HEAD')
+            self.with_vc (repo)
+
+    def get_build_dependencies (self):
+        return ["scons"]
+
+    def patch (self):
+        self.system ('mkdir -p %(allbuilddir)s', ignore_errors=True)
+        self.system ('ln -s %(srcdir)s %(builddir)s')
+        #self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/nsis-2.22-contrib-math.patch')
+        
+    def configure (self):
+        pass
+
+    def compile_command (self):
+        ## no trailing / in paths!
+        return (' scons PREFIX=%(system_root)s/usr PREFIX_DEST=%(install_root)s '
+                ' DEBUG=yes '
+                ' NSIS_CONFIG_LOG=yes '
+                ' SKIPPLUGINS=System')
+    
+    def compile (self): 
+        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
+        self.system ('cd %(builddir)s/ && %(compile_command)s',
+                     env)
+
+    def install (self):
+        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
+        self.system ('cd %(builddir)s/ && %(compile_command)s install ', env)
+
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/osx-lilypad.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,17 @@
+from gub import mirrors
+from gub import gubb
+
+class Osx_lilypad (gubb.NullBuildSpec):
+    pass
+
+class Osx_lilypad__darwin__ppc (gubb.NullBuildSpec):
+    def __init__ (self, settings):
+        gubb.NullBuildSpec.__init__ (self, settings)
+        self.with (version="0.2",
+                   mirror='http://lilypond.org/download/gub-sources/osx-lilypad-ppc-0.2.tar.gz')
+
+class Osx_lilypad__darwin__x86 (gubb.NullBuildSpec):
+    def __init__ (self, settings):
+        gubb.NullBuildSpec.__init__ (self, settings)
+        self.with (version="0.2",
+                   mirror='http://lilypond.org/download/gub-sources/osx-lilypad-x86-0.2.tar.gz')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/pango.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,102 @@
+import glob
+import os
+import shutil
+from gub import mirrors
+from gub import misc
+from gub import targetpackage
+import re
+
+class Pango (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='1.14.8',
+                   mirror=mirrors.gnome_216,
+                   format='bz2')
+
+    def get_build_dependencies (self):
+        return ['freetype-devel', 'fontconfig-devel', 'glib-devel',
+                'libtool']
+
+    def get_dependency_dict (self):
+        return {'': ['freetype', 'fontconfig', 'glib', 'libtool-runtime']}
+
+
+    def configure_flags (self):
+        return misc.join_lines ('''
+--without-x
+--without-cairo
+''')
+
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + self.configure_flags ())
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)                
+        self.update_libtool ()
+
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+        self.system ('cd %(srcdir)s && patch --force -p1 < %(patchdir)s/pango-substitute-env.patch')
+
+    def fix_modules (self, prefix='/usr'):
+        etc = self.expand ('%(install_root)s/%(prefix)s/etc/pango', locals ())
+        self.system ('mkdir -p %(etc)s' , locals ())
+        for a in glob.glob (etc + '/*'):
+            self.file_sub ([('/%(prefix)s/', '$PANGO_PREFIX/')], a, locals ())
+
+        pango_module_version = None
+        for dir in glob.glob (self.expand ('%(install_root)s/%(prefix)s/lib/pango/*', locals ())):
+            m = re.search ("([0-9.]+)", dir)
+            if not m:
+                continue
+            
+            pango_module_version = m.group (1)
+            break
+        
+        if not pango_module_version:
+            raise 'No version found'
+        
+        open (etc + '/pangorc', 'w').write (
+        '''[Pango]
+ModuleFiles = $PANGO_PREFIX/etc/pango/pango.modules
+ModulesPath = $PANGO_PREFIX/lib/pango/%(pango_module_version)s/modules
+''' % locals ())
+        
+        shutil.copy2 (self.expand ('%(sourcefiledir)s/pango.modules'), etc)
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)                
+        self.dump ("""
+setfile PANGO_RC_FILE=$INSTALLER_PREFIX/etc/pango/pangorc
+setdir PANGO_PREFIX=$INSTALLER_PREFIX/
+""", '%(install_root)s/usr/etc/relocate/pango.reloc', env=locals())
+        self.fix_modules ()
+
+class Pango__linux (Pango):
+    def untar (self):
+        Pango.untar (self)
+        # FIXME: --without-cairo switch is removed in 1.10.1,
+        # pango only compiles without cairo if cairo is not
+        # installed linkably on the build system.  UGH.
+        self.file_sub ([('(have_cairo[_a-z0-9]*)=true', '\\1=false'),
+                        ('(cairo[_a-z0-9]*)=yes', '\\1=no')],
+                       '%(srcdir)s/configure')
+        os.chmod ('%(srcdir)s/configure' % self.get_substitution_dict (), 0755)
+
+class Pango__freebsd (Pango__linux):
+    def get_build_dependencies (self):
+        return Pango__linux.get_build_dependencies (self) + ['libiconv-devel']
+            
+
+class Pango__darwin (Pango):
+    def configure (self):
+        Pango.configure (self)
+        self.file_sub ([('nmedit', '%(target_architecture)s-nmedit')],
+                       '%(builddir)s/libtool')
+
+    def install (self):
+        Pango.install (self)                
+        self.dump ("""
+set PANGO_SO_EXTENSION=.so
+""", '%(install_root)s/usr/etc/relocate/pango.reloc', env=locals(), mode="a")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/pic.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,152 @@
+import glob
+import os
+import re
+import shutil
+import cvs
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+
+pic_cvs = ':pserver:anonymous@gforge.natlab.research.philips.com:/cvsroot/pfgpsc'
+
+from context import *
+
+class Pic (targetpackage.TargetBuildSpec):
+    def get_dependency_dict (self):
+        return {'': []}
+
+    def get_subpackage_names (self):
+        return ['']
+    
+    def broken_for_distcc (self):
+        ## upnpAllegro is broken
+        return True
+
+    def get_build_dependencies (self):
+        neon_debian = ['comerr-dev',
+                       'libcomerr2',
+                       'libneon24-dev',
+                       'libssl0.9.8',
+                       'libkrb53',
+                       'libxml2',
+                       'zlib1g',
+                       ]
+        return [
+                'libbluetooth1-dev',
+                'libboost-dev',
+                'libboost-filesystem-dev',
+                'libboost-thread1.32.0',
+                'libboost-thread-dev',
+                'libdbi0-dev',
+                'libexif-dev',
+                'libgphoto2-2-dev',
+                'libid3-3.8.3-dev',
+                'libobexftp-dev',
+                'libopenobex-1.0-0-dev',
+                'libstdc++5',
+                'libstdc++5-3.3-dev',
+                'libusb-dev',
+                'libxerces26',
+                'libxerces26-dev',
+                'uuid-dev',
+                'zlib1g-dev',
+                ]
+
+    def get_unstable_build_dependencies (self):
+        neon_debian = ['comerr-dev',
+                       'libcomerr2',
+                       'libneon25-dev',
+                       'libssl0.9.8',
+                       'libkrb53',
+                       'libxml2',
+                       'zlib1g',
+                       ]
+        return [
+                'libbluetooth1-dev',
+                'libboost-dev',
+                'libboost-filesystem-dev',
+                'libboost-thread-dev',
+                'libdbi0-dev',
+                'libexif-dev',
+                'libgphoto2-2-dev',
+                'libid3-3.8.3-dev',
+                'libobexftp-dev',
+                'libopenobex-1.0-0-dev',
+                'libusb-dev',
+                'libxerces26c2',
+                'libxerces26-dev',
+                'uuid-dev',
+                ]
+
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        # FIXME: lilypond_branch
+        self.with (version=settings.lilypond_branch, mirror=pic_cvs,
+                   vc_type='cvs')
+
+        # FIXME: should add to C_INCLUDE_PATH
+        builddir = self.builddir ()
+        self.target_gcc_flags = (settings.target_gcc_flags
+                    + ' -I%(builddir)s' % locals ())
+        self._downloader = self.cvs
+
+    def rsync_command (self):
+        c = targetpackage.TargetBuildSpec.rsync_command (self)
+        c = c.replace ('rsync', 'rsync --delete') # --exclude configure')
+        return c
+
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + misc.join_lines ('''
+--enable-media-server
+--disable-decui
+--enable-static-gxx
+'''))
+
+    def patch (self):
+        self.system ('''
+sed -i 's/neon//' %(srcdir)s/comps/decDemo/CMakeLists.txt
+sed -i 's/id3/id3 z/' %(srcdir)s/comps/mtmTools/CMakeLists.txt
+sed -i 's/gphoto2_port/gphoto2_port dl/' %(srcdir)s/comps/mtmUsb/CMakeLists.txt
+''')
+
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        self.system ('''
+echo '#define HAVE_OBEXFTP_CLIENT_BODY_CONTENT 1' >> %(builddir)s/build/config.h
+''')
+#'
+
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+            + ' mediaServer')
+
+    def install_command (self):
+        return 'mkdir -p %(install_prefix)s/bin && cp -pv %(builddir)s/build/bin/mediaServer %(install_prefix)s/bin'
+
+    # FIXME: shared for all CVS packages
+    def srcdir (self):
+        return '%(allsrcdir)s/%(name)s-%(version)s'
+
+    # FIXME: shared for all CVS packages
+    def builddir (self):
+        return '%(targetdir)s/build/%(name)s-%(version)s'
+
+    def name_version (self):
+        # whugh
+        if os.path.exists (self.srcdir ()):
+            d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
+            return 'pic-%(VERSION)s' % d
+        #return targetpackage.TargetBuildSpec.name_version (self)
+        return 'pic-1.67'
+
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+
+    def gub_name (self):
+        nv = self.name_version ()
+        p = self.settings.platform
+        return '%(nv)s.%(p)s.gub' % locals ()
+
+#Hmm
+Pic__mipsel = Pic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/pjproject.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,26 @@
+from gub import repository
+from gub import targetpackage
+
+class Pjproject (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_vc (repository.TarBall (self.settings.mirrorss,
+                                          url='http://www.pjsip.org/release/0.5.10.1/pjproject-0.5.10.1.tar.gz',
+                                          version='0.5.10.1',
+                                          strip_components=True))
+        # FIXME: broken for make -j2, why does broken_for_distcc not handle?
+        self.settings.cpu_count_str = '1'
+    def broken_for_distcc (self):
+        return True
+    def patch (self):
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/pjproject-install.patch')
+    def configure_command (self):
+#        return targetpackage.TargetBuildSpec.configure_command (self).replace ('/configure', '/aconfigure')
+        return (targetpackage.TargetBuildSpec.configure_command (self).replace ('%(srcdir)s/configure', './aconfigure')
+                + ' --disable-sound')
+    def configure (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+        targetpackage.TargetBuildSpec.configure (self)
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' prefix=/usr')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/pkg-config.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,12 @@
+from gub import mirrors
+from gub import toolpackage
+
+class Pkg_config (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version="0.20",
+                   mirror=mirrors.freedesktop),
+
+    def configure (self):
+        toolpackage.ToolBuildSpec.configure (self)
+        self.update_libtool ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/potrace.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,7 @@
+from gub import toolpackage
+
+class Potrace (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+	from gub import mirrors
+        self.with (mirror=mirrors.sf, version="1.7"),
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/python-config.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,22 @@
+from gub import gubb
+
+class Python_config (gubb.SdkBuildSpec):
+    def __init__ (self, settings):
+        gubb.SdkBuildSpec.__init__ (self, settings)
+        self.has_source = False
+        self.with (version='2.4.1')
+    def untar (self):
+        pass
+    # FIXME: c&p python.py:install ()
+    def install (self):
+        import re
+        gubb.SdkBuildSpec.install (self)
+        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
+        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
+        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
+        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
+        import sys
+        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
+        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
+                   expand_string=False)
+        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/python.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,167 @@
+import re
+import sys
+#
+from gub import mirrors
+import glob
+from gub import gubb
+from gub import targetpackage
+
+from context import *
+
+class Python (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='2.4.2',
+                   mirror=mirrors.python,
+                   format='bz2')
+
+        ## don't from gub import settings from build system.
+	self.BASECFLAGS = ''
+        self.CROSS_ROOT = '%(system_root)s'
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
+
+    def get_subpackage_names (self):
+        return ['doc', 'devel', 'runtime', '']
+
+    def get_build_dependencies (self):
+        return ['expat-devel', 'zlib-devel']
+
+    def get_dependency_dict (self):
+        return { '': ['expat', 'python-runtime', 'zlib'],
+                 'devel' : ['libtool', 'python-devel'],
+                 'runtime': [], }
+
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-1.patch')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-configure.in-posix.patch')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-configure.in-sysname.patch')
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-configure.in-sysrelease.patch')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-import.patch')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-cross_root.patch')
+        self.file_sub ([('@CC@', '@CC@ -I$(shell pwd)')],
+                        '%(srcdir)s/Makefile.pre.in')
+
+    def configure (self):
+        self.system ('''cd %(srcdir)s && autoconf''')
+        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
+        targetpackage.TargetBuildSpec.configure (self)
+
+    def compile_command (self):
+        ##
+        ## UGH.: darwin Python vs python (case insensitive FS)
+        c = targetpackage.TargetBuildSpec.compile_command (self)
+        c += ' BUILDPYTHON=python-bin '
+        return c
+
+    def install_command (self):
+        ##
+        ## UGH.: darwin Python vs python (case insensitive FS)
+        c = targetpackage.TargetBuildSpec.install_command (self)
+        c += ' BUILDPYTHON=python-bin '
+        return c
+
+    # FIXME: c&p linux.py:install ()
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
+        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
+        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
+        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
+        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
+                   expand_string=False)
+        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
+
+
+    ### Ugh.
+    @subst_method
+    def python_version (self):
+        return '.'.join (self.ball_version.split ('.')[0:2])
+
+class Python__mingw_binary (gubb.BinarySpec):
+    def __init__ (self, settings):
+        gubb.BinarySpec.__init__ (self, settings)
+        self.with (mirror="http://lilypond.org/~hanwen/python-2.4.2-windows.tar.gz",
+                   version='2.4.2')
+
+    def python_version (self):
+        return '2.4'
+
+    def install (self):
+        gubb.BinarySpec.install (self)
+
+        self.system ("cd %(install_root)s/ && mkdir usr && mv Python24/include  usr/ ")
+        self.system ("cd %(install_root)s/ && mkdir -p usr/bin/ && mv Python24/* usr/bin/ ")
+        self.system ("rmdir %(install_root)s/Python24/")
+
+
+class Python__mingw_cross (Python):
+    def __init__ (self, settings):
+        Python.__init__ (self, settings)
+        self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_root)s/usr/include' % self.settings.__dict__
+
+    # FIXME: first is cross compile + mingw patch, backported to
+    # 2.4.2 and combined in one patch; move to cross-Python?
+    def patch (self):
+        Python.patch (self)
+        self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-winsock2.patch
+''')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-selectmodule.patch')
+
+        ## to make subprocess.py work.
+        self.file_sub ([
+                ("import fcntl", ""),
+                ], "%(srcdir)s/Lib/subprocess.py",
+               must_succeed=True)
+
+    def config_cache_overrides (self, str):
+        # Ok, I give up.  The python build system wins.  Once
+        # someone manages to get -lwsock32 on the
+        # sharedmodules link command line, *after*
+        # timesmodule.o, this can go away.
+        return re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
+               str)
+
+    def install (self):
+        Python.install (self)
+        for i in glob.glob ('%(install_root)s/usr/lib/python%(python_version)s/lib-dynload/*.so*' \
+                  % self.get_substitution_dict ()):
+            dll = re.sub ('\.so*', '.dll', i)
+            self.system ('mv %(i)s %(dll)s', locals ())
+
+        ## UGH.
+        self.system ('''
+cp %(install_root)s/usr/lib/python%(python_version)s/lib-dynload/* %(install_root)s/usr/bin
+''')
+        self.system ('''
+chmod 755 %(install_root)s/usr/bin/*
+''')
+
+class Python__mingw (Python__mingw_cross):
+    pass
+
+
+from gub import toolpackage
+class Python__local (toolpackage.ToolBuildSpec, Python):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='2.4.2',
+                   mirror=mirrors.python,
+                   format='bz2')
+
+    def configure (self):
+        self.system ('''cd %(srcdir)s && autoconf''')
+        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
+        targetpackage.TargetBuildSpec.configure (self)
+    def install (self):
+        toolpackage.ToolBuildSpec.install (self)
+
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
+
+    def wrap_executables (self):
+        pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/python25.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,149 @@
+import re
+import sys
+#
+from gub import mirrors
+import glob
+from gub import gubb
+from gub import targetpackage
+
+from context import *
+
+class Python (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        
+        ## don't from gub import settings from build system.
+	self.BASECFLAGS=''
+        self.with (version='2.5',
+                   mirror=mirrors.python,
+                   format='bz2')
+
+    def configure_command (self):
+        return 'ac_cv_printf_zd_format=yes ' + targetpackage.TargetBuildSpec.configure_command (self)
+
+    def patch (self):
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.5.patch')
+
+        self.file_sub ([(r"'/usr/include'",
+                         r"'%(system_root)s/usr/include'")],
+                       "%(srcdir)s/setup.py", must_succeed=True)
+                        
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
+
+    def get_subpackage_names (self):
+        return ['doc', 'devel', 'runtime', '']
+
+    def get_build_dependencies (self):
+        return ['expat-devel', 'zlib-devel']
+
+    def get_dependency_dict (self):
+        return { '': ['expat', 'python-runtime', 'zlib'],
+                 'devel' : ['libtool', 'python-devel'],
+                 'runtime': [], }
+
+    def configure (self):
+        self.system ('''cd %(srcdir)s && autoconf''')
+        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
+        targetpackage.TargetBuildSpec.configure (self)
+
+    def compile_command (self):
+        ##
+        ## UGH.: darwin Python vs python (case insensitive FS)
+        c = targetpackage.TargetBuildSpec.compile_command (self)
+        c += ' BUILDPYTHON=python-bin '
+        return c
+
+    def install_command (self):
+        ##
+        ## UGH.: darwin Python vs python (case insensitive FS)
+        c = targetpackage.TargetBuildSpec.install_command (self)
+        c += ' BUILDPYTHON=python-bin '
+        return c
+
+    # FIXME: c&p linux.py:install ()
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
+        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
+        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
+        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
+        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
+                   expand_string=False)
+        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
+
+
+    ### Ugh.
+    @subst_method
+    def python_version (self):
+        return '.'.join (self.ball_version.split ('.')[0:2])
+
+class Python__mingw (Python):
+    def __init__ (self, settings):
+        Python.__init__ (self, settings)
+        self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_root)s/usr/include' % self.settings.__dict__
+
+    # FIXME: first is cross compile + mingw patch, backported to
+    # 2.4.2 and combined in one patch; move to cross-Python?
+    def patch (self):
+        Python.patch (self)
+        if 0:
+            self.system ('''
+cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-winsock2.patch
+''')
+        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-selectmodule.patch')
+    def compile (self):
+        Python.compile (self)
+
+    def configure (self):
+        Python.configure (self)
+        self.file_sub ([('pwd pwdmodule.c', '')],
+                       '%(builddir)s/Modules/Setup')
+        self.file_sub ([(' Modules/pwdmodule.o ', ' ')],
+                       '%(builddir)s/Makefile')
+        self.system ("cp %(srcdir)s/PC/errmap.h %(builddir)s/")
+        
+    def config_cache_overrides (self, str):
+        # Ok, I give up.  The python build system wins.  Once
+        # someone manages to get -lwsock32 on the
+        # sharedmodules link command line, *after*
+        # timesmodule.o, this can go away.
+        return re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
+                       str)
+
+    def install (self):
+        Python.install (self)
+        for i in glob.glob ('%(install_root)s/usr/lib/python%(python_version)s/lib-dynload/*.so*' \
+                  % self.get_substitution_dict ()):
+            dll = re.sub ('\.so*', '.dll', i)
+            self.system ('mv %(i)s %(dll)s', locals ())
+
+        ## UGH.
+        self.system ('''
+cp %(install_root)s/usr/lib/python%(python_version)s/lib-dynload/* %(install_root)s/usr/bin
+''')
+        self.system ('''
+chmod 755 %(install_root)s/usr/bin/*
+''')
+
+from gub import toolpackage
+class Python__local (toolpackage.ToolBuildSpec, Python):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='2.5',
+                   mirror=mirrors.python,
+                   format='bz2')
+
+    def configure (self):
+        self.system ('''cd %(srcdir)s && autoconf''')
+        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
+        targetpackage.TargetBuildSpec.configure (self)
+    def install (self):
+        toolpackage.ToolBuildSpec.install (self)
+
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE'
+
+    def wrap_executables (self):
+        pass
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/qtopia-core.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,109 @@
+from gub import context
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+
+trolltech = 'ftp://ftp.trolltech.com/qt/source/%(name)s-opensource-src-%(ball_version)s.tar.%(format)s'
+
+# TODO: base class Qmake build.
+#       sort-out what exactly is Qmake build, qt, and qtopia-core specific
+
+class Qtopia_core (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=trolltech, version='4.2.2')
+        dict = {
+            'CC': 'gcc',
+            'CXX': 'g++',
+            #'LINK': '%(tool_prefix)sg++',
+            }
+        gubb.change_target_dict (self, dict)
+    def get_build_dependencies (self):
+        return ['freetype', 'glib', 'tslib']
+    def patch (self):
+        self.file_sub ([('pkg-config', '$PKG_CONFIG')],
+                       '%(srcdir)s/configure')
+    def configure_command (self):
+        return misc.join_lines ('''
+unset CC CXX; bash -x %(srcdir)s/configure
+-prefix /usr
+-bindir /usr/bin
+-libdir /usr/lib
+-embedded %(cpu)s
+-fast
+-headerdir /usr/include
+-datadir /usr/share
+-sysconfdir /etc
+-xplatform qws/%(qmake_target_architecture)s
+-depths 8,24
+
+-little-endian
+-release
+-no-cups
+-no-accessibility
+-no-freetype
+-nomake demos
+-nomake examples
+-nomake tools
+-qt-mouse-tslib
+-qt-libjpeg
+
+-confirm-license
+
+-docdir /usr/share/doc/qtopia
+-plugindir /usr/share/qtopia/plugins
+-translationdir /usr/share/qtopia/translations
+-examplesdir /usr/share/doc/qtopia/examples
+-demosdir /usr/share/doc/qtopia/demos
+-verbose
+''')
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        for i in misc.find (self.expand ('%(install_root)s'), 'Makefile'):
+            self.file_sub ([('-I/usr', '-I%(system_root)/usr')], i)
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + ' INSTALL_ROOT=%(install_root)s')
+    def license_file (self):
+        return '%(srcdir)s/LICENSE.GPL'
+    def install (self):
+        targetpackage.TargetBuildSpec.install (self)
+        self.system ('mkdir -p %(install_root)s/usr/lib/pkgconfig')
+        for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
+            self.system ('''
+mv %(install_root)s/usr/lib/%(i)s %(install_root)s/usr/lib/pkgconfig/%(i)s
+''',
+                         locals ())
+            self.file_sub ([('includedir', 'deepqtincludedir')],
+                           '%(install_root)s/usr/lib/pkgconfig/%(i)s',
+                           env=locals ())
+
+class Qtopia_core__linux__arm__softfloat (Qtopia_core):
+    @context.subst_method
+    def qmake_target_architecture (self):
+        return 'linux-arm-g++'
+    def patch (self):
+        Qtopia_core.patch (self)
+        self.file_sub ([('arm-linux', '%(target_architecture)s')],
+                       '%(srcdir)s/mkspecs/qws/%(qmake_target_architecture)s/qmake.conf')
+
+Qtopia_core__linux__arm__vfp = Qtopia_core__linux__arm__softfloat
+
+class Qtopia_core__linux__64 (Qtopia_core):
+    @context.subst_method
+    def qmake_target_architecture (self):
+        return 'linux-x86_64-g++'
+    def patch (self):
+        Qtopia_core.patch (self)
+        # ugh, dupe
+        self.system ('''
+#cd %(srcdir)s/mkspecs/qws && cp -R linux-x86_64-g++ %(target_architecture)s
+cd %(srcdir)s/mkspecs && cp -R linux-g++ %(qmake_target_architecture)s
+''')
+        self.file_sub ([
+                ('= gcc', '= %(target_architecture)s-gcc'),
+                ('= g\+\+', '= %(target_architecture)s-g++'),
+                ('= ar', '= %(target_architecture)s-ar'),
+                ('= ranlib', '= %(target_architecture)s-ranlib'),
+                ],
+                       '%(srcdir)s/mkspecs/qws/%(target_architecture)s/qmake.conf')
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/regex.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,11 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Regex (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with (version='2.3.90-1',
+                   mirror=mirrors.lilypondorg, format='bz2')
+
+    def license_file (self):
+        return '%(srcdir)s/COPYING.LIB'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/scons.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,24 @@
+from gub import toolpackage
+from gub import mirrors
+
+class Scons (toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='0.96.93',
+                   format='gz',
+                   mirror=mirrors.sf),
+
+    def compile (self):
+        pass
+
+    def patch (self):
+        pass
+    
+    def configure (self):
+        self.system ('mkdir %(builddir)s')
+    
+    def install_command (self):
+        return 'python %(srcdir)s/setup.py install --prefix=%(local_prefix)s --root=%(install_root)s'
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE.txt' 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/sqlite.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,18 @@
+from gub import targetpackage
+
+sqlite = 'http://www.sqlite.org/sqlite-%(ball_version)s.tar.%(format)s'
+
+class Sqlite (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=sqlite, version='3.3.16')
+    def configure_command (self):
+        return (targetpackage.TargetBuildSpec.configure_command (self)
+                + ' --disable-tcl --enable-threadsafe')
+    def patch (self):
+        open (self.expand ('%(srcdir)s/PUBLIC-DOMAIN'), 'w').write ('''
+Sqlite has no license, it is in the public domain.
+See http://www.sqlite.org/copyright.html .
+''')
+    def license_file (self):
+        return '%(srcdir)s/PUBLIC-DOMAIN'
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/texinfo.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,13 @@
+from gub import toolpackage
+from gub import mirrors
+
+class Texinfo(toolpackage.ToolBuildSpec):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version="4.8",
+                   mirror=mirrors.gnu, format="bz2")
+    def patch (self):
+        toolpackage.ToolBuildSpec.patch (self)
+        self.system ('cd %(srcdir)s && patch -p1 <  %(patchdir)s/texinfo-4.8.patch')
+
+    ## TODO: should patch out info reader completely.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/texlive.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,250 @@
+from gub import repository
+from gub import targetpackage
+
+texlive_svn = 'svn://username@tug.org/texlive'
+license_url = 'http://tug.org/svn/texlive/trunk/Master/LICENSE.TL'
+
+class Texlive (targetpackage.TargetBuildSpec):
+    '''The TeX Live text formatting system
+The TeX Live software distribution offers a complete TeX system.
+It  encompasses programs for editing, typesetting, previewing and printing
+of TeX documents in many different languages, and a large collection
+of TeX macros and font libraries.
+ 
+The distribution also includes extensive general documentation about
+TeX, as well as the documentation accompanying the included software
+packages.'''
+
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        repo = repository.Subversion (
+            dir=self.get_repodir (),
+            source=texlive_svn,
+            branch='trunk',
+            module='Build/source',
+            revision='HEAD')
+
+        def fixed_version (self):
+            return '2006'
+
+        from new import instancemethod
+        repo.version = instancemethod (fixed_version, repo, type (repo))
+
+        self.with_vc (repo)
+
+        self.texmf_repo = repository.Subversion (
+# FIXME: module should be used in checkout dir name.            
+            dir=self.get_repodir () + '-texmf',
+#            dir=self.get_repodir () + 'vc_repository._checkout_dir (),
+            source=texlive_svn,
+            branch='trunk',
+            module='Master/texmf',
+            revision='HEAD')
+
+        self.texmf_dist_repo = repository.Subversion (
+# FIXME: module should be used in checkout dir name.            
+            dir=self.get_repodir () + '-texmf-dist',
+#            dir=self.get_repodir () + 'vc_repository._checkout_dir (),
+            source=texlive_svn,
+            branch='trunk',
+            module='Master/texmf-dist',
+            revision='HEAD')
+
+    def version (self):
+        return '2006'
+    
+    def get_subpackage_names (self):
+        return ['doc', 'devel', 'base', 'runtime', 'bin', '']
+
+    def get_subpackage_definitions (self):
+        d = targetpackage.TargetBuildSpec.get_subpackage_definitions (self)
+        d['doc'] += ['/usr/share/texmf/doc']
+        d['base'] = ['/usr/share/texmf']
+#        d['bin'] = ['/']
+        d['bin'] = ['/etc', '/usr']
+        return d
+
+    def download (self):
+        targetpackage.TargetBuildSpec.download (self)
+        self.texmf_repo.download ()
+        from gub import misc
+        misc.download_url (license_url,  self.vc_repository._checkout_dir ())
+#        self.dump ('MAJOR_VERSION=2006', self.vc_repository.dir + '/VERSION')
+                           
+    def untar (self):
+        targetpackage.TargetBuildSpec.untar (self)
+#        self.texmf_repo.update_workdir (self.expand ('%(srcdir)s/texmf-dist'))
+        self.texmf_repo.update_workdir (self.expand ('%(srcdir)s/texmf'))
+
+    def rsync_command (self):
+        return targetpackage.TargetBuildSpec.rsync_command (self).replace ('rsync', 'rsync --exclude=.svn')
+
+    def configure_command (self):
+        from gub import misc
+        #FIXME
+        return ('export TEXMFMAIN=%(srcdir)s/texmf;'
+                + 'bash '
+                + targetpackage.TargetBuildSpec.configure_command (self).replace ('--config-cache', '--cache-file=config.cache')
+                + misc.join_lines ('''
+--disable-multiplatform
+--enable-ipc
+--enable-shared
+--with-dialog
+--with-etex
+--with-omega
+--with-oxdvik
+--with-pdflatex
+--with-pdftex
+--with-pnglib-include=%(system_root)s/usr/include/libpng12
+--with-system-freetype
+--with-system-freetype2
+--with-freetype2-include=%(system_root)s/usr/include/freetype2
+--with-system-gd
+--with-system-ncurses
+--with-system-pnglib
+--with-system-t1lib
+--with-system-tifflib
+--with-system-zlib
+--with-x
+--with-mf-x-toolkit=xaw
+--with-xdvi-x-toolkit=xaw
+--without-cjkutils
+--without-dvi2tty
+--without-dvipdfmx
+--without-dvipng
+--without-icu
+--without-lcdf-typetools
+--without-psutils
+--without-sam2p
+--without-t1utils
+--without-texi2html
+--without-texinfo
+--without-ttf2pk
+--without-xetex
+--without-xdvipdfmx
+--x-includes=%(system_root)s/usr/X11R6/include
+--x-libraries=%(system_root)s/usr/X11R6/lib
+'''))
+
+    def install_command (self):
+        return self.broken_install_command ()
+
+    def install (self):
+    	targetpackage.TargetBuildSpec.install (self)
+        self.system ('''
+#rsync -v -a %(srcdir)s/texmf-dist/* %(install_root)s/usr/share/texmf-dist
+rsync -v -a %(srcdir)s/texmf/* %(install_root)s/usr/share/texmf/
+''')
+
+    def license_file (self):
+        return '%(srcdir)s/LICENSE.TL'
+
+    # FIXME: shared for all vc packages
+    def srcdir (self):
+        return '%(allsrcdir)s/%(name)s-%(version)s'
+
+    # FIXME: shared for all vc packages
+    def builddir (self):
+        return '%(targetdir)s/build/%(name)s-%(version)s'
+
+    def name_version (self):
+        # whugh
+        import os
+        if os.path.exists (self.srcdir ()):
+            d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
+            return 'texlive-%(VERSION)s' % d
+        return 'texlive-3.0'
+
+class Texlive__cygwin (Texlive):
+    def __init__ (self, settings):
+        Texlive.__init__ (self, settings)
+
+    # FIXME: uses mixed gub/distro dependencies
+    def get_dependency_dict (self):
+        d = Texlive.get_dependency_dict (self)
+        d[''] += ['cygwin']
+#        d['devel'] += ['cygwin'] + ['bash']
+#        d['runtime'] += ['libjpeg62', 'libpng12', 't1lib', 'zlib']
+        d[''] += ['libfreetype26', 'libgd2', 'libjpeg62', 'libncurses7', 'libpng12', 't1lib', 'xorg-x11-bin-dlls', 'xaw3d', 'zlib']
+        return d
+ 
+    # FIXME: uses mixed gub/distro dependencies
+    def get_build_dependencies (self):
+        return ['jpeg', 'libfreetype2-devel', 'libgd-devel', 'libncurses-devel', 'libpng12-devel', 'libtool', 't1lib', 'xorg-x11-devel', 'xaw3d', 'zlib']
+
+    def config_cache_overrides (self, str):
+        # split part to Texlive ?
+        return (str + '''
+xdvi_cv_bitmap_type=${xdvi_cv_bitmap_type='BMTYPE=int BMBYTES=4'}
+xdvi_cv_func_poll=${xdvi_cv_func_poll=yes}
+xdvi_cv_sys_streams=${xdvi_cv_sys_streams=no}
+xdvi_cv_sys_sunos_4=${xdvi_cv_sys_sunos_4=no}
+xdvi_cv_motif_include=${xdvi_cv_motif_include=no}
+xdvi_cv_motif_libdir=${xdvi_cv_motif_libdir=no}
+xdvi_cv_func_good_vsnprintf=${xdvi_cv_func_good_vsnprintf=yes}
+ac_cv_func_vfork_works=${ac_cv_func_vfork_works=yes}
+xdvi_cv_setsid_in_vfork=${xdvi_cv_setsid_in_vfork=yes}
+lt_cv_cc_dll_switch=${lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles"}
+''')
+
+    def patch (self):
+        # FIXME: duh: cross-compile auto-enables t1lib
+        for i in self.locate_files ('%(srcdir)s', 'configure'):
+            self.file_sub ([
+                    ('ac_compile_t1lib=1', 'ac_compile_t1lib=0'),
+                    ('-lpng ', '-lpng12 '),
+                    ('-lpng"', '-lpng12"'),
+                    ], i)
+        self.file_sub ([('^(/\* kpsewhich --)', '#undef KPSE_DLL\n\\1')],
+                       '%(srcdir)s/texk/kpathsea/kpsewhich.c')
+
+    def configure (self):
+        Texlive.configure (self)
+        self.update_libtool ()
+        self.file_sub ([('(-version-info 4:0:0)', '\\1 -no-undefined')],
+                       '%(builddir)s/texk/kpathsea/Makefile')
+
+    def makeflags (self):
+        from gub import misc
+        return misc.join_lines ('''
+CFLAGS="-O2 -g -DKPSE_DLL"
+''')
+
+    def compile_command (self):
+        return (Texlive.compile_command (self) + self.makeflags ())
+
+    def install (self):
+    	self.pre_install_smurf_exe ()
+        Texlive.install (self)
+        
+    # FIXME: we do most of this for all cygwin packages
+    def category_dict (self):
+        return {'': 'text publishing',
+                'base': 'text publishing',
+                'extra': 'text publishing',
+                'runtime': 'libs',
+                'devel': 'devel libs',
+                'doc': 'doc',
+                'x11': 'x11',
+                }
+
+    def description_dict (self):
+        # FIXME: fairly uninformative description for packages,
+        # unlike, eg, guile-devel.  This is easier, though.
+        d = {}
+        for i in self.get_subpackage_names ():
+            d[i] = self.get_subpackage_doc (i)
+        return d
+
+    def get_subpackage_doc (self, split):
+        flavor = {'': 'installer helper',
+                  'bin': 'executables',
+                  'base': 'base texmf tree',
+                  'extra': 'full texmf tree',
+                  'devel': 'development',
+                  'doc': 'documentation',
+                  'runtime': 'runtime',
+                  'x11': 'x11 executables',
+                  }[split]
+        return (Texlive.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
+                % locals ())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/tslib.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,12 @@
+from gub import mirrors
+from gub import targetpackage
+
+class Tslib (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.berlios, version='1.0', format='bz2')
+    def configure (self):
+        targetpackage.TargetBuildSpec.configure (self)
+        self.file_sub ([('#define malloc', '#define urg_malloc')],
+                       '%(builddir)s/config.h')
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/urw-fonts.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,19 @@
+from gub import gubb
+
+class Urw_fonts (gubb.BinarySpec):
+    def __init__ (self, settings):
+        gubb.BinarySpec.__init__ (self, settings)
+
+        self.with (version='1.0.7pre41',
+                   mirror='ftp://ftp.gnome.ru/fonts/urw/release/urw-fonts-%(version)s.tar.bz2')
+        self.vc_repository.strip_components = 0
+    def compile (self):
+        self.system ('cd %(srcdir)s && rm README* COPYING ChangeLog TODO')
+    def install (self):
+        self.system ('mkdir -p %(install_root)s/usr/share/fonts/default/Type1')
+        self.system ('cp %(srcdir)s/* %(install_root)s/usr/share/fonts/default/Type1/')
+    def package (self):
+        gubb.BuildSpec.package (self)
+    def get_subpackage_names (self):
+        return ['']
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/xerces-c.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,62 @@
+from gub import mirrors
+from gub import gubb
+from gub import misc
+from gub import targetpackage
+
+class Xerces_c (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.xerces_c, version='2_7_0')
+        self.compile_dict = {
+            'XERCESCROOT': '%(builddir)s',
+            'TRANSCODER': 'NATIVE',
+            'MESSAGELOADER': 'INMEM',
+            'NETACCESSOR': 'Socket',
+            'THREADS': 'pthread',
+            'BITSTOBUILD': '32',
+            'LIBS': ' -lpthread ',
+            'CFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
+            'CXXFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
+            }
+        gubb.change_target_dict (self, self.compile_dict)
+        # FIXME: broken for make -j2, why does broken_for_distcc not handle?
+        self.settings.cpu_count_str = '1'
+    def broken_for_distcc (self):
+        return True
+    def patch (self):
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+    def configure_command (self):
+        # We really did not understand autotools, so we cd and ENV
+        # around it until it breaks.  And see, our webserver is soo
+        # cool, it can serve the INSTALL file!  Let's remove it from
+        # the tarball!
+        return (self.makeflags () + ' '
+                + targetpackage.TargetBuildSpec.configure_command (self)
+                .replace ('/configure ', '/src/xercesc/configure ')
+                .replace ('--config-cache', '--cache-file=%(builddir)s/config.cache'))
+    def makeflags (self):
+        s = ''
+        for i in self.compile_dict.keys ():
+            s += ' ' + i + '="' + self.compile_dict[i] + '"'
+        return s
+    def xcompile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+                + self.makeflags ()
+                + ';' + targetpackage.TargetBuildSpec.compile_command (self)
+                + self.makeflags ()
+                + ';' + targetpackage.TargetBuildSpec.compile_command (self)
+                + self.makeflags ())
+    def compile_command (self):
+        return (targetpackage.TargetBuildSpec.compile_command (self)
+                + self.makeflags ())
+    def install_command (self):
+        return (targetpackage.TargetBuildSpec.install_command (self)
+                + self.makeflags ())
+    def configure (self):
+        self.config_cache ()
+        self.system ('cd %(builddir)s/src/xercesc && %(configure_command)s')
+    def compile (self):
+        self.system ('cd %(builddir)s/src/xercesc && %(compile_command)s')
+    def install (self):
+        self.system ('cd %(builddir)s/src/xercesc && %(install_command)s')
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/zlib.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,79 @@
+from gub import targetpackage
+from gub import gubb
+from gub import toolpackage
+
+class Zlib (targetpackage.TargetBuildSpec):
+    def __init__ (self, settings):
+        targetpackage.TargetBuildSpec.__init__ (self, settings)
+	self.with (version='1.2.3',
+                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz')
+        
+    def patch (self):
+        targetpackage.TargetBuildSpec.patch (self)
+
+        self.system ('cp %(sourcefiledir)s/zlib.license %(license_file)s')
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/zlib-1.2.3.patch')
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+
+    def compile_command (self):
+        return targetpackage.TargetBuildSpec.compile_command (self) + ' ARFLAGS=r '
+
+    
+    def configure_command (self):
+        import re
+        stripped_platform = self.settings.expand ('%(platform)s')
+        stripped_platform = re.sub ('-.*', '', stripped_platform)
+        stripped_platform = stripped_platform.replace ('darwin', 'Darwin')
+        
+        zlib_is_broken = 'SHAREDTARGET=libz.so.1.2.3 target=' + stripped_platform
+
+        ## doesn't use autoconf configure.
+        return zlib_is_broken + ' %(srcdir)s/configure --shared '
+
+    def install_command (self):
+        return targetpackage.TargetBuildSpec.broken_install_command (self)
+
+
+
+class Zlib__mingw (Zlib):
+    # FIXME: removeme, try zlib-1.2.3.patch
+    def x__init__ (self, settings):
+        Zlib.__init__ (self, settings)
+        self.with (version='1.2.2',
+                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.2.tar.gz')
+
+    def patch (self):
+        Zlib.patch (self)
+        self.file_sub ([("='/bin/true'", "='true'"),
+                        ('mgwz','libz'),
+                        ],
+                       '%(srcdir)s/configure')
+
+    def configure_command (self):
+        zlib_is_broken = 'target=mingw'
+        return zlib_is_broken + ' %(srcdir)s/configure --shared '
+
+class Zlib__local (toolpackage.ToolBuildSpec, Zlib):
+    def __init__ (self, settings):
+        toolpackage.ToolBuildSpec.__init__ (self, settings)
+        self.with (version='1.2.3',
+                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz')
+
+        
+    def patch (self):
+        ## ugh : C&P
+        toolpackage.ToolBuildSpec.patch (self)
+        
+        self.system ('cp %(sourcefiledir)s/zlib.license %(license_file)s')
+        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/zlib-1.2.3.patch')
+        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
+      
+    def install_command (self):
+        return toolpackage.ToolBuildSpec.broken_install_command (self)
+        
+    def install (self):
+        toolpackage.ToolBuildSpec.install (self)
+        self.system ('cd %(install_root)s && mkdir -p ./%(local_prefix)s && cp -av usr/* ./%(local_prefix)s && rm -rf usr')
+
+    def configure_command (self):
+        return Zlib.configure_command (self)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/targetpackage.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,169 @@
+import os
+from gub import gubb
+from gub import misc
+import re
+import imp
+import md5
+from gub import cross
+
+from context import subst_method
+
+class TargetBuildSpec (gubb.BuildSpec):
+    def configure_command (self):
+        return misc.join_lines ('''%(srcdir)s/configure
+--config-cache
+--enable-shared
+--disable-static
+--build=%(build_architecture)s
+--host=%(target_architecture)s
+--target=%(target_architecture)s
+--prefix=/usr
+--sysconfdir=/usr/etc
+--includedir=/usr/include
+--infodir=/usr/share/info
+--mandir=/usr/share/man
+--libdir=/usr/lib
+''')
+
+    def __init__ (self, settings):
+        gubb.BuildSpec.__init__ (self, settings)
+
+    def install (self):
+        self.pre_install_libtool_fixup ()
+        gubb.BuildSpec.install (self)
+
+    def pre_install_libtool_fixup (self):
+        ## Workaround for libtool bug.
+        ## libtool inserts -L/usr/lib into command line, but this is
+        ## on the target system. It will try link in libraries from
+        ## /usr/lib/ on the build system. This seems to be problematic for libltdl.a and libgcc.a on MacOS.
+        ##
+        for lt in self.locate_files ("%(builddir)s", '*.la'):
+            lt = lt.strip()
+            if not lt:
+                continue
+
+            dir = os.path.split (lt)[0]
+            suffix = "/.libs"
+            if re.search("\\.libs$", dir):
+                suffix = ''
+            self.file_sub ([
+                ("libdir='/usr/lib'", "libdir='%(dir)s%(suffix)s'"),
+                ],
+                   lt, env=locals ())
+
+    ## UGH. only for cross!
+    def config_cache_overrides (self, str):
+        return str
+
+    def config_cache_settings (self):
+        return self.config_cache_overrides (self, '')
+
+    def config_cache (self):
+        str = self.config_cache_settings ()
+        if str:
+            self.system ('mkdir -p %(builddir)s')
+            cache_file = '%(builddir)s/config.cache'
+            self.dump (self.config_cache_settings (), cache_file)
+            os.chmod (self.expand (cache_file), 0755)
+
+    def config_cache_settings (self):
+        from gub import config_cache
+        return self.config_cache_overrides (config_cache.config_cache['all']
+                                            + config_cache.config_cache[self.settings.platform])
+
+    def compile_command (self):
+        c = gubb.BuildSpec.compile_command (self)
+        if (self.settings.cross_distcc_hosts
+            and not self.broken_for_distcc ()
+            and re.search (r'\bmake\b', c)):
+            
+            jobs = '-j%d ' % (2*len (self.settings.cross_distcc_hosts.split (' ')))
+            c = re.sub (r'\bmake\b', 'make ' + jobs, c)
+
+            ## do this a little complicated: we don't want a trace of
+            ## distcc during configure.
+            c = 'DISTCC_HOSTS="%s" %s' % (self.settings.cross_distcc_hosts , c)
+            c = 'PATH="%(cross_distcc_bindir)s:$PATH" ' + c
+        elif self.settings.cpu_count_str:
+            c += ' -j%s '% self.settings.cpu_count_str
+        return c
+            
+    def configure (self):
+        self.config_cache ()
+        gubb.BuildSpec.configure (self)
+
+    ## FIXME: this should move elsewhere , as it's not
+    ## package specific
+    def get_substitution_dict (self, env={}):
+        dict = {
+            'AR': '%(tool_prefix)sar',
+            'AS': '%(tool_prefix)sas',
+            'CC': '%(tool_prefix)sgcc %(target_gcc_flags)s',
+            'CC_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
+            'CCLD_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
+
+
+            ## %(system_root)s/usr/include is already done by
+            ## GCC --with-sysroot config, but we  have to be sure
+            ## note that overrides some headers in sysroot/usr/include,
+            ## which is why setting C_INCLUDE_PATH breaks on FreeBSD. 
+            ## 
+            ## no %(local_prefix)s/usr/include, as this will interfere
+            ## with target headers.
+            ## The flex header has to be copied into the target compile manually.
+            ##
+            'C_INCLUDE_PATH': '',
+            'CPATH': '',
+            'CPLUS_INCLUDE_PATH': '',
+            'CXX':'%(tool_prefix)sg++ %(target_gcc_flags)s',
+
+#--urg-broken-if-set-exec-prefix=%(system_root)s/usr \
+## ugh, creeping -L/usr/lib problem
+## trying revert to LDFLAGS...
+##                        'LIBRARY_PATH': '%(system_root)s/usr/lib:%(system_root)s/usr/bin',
+            'LIBRARY_PATH': '',
+# FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken
+#            'LDFLAGS': '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api',
+            'LDFLAGS': '',
+            'LD': '%(tool_prefix)sld',
+            'NM': '%(tool_prefix)snm',
+            'PKG_CONFIG_PATH': '%(system_root)s/usr/lib/pkgconfig',
+            'PATH': '%(cross_prefix)s/bin:%(local_prefix)s/bin:' + os.environ['PATH'],
+            'PKG_CONFIG': '''pkg-config \
+--define-variable prefix=%(system_root)s/usr \
+--define-variable includedir=%(system_root)s/usr/include \
+--define-variable libdir=%(system_root)s/usr/lib \
+''',
+            'RANLIB': '%(tool_prefix)sranlib',
+            'SED': 'sed', # libtool (expat mingw) fixup
+            }
+
+        # FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken
+        # FIXME: how to move this to cygwin.py/mingw.py?
+        # Hmm, better to make wrappers for gcc/c++/g++ that add options;
+        # see (gub-samco branch) linux-arm-vfp.py?
+        if self.settings.platform in ('cygwin', 'mingw'):
+            dict['LDFLAGS'] = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
+
+        #FIXME: how to move this to arm.py?
+        if self.settings.target_architecture == 'armv5te-softfloat-linux':
+            dict['CFLAGS'] = '-O'
+
+        dict.update (env)
+        d = gubb.BuildSpec.get_substitution_dict (self, dict).copy ()
+        return d
+
+def get_build_spec (settings, url):
+    """
+    Return TargetBuildSpec instance to build package from URL.
+
+    URL can be partly specified (eg: only a name, `lilypond'),
+    defaults are taken from the spec file.
+    """
+
+    package = gubb.get_build_spec (TargetBuildSpec, settings, url)
+    crossmod = cross.get_cross_module (settings.platform)
+    crossmod.change_target_package (package)
+    return package
+    
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/toolpackage.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,57 @@
+from gub import misc
+import os
+import re
+
+from gub import gubb
+
+class ToolBuildSpec (gubb.BuildSpec):
+    def configure_command (self):
+        return (gubb.BuildSpec.configure_command (self)
+            + misc.join_lines ('''
+--prefix=%(local_prefix)s
+'''))
+
+    ## ugh: prefix= will trigger libtool relinks.
+    def install_command (self):
+        return '''make DESTDIR=%(install_root)s install'''
+
+    def install (self):
+        gubb.BuildSpec.install (self)
+        self.wrap_executables ()
+                
+    def wrap_executables (self):
+        for e in (self.locate_files ('%(install_root)s/usr/bin', '*')
+                  + self.locate_files ('%(install_root)s/%(local_prefix)s/bin',
+                                       '*')):
+            dir = os.path.dirname (e)
+            file = os.path.basename (e)
+            self.system ('mv %(e)s %(dir)s/.%(file)s', locals ())
+            self.dump ('''#!/bin/sh
+LD_LIBRARY_PATH=%(system_root)s/usr/lib
+%(system_root)s/usr/bin/.%(file)s "$@"
+''', e, env=locals ())
+            os.chmod (e, 0755)
+
+    def compile_command (self):
+        return self.native_compile_command ()
+
+    ## we need to tar up %(install_root)/%(prefix)
+    def packaging_suffix_dir (self):
+        return '%(system_root)s'
+
+    def get_subpackage_names (self):
+        return ['']
+
+    def configure (self):
+        gubb.BuildSpec.configure (self)
+        self.update_libtool ()
+
+    def get_substitution_dict (self, env={}):
+        dict = {
+            'C_INCLUDE_PATH': '%(local_prefix)s/include',
+            'LIBRARY_PATH': '%(local_prefix)s/lib',
+            'CPLUS_INCLUDE_PATH': '%(local_prefix)s/include',
+        }
+        dict.update (env)
+        d = gubb.BuildSpec.get_substitution_dict (self, dict).copy ()
+        return d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/tools.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,10 @@
+# FIXME: why is this called tools iso local?
+def get_cross_build_dependencies (settings):
+    return []
+
+def get_cross_packages (settings):
+    return []
+
+def change_target_package (bla):
+    pass
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/versiondb.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,219 @@
+#!/usr/bin/env python
+
+"""
+    Copyright (c) 2005--2007
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import re
+import urllib
+import string
+import pickle
+import optparse
+import os
+
+platforms = ['linux-x86',
+             'linux-64',
+             'linux-ppc',
+             'darwin-ppc',
+             'darwin-x86',
+             'documentation',
+             'freebsd-x86',
+             'mingw',
+             'cygwin',
+             'source',
+             ]
+
+def get_url_versions (url):
+    opener = urllib.URLopener ()
+    index = opener.open (url).read ()
+
+    versions = []
+    def note_version (m):
+        name = m.group (1)
+        version = tuple (map (int,  m.group (2).split('.')))
+        build = 0
+        build_url = url + re.sub ("HREF=", '', m.group (0))
+        build_url = build_url.replace ('"', "")
+        
+        # disregard buildnumber for src tarball. 
+        if m.group(3):
+            build = int (m.group (4))
+            
+        versions.append ((name, version, build, build_url))
+        
+        return ''
+
+    # [^0-9] is to force that version no is not swalled by name. Check this for cygwin libfoo3  
+    # packages
+    re.sub (r'HREF="(.*[^0-9])-([0-9.]+)(-([0-9]+))?\.[0-9a-z-]+\.[.0-9a-z-]+"', note_version, index)
+
+    return versions
+
+class VersionDataBase:
+    def __init__ (self, file_name):
+        self._db = {}
+        self.file_name = file_name
+        if os.path.exists (file_name):
+            self.read ()
+            
+    def platforms (self):
+        return self._db.keys ()
+    
+    def get_sources_from_url (self, url):
+
+        ## ugh: should follow urls in the index.
+        directories = ['v0.0', 'v0.1', 'v1.0', 'v1.1', 'v1.2', 'v1.3',
+                       'v1.4', 'v1.5', 'v1.6', 'v1.7', 'v1.8', 'v1.9',
+                       'v2.0', 'v2.1', 'v2.2', 'v2.3', 'v2.4', 'v2.5',
+                       'v2.6', 'v2.7', 'v2.8', 'v2.9', 'v2.10', 'v2.11']
+
+        sources = []
+        for d in directories:
+            u = '%(url)ssources/%(d)s/' % locals ()
+            sources += get_url_versions (u)
+            
+        self._db['source'] = sources
+
+
+    def get_binaries_from_url (self, url):
+        package = os.path.basename (os.path.splitext (self.file_name)[0])
+        for p in platforms:
+            if p == 'source':
+                continue
+            
+            u = '%(url)sbinaries/%(p)s/' % locals ()
+            
+            if p == 'cygwin':
+                u += 'release/%(package)s/' % locals ()
+
+            try:
+                self._db[p] = get_url_versions (u)
+            except IOError, x:
+                print 'problem loading', u 
+                continue
+            
+    def write (self):
+        open (self.file_name,'w').write (pickle.dumps (self._db))
+
+    def read (self):
+        self._db = pickle.loads (open (self.file_name).read ())
+
+
+    ## UI functions:
+    def get_next_build_number (self, version_tuple):
+        assert (type (version_tuple) == type (()))
+        sub_db = {}
+        for platform in platforms:
+            sub_db[platform] = [0]
+            if self._db.has_key (platform):
+                sub_db[platform] = [buildnum
+                                    for (name, version, buildnum, url)
+                                    in self._db[platform]
+                                    if version == version_tuple]
+            
+        return max (max (bs + [0]) for (p, bs) in sub_db.items ()) + 1
+
+    def get_last_release (self, platform, version_tuple):
+        candidates = [(v, b, url) for (name, v, b, url) in  self._db[platform]
+                      if v[:len (version_tuple)] == version_tuple]
+        candidates.append ( ((0,0,0), 0, '/dev/null' ))
+        candidates.sort ()
+        
+        return candidates[-1]
+
+def get_cli_parser ():
+    p = optparse.OptionParser ()
+
+    p.usage='''versiondb.py  [OPTION]... COMMAND [PACKAGE]...
+
+Inspect lilypond.org download area, and write pickle of all version numbers.
+
+'''
+    p.description='Grand Unified Builder.  Specify --package-version to set build version'
+
+    p.add_option ('--dbfile', action='store',
+                  dest="dbfile",
+                  help="Pickle of version dict",
+                  default="uploads/lilypond.versions")
+                  
+    p.add_option ('--url', action='store',
+                  dest='url',
+                  default='http://lilypond.org/download/',
+                  help='download url')
+
+    p.add_option ('--download', action='store_true',
+                  dest='download',
+                  default=False,
+                  help='download new versions')
+
+
+    p.add_option ('--no-sources', action='store_false',
+                  dest='do_sources',
+                  default=True,
+                  help="do not look for versions of sources")
+
+    p.add_option ('--build-for', action='store',
+                  dest='version',
+                  default='',
+                  help='print build number for version')
+
+    p.add_option ('--test', action='store_true',
+                  dest='test',
+                  default=False,
+                  help='self test')
+
+    return p
+
+def main ():
+    cli_parser = get_cli_parser ()
+    (options, files) = cli_parser.parse_args ()
+
+    if options.url and not options.url.endswith ('/'):
+        options.url += "/"
+
+    db = VersionDataBase (options.dbfile)
+    if options.test:
+        print '2.9.28:', db.get_next_build_number ((2,9,28))
+        print '2.8.2:', db.get_next_build_number ((2,8,2))
+        print '2.9.28:', db.get_next_build_number ((2,9,28))
+        print '2.8.2:', db.get_next_build_number ((2,8,2))
+        print '2.10.0 next:', db.get_next_build_number ((2,10,0))
+        
+        print 'last mingw 2.9.26:', db.get_last_release ('mingw', (2,9,26))
+        print 'last mingw 2.9:', db.get_last_release ('mingw', (2,9))
+        print 'last mingw 2.9:', db.get_last_release ('mingw', (2,))
+        print 'last source:', db.get_last_release ('source', ())
+        return
+
+    if options.download:
+        
+        ##ugh
+        if options.do_sources: 
+            db.get_sources_from_url (options.url)
+            
+        db.get_binaries_from_url (options.url)
+        db.write ()
+
+    if options.version:
+        v = tuple (map (int, options.version.split ('.')))
+        print db.get_next_build_number (v)
+    
+    
+if __name__ == '__main__':
+    main ()
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/with-lock.py	Sun Apr 29 23:28:01 2007 +0200
@@ -0,0 +1,77 @@
+#!/usr/bin/env python
+
+
+"""
+    Copyright (c) 2005--2007
+    Jan Nieuwenhuizen <janneke@gnu.org>
+    Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+"""
+
+import optparse
+import sys
+import os
+
+
+sys.path.insert (0, os.path.split (sys.argv[0])[0] + '/../lib/')
+
+from gub import locker
+
+def parse_options ():
+    p = optparse.OptionParser ()
+    p.usage = "with-lock.py FILE COMMAND"
+    p.add_option ('--skip',
+		  action="store_true",
+		  dest="skip",
+		  help="return 0 if couldn't get lock.")
+
+    p.disable_interspersed_args()
+
+
+    (o,a) = p.parse_args ()
+    if len (a) < 2:
+	p.print_help()
+	sys.exit (2)
+	
+    return o,a
+
+def run_command_with_lock (lock_file_name, cmd, args):
+    lock_obj = locker.Locker (lock_file_name)
+    stat = os.spawnvp (os.P_WAIT, cmd, args)
+    return stat
+
+def main ():
+    (opts, args) = parse_options ()
+
+    lock_file_name = args[0]
+    cmd = args[1]
+
+    ## need to include binary too.
+    args = args[1:]
+
+
+    try:
+        stat = run_command_with_lock (lock_file_name, cmd, args)
+        sys.exit (stat)
+    except locker.LockedError:
+	print "Can't acquire lock %s" % lock_file_name
+	if opts.skip:
+	    sys.exit (0)
+	else:
+	    sys.exit (1)
+
+if __name__ == '__main__':
+    main ()
--- a/lib/config_cache.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,272 +0,0 @@
-config_cache = {
-    'local': '',
-    'all': '''
-
-# FIXME: 32 bit only
-ac_16bit_type=${ac_16bit_type=short}
-ac_32bit_type=${ac_32bit_type=int}
-ac_64bit_type=${ac_64bit_type=none}
-ac_cv_c_long_size_t=${ac_cv_c_long_size_t=no}
-ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
-ac_cv_c_stack_direction=${ac_cv_c_stack_direction=-1}
-ac_cv_func_getpgrp_void=${ac_cv_func_getpgrp_void=yes}
-ac_cv_func_select=${ac_cv_func_select=yes} # but in mingw only if winsock2.h
-ac_cv_func_setvbuf_reversed=${ac_cv_func_setvbuf_reversed=no}
-ac_cv_lib_dld_shl_load=${ac_cv_lib_dld_shl_load=no}
-ac_cv_search_dlopen=${ac_cv_search_dlopen="none required"}
-ac_cv_sizeof___int64=${ac_cv_sizeof___int64=0}
-# FIXME: 32 bit only
-ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
-ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=4}
-ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
-ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
-ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
-ac_cv_sizeof_intmax_t=${ac_cv_sizeof_intmax_t=8}
-ac_cv_sizeof_intptr_t=${ac_cv_sizeof_intptr_t=4}
-ac_cv_sizeof_long=${ac_cv_sizeof_long=4}
-ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=12}
-ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
-ac_cv_sizeof_ptrdiff_t=${ac_cv_sizeof_ptrdiff_t=4}
-ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
-ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=4}
-ac_cv_sizeof_uintptr_t=${ac_cv_sizeof_uintptr_t=4}
-ac_cv_sizeof_unsigned___int64=${ac_cv_sizeof_unsigned___int64=0}
-ac_cv_sizeof_unsigned_char=${ac_cv_sizeof_unsigned_char=1}
-ac_cv_sizeof_unsigned_int=${ac_cv_sizeof_unsigned_int=4}
-ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=4}
-ac_cv_sizeof_unsigned_long_long=${ac_cv_sizeof_unsigned_long_long=8}
-ac_cv_sizeof_unsigned_short=${ac_cv_sizeof_unsigned_short=2}
-ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=4}
-ac_cv_spinlocks=${ac_cv_spinlocks=no}
-ac_cv_sprintf_count=${ac_cv_sprintf_count=yes}
-ac_cv_sys_restartable_syscalls=${ac_cv_sys_restartable_syscalls=yes}
-
-# libtool searches not only in the cross libpath
-#     /cygwin/usr/lib:/cygwin/usr/lib/w32api:/usr/i686-cygwin/lib
-# but also in /usr/lib.  there it finds libdl.a and adds -ldl
-# to LIBS
-# it seems that libtool is broken wrt cross compilation:
-#    sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-
-lt_cv_dlopen=${lt_cv_dlopen="dlopen"}
-''',
-    'arm' : '''
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-''',
-    'mipsel' : '''
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-''',
-    'freebsd6-x86' : '''
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=no}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-lc"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib "'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib "'"}
-
-
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-
-
-libc_cv_forced_unwind=${libc_cv_forced_unwind=yes}
-libc_cv_c_cleanup=${libc_cv_c_cleanup=yes}
-
-''',
-    'linux-x86' : '''
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-
-
-
-''',
-    'linux-64' : """
-# FIXME: clean type lengths from `all' section
-unset ac_16bit_type
-unset ac_32bit_type
-unset ac_64bit_type
-unset ac_cv_c_long_size_t
-unset ac_cv_c_long_time_t
-#
-unset ac_cv_sizeof___int64
-unset ac_cv_sizeof_char
-unset ac_cv_sizeof_char_p
-unset ac_cv_sizeof_double
-unset ac_cv_sizeof_float
-unset ac_cv_sizeof_int
-unset ac_cv_sizeof_intmax_t
-unset ac_cv_sizeof_intptr_t
-unset ac_cv_sizeof_long
-unset ac_cv_sizeof_long_double
-unset ac_cv_sizeof_long_long
-unset ac_cv_sizeof_ptrdiff_t
-unset ac_cv_sizeof_short
-unset ac_cv_sizeof_size_t
-unset ac_cv_sizeof_uintptr_t
-unset ac_cv_sizeof_unsigned___int64
-unset ac_cv_sizeof_unsigned_char
-unset ac_cv_sizeof_unsigned_int
-unset ac_cv_sizeof_unsigned_long
-unset ac_cv_sizeof_unsigned_long_long
-unset ac_cv_sizeof_unsigned_short
-unset ac_cv_sizeof_void_p
-
-
-ac_16bit_type=${ac_16bit_type=short}
-ac_32bit_type=${ac_32bit_type=int}
-ac_64bit_type=${ac_64bit_type=long}
-ac_cv_c_long_size_t=${ac_cv_c_long_size_t=yes}
-ac_cv_c_long_time_t=${ac_cv_c_long_time_t=yes}
-#
-ac_cv_sizeof___int64=${ac_cv_sizeof___int64=0}
-ac_cv_sizeof_char=${ac_cv_sizeof_char=1}
-ac_cv_sizeof_char_p=${ac_cv_sizeof_char_p=8}
-ac_cv_sizeof_double=${ac_cv_sizeof_double=8}
-ac_cv_sizeof_float=${ac_cv_sizeof_float=4}
-ac_cv_sizeof_int=${ac_cv_sizeof_int=4}
-ac_cv_sizeof_intmax_t=${ac_cv_sizeof_intmax_t=8}
-ac_cv_sizeof_intptr_t=${ac_cv_sizeof_intptr_t=8}
-ac_cv_sizeof_long=${ac_cv_sizeof_long=8}
-ac_cv_sizeof_long_double=${ac_cv_sizeof_long_double=16}
-ac_cv_sizeof_long_long=${ac_cv_sizeof_long_long=8}
-ac_cv_sizeof_ptrdiff_t=${ac_cv_sizeof_ptrdiff_t=8}
-ac_cv_sizeof_short=${ac_cv_sizeof_short=2}
-ac_cv_sizeof_size_t=${ac_cv_sizeof_size_t=8}
-ac_cv_sizeof_uintptr_t=${ac_cv_sizeof_uintptr_t=8}
-ac_cv_sizeof_unsigned___int64=${ac_cv_sizeof_unsigned___int64=0}
-ac_cv_sizeof_unsigned_char=${ac_cv_sizeof_unsigned_char=1}
-ac_cv_sizeof_unsigned_int=${ac_cv_sizeof_unsigned_int=4}
-ac_cv_sizeof_unsigned_long=${ac_cv_sizeof_unsigned_long=8}
-ac_cv_sizeof_unsigned_long_long=${ac_cv_sizeof_unsigned_long_long=8}
-ac_cv_sizeof_unsigned_short=${ac_cv_sizeof_unsigned_short=2}
-ac_cv_sizeof_void_p=${ac_cv_sizeof_void_p=8}
-
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-
-""",
-    'darwin-ppc' : '''
-ac_cv_c_bigendian=${ac_cv_c_bigendian=yes}
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_type_socklen_t=${ac_cv_type_socklen_t=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
-
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
-
-
-''',
-    'linux-ppc' : '''
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="-ldl"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=32768}
-##libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib"'"}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/lib"'"}
-ac_cv_c_bigendian=${ac_cv_c_bigendian=yes}
-
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=yes}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-
-''',
-
-    'darwin-x86' : '''
-ac_cv_c_bigendian=${ac_cv_c_bigendian=no}
-ac_cv_func_posix_getpwuid_r=${ac_cv_func_posix_getpwuid_r=yes}
-ac_cv_type_socklen_t=${ac_cv_type_socklen_t=yes}
-
-glib_cv_uscore=${glib_cv_uscore=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
-
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
-''',
-
-    ## check me: ac_cv_file__dev_ptmx
-    'cygwin': '''
-ac_cv_func_mkfifo=${ac_cv_func_mkfifo=yes}
-ac_cv_have_dev_ptc=${ac_cv_have_dev_ptc=}
-ac_cv_have_dev_ptmx=${ac_cv_have_dev_ptmx=}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib/w32api %(system_root)s/lib"'"}
-''',
-    'mingw': '''
-ac_cv_func_malloc_0_nonnull=${ac_cv_func_malloc_0_nonnull=yes}
-ac_cv_func_memcmp_working=${ac_cv_func_memcmp_working=yes}
-ac_cv_func_mkfifo=${ac_cv_func_mkfifo=no}
-ac_cv_func_stat_empty_string_bug=${ac_cv_func_stat_empty_string_bug=no}
-ac_cv_have_dev_ptc=${ac_cv_have_dev_ptc=no}
-ac_cv_have_dev_ptmx=${ac_cv_have_dev_ptmx=no}
-ac_cv_file__dev_ptmx=${ac_cv_file__dev_ptmx=no}
-ac_cv_file__dev_ptc=${ac_cv_file__dev_ptc=no}
-ac_cv_lib_dl_dlopen=${ac_cv_lib_dl_dlopen=no}
-ac_cv_exeext=${ac_cv_exeext=.exe}
-ac_exeext=${ac_exeext=}
-ac_cv_type_struct_sockaddr_storage=${ac_cv_type_struct_sockaddr_storage=yes}
-ac_cv_c_c99_format=${ac_cv_c_c99_format=no}
-lt_cv_dlopen_libs=${lt_cv_dlopen_libs="none required"}
-lt_cv_sys_max_cmd_len=${lt_cv_sys_max_cmd_len=8192}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="'"%(system_root)s/usr/lib %(system_root)s/usr/lib/w32api %(system_root)s/lib"'"}
-'''
-}
-
-config_cache['debian'] = config_cache['linux-x86']
-config_cache['debian-arm'] = config_cache['arm']
-config_cache['linux-arm-softfloat'] = config_cache['arm']
-config_cache['linux-arm-vfp'] = config_cache['arm']
-config_cache['freebsd-x86'] = config_cache['freebsd6-x86']
-config_cache['freebsd4-x86'] = config_cache['freebsd6-x86']
--- a/lib/context.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,222 +0,0 @@
-import inspect
-import os
-import re
-import fnmatch
-
-def subst_method (func):
-    """Decorator to match Context.get_substitution_dict()"""
-    
-    func.substitute_me = True
-    return func
-
-def is_subst_method_in_class (method_name, klass):
-    bs = [k for k in klass.__bases__
-          if is_subst_method_in_class (method_name, k)]
-    if bs:
-        return True
-    
-    if (klass.__dict__.has_key (method_name)
-      and callable (klass.__dict__[method_name])
-      and klass.__dict__[method_name].__dict__.has_key ('substitute_me')):
-        return True
-
-    return False
-
-def typecheck_substitution_dict (d):
-    for (k, v) in d.items ():
-        if type (v) != type(''):
-            raise Exception ('type', (k, v))
-
-def recurse_substitutions (d):
-    for (k, v) in d.items ():
-        if type(v) != type(''):
-            del d[k]
-            continue
-
-        try:
-            while v.index ('%(') >= 0:
-                v = v % d
-        except ValueError:
-            pass
-        d[k] = v
-
-    return d
-
-class ConstantCall:
-    def __init__ (self, const):
-        self.const = const
-    def __call__ (self):
-        return self.const
-    
-class Context:
-    def __init__ (self, parent = None):
-        self._substitution_dict = None
-        self._parent = parent
-
-    def get_constant_substitution_dict (self):
-        d = {}
-        if self._parent:
-            d = self._parent.get_substitution_dict ()
-            d = d.copy ()
-            
-        ms = inspect.getmembers (self)
-        vars = dict((k, v) for (k, v) in ms if type (v) == type (''))
-
-        member_substs = {}
-        for (name, method) in ms:
-            try:
-                ccall = self.__dict__[name]
-                if isinstance (ccall, ConstantCall):
-                    method = ccall
-            except KeyError:
-                pass
-            
-            if (callable (method)
-                and is_subst_method_in_class (name, self.__class__)):
-                
-                val = method ()
-                self.__dict__[name] = ConstantCall (val)
-
-                member_substs[name] = val
-
-                if type (val) != type (''):
-                    print 'non string value ', val, 'for subst_method', name
-                    raise Exception
-        
-        d.update (vars)
-        d.update (member_substs)
-
-        d = recurse_substitutions (d)
-        return d
-
-    def get_substitution_dict (self, env={}):
-        if  self._substitution_dict == None:
-            self._substitution_dict = self.get_constant_substitution_dict ()
-
-        d = self._substitution_dict
-        if env:
-            d = d.copy ()
-            for (k, v) in env.items ():
-                try:
-                    if type (v) == type (''):
-                        d.update ({k: v % d})
-                except:
-                    print 'error substituting in', v
-                    print 'with', k
-                    raise 
-        return d
-    
-    def expand (self, s, env={}):
-        d = self.get_substitution_dict (env)
-        try:
-            e = s % d
-        except KeyError, v:
-            print 's=', s
-            raise v
-        except ValueError, v:
-            print 's=', s
-            raise v
-        return e
-
-class Os_context_wrapper (Context):
-    def __init__ (self, settings):
-        Context.__init__ (self, settings)
-        self.os_interface = settings.os_interface
-        self.verbose = settings.verbose ()
-        
-    def file_sub (self, re_pairs, name, to_name=None, env={}, must_succeed=False, use_re=True):
-        substs = []
-        for (frm, to) in re_pairs:
-            frm = self.expand (frm, env)
-            if type (to) ==type(''):
-                to = self.expand (to, env)
-
-            substs.append ((frm, to))
-
-        if to_name:
-            to_name = self.expand (to_name, env)
-            
-        return self.os_interface.file_sub (substs, self.expand (name, env), to_name, must_succeed, use_re=use_re)
-    
-    def log_command (self, str, env={}):
-        str = self.expand (str, env)
-        self.os_interface.log_command (str)
-        
-    def read_pipe (self, cmd, env={}, ignore_errors=False):
-        dict = self.get_substitution_dict (env)
-        return self.os_interface.read_pipe (cmd % dict, ignore_errors=ignore_errors)
-
-    def system (self, cmd, env={}, ignore_errors=False):
-        dict = self.get_substitution_dict (env)
-        cmd = self.expand (cmd, env)
-        self.os_interface.system (cmd, env=dict, ignore_errors=ignore_errors,
-                                  verbose=self.verbose)
-
-    def shadow_tree (self, src, dest):
-        src = self.expand (src)
-        dest = self.expand (dest)
-        self.os_interface.shadow_tree (src, dest)
-        
-    def dump (self, str, name, mode='w', env={},
-              expand_string=True, expand_name=True):
-        if expand_name:
-            name = self.expand (name, env)
-        if expand_string:
-            str = self.expand (str, env)
-            
-        return self.os_interface.dump (str, name, mode=mode)
-    
-    def locate_files (self, directory, pattern,
-                      include_dirs=True, include_files=True):
-        """
-        Find file using glob PATTERNs. DIRECTORY is expanded.
-
-        Results include DIRECTORY in the filenames.
-        """
-
-        ## find() is actually not portable across unices,
-        ## so we bake our own.
-        
-        directory = self.expand (directory)
-        directory = re.sub ( "/*$", '/', directory)
-        
-        results = []
-        for (root, dirs, files) in os.walk (directory):
-            relative_results = []
-            if include_dirs:
-                relative_results += dirs
-            if include_files:
-                relative_results += files
-                
-            results += [os.path.join (root, f)
-                        for f in (fnmatch.filter (relative_results, pattern))]
-
-        return results
-
-#
-# Tests.
-#
-if __name__=='__main__':
-    class TestBase(Context):
-        @subst_method
-        def bladir(self):
-            return 'foo'
-        
-    class TestClass(TestBase):
-        @subst_method
-        def name(self):
-            return self.__class__.__name__
-        
-        def bladir(self):
-            return 'derivedbladir'
-    class S: 
-        pass
-    
-    p = TestClass ()
-    import settings
-    s = settings.Settings ('debian-arm')
-    c = Os_context_wrapper (s)
-
-    print c.locate_files ('/etc/', '*.conf')
-    
-    print p.expand ('%(name)s %(bladir)s')
--- a/lib/cross.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,182 +0,0 @@
-import os
-#
-import gub
-import misc
-
-from context import subst_method 
-class CrossToolSpec (gub.BuildSpec):
-    """Package for cross compilers/linkers etc.
-    """
-
-    def configure_command (self):
-        return (gub.BuildSpec.configure_command (self)
-            + misc.join_lines ('''
---program-prefix=%(target_architecture)s-
---prefix=%(cross_prefix)s
---with-slibdir=/usr/lib
---target=%(target_architecture)s
---with-sysroot=%(system_root)s
---disable-multilib
-'''))
-
-    def compile_command (self):
-        return self.native_compile_command ()
-        
-    def install_command (self):
-        return '''make DESTDIR=%(install_root)s prefix=/usr/cross install'''
-
-#    def gub_src_uploads (self):
-#        return '%(gub_cross_uploads)s'
-
-    def get_subpackage_names (self):
-        return ['doc', '']
-    
-    def license_file (self):
-        return ''
-
-#FIXME: merge fully with specs/binutils.py
-class Binutils (CrossToolSpec):
-    def install (self):
-        CrossToolSpec.install (self)
-        self.system ('rm %(install_root)s/usr/cross/lib/libiberty.a')
-    
-#FIXME: merge fully with specs/gcc
-class Gcc (CrossToolSpec):
-    def get_build_dependencies (self):
-        return ['binutils']
-
-    @subst_method
-    def NM_FOR_TARGET(self):
-         return '%(tool_prefix)snm'
-
-    def get_subpackage_names (self):
-        # FIXME: why no -devel package?
-        return ['doc', 'runtime', '']
-
-    def languages (self):
-        return  ['c', 'c++']
-        
-    def configure_command (self):
-        cmd = CrossToolSpec.configure_command (self)
-        # FIXME: using --prefix=%(tooldir)s makes this
-        # uninstallable as a normal system package in
-        # /usr/i686-mingw/
-        # Probably --prefix=/usr is fine too
-
-        language_opt = (' --enable-languages=%s '
-                        % ','.join (self.languages ()))
-        cxx_opt = '--enable-libstdcxx-debug '
-
-        cmd += '''
---with-as=%(cross_prefix)s/bin/%(target_architecture)s-as
---with-ld=%(cross_prefix)s/bin/%(target_architecture)s-ld
---enable-static
---enable-shared '''
-
-        cmd += language_opt
-        if 'c++' in self.languages ():
-            cmd +=  ' ' + cxx_opt
-
-        return misc.join_lines (cmd)
-
-    def move_target_libs (self, libdir):
-        if not os.path.isdir (libdir):
-            return
-
-        files = []
-
-        ## .so* because version numbers trail .so extension. 
-        for suf in ['.la', '.so*', '.dylib']:
-            files += self.locate_files (libdir, 'lib*' + suf)
-            
-        for f in files:
-            (dir, file) = os.path.split (f)
-            target = self.expand ('%(install_prefix)s/%(dir)s', locals ())
-            if not os.path.isdir (target):
-                os.makedirs (target)
-            self.system ('mv %(f)s %(install_prefix)s/lib', locals ())
-
-    def install (self):
-        CrossToolSpec.install (self)
-        old_libs = self.expand ('%(install_root)s/usr/cross/%(target_architecture)s')
-
-        self.move_target_libs (old_libs)
-        self.move_target_libs (self.expand ('%(install_root)s/usr/cross/lib'))
-        if os.path.exists (self.expand ('cd %(install_root)s/usr/lib/libgcc_s.so.1')):
-            # FIXME: .so senseless for darwin.
-            self.system ('''
-cd %(install_root)s/usr/lib && ln -fs libgcc_s.so.1 libgcc_s.so
-''')
-
-def change_target_package (package):
-    pass
-
-def set_cross_dependencies (package_object_dict):
-    packs = package_object_dict.values ()
-    cross_packs = [p for p in packs if isinstance (p, CrossToolSpec)]
-    sdk_packs = [p for p in packs if isinstance (p, gub.SdkBuildSpec)]
-    other_packs = [p for p in packs if (not isinstance (p, CrossToolSpec)
-                                        and not isinstance (p, gub.SdkBuildSpec)
-                                        and not isinstance (p, gub.BinarySpec))]
-    
-    sdk_names = [s.name() for s in sdk_packs]
-    cross_names = [s.name() for s in cross_packs]
-    for p in other_packs:
-        old_callback = p.get_build_dependencies
-        p.get_build_dependencies = misc.MethodOverrider (old_callback,
-                                                         lambda x,y: x+y, (cross_names,))
-
-    for p in other_packs + cross_packs:
-        old_callback = p.get_build_dependencies
-        p.get_build_dependencies = misc.MethodOverrider (old_callback,
-                                                         lambda x,y: x+y, (sdk_names,))
-
-    return packs
-
-cross_module_checksums = {}
-cross_module_cache = {}
-def get_cross_module (platform):
-    base = platform
-    try:
-        base = {
-            'darwin-ppc':'darwintools',
-            'darwin-x86':'darwintools',
-            'freebsd-x86': 'freebsd',
-            'freebsd4-x86': 'freebsd',
-            'freebsd6-x86': 'freebsd',
-            'linux-ppc' : 'linux',
-            'linux-x86' : 'linux',
-            'linux-64' : 'linux',
-            'local':'tools'}[platform]
-    except KeyError:
-        pass
-
-    if cross_module_cache.has_key (platform):
-        return cross_module_cache[platform]
-    
-    desc = ('.py', 'U', 1)
-    file_name = 'lib/%s.py' % base
-    file = open (file_name)
-    print 'module-name: ' + file_name
-    import imp
-    module = imp.load_module (base, file, file_name, desc)
-
-    import md5
-    cross_module_checksums[platform] = md5.md5 (open (file_name).read ()).hexdigest ()
-    cross_module_cache[platform] = module
-    return module
-
-def get_cross_packages (settings):
-    mod = get_cross_module (settings.platform)
-    return mod.get_cross_packages (settings)
-
-def get_build_dependencies (settings):
-    mod = get_cross_module (settings.platform)
-    return mod.get_cross_build_dependencies (settings)
-
-def get_cross_checksum (platform):
-    try:
-        return cross_module_checksums[platform]
-    except KeyError:
-        print 'No cross module found'
-        return '0000'
--- a/lib/cygwin.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,381 +0,0 @@
-import os
-import re
-
-from new import classobj
-from new import instancemethod
-#
-import cross
-import mirrors
-import gub
-import gup
-import mingw
-import misc
-
-# FIXME: setting binutil's tooldir and/or gcc's gcc_tooldir may fix
-# -luser32 (ie -L .../w32api/) problem without having to set LDFLAGS.
-class Binutils (cross.Binutils):
-    def makeflags (self):
-        return misc.join_lines ('''
-tooldir="%(cross_prefix)s/%(target_architecture)s"
-''')
-    def compile_command (self):
-        return (cross.Binutils.compile_command (self)
-                + self.makeflags ())
-    def configure_command (self):
-        return ( cross.Binutils.configure_command (self)
-                 + ' --disable-werror ')
-
-class W32api_in_usr_lib (gub.BinarySpec, gub.SdkBuildSpec):
-    def get_build_dependencies (self):
-        return ['w32api']
-
-    def install (self):
-        self.system ('mkdir -p %(install_root)s/usr/lib')
-        self.system ('''
-tar -C %(system_root)s/usr/lib/w32api -cf- . | tar -C %(install_root)s/usr/lib -xf-
-''')
-
-class Libtool_fixup (gub.NullBuildSpec):
-    def get_build_dependencies (self):
-        return ['libtool']
-    def untar (self):
-        self.file_sub ([('/usr/bin/sed', '/bin/sed')],
-                       '%(system_root)s/usr/bin/libtool')
-
-class Gcc (mingw.Gcc):
-    def get_build_dependencies (self):
-        return (mingw.Gcc.get_build_dependencies (self)
-                + ['cygwin', 'w32api-in-usr-lib'])
-    def makeflags (self):
-        return misc.join_lines ('''
-tooldir="%(cross_prefix)s/%(target_architecture)s"
-gcc_tooldir="%(cross_prefix)s/%(target_architecture)s"
-''')
-    def compile_command (self):
-        return (mingw.Gcc.compile_command (self)
-                + self.makeflags ())
-
-    def configure_command (self):
-        return (mingw.Gcc.configure_command (self)
-                + misc.join_lines ('''
---with-newlib
---enable-threads
-'''))
-
-
-def untar_cygwin_src_package_variant2 (self, file_name, split=False):
-    '''Unpack this unbelievably broken version of Cygwin source packages.
-
-foo[version][-split]-x.y.z-b.tar.bz2 contains
-foo[-split]-x.y.z.tar.[bz2|gz] and foo[version]-x.y.z-b.patch
-(and optionally foo[version]-x.y.z-b.patch2 ...).
-foo-x.y.z.tar.[bz2|gz] contains foo-x.y.z.  The patch contains patches
-against all foo split source balls, so applying it may fail partly and
-complain about missing files.'''
-
-    file_name = self.expand (file_name)
-    import misc
-    t = misc.split_ball (file_name)
-    print 'split: ' + `t`
-    no_src = re.sub ('-src', '', file_name)
-    base = re.sub ('\.tar\..*', '', no_src)
-    # FIXME: use split iso custom ball_re macramee
-    ball_re = '^([a-z]+)([.0-9]+)?(-[a-z+]+)?(.*)(-[0-9]+)'
-    m = re.match (ball_re, base)
-    if m.group (3):
-        second_tarball = re.sub (ball_re, '\\1\\3\\4', base)
-    else:
-        second_tarball = re.sub (ball_re, '\\1\\4', base)
-    print 'second_tarball: ' + second_tarball
-    if split and m.group (3):
-        second_tarball_contents = re.sub (ball_re, '\\1\\3\\4', base)
-    else:
-        second_tarball_contents = re.sub (ball_re, '\\1\\4', base)
-    print 'second_tarball_contents: ' + second_tarball_contents
-    flags = '-jxf'
-    self.system ('''
-rm -rf %(allsrcdir)s/%(base)s
-tar -C %(allsrcdir)s %(flags)s %(downloads)s/%(file_name)s
-''',
-                 locals ())
-    tgz = 'tar.bz2'
-    if not os.path.exists (self.expand ('%s(allsrcdir)s/%(second_tarball)s.%(tgz)s',
-                                        locals ())):
-        flags = '-zxf'
-        tgz = 'tar.gz'
-    self.system ('''
-tar -C %(allsrcdir)s %(flags)s %(allsrcdir)s/%(second_tarball)s.%(tgz)s
-''',
-                 locals ())
-    if split:
-        return
-    if m.group (2):
-        patch = re.sub (ball_re, '\\1\\2\\4\\5.patch', base)
-    else:
-        patch = re.sub (ball_re, '\\1\\4\\5.patch', base)
-    print 'patch: ' + patch
-    self.system ('''
-cd %(allsrcdir)s && mv %(second_tarball_contents)s %(base)s
-cd %(srcdir)s && patch -p1 -f < %(allsrcdir)s/%(patch)s || true
-''',
-                 locals ())
-
-class Gcc_core (Gcc):
-    def untar (self):
-        gxx_file_name = re.sub ('-core', '-g++',
-                                self.expand (self.file_name ()))
-        untar_cygwin_src_package_variant2 (self, gxx_file_name, split=True)
-        untar_cygwin_src_package_variant2 (self, self.file_name ())
-
-# download-only package
-class Gcc_gxx (gub.NullBuildSpec):
-    pass
-
-mirror = 'http://mirrors.kernel.org/sourceware/cygwin'
-def get_cross_packages (settings):
-    import linux
-    cross_packs = [
-        Binutils (settings).with (version='2.17', format='bz2', mirror=mirrors.gnu),
-        W32api_in_usr_lib (settings).with (version='1.0',  strip_components=0),
-        Gcc (settings).with (version='4.1.1', mirror=mirrors.gcc_41, format='bz2'),
-        linux.Freetype_config (settings).with (version='2.1.9'),
-        linux.Python_config (settings).with (version='2.4.3'),
-# FIXME: using the binary libtool package is quite involved, it has
-# names of tools hardcoded and wrong (LD, NM, SED, GCC, GREP, ...)
-#        Libtool_fixup (settings).with (version='1.0'),
-        ]
-    return cross_packs
-
-def change_target_package (package):
-    cross.change_target_package (package)
-    package.get_build_dependencies \
-            = misc.MethodOverrider (package.get_build_dependencies,
-                                    lambda d, extra: d + extra, (['cygwin'],))
-
-    def cyg_defs (d):
-        k = 'runtime'
-        if not d.has_key (k):
-            k = ''
-        d[k].append ('/usr/bin/cyg*dll')
-        d[k].append ('/etc/postinstall')
-        return d
-
-    package.get_subpackage_definitions \
-        = misc.MethodOverrider (package.get_subpackage_definitions, cyg_defs)
-
-    def enable_static (d):
-        return d.replace ('--disable-static', '--enable-static')
-
-    package.configure_command \
-        = misc.MethodOverrider (package.configure_command, enable_static)
-
-    def install (whatsthis, lst):
-	package = lst[0]
-        package.post_install_smurf_exe ()
-        package.install_readmes ()
-
-    package.install \
-        = misc.MethodOverrider (package.install, install, ([package],))
-
-    ## TODO : get_dependency_dict
-        
-    # FIXME: why do cross packages get here too?
-    if isinstance (package, cross.CrossToolSpec):
-        return package
-        
-    gub.change_target_dict (package, {
-            'DLLTOOL': '%(tool_prefix)sdlltool',
-            'DLLWRAP': '%(tool_prefix)sdllwrap',
-            'LDFLAGS': '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api',
-            })
-
-def get_cygwin_package (settings, name, dict, skip):
-    cross = [
-        'base-passwd', 'bintutils',
-        'gcc', 'gcc-core', 'gcc-g++',
-        'gcc-mingw', 'gcc-mingw-core', 'gcc-mingw-g++',
-        'gcc-runtime', 'gcc-core-runtime',
-        ]
-    cycle = ['base-passwd']
-    # FIXME: These packages are not needed for [cross] building,
-    # but most should stay as distro's final install dependency.
-    unneeded = [
-        'autoconf', 'autoconf2.13', 'autoconf2.50', 'autoconf2.5',
-        'automake', 'automake1.9',
-        'ghostscript-base', 'ghostscript-x11',
-        '-update-info-dir',
-        'libguile12', 'libguile16',
-        'libxft', 'libxft1', 'libxft2',
-        'libbz2-1',
-        'perl',
-        'tcltk',
-        'x-startup-scripts',
-        'xorg-x11-bin-lndir',
-        'xorg-x11-etc',
-        'xorg-x11-fnts',
-        'xorg-x11-libs-data',
-        ]
-    blacklist = cross + cycle + skip + unneeded
-    if name in blacklist:
-        name += '::blacklisted'
-    package_class = classobj (name, (gub.BinarySpec,), {})
-    package = package_class (settings)
-    package.name_dependencies = []
-    if dict.has_key ('requires'):
-        deps = re.sub ('\([^\)]*\)', '', dict['requires']).split ()
-        deps = [x.strip ().lower ().replace ('_', '-') for x in deps]
-
-        deps = filter (lambda x: x not in blacklist, deps)
-        package.name_dependencies = deps
-
-    def get_build_dependencies (self):
-        return self.name_dependencies
-    package.get_build_dependencies = instancemethod (get_build_dependencies,
-                                                     package, package_class)
-    package.ball_version = dict['version']
-    package.url = (mirror + '/' + dict['install'].split ()[0])
-    package.format = 'bz2'
-    import repository
-    package.vc_repository = repository.TarBall (settings.downloads,
-                                                package.url,
-                                                package.ball_version,
-                                                strip_components=0)
-    return package
-
-## UGH.   should split into parsing  package_file and generating gub specs.
-def get_cygwin_packages (settings, package_file, skip=[]):
-    dist = 'curr'
-
-    dists = {'test': [], 'curr': [], 'prev' : []}
-    chunks = open (package_file).read ().split ('\n\n@ ')
-    for i in chunks[1:]:
-        lines = i.split ('\n')
-        name = lines[0].strip ()
-        name = name.lower ()
-        packages = dists['curr']
-        records = {
-            'sdesc': name,
-            'version': '0-0',
-            'install': 'urg 0 0',
-            }
-        j = 1
-        while j < len (lines) and lines[j].strip ():
-            if lines[j][0] == '#':
-                j = j + 1
-                continue
-            elif lines[j][0] == '[':
-                packages.append (get_cygwin_package (settings, name,
-                                                     records.copy (),
-                                                     skip))
-                packages = dists[lines[j][1:5]]
-                j = j + 1
-                continue
-
-            try:
-                key, value = [x.strip () for x in lines[j].split (': ', 1)]
-            except:
-                print lines[j], package_file
-                raise 'URG'
-            if (value.startswith ('"')
-              and value.find ('"', 1) == -1):
-                while 1:
-                    j = j + 1
-                    value += '\n' + lines[j]
-                    if lines[j].find ('"') != -1:
-                        break
-            records[key] = value
-            j = j + 1
-        packages.append (get_cygwin_package (settings, name, records, skip))
-
-    # debug
-    names = [p.name () for p in dists[dist]]
-    names.sort ()
-    return dists[dist]
-
-# FIXME: this really sucks, should translate or something
-# There also is the problem that gub build-dependencies
-# use unsplit packages.
-guile_source = [
-    'guile',
-    'guile-devel',
-    'libguile17',
-    ]
-fontconfig_source = [
-    'fontconfig',
-    'libfontconfig1',
-    'libfontconfig-devel',
-    'fontconfig-devel',
-    ]
-libtool_source = [
-    'libltdl3',
-    'libtool',
-    'libtool1.5',
-    ]
-
-## FIXME: c&p debian.py
-class Dependency_resolver:
-    def __init__ (self, settings):
-        self.settings = settings
-        self.packages = {}
-        self.source = fontconfig_source + guile_source + libtool_source
-        self.load_packages ()
-        
-    def grok_setup_ini (self, file, skip=[]):
-        for p in get_cygwin_packages (self.settings, file, skip):
-            self.packages[p.name ()] = p
-
-    def load_packages (self):
-        url = mirror + '/setup.ini'
-
-        # FIXME: download/offline update
-        file = self.settings.downloads + '/setup.ini'
-        if not os.path.exists (file):
-            misc.download_url (url, self.settings.downloads)
-            # arg
-            # self.file_sub ([('\':"', "':'")], file)
-            s = open (file).read ()
-            open (file, 'w').write (s.replace ('\':"', "':'"))
-        self.grok_setup_ini (file, self.source)
-
-        # support one extra local setup.ini, that overrides the default
-        local_file = self.settings.uploads + '/cygwin/setup.ini'
-        if os.path.exists (local_file):
-            ## FIXME: using the generated setup.ini to install the
-            ## actual to be distributed cygwin packages with cygwin
-            ## names does not work.
-            ##
-            ## After building gub installs the gub packages, using GUB
-            ## naming.
-            #self.grok_setup_ini (local_file)
-            self.grok_setup_ini (local_file, self.source)
-
-    def get_packages (self):
-        return self.packages
-        
-dependency_resolver = None
-
-def init_dependency_resolver (settings):
-    global dependency_resolver
-    dependency_resolver = Dependency_resolver (settings)
-
-def get_packages ():
-    return dependency_resolver.get_packages ()
-
-gub_to_distro_dict = {
-    'expat-devel': ['expat'],
-    'fontconfig-runtime' : ['libfontconfig1'],
-    'fontconfig-devel' : ['libfontconfig-devel'],
-    'freetype' : ['libfreetype26'],
-    'freetype-devel' : ['libfreetype2-devel'],
-    'gettext' : ['libintl8', 'libintl3'],
-    'gmp-devel': ['gmp'],
-    'guile-runtime' : ['libguile17', 'libguile12'],
-#    'libtool': ['libtool1.5'],
-    'libtool-runtime': ['libltdl3'],
-    'libiconv-devel': ['libiconv2'],
-    'pango': ['pango-runtime'],
-    'python-devel': ['python'],
-    'python-runtime': ['python'],
-    'texlive-devel': ['libkpathsea-devel'],
-    'texlive-runtime': ['libkpathsea4']
-    }
--- a/lib/darwintools.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,317 +0,0 @@
-import glob
-import re
-import os
-import misc
-import context
-import cross
-import mirrors
-import gub
-import repository
-
-darwin_sdk_version = '0.4'
-class Odcctools (cross.CrossToolSpec):
-    def configure (self):
-        cross.CrossToolSpec.configure (self)
-
-        ## remove LD64 support.
-        self.file_sub ([('ld64','')],
-                       self.builddir () + '/Makefile')
-
-## change to sdk package
-class Python (gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.NullBuildSpec.__init__ (self, settings)
-        self.version = (lambda: '2.3')
-        self.vc_branch = ''
-        self.format = ''
-        self.has_source = False
-
-    def srcdir (self):
-        return '%(allsrcdir)s/python-darwin'
-
-    def package (self):
-        gub.BuildSpec.package (self)
-        
-    def install (self):
-        self.system ('mkdir -p %(install_root)s/usr/cross/bin/')
-        self.dump ('''#!/bin/sh
-if test "$1" == "--cflags"; then
-  echo "-I%(system_root)s/System/Library/Frameworks/Python.framework/Versions/%(version)s/include/python%(version)s"
-fi
-if test "$1" == "--ldflags"; then
-  echo ""
-fi
-''', '%(install_root)s/usr/cross/bin/python-config')
-        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
-        
-class Darwin_sdk (gub.SdkBuildSpec):
-    def patch (self):
-        self.system ('''
-rm %(srcdir)s/usr/lib/libgcc*
-rm %(srcdir)s/usr/lib/libstdc\+\+*
-rm %(srcdir)s/usr/lib/libltdl*
-rm %(srcdir)s/usr/include/ltdl.h
-rm -f %(srcdir)s/usr/lib/gcc/*-apple-darwin*/*/*dylib
-rm -rf %(srcdir)s/usr/lib/gcc
-''')
-
-        ## ugh, need to have gcc/3.3/machine/limits.h
-        ### self.system ('rm -rf %(srcdir)s/usr/include/gcc')
-        ##self.system ('rm -rf %(srcdir)s/usr/include/machine/limits.h')
-
-        ## limits.h symlinks into GCC.
-        
-        pat = self.expand ('%(srcdir)s/usr/lib/*.la')
-        for a in glob.glob (pat):
-            self.file_sub ([(r' (/usr/lib/.*\.la)', r'%(system_root)s\1')], a)
-
-
-class Gcc (cross.Gcc):
-    def patch (self):
-        self.file_sub ([('/usr/bin/libtool', '%(cross_prefix)s/bin/%(target_architecture)s-libtool')],
-                       '%(srcdir)s/gcc/config/darwin.h')
-
-        self.file_sub ([('--strip-underscores', '--strip-underscore')],
-                       "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl")
-
-    def configure_command (self):
-        c = cross.Gcc.configure_command (self)
-#                c = re.sub ('enable-shared', 'disable-shared', c)
-        return c
-    
-
-    def configure (self):
-        cross.Gcc.configure (self)
-
-    def rewire_gcc_libs (self):
-        skip_libs = ['libgcc_s']
-        for l in self.locate_files ("%(install_root)s/usr/lib/", '*.dylib'):
-            found_skips = [s for s in  skip_libs if l.find (s) >= 0]
-            if found_skips:
-                continue
-            
-            id = self.read_pipe ('%(tool_prefix)sotool -L %(l)s', locals ()).split()[1]
-            id = os.path.split (id)[1]
-            self.system ('%(tool_prefix)sinstall_name_tool -id /usr/lib/%(id)s %(l)s', locals ())
-        
-    def install (self):
-        cross.Gcc.install (self)
-        self.rewire_gcc_libs ()
-
-    def get_build_dependencies (self):
-        return ['odcctools']
-    
-class Gcc__darwin (Gcc):
-    def configure (self):
-        cross.Gcc.configure (self)
-
-    def install (self):
-        ## UGH ?
-        ## Gcc.install (self)
-
-        cross.Gcc.install (self)
-        self.rewire_gcc_libs ()
-        
-class Rewirer (context.Os_context_wrapper):
-    def __init__ (self, settings):
-        context.Os_context_wrapper.__init__ (self,settings)
-        self.ignore_libs = None
-
-    def get_libaries (self, name):
-        lib_str = self.read_pipe ('''
-%(cross_prefix)s/bin/%(target_architecture)s-otool -L %(name)s
-''',
-                     locals (), ignore_errors=True)
-
-        libs = []
-        for l in lib_str.split ('\n'):
-            m = re.search (r"\s+(.*) \(.*\)", l)
-            if not m:
-                continue
-            if self.ignore_libs.has_key (m.group (1)):
-                continue
-
-            libs.append (m.group (1))
-
-        return libs
-
-    def rewire_mach_o_object (self, name, substitutions):
-        if not substitutions:
-            return
-        changes = ' '.join (['-change %s %s' % (o, d)
-                  for (o, d) in substitutions])
-        self.system ('''
-%(cross_prefix)s/bin/%(target_architecture)s-install_name_tool %(changes)s %(name)s ''',
-              locals ())
-
-    def rewire_mach_o_object_executable_path (self, name):
-        orig_libs = ['/usr/lib']
-
-        libs = self.get_libaries (name)
-        subs = []
-        for l in libs:
-
-            ## ignore self.
-            print os.path.split (l)[1], os.path.split (name)[1]
-            
-            if os.path.split (l)[1] == os.path.split (name)[1]:
-                continue
-            
-            for o in orig_libs:
-                if re.search (o, l):
-                    newpath = re.sub (o, '@executable_path/../lib/', l); 
-                    subs.append ((l, newpath))
-                elif l.find (self.expand ('%(targetdir)s')) >= 0:
-                    print 'found targetdir in linkage', l
-                    raise 'abort'
-
-        self.rewire_mach_o_object (name, subs)
-
-    def rewire_binary_dir (self, dir):
-        if not os.path.isdir (dir):
-            print dir
-            raise 'Not a directory'
-
-        (root, dirs, files) = os.walk (dir).next ()
-        files = [os.path.join (root, f) for f in files]
-
-        skip_libs = ['libgcc_s']
-        for f in files:
-            found_skips = [s for s in  skip_libs if f.find (s) >= 0]
-            if found_skips:
-                continue
-
-            if os.path.isfile (f):
-                self.rewire_mach_o_object_executable_path(f)
-
-    def set_ignore_libs_from_tarball (self, tarball):
-        file_str = self.read_pipe ('tar tzf %(tarball)s', locals())
-        files = file_str.split ('\n')
-        self.set_ignore_libs_from_files (files)
-        
-    def set_ignore_libs_from_files (self, files):
-        self.ignore_libs = dict ((k.strip()[1:], True)
-             for k in files
-             if re.match (r'^\./usr/lib/', k))
-
-    def rewire_root (self, root):
-        if self.ignore_libs == None:
-            raise 'error: should init with file_manager.'
-
-        self.rewire_binary_dir (root + '/usr/lib')
-        for d in glob.glob (root + '/usr/lib/pango/*/modules/'):
-            self.rewire_binary_dir (d)
-
-        self.rewire_binary_dir (root + '/usr/bin')
-
-class Package_rewirer:
-    def __init__ (self, rewirer, package):
-        self.rewirer = rewirer
-        self.package = package
-
-    def rewire (self):
-        self.rewirer.rewire_root (self.package.install_root ())
-
-def get_cross_packages (settings):
-    packages = []
-
-    sdk = Darwin_sdk (settings)
-
-    os_version = 7
-    if settings.platform == 'darwin-x86':
-        os_version = 8
-
-    sdk.vc_repository = repository.TarBall (settings.downloads,
-                                            url='http://lilypond.org/download/gub-sources/darwin%d-sdk-0.4.tar.gz' % os_version,
-                                            version='0.4')
-
-
-    packages.append (sdk)
-    packages.append (Python (settings))
-        
-    packages += [Odcctools (settings).with (version='20060413',
-#    packages += [Odcctools (settings).with (version='20060608',
-                                            mirror=mirrors.opendarwin,
-                                            format='bz2')]
-
-    if settings.target_architecture.startswith ("powerpc"):
-        packages.append (Gcc (settings).with (version='4.1.1',
-                                              mirror=mirrors.gcc_41,
-                                              format='bz2'))
-    else:
-        packages.append (Gcc (settings).with (version='4.2-20070207',
-                                              mirror=mirrors.gcc_snap,
-                                              format='bz2'))
-
-    return packages
-
-def strip_build_dep (old_val, what):
-    deps = old_val
-
-    for w in what:
-        if w in deps:
-            deps.remove (w)
-    deps.sort()
-    return deps                     
-
-    
-def strip_dependency_dict (old_val, what):
-    d = dict((k,[p for p in deps if p not in what])
-             for (k, deps) in old_val.items ())
-
-    return d
-
-def change_target_package (p):
-    cross.change_target_package (p)
-    p.get_build_dependencies = misc.MethodOverrider (p.get_build_dependencies,
-                                                     strip_build_dep, (['zlib', 'zlib-devel'],))
-    p.get_dependency_dict = misc.MethodOverrider (p.get_dependency_dict,
-                                                  strip_dependency_dict, (['zlib', 'zlib-devel'],))
-    gub.change_target_dict (p, {
-
-            ## We get a lot of /usr/lib/ -> @executable_path/../lib/
-            ## we need enough space in the header to do these relocs.
-            'LDFLAGS': '-Wl,-headerpad_max_install_names ',
-
-            ## UGH: gettext fix for ptrdiff_t
-            'CPPFLAGS' : '-DSTDC_HEADERS',
-            })
-
-        
-def system (c):
-    s = os.system (c)
-    if s:
-        raise 'barf'
-
-def get_darwin_sdk ():
-    def system (s):
-        print s
-        if os.system (s):
-            raise 'barf'
-        
-    host  = 'maagd'
-    version = '0.4'
-    darwin_version  = 8
-
-    dest =        'darwin%(darwin_version)d-sdk-%(version)s' % locals()
-    
-    system ('rm -rf %s' % dest)
-    os.mkdir (dest)
-    
-    src = '/Developer/SDKs/'
-
-    if darwin_version == 7:
-        src += 'MacOSX10.3.9.sdk'
-    else:
-        src += 'MacOSX10.4u.sdk'
-    
-    cmd =  ('rsync -a -v %s:%s/ %s/ ' % (host, src, dest))
-    system (cmd)
-    system ('chmod -R +w %s '  % dest)
-    system ('tar cfz %s.tar.gz %s '  % (dest, dest))
-
-if __name__== '__main__':
-    import sys
-    if len (sys.argv) > 1:
-        get_darwin_sdk ()
-
--- a/lib/debian-arm.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-import os
-import re
-#
-import cross
-import mirrors
-import gub
-import linux
-import misc
-import targetpackage
-
-class Debian_arm_runtime (gub.BinarySpec, gub.SdkBuildSpec):
-    pass
-
-def get_cross_packages (settings):
-    import debian
-    return debian.get_cross_packages (settings)
-    #return get_cross_packages_pre_eabi (settings)
-
-def get_cross_packages_pre_eabi (settings):
-    binutils_version = '2.16.1'
-    gcc_version = '3.4.3' # only change
-    guile_version = '1.6.7'
-    kernel_version = '2.5.999-test7-bk-17'
-    libc6_version = '2.3.2.ds1-22sarge4'
-    python_version = '2.4.1'
-    import debian
-    return debian._get_cross_packages (settings,
-                                       binutils_version, gcc_version,
-                                       guile_version,
-                                       kernel_version, libc6_version,
-                                       python_version)
-
-def change_target_package (p):
-    cross.change_target_package (p)
-    return p
--- a/lib/debian.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,300 +0,0 @@
-import glob
-import os
-import re
-import string
-#
-import cross
-import mirrors
-import gup
-import gub
-import linux
-import misc
-import settings
-
-from new import classobj
-from new import instancemethod
-
-mirror = 'http://ftp.de.debian.org/debian'
-
-class Libc6 (gub.BinarySpec, gub.SdkBuildSpec):
-    def untar (self):
-        gub.BinarySpec.untar (self)
-        # Ugh, rewire absolute names and symlinks.
-        i = self.expand ('%(srcdir)s/lib64')
-        if os.path.islink (i):
-            s = os.readlink (i)
-            if s.startswith ('/'):
-                os.remove (i)
-                os.symlink (s[1:], i)
-
-    def patch (self):
-        self.system ('cd %(srcdir)s && rm -rf usr/sbin/ sbin/ bin/ usr/bin')
-
-class Libc6_dev (gub.BinarySpec, gub.SdkBuildSpec):
-    def untar (self):
-        gub.BinarySpec.untar (self)
-        # FIXME: this rewiring breaks ld badly, it says
-        #     i686-linux-ld: cannot find /home/janneke/bzr/gub/target/i686-linux/system/lib/libc.so.6 inside /home/janneke/bzr/gub/target/i686-linux/system/
-        # although that file exists.  Possibly rewiring is not necessary,
-        # but we can only check on non-linux platform.
-        # self.file_sub ([(' /', ' %(system_root)s/')],
-        #               '%(srcdir)s/root/usr/lib/libc.so')
-
-        for i in ('pthread.h', 'bits/sigthread.h'):
-            self.file_sub ([('__thread', '___thread')],
-                           '%(srcdir)s/usr/include/%(i)s',
-                           env=locals ())
-            
-        self.system ('rm -rf  %(srcdir)s/usr/include/asm/  %(srcdir)s/usr/include/linux ')
-            
-class Linux_kernel_headers (gub.BinarySpec, gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.BinarySpec.__init__ (self, settings)
-        self.with (version='2.5.999-test7-bk-17',
-                   strip_components=0,
-                   mirror=mirrors.lilypondorg_deb,
-                   format='deb')
-    def get_subpackage_names (self):
-        return ['']
-
-class Libdbi0_dev (gub.BinarySpec, gub.SdkBuildSpec):
-    pass
-
-class Libqt4_dev (gub.BinarySpec, gub.SdkBuildSpec):
-    def untar (self):
-        gub.BinarySpec.untar (self)
-        for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
-            self.file_sub ([('includedir', 'deepqtincludedir')],
-                           '%(srcdir)s/usr/lib/pkgconfig/%(i)s',
-                           env=locals ())
-
-class Gcc (cross.Gcc):
-    def patch (self):
-        cross.Gcc.patch (self)
-        # KUCH
-        if self.vc_repository._version == '4.1.1':
-            self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch
-''')
-        # KUCH, KUCH
-        if (self.vc_repository._version == '3.4.3'
-            and self.settings.platform == 'arm'):
-            self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.3-arm-softvfp-jcn.patch
-''')
-        
-
-    ## TODO: should detect whether libc supports TLS 
-    def configure_command (self):
-        return cross.Gcc.configure_command (self) + ' --disable-tls '
-
-# http://ftp.de.debian.org/debian/pool/main/l/linux-kernel-headers/
-
-def _get_cross_packages (settings,
-                         binutils_version, gcc_version,
-                         guile_version, kernel_version, libc6_version,
-                         python_version):
-    configs = []
-    if not settings.platform.startswith ('linux'):
-        configs = [
-            linux.Guile_config (settings).with (version=guile_version),
-            linux.Python_config (settings).with (version=python_version),
-            ]
-
-    return [
-        Libc6 (settings).with (version=libc6_version, strip_components=0,
-                               mirror=mirrors.lilypondorg_deb, format='deb'),
-        Libc6_dev (settings).with (version=libc6_version, strip_components=0,
-                                   mirror=mirrors.lilypondorg_deb,
-                                   format='deb'),
-        Linux_kernel_headers (settings).with (version=kernel_version,
-                                              strip_components=0,
-                                              mirror=mirrors.lilypondorg_deb,
-                                              format='deb'),
-        
-        cross.Binutils (settings).with (version=binutils_version,
-                                        format='bz2', mirror=mirrors.gnu),
-        Gcc (settings).with (version=gcc_version,
-                             mirror=mirrors.gcc, format='bz2'),
-        ] + configs
-
-# FIXME: determine libc6_version, kernel_version from
-# Packages/Dependency_resolver.
-def get_cross_packages_stable (settings):
-    binutils_version = '2.16.1'
-    gcc_version = '4.1.1'
-    guile_version = '1.6.7'
-    kernel_version = '2.5.999-test7-bk-17'
-    libc6_version = '2.3.2.ds1-22sarge4'
-    python_version = '2.4.1'
-    return _get_cross_packages (settings,
-                                binutils_version, gcc_version,
-                                guile_version, kernel_version, libc6_version,
-                                python_version)
-
-# FIXME: determine libc6_version, kernel_version from
-# Packages/Dependency_resolver.
-def get_cross_packages_unstable (settings):
-    binutils_version = '2.16.1'
-    gcc_version = '4.1.1'
-    guile_version = '1.8.0'
-    kernel_version = '2.6.18-6'
-    libc6_version = '2.3.6.ds1-9'
-    python_version = '2.4.1'
-    return _get_cross_packages (settings,
-                                binutils_version, gcc_version,
-                                guile_version, kernel_version, libc6_version,
-                                python_version)
-
-def get_cross_packages (settings):
-    if settings.debian_branch == 'stable':
-        return get_cross_packages_stable (settings)
-    return get_cross_packages_unstable (settings)
-
-def change_target_package (p):
-    cross.change_target_package (p)
-
-def get_debian_packages (settings, package_file):
-    if settings.verbose:
-        print ('parsing: %s...' % package_file)
-    return map (lambda j: get_debian_package (settings, j),
-          open (package_file).read ().split ('\n\n')[:-1])
-
-def get_debian_package (settings, description):
-    s = description[:description.find ('\nDescription')]
-    d = dict (map (lambda line: line.split (': ', 1),
-           map (string.strip, s.split ('\n'))))
-    # FIXME: should blacklist toplevel gub-builder.py argument iso lilypond
-    blacklist = [
-        'binutils',
-        'cpp',
-        'gcc-3.3',
-        'cpp-3.3',
-        'gcc',
-        'gcc-3.4',
-        'libgcc1',
-        'libgcc1-3.4',
-        'lilypond',
-        'libstdc++6',
-        'libstdc++-dev',
-        'libtool',
-        'perl',
-        'perl-modules',
-        'perl-base',
-#        'pkg-config',
-        ]
-    if d['Package'] in blacklist:
-        d['Package'] += '::blacklisted'
-    package_class = classobj (d['Package'], (gub.BinarySpec,), {})
-    package = package_class (settings)
-    package.name_dependencies = []
-    if d.has_key ('Depends'):
-        deps = map (string.strip,
-              re.sub ('\([^\)]*\)', '',
-                  d['Depends']).split (', '))
-        # FIXME: BARF, ignore choices
-        deps = filter (lambda x: x.find ('|') == -1, deps)
-        # FIXME: how to handle Provides: ?
-        # FIXME: BARF, fixup libc Provides
-        deps = map (lambda x: re.sub ('libc($|-)', 'libc6\\1', x), deps)
-        deps = map (lambda x: re.sub ('liba52-dev', 'liba52-0.7.4-dev', x), deps)
-        deps = map (lambda x: re.sub ('libpng12-0-dev', 'libpng12-dev', x), deps)
-        # FIXME: ugh, skip some
-        deps = filter (lambda x: x not in blacklist, deps)
-        package.name_dependencies = deps
-
-    def get_build_dependencies (self):
-        return self.name_dependencies
-    package.get_build_dependencies = instancemethod (get_build_dependencies,
-                                                     package, package_class)
-    package.ball_version = d['Version']
-    package.url = mirror + '/' + d['Filename']
-    package.format = 'deb'
-
-    import repository
-    package.vc_repository = repository.TarBall (settings.downloads,
-                                                package.url,
-                                                package.ball_version,
-                                                strip_components=0)
-    return package
-
-## FIXME: c&p cygwin.py
-class Dependency_resolver:
-    def __init__ (self, settings):
-        self.settings = settings
-        self.packages = {}
-        self.load_packages ()
-        
-    def grok_packages_file (self, file):
-        for p in get_debian_packages (self.settings, file):
-            self.package_fixups (p)
-            self.packages[p.name ()] = p
-
-    def package_fixups (self, package):
-        if package.name () == 'libqt4-dev':
-            def untar (whatsthis):
-                gub.BinarySpec.untar (package)
-                for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
-                    package.file_sub ([
-                            ('includedir', 'deepqtincludedir'),
-                            ('(-I|-L) */usr',
-                             '''\\1%(system_root)s/usr''' % locals ()),
-                            ],
-                                      '%(srcdir)s/usr/lib/pkgconfig/%(i)s',
-                                      env=locals ())
-            package.untar = misc.MethodOverrider (package.untar, untar)
-
-    def load_packages (self):
-        p = gup.DependencyManager (self.settings.system_root,
-                                   self.settings.os_interface)
-#        arch = settings.platform
-#        if settings.platform == 'debian':
-#            arch = 'i386'
-	arch = self.settings.package_arch
-        branch = self.settings.debian_branch
-        packages_path = '/dists/%(branch)s/main/binary-%(arch)s/Packages.gz' \
-                        % locals ()
-        url = mirror + packages_path
-        base = self.settings.downloads + '/Packages'
-        file = '.'.join ((base, arch, branch))
-
-        # FIXME: download/offline update
-        if not os.path.exists (file):
-            misc.download_url (url, self.settings.downloads)
-            os.system ('gunzip  %(base)s.gz' % locals ())
-            os.system ('mv %(base)s %(file)s' % locals ())
-        self.grok_packages_file (file)
-
-    def get_packages (self):
-        return self.packages
-        
-dependency_resolver = None
-
-def init_dependency_resolver (settings):
-    global dependency_resolver
-    dependency_resolver = Dependency_resolver (settings)
-
-def debian_name_to_dependency_names (name):
-    return dependency_resolver.get_dependencies (name)
-
-def get_packages ():
-    return dependency_resolver.get_packages ()
-
-#FIXME: stable/unstable?
-gub_to_distro_dict = {
-    'fontconfig' : ['libfontconfig1'],
-    'fontconfig-devel' : ['libfontconfig1-dev'],
-    'freetype' : ['libfreetype6'],
-    'freetype-devel' : ['libfreetype6-dev'],
-    'gettext' : ['gettext'],
-    'gettext-devel' : ['gettext'],
-    'gmp-devel': ['libgmp3-dev'],
-    'gmp-runtime': ['libgmp3'],
-    'ghostscript': ['gs'],
-    'guile-runtime' : ['guile-1.6-libs'],
-    'libtool-runtime': ['libltdl3'],
-    'libiconv-devel': ['libiconv2'],
-    'pango': ['libpango1.0-0'],
-    'python-devel': ['python2.4-dev'],
-    'python-runtime': ['python2.4'],
-    }
--- a/lib/distcc.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-#!/usr/bin/env python
-
-import os
-import re
-import socket
-import sys
-import telnetlib
-
-def live_hosts (hosts, port = 3633):
-    live = []
-    for h in hosts:
-        try:
-            t = telnetlib.Telnet (h, port)
-            t.close ()
-        except socket.error:
-            continue
-
-        live.append ('%s:%d' % (h,port))
-
-    if live:
-        print 'DISTCC live hosts: ', live
-    return live
-
-
-def main ():
-    exe_name = os.path.split (sys.argv[0])[1]
-    path_comps = [c for c in os.environ['PATH'].split (':')
-                  if not re.search ('distcc', c)]
-    os.environ['PATH'] = ':'.join (path_comps)
-    argv = ['distcc', exe_name] + sys.argv[1:]
-    os.execvp ('distcc', argv)
-
-if __name__ == '__main__':
-    main ()
-
--- a/lib/freebsd.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-import os
-import re
-
-import cross
-import mirrors
-import gub
-import misc
-import targetpackage
-
-class Binutils (cross.Binutils):
-    def configure_command (self):
-        # Add --program-prefix, otherwise we get
-        # i686-freebsd-FOO iso i686-freebsd4-FOO.
-        return (cross.Binutils.configure_command (self)
-            + misc.join_lines ('''
---program-prefix=%(tool_prefix)s
-'''))
-
-class Gcc (cross.Gcc):
-    def configure_command (self):
-        # Add --program-prefix, otherwise we get
-        # i686-freebsd-FOO iso i686-freebsd4-FOO.
-        return (cross.Gcc.configure_command (self)
-            + misc.join_lines ('''
---program-prefix=%(tool_prefix)s
-'''))
-
-class Freebsd_runtime (gub.BinarySpec, gub.SdkBuildSpec):
-    def untar (self):
-        gub.BinarySpec.untar (self)
-    def patch (self):
-        self.system ('rm -rf %(srcdir)s/usr/include/g++')
-
-def _get_cross_packages (settings, libc_version):
-    return (
-        Freebsd_runtime (settings).with (version=libc_version,
-                                         strip_components=0,
-                                         mirror=mirrors.lilypondorg),
-        Binutils (settings).with (version='2.16.1', format='bz2', mirror=mirrors.gnu),
-        Gcc (settings).with (version='4.1.1', mirror=mirrors.gcc_41,
-                             format='bz2'),
-        )
-
-def get_cross_packages_41 (settings):
-    return _get_cross_packages (settings, '4.10-2')
-
-def get_cross_packages_61 (settings):
-    return _get_cross_packages (settings, '6.1-RELEASE')
-
-def get_cross_packages (settings):
-    return get_cross_packages_41 (settings)
-
-    if settings.target_architecture == 'i686-freebsd4':
-        return get_cross_packages_41 (settings)
-    return get_cross_packages_61 (settings)
-
-def change_target_package (package):
-    cross.change_target_package (package)
-
-        
-    
-# FIXME: download from sane place.
-def get_sdk():
-    '''
-
-#FIXME: how to get libc+kernel headers package contents on freebsd?
-# * remove zlib.h, zconf.h or include libz and remove Zlib from src packages?
-# * remove gmp.h, or include libgmp and remove Gmp from src packages?
-# bumb version number by hand, sync with freebsd.py
-freebsd-runtime:
-	ssh xs4all.nl tar -C / --exclude=zlib.h --exclude=zconf.h --exclude=gmp.h -czf public_html/freebsd-runtime-4.10-2.tar.gz /usr/lib/{lib{c,c_r,m}{.a,.so{,.*}},crt{i,n,1}.o} /usr/include
-
-    '''
--- a/lib/gub.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,861 +0,0 @@
-# own
-import glob
-import misc
-import repository
-
-# sys
-import pickle
-import os
-import re
-
-from context import *
-
-class PackageSpec:
-    "How to package part of an install_root."
-    
-    def __init__ (self, os_interface):
-        self._dict = {}
-        self._os_interface = os_interface
-        self._file_specs = []
-        self._dependencies = []
-        self._conflicts = []
-        
-    def set_dict (self, dict, sub_name):
-        self._dict = dict.copy ()
-        self._dict['sub_name'] = sub_name
-        if sub_name:
-            sub_name = '-' + sub_name
-        s = ('%(name)s' % dict) + sub_name
-        self._dict['split_name'] = s
-        self._dict['split_ball'] = ('%(gub_uploads)s/%(split_name)s%(ball_suffix)s.%(platform)s.gup') % self._dict
-        self._dict['split_hdr'] = ('%(gub_uploads)s/%(split_name)s%(vc_branch_suffix)s.%(platform)s.hdr') % self._dict
-        self._dict['conflicts_string'] = ';'.join (self._conflicts)
-        self._dict['dependencies_string'] = ';'.join (self._dependencies)
-        self._dict['source_name'] = self.name ()
-        if sub_name:
-            self._dict['source_name'] = self.name ()[:-len (sub_name)]
-        
-    def expand (self, s):
-        return s % self._dict
-    
-    def dump_header_file (self):
-        hdr = self.expand ('%(split_hdr)s')
-        self._os_interface.dump (pickle.dumps (self._dict), hdr)
-        
-    def clean (self):
-        base = self.expand ('%(install_root)s/')
-        for f in self._file_specs:
-            self._os_interface.system ('rm -rf %s%s ' % (base, f))
-
-    def create_tarball (self):
-        cmd = 'tar -C %(install_root)s/%(packaging_suffix_dir)s --ignore-failed --exclude="*~" -zcf %(split_ball)s '
-
-        path = os.path.normpath (self.expand ('%(install_root)s'))
-        globs  = []
-        for f in self._file_specs:
-            f = re.sub ('/+', '/', f)
-            if f.startswith ('/'):
-                f = f[1:]
-                
-            for exp in glob.glob (os.path.join (path, f)):
-                globs.append (exp.replace (path, './').replace ('//', '/'))
-
-        if not globs:
-            globs.append ('thisreallysucks-but-lets-hope-I-dont-exist/')
-            
-        cmd += ' '.join (globs) 
-        cmd = self.expand (cmd)
-        self._os_interface.system (cmd)
-
-    def dict (self):
-        return self._dict
-
-    def name (self):
-        return "%(split_name)s" % self._dict
-    
-class BuildSpec (Os_context_wrapper):
-    def __init__ (self, settings):
-        Os_context_wrapper.__init__(self, settings)
-
-        self.verbose = settings.verbose ()
-        self.settings = settings
-        self.url = ''
-        self.has_source = True
-        self._dependencies = None
-        self._build_dependencies = None
-        
-        self.spec_checksum = '0000' 
-        self.cross_checksum = '0000'
-        
-        # TODO: move to PackageSpec, always instantiate.
-        # then remove all if self.vc_repository checks
-        self.vc_repository = None
-        
-        self.split_packages = []
-        self.so_version = '1'
-
-    @subst_method
-    def LD_PRELOAD (self):
-        return '%(topdir)s/librestrict/librestrict.so'
-    
-    def get_substitution_dict (self, env={}):
-        dict = {
-            'CPATH': '',
-            'CPLUS_INCLUDE_PATH': '',
-            'C_INCLUDE_PATH': '',
-            'LIBRARY_PATH': '/empty-means-cwd-in-feisty',
-            }
-        dict.update (env)
-        d = Os_context_wrapper.get_substitution_dict (self, dict).copy ()
-        return d
-          
-    def class_invoke_version (self, klas, name):
-        name_version = name + '_' + self.version ().replace ('.', '_')
-        if klas.__dict__.has_key (name_version):
-            klas.__dict__[name_version] (self)
-
-    def download (self):
-        if self.vc_repository:
-            self.vc_repository.download ()
-
-    def get_repodir (self):
-        return self.settings.downloads + '/' + self.name ()
-    
-    def get_conflict_dict (self):
-        """subpackage -> list of confict dict."""
-        return {'': [], 'devel': [], 'doc': [], 'runtime': []}
-  
-    def get_dependency_dict (self):
-        """subpackage -> list of dependency dict."""
-        # FIMXE: '' always depends on runtime?
-        return {'': [], 'devel': [], 'doc': [], 'runtime': []}
-  
-    def broken_for_distcc (self):
-        """Set to true if package can't handle make -jX """
-        return False
-    
-    @subst_method
-    def name (self):
-        file = self.__class__.__name__.lower ()
-        file = re.sub ('__.*', '', file)
-        file = re.sub ('_', '-', file)
-
-        ## UGH ? what happens if xx is in a normal name?!
-        file = re.sub ('xx', '++', file)
-        return file
-
-    @subst_method
-    def pretty_name (self):
-        name = self.__class__.__name__
-        name = re.sub ('__.*', '', name)
-        return name
-    
-    @subst_method
-    def file_name (self):
-        if self.url:
-            file = re.sub ('.*/([^/]+)', '\\1', self.url)
-        else:
-            file = self.name ()
-        return file
-
-    @subst_method
-    def source_checksum (self):
-        if self.vc_repository:
-            return self.vc_repository.get_checksum ().replace ('/', '-')
-        
-        return self.version () 
-
-    @subst_method
-    def license_file (self):
-        return '%(srcdir)s/COPYING'
-    
-    @subst_method
-    def basename (self):
-        return misc.ball_basename (self.file_name ())
-
-    @subst_method
-    def packaging_suffix_dir (self):
-        return ''
-
-    @subst_method
-    def full_version (self):
-        return self.version ()
-
-    @subst_method
-    def build_dependencies_string (self):
-        deps = self.get_build_dependencies ()
-        return ';'.join (deps)
-
-    @subst_method
-    def ball_suffix (self):
-        b = '-%(version)s'
-        if self.vc_repository and self.vc_repository.is_tracking ():
-            try:
-                b = '-' + self.vc_repository.branch
-            except AttributeError:
-                pass
-        return b
-
-    @subst_method
-    def vc_branch (self):
-        b = ''
-        if self.vc_repository and self.vc_repository.is_tracking ():
-            try:
-                b = self.vc_repository.branch
-            except AttributeError:
-                pass
-        return b
-    
-    @subst_method
-    def vc_branch_suffix (self):
-        b = ''
-        if self.vc_repository and self.vc_repository.is_tracking ():
-            try:
-                b = '-' + self.vc_repository.branch
-            except AttributeError:
-                pass
-        return b
-        
-    @subst_method
-    def version (self):
-        # kugh, must construct using vc_repository in __init__
-        if not self.vc_repository :
-            print 'need version, but repository not yet set: ', self.name ()
-            raise 'urg'
-        return self.vc_repository.version ()
-
-    @subst_method
-    def name_version (self):
-        return '%s-%s' % (self.name (), self.version ())
-
-    @subst_method
-    def srcdir (self):
-        return '%(allsrcdir)s/%(name)s%(ball_suffix)s'
-
-    @subst_method
-    def builddir (self):
-        return '%(allbuilddir)s/%(name)s%(ball_suffix)s'
-
-    @subst_method
-    def install_root (self):
-        return '%(installdir)s/%(name)s-%(version)s-root'
-
-    @subst_method
-    def install_prefix (self):
-        return self.install_root () + '/usr'
-
-    @subst_method
-    def install_command (self):
-        return '''make DESTDIR=%(install_root)s install'''
-
-    @subst_method
-    def configure_command (self):
-        return '%(srcdir)s/configure --prefix=%(install_prefix)s'
-
-    @subst_method
-    def compile_command (self):
-        return 'make'
-
-    @subst_method
-    def native_compile_command (self):
-        c = 'make'
-
-        job_spec = ' '
-        if self.settings.native_distcc_hosts:
-            job_spec = '-j%d ' % (2*len (self.settings.native_distcc_hosts.split (' ')))
-
-            ## do this a little complicated: we don't want a trace of
-            ## distcc during configure.
-            c = 'DISTCC_HOSTS="%s" %s' % (self.settings.native_distcc_hosts, c)
-            c = 'PATH="%(native_distcc_bindir)s:$PATH" ' + c
-        elif self.settings.cpu_count_str != '1':
-            job_spec += ' -j%s ' % self.settings.cpu_count_str
-
-        c += job_spec
-        return c
-
-
-    @subst_method
-    def src_package_ball (self):
-        return '%(src_package_uploads)s/%(name)s%(ball_suffix)s-src.%(platform)s.tar.gz'
-
-    @subst_method
-    def src_package_uploads (self):
-        return '%(gub_uploads)s'
-
-    @subst_method
-    def stamp_file (self):
-        return '%(statusdir)s/%(name)s-%(version)s-%(source_checksum)s'
-
-    @subst_method
-    def rsync_command (self):
-        return "rsync --exclude .git --exclude _darcs --exclude .svn --exclude CVS -v -a %(downloads)s/%(name)s-%(version)s/ %(srcdir)s"
-
-    def get_stamp_file (self):
-        stamp = self.expand ('%(stamp_file)s')
-        return stamp
-
-    def is_done (self, stage, stage_number):
-        f = self.get_stamp_file ()
-        if os.path.exists (f):
-            return int (open (f).read ()) >= stage_number
-        return False
-
-    def set_done (self, stage, stage_number):
-        open (self.get_stamp_file (),'w'). write ('%d' % stage_number) 
-
-    def autoupdate (self, autodir=0):
-        if not autodir:
-            autodir = self.srcdir ()
-        if os.path.isdir (os.path.join (self.srcdir (), 'ltdl')):
-            self.system ('''
-rm -rf %(autodir)s/libltdl
-cd %(autodir)s && libtoolize --force --copy --automake --ltdl
-''', locals ())
-        else:
-            self.system ('''
-cd %(autodir)s && libtoolize --force --copy --automake
-''', locals ())
-        if os.path.exists (os.path.join (autodir, 'bootstrap')):
-            self.system ('''
-cd %(autodir)s && ./bootstrap
-''', locals ())
-        elif os.path.exists (os.path.join (autodir, 'autogen.sh')):
-
-            ## --noconfigure ??
-            ## is --noconfigure standard for autogen? 
-            self.system ('''
-cd %(autodir)s && bash autogen.sh  --noconfigure
-''', locals ())
-        else:
-            aclocal_opt = ''
-            if os.path.exists (self.expand ('%(system_root)s/usr/share/aclocal')):
-                aclocal_opt = '-I %(system_root)s/usr/share/aclocal'
-                
-            headcmd = ''
-            for c in ('configure.in','configure.ac'):
-                try:
-                    str = open (self.expand ('%(srcdir)s/' + c)).read ()
-                    m = re.search ('A[CM]_CONFIG_HEADER', str)
-                    str = 0   ## don't want to expand str
-                    if m:
-                        headcmd = self.expand ('cd %(autodir)s && autoheader %(aclocal_opt)s', env=locals ())
-                        break
-                    
-                except IOError:
-                    pass
-                
-            self.system ('''
-cd %(autodir)s && aclocal %(aclocal_opt)s
-%(headcmd)s
-cd %(autodir)s && autoconf %(aclocal_opt)s
-''', locals ())
-            if os.path.exists (self.expand ('%(srcdir)s/Makefile.am')):
-                self.system ('''
-cd %(srcdir)s && automake --add-missing --foreign
-''', locals ())
-
-
-    def configure (self):
-        self.system ('''
-mkdir -p %(builddir)s
-cd %(builddir)s && %(configure_command)s
-''')
-
-    def install_license (self):
-        if self.expand ('%(license_file)s'):
-            self.system ('mkdir -p %(install_root)s/license/', ignore_errors=True)
-            self.system ('cp %(license_file)s %(install_root)s/license/%(name)s')
-        
-    def broken_install_command (self):
-        """For packages that do not honor DESTDIR.
-        """
-
-        # FIXME: use sysconfdir=%(install_PREFIX)s/etc?  If
-        # so, must also ./configure that way
-        return misc.join_lines ('''make install
-bindir=%(install_prefix)s/bin
-aclocaldir=%(install_prefix)s/share/aclocal
-datadir=%(install_prefix)s/share
-exec_prefix=%(install_prefix)s
-gcc_tooldir=%(install_prefix)s
-includedir=%(install_prefix)s/include
-infodir=%(install_prefix)s/share/info
-libdir=%(install_prefix)s/lib
-libexecdir=%(install_prefix)s/lib
-mandir=%(install_prefix)s/share/man
-prefix=%(install_prefix)s
-sysconfdir=%(install_prefix)s/etc
-tooldir=%(install_prefix)s
-''')
-
-    def kill_libtool_installation_test (self, file):
-        self.file_sub ([(r'if test "\$inst_prefix_dir" = "\$destdir"; then',
-                         'if false && test "$inst_prefix_dir" = "$destdir"; then')],
-                       file, must_succeed=True)
-        
-    def update_libtool (self):
-        lst = self.locate_files ('%(builddir)s', 'libtool')
-        if lst:
-            new = self.expand ('%(system_root)s/usr/bin/libtool')
-            if not os.path.exists (new):
-                self.log_command ("Cannot update libtool: no such file: %(new)s" % locals ())
-                raise 'barf'
-            for i in lst:
-                self.system ('cp %(new)s %(i)s', locals ())
-                self.kill_libtool_installation_test (i)
-                self.system ('chmod 755  %(i)s', locals ())
-
-    def install (self):
-        self.system ('''
-rm -rf %(install_root)s
-cd %(builddir)s && %(install_command)s
-rm -f %(install_root)s/%(packaging_suffix_dir)s/usr/share/info/dir %(install_root)s/%(packaging_suffix_dir)s/usr/cross/info/dir %(install_root)s/%(packaging_suffix_dir)s/usr/info/dir
-''')
-        self.install_license ()
-        self.libtool_installed_la_fixups ()
-
-    def libtool_installed_la_fixups (self):
-        for la in misc.find (self.expand ('%(install_root)s'), '\.la$'):
-            (dir, base) = os.path.split (la)
-            base = base[3:-3]
-            dir = re.sub (r"^\./", "/", dir)
-            full_la = self.expand ("%(install_root)s/%(la)s", locals())
-
-            self.file_sub ([(''' *-L *[^\"\' ][^\"\' ]*''', ''),
-                    ('''( |=|\')(/[^ ]*usr/lib|%(targetdir)s.*)/lib([^ \'/]*)\.(a|la|so)[^ \']*''',
-                    '\\1-l\\3 '),
-                    ('^old_library=.*',
-                    """old_library='lib%(base)s.a'"""),
-                    ],
-                   full_la, env=locals ())
-            if self.settings.platform.startswith ('mingw'):
-                self.file_sub ([('library_names=.*',
-                                 "library_names='lib%(base)s.dll.a'")],
-                               full_la, env=locals())
-
-    def compile (self):
-        self.system ('cd %(builddir)s && %(compile_command)s')
-
-    # FIXME: should not misusde patch for auto stuff
-    def patch (self):
-        if not os.path.exists ('%(srcdir)s/configure' \
-                               % self.get_substitution_dict ()):
-            self.autoupdate ()
-
-    @subst_method
-    def is_sdk_package (self):
-        return 'false'
-
-    def rewire_symlinks (self):
-        for f in self.locate_files ('%(install_root)s', '*'):
-            if os.path.islink (f):
-                s = os.readlink (f)
-                if s.startswith ('/') and self.settings.system_root not in s:
-
-                    new_dest = os.path.join (self.settings.system_root, s[1:])
-                    os.remove (f)
-                    print 'changing absolute link %s -> %s' % (f, new_dest)
-                    os.symlink (new_dest, f)
-
-    def package (self):
-        self.rewire_symlinks ()
-        
-        ps = self.get_packages ()
-        for p in ps:
-            p.create_tarball ()
-            p.dump_header_file ()
-            p.clean ()
-            
-    def get_build_dependencies (self):
-        return []
-
-    def get_subpackage_definitions (self):
-        d = {
-            'devel': [
-            '/usr/bin/*-config',
-            '/usr/include',
-            '/usr/cross/include',
-            '/usr/share/aclocal',
-            '/usr/lib/lib*.a',
-            '/usr/lib/pkgconfig',
-            ],
-            'doc': [
-            '/usr/share/doc',
-            '/usr/share/gtk-doc',
-            '/usr/share/info',
-            '/usr/share/man',
-            '/usr/cross/info',
-            '/usr/cross/man',
-            ],
-            'runtime': ['/usr/lib', '/usr/share'],
-            '' : ['/'],
-            }
-        return d
-    
-    def get_subpackage_names (self):
-        return ['devel', 'doc', '']
-
-    ## FIXME: patch in via MethodOverride
-    def description_dict (self):
-        return {}
-
-    ## FIXME: patch in via MethodOverride
-    def category_dict (self):
-        return {'': 'interpreters',
-                'runtime': 'libs',
-                'devel': 'devel libs',
-                'doc': 'doc'}
-    
-    def get_packages (self):
-        defs = dict (self.get_subpackage_definitions ())
-
-        ps = []
-
-        conflict_dict = self.get_conflict_dict ()
-        dep_dict = self.get_dependency_dict ()
-        descr_dict = self.description_dict ()
-        category_dict = self.category_dict ()
-        
-        for sub in self.get_subpackage_names ():
-            filespecs = defs[sub]
-            
-            p = PackageSpec (self.os_interface)
-            if sub:
-                p._dependencies = [self.expand ("%(name)s")]
-
-            p._file_specs = filespecs
-            p.set_dict (self.get_substitution_dict (), sub)
-
-            conflict_str = ';'.join (conflict_dict.get (sub, []))
-            if p._dict.has_key ('conflicts_string'):
-                conflict_str = p._dict['conflicts_string'] + ';' + conflict_str
-            p._dict['conflicts_string'] = conflict_str
-
-            dep_str = ';'.join (dep_dict.get (sub, []))
-            if p._dict.has_key ('dependencies_string'):
-                dep_str = p._dict['dependencies_string'] + ';' + dep_str
-            p._dict['dependencies_string'] = dep_str
-
-	    ## FIXME make generic: use cross.get_subpackage_dict_methods () or similar.
-            desc_str = descr_dict.get (sub, '')
-            p._dict['description'] = desc_str
-
-            cat_str = category_dict.get (sub, '')
-            p._dict['category'] = cat_str
-            
-            ps.append (p)
-
-        return ps
-    
-    def src_package (self):
-        # URG: basename may not be source dir name, eg,
-        # package libjpeg uses jpeg-6b.  Better fix at untar
-        # stage?
-        dir_name = re.sub (self.expand ('%(allsrcdir)s/'), '',
-                           self.expand ('%(srcdir)s'))
-        self.system ('''
-tar -C %(allsrcdir)s --exclude "*~" --exclude "*.orig"  -zcf %(src_package_ball)s %(dir_name)s
-''',
-                     locals ())
-
-    def clean (self):
-        self.system ('rm -rf  %(stamp_file)s %(install_root)s', locals ())
-        if self.vc_repository and self.vc_repository.is_tracking ():
-            return
-
-        self.system ('''rm -rf %(srcdir)s %(builddir)s''', locals ())
-
-    def untar (self):
-        if not self.has_source:
-            return False
-        if not (self.vc_repository and self.vc_repository.is_tracking ()) :
-            self.system ('rm -rf %(srcdir)s %(builddir)s %(install_root)s')
-
-        if self.vc_repository:
-            self.vc_repository.update_workdir (self.expand ('%(srcdir)s'))
-            
-        if (os.path.isdir (self.expand ('%(srcdir)s'))):
-            self.system ('chmod -R +w %(srcdir)s', ignore_errors=True)
-
-    def pre_install_smurf_exe (self):
-        for i in self.locate_files ('%(builddir)s', '*.exe'):
-            base = os.path.splitext (i)[0]
-            self.system ('''mv %(i)s %(base)s''', locals ())
-
-    def post_install_smurf_exe (self):
-        for i in (self.locate_files ('%(install_root)s/bin', '*')
-                  + self.locate_files ('%(install_root)s/usr/bin', '*')):
-            if (not os.path.islink (i)
-                and not os.path.splitext (i)[1]
-                and self.read_pipe ('file -b %(i)s', locals ()).startswith ('MS-DOS executable PE')):
-                self.system ('''mv %(i)s %(i)s.exe''', locals ())
-
-    def install_readmes (self):
-        self.system ('''
-mkdir -p %(install_root)s/usr/share/doc/%(name)s
-''')
-        for i in glob.glob ('%(srcdir)s/[A-Z]*'
-                            % self.get_substitution_dict ()):
-            import shutil
-            if (os.path.isfile (i)
-                and not os.path.basename (i).startswith ('Makefile')
-                and not os.path.basename (i).startswith ('GNUmakefile')):
-                shutil.copy2 (i, '%(install_root)s/usr/share/doc/%(name)s'
-                              % self.get_substitution_dict ())
-
-    def build_version (self):
-        "the version in the shipped package."
-        # FIXME: ugly workaround needed for lilypond package...
-        return '%(version)s'
-
-    def build_number (self):
-        # FIXME: actually need the packages' build number here...
-        build_number_file = '%(topdir)s/buildnumber-%(lilypond_branch)s.make'
-        d = misc.grok_sh_variables (self.expand (build_number_file))
-        b = '%(INSTALLER_BUILD)s' % d
-        return b
-
-    # TODO: junk this, always set repo in __init__
-    def with_vc (self, repo):
-        self.vc_repository = repo
-        return self
-
-    def with_tarball (self, mirror='', version='', format='gz', strip_components=1, name=''):
-        return self.with_vc (self.get_tarball (mirror, version, format, strip_components, name))
-
-    def get_tarball (self, mirror, version, format='gz', strip_components=1, name=''):
-        if not name:
-            name = self.name ()
-        if not format:
-            format = self.__dict__.get ('format', 'gz')
-        if not mirror:
-            mirror = self.__dict__.get ('url', '')
-        if not version and self.version:
-            version = self.ball_version
-
-        import repository
-        return repository.NewTarBall (self.settings.downloads, mirror, name, version, format, strip_components)
-
-    # TODO: junk this, use TarBall ()or Version ()
-    def with (self,
-              mirror='',
-              version='',
-              strip_components=1,
-              format='',
-              name=''):
-
-        if not name:
-            name = self.name ()
-        if not format:
-            format = self.__dict__.get ('format', 'gz')
-        if not mirror:
-            mirror = self.__dict__.get ('url', '')
-        if not version and self.version:
-            version = self.ball_version
-
-        self.format = format
-        self.ball_version = version
-        self.url = mirror
-
-        ball_version = version
-        package_arch = self.settings.package_arch
-        if mirror:
-            self.vc_repository = repository.TarBall (self.settings.downloads,
-                                                     # Hmm, better to construct
-                                                     # mirror later?
-                                                     mirror % locals (),
-                                                     version,
-                                                     strip_components=strip_components)
-        else:
-            self.vc_repository = repository.Version (version)
-
-        self.ball_version = version
-
-        ## don't do substitution. We want to postpone
-        ## generating the dict until we're sure it doesn't change.
-
-        return self
-
-class BinarySpec (BuildSpec):
-    def configure (self):
-        pass
-
-    def patch (self):
-        pass
-
-    def compile (self):
-        pass
-
-    def install (self):
-        
-        """Install package into %(install_root). Any overrides should
-        follow this command, since it will erase the old install_root first."""
-        
-        self.system ('mkdir -p %(install_root)s')
-
-        _verbose = ''
-        if self.verbose:
-            _verbose = ' -v'
-        self.system ('tar -C %(srcdir)s -cf- . | tar -C %(install_root)s%(_verbose)s -xf-', env=locals ())
-        self.libtool_installed_la_fixups ()
-
-    def get_subpackage_names (self):
-        # FIXME: splitting makes that cygwin's gettext + -devel subpackage
-        # gets overwritten by cygwin's gettext-devel + '' base package
-        return ['']
-
-    # FIXME: no src packages for binary specs
-    # They used to work, but now they fail?
-    def src_package (self):
-        pass
-
-class NullBuildSpec (BuildSpec):
-    """Placeholder for downloads """
-
-    def compile (self):
-        pass
-    def configure (self):
-        pass
-    def install (self):
-        self.system ('mkdir -p %(install_root)s')
-    def untar (self):
-        pass
-    def patch (self):
-        pass
-    def src_package (self):
-        pass
-
-class SdkBuildSpec (NullBuildSpec):
-    def untar (self):
-        BuildSpec.untar (self)
-
-    def get_subpackage_names (self):
-        return ['']
-    
-    ## UGH: should store superclass names of each package.
-    def is_sdk_package (self):
-        return 'true'
-    
-    def install_root (self):
-        return self.srcdir ()
-
-class Change_target_dict:
-    def __init__ (self, package, override):
-        self._target_dict_method = package.get_substitution_dict
-        self._add_dict = override
-
-    def target_dict (self, env={}):
-        env_copy = env.copy ()
-        env_copy.update (self._add_dict)
-        d = self._target_dict_method (env_copy)
-        return d
-
-    def append_dict (self, env={}):
-        d = self._target_dict_method ()
-        for (k,v) in self._add_dict.items ():
-            d[k] += v
-
-        d.update (env)
-        d = recurse_substitutions (d)
-        return d
-
-def change_target_dict (package, add_dict):
-    """Override the get_substitution_dict() method of PACKAGE."""
-    try:
-        package.get_substitution_dict = Change_target_dict (package, add_dict).target_dict
-    except AttributeError:
-        pass
-
-def append_target_dict (package, add_dict):
-    """Override the get_substitution_dict() method of PACKAGE."""
-    try:
-        package.get_substitution_dict = Change_target_dict (package, add_dict).append_dict
-    except AttributeError:
-        pass
-
-def get_class_from_spec_file (settings, file_name, name):
-    import imp
-
-    print 'reading spec', file_name
-    class_name = (name[0].upper () + name[1:]).replace ('-', '_')
-    file = open (file_name)
-    desc = ('.py', 'U', 1)
-    module = imp.load_module (name, file, file_name, desc)
-    full = class_name + '__' + settings.platform.replace ('-', '__')
-
-    d = module.__dict__
-    while full:
-        if d.has_key (full):
-            klass = d[full]
-            break
-        full = full[:max (full.rfind ('__'), 0)]
-
-#    dropped feature:
-#    version = xxx at toplevel of spec file
-#    mirror = xxx at toplevel of spec file
-#    for i in init_vars.keys ():
-#        if d.has_key (i):
-#            init_vars[i] = d[i]
-
-    return klass
-
-def get_build_spec (flavour, settings, url):
-    """
-    Return BuildSpec instance to build package from URL.
-
-    URL can be partly specified (eg: only a name, `lilypond'),
-    defaults are taken from the spec file.
-    """
-    name = os.path.basename (url)
-    init_vars = {'format':None, 'version':None, 'url': None,}
-    if misc.is_ball (name):
-        ball = name
-        name, version_tuple, format = misc.split_ball (ball)
-        version = misc.version_to_string (version_tuple)
-        if not version:
-            name = url
-        elif (url.startswith ('/')
-              or url.startswith ('file://')
-              or url.startswith ('ftp://')
-              or url.startswith ('http://')):
-            init_vars['url'] = url
-        if version:
-            init_vars['version'] = version
-        if format:
-            init_vars['format'] = format
-
-    file_name = settings.specdir + '/' + name + '.py'
-    klass = None
-    checksum = '0000'
-    
-    if os.path.exists (file_name):
-        klass = get_class_from_spec_file (settings, file_name, name)
-        if klass:
-            import md5
-            checksum = md5.md5 (open (file_name).read ()).hexdigest ()
-#   else:
-#       # FIXME: make a --debug-must-have-spec option
-#       ## yes: sucks for cygwin etc. but need this for debugging the rest.
-#       raise Exception ("no such spec: " + url)
-
-    if not klass:
-        print 'NO SPEC'
-        from new import classobj
-        # Without explicit spec will only work if URL
-        # includes version and format, eg,
-        # URL=libtool-1.5.22.tar.gz
-        klass = classobj (name, (flavour,), {})
-    package = klass (settings)
-    package.spec_checksum = checksum
-    import cross
-    package.cross_checksum = cross.get_cross_checksum (settings.platform)
-
-    # Initialise building package from url, without spec
-    # test:
-    # bin/gub -p linux-64 ftp://ftp.gnu.org/pub/gnu/bison/bison-2.3.tar.gz
-    if init_vars['version']:
-        package.with (format=init_vars['format'],
-                      mirror=init_vars['url'],
-                      version=init_vars['version'])
-    return package
--- a/lib/gup.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,497 +0,0 @@
-import gdbm as dbmodule
-#import dbhash as dbmodule
-
-import pickle
-import os
-import re
-import string
-import fcntl
-import sys
-import glob
-
-#
-import cross
-import targetpackage
-from misc import *  # URG, fixme
-import locker
-import cygwin
-import debian
-import gub ## ugh
-
-class GupException (Exception):
-    pass
-
-class FileManager:
-
-    """FileManager handles a tree, and keeps track of files,
-    associating files with a package name"""
-
-    def __init__ (self, root, os_interface, dbdir=None, clean=False):
-        self.root = os.path.normpath (root)
-        if dbdir:
-            self.config = dbdir
-        else:
-            self.config = self.root + '/etc/gup'
-
-        self.config = os.path.normpath (self.config)
-        self.os_interface = os_interface
-        self.verbose = True
-        self.is_distro = False
-
-        ## lock must be outside of root, otherwise we can't rm -rf root
-        self.lock = locker.Locker (self.root + '.lock')
-        if clean:
-            os_interface.system ('rm -fr %s' % self.config)
-            os_interface.system ('rm -fr %s' % self.root)
-            
-        self.make_dirs ()
-        self._file_package_db = dbmodule.open (self.config
-                           + '/files.db', 'c')
-        self._package_file_db = dbmodule.open (self.config
-                           + '/packages.db', 'c')
-
-    def __repr__ (self):
-        name = self.__class__.__name__
-        root = self.root
-        distro =  self.is_distro
-        return '%(name)s: %(root)s, distro: %(distro)d'  % locals()
-
-    def make_dirs (self):
-        if not os.path.isdir (self.config):
-            self.os_interface.system ('mkdir -p %s' % self.config)
-        if not os.path.isdir (self.root):
-            self.os_interface.system ('mkdir -p %s' % self.root)
-        
-    def tarball_files (self, ball):
-        flag = tar_compression_flag (ball)
-        str = self.os_interface.read_pipe ('tar -t%(flag)sf "%(ball)s"'
-                                           % locals ())
-        lst = str.split ('\n')
-        return lst
-
-    def installed_files (self, package):
-        return self._package_file_db[package].split ('\n')
-
-    def is_installed (self, name):
-        return self._package_file_db.has_key (name)
-
-    def install_tarball (self, ball, name):
-        self.os_interface.log_command ('installing package %(name)s from %(ball)s\n'
-                                       % locals ())
-
-        flag = tar_compression_flag (ball)
-        root = self.root
-        lst = self.tarball_files (ball)
-
-        conflicts = False
-        for f in lst:
-            if (self._file_package_db.has_key (f)
-                and not os.path.isdir (self.root + '/' +  f)):
-                print 'already have file %s: %s' % (f, self._file_package_db[f])
-                conflicts = True
-
-        if conflicts and not self.is_distro:
-            raise Exception ('abort')
-
-        self.os_interface.system ('tar -C %(root)s -x%(flag)sf %(ball)s'
-                                  % locals ())
-
-        self._package_file_db[name] = '\n'.join (lst)
-        for f in lst:
-            # ignore directories.
-            if not f.endswith ('/'):
-                self._file_package_db[f] = name
-            if f.endswith ('.la'):
-                self.libtool_la_fixup (root, f)
-            if f.endswith ('.pc'):
-                self.pkgconfig_pc_fixup (root, f)
-
-    def libtool_la_fixup (self, root, file):
-        # avoid using libs from build platform, by adding
-        # %(system_root)s
-        if file.startswith ('./'):
-            file = file[2:]
-        dir = os.path.dirname (file)
-        self.os_interface.file_sub ([('^libdir=.*',
-                                      """libdir='%(root)s/%(dir)s'""" % locals ()
-                                      ),],
-                                    '%(root)s/%(file)s' % locals ())
-
-    def pkgconfig_pc_fixup (self, root, file):
-        # avoid using libs from build platform, by adding
-        # %(system_root)s
-        if file.startswith ('./'):
-            file = file[2:]
-        dir = os.path.dirname (file)
-        self.os_interface.file_sub ([('(-I|-L) */usr',
-                                      '''\\1%(root)s/usr''' % locals ()
-                                      ),],
-                                    '%(root)s/%(file)s' % locals ())
-
-    def uninstall_package (self, name):
-        self.os_interface.log_command ('uninstalling package: %s\n' % name)
-
-        lst = self.installed_files (name)
-
-        dirs = []
-        files = []
-        for i in lst:
-            f = os.path.join (self.root, i)
-            if os.path.islink (f):
-                files.append (f)
-            elif (not os.path.exists (f)
-               and not self.is_distro):
-                print 'FileManager: uninstall: %s' % name
-                print 'FileManager: no such file: %s' % f
-            elif os.path.isdir (f):
-                dirs.append (f)
-            else:
-                files.append (f)
-
-        for f in files:
-            os.unlink (f)
-
-        for d in reversed (dirs):
-            try:
-                os.rmdir (d)
-            except OSError:
-                print 'warning: %s not empty' % d
-
-        for f in lst:
-
-            ## fixme (?)  -- when is f == ''
-            if not f or f.endswith ('/'):
-                continue
-
-            try:
-                del self._file_package_db[f]
-            except:
-                print 'db delete failing for ', f
-        del self._package_file_db[name]
-
-    def installed_packages (self):
-        names = self._package_file_db.keys ()
-        return names
-
-class PackageDictManager:
-    """
-
-    A dict of PackageName ->  (Key->Value dict)
-
-    which can be read off the disk.
-    """
-    def __init__ (self, os_interface):
-        self._packages = {}
-
-        ## ugh mi 
-        self.verbose = False
-        
-        ## ugh: mi overwrite.
-        self.os_interface = os_interface
-    def register_package_dict (self, d):
-        nm = d['name']
-        if d.has_key ('split_name'):
-            nm = d['split_name']
-        if (self._packages.has_key (nm)):
-            if self._packages[nm]['spec_checksum'] != d['spec_checksum']:
-                self.os_interface.log_command ('******** checksum of %s changed!\n\n' % nm)
-
-            ## UGH ; need to look at installed hdr.
-            if self._packages[nm]['cross_checksum'] != d['cross_checksum']:
-                self.os_interface.log_command ('******** checksum of cross changed for %s\n' % nm)
-            return
-
-        self._packages[nm] = d
-   
-        
-    def register_package_header (self, package_hdr, branch_dict):
-        if self.verbose:
-            self.os_interface.log_command ('reading package header: %s\n'
-                                           % `package_hdr`)
-
-        str = open (package_hdr).read ()
-
-        d = pickle.loads (str)
-
-        if branch_dict.has_key (d['basename']):
-            if branch_dict[d['basename']] != d['vc_branch']:
-                suffix = d['vc_branch']
-                print 'ignoring header: ' + package_hdr
-                branch = branch_dict[d['basename']]
-                print 'branch: %(branch)s, suffix: %(suffix)s' % locals ()
-                return
-        elif d['vc_branch']:
-            sys.stdout.write ('No branch for package %s, ignoring header: %s\n' % (d['basename'], package_hdr))
-            return
-        
-        name = d['split_name']
-        if 0:
-          ## FIXME ?
-          if self._package_dict_db.has_key (name):
-              if str != self._package_dict_db[name]:
-                  self.os_interface.log_command ("package header changed for %s\n" % name)
-
-              return
-
-        self.register_package_dict (d)
-
-    def unregister_package_dict (self, name):
-        del self._packages[name]
-
-    def is_registered (self, package):
-        return self._packages.has_key (package)
-
-    def package_dict (self, package_name):
-        return self._packages[package_name]
-
-    def get_all_packages (self):
-        return self._packages.values ()
-
-    def is_installable (self, name):
-        d = self._packages[name]
-        ball = '%(split_ball)s' % d
-        hdr = '%(split_hdr)s' % d
-        return os.path.exists (ball) and os.path.exists (hdr)
-
-    def read_package_headers (self, s, branch_dict):
-        if os.path.isdir (s) and not s.endswith ('/'):
-            s += '/'
-            
-        for f in glob.glob ('%(s)s*hdr' % locals ()):
-            self.register_package_header (f, branch_dict)
-
-
-## FIXME: MI
-class PackageManager (FileManager, PackageDictManager):
-
-
-    """PackageManager is a FileManager, which also associates a
-    key/value dict with each package.
-
-    Such dicts come either from either 
-
-    1. A build spec (ie. a python object)
-
-    2. A pickled dict on disk, a package header
-
-    3. 
-    """
-
-    
-    def __init__ (self, root, os_interface, **kwargs):
-        FileManager.__init__ (self, root, os_interface, **kwargs)
-        PackageDictManager.__init__ (self, os_interface)
-        
-        self._package_dict_db = dbmodule.open (self.config
-                           + '/dicts.db', 'c')
-        for k in self._package_dict_db.keys ():
-            v = self._package_dict_db[k]
-            self.register_package_dict (pickle.loads (v))
-
-    def installed_package_dicts (self):
-        names = self._package_file_db.keys ()
-        return [self._packages[p] for p in names]
-
-    def install_package (self, name):
-        if self.is_installed (name):
-            return
-        self.os_interface.log_command ('installing package: %s\n'
-                                       % name)
-        if self._package_file_db.has_key (name):
-            print 'already have package ', name
-            raise Exception ('abort')
-        d = self._packages[name]
-        ball = '%(split_ball)s' % d
-        self.install_tarball (ball, name)
-        self._package_dict_db[name] = pickle.dumps (d)
-
-    def uninstall_package (self, name):
-        FileManager.uninstall_package (self, name)
-        del self._package_dict_db[name]
-
-    def source_name (self, name):
-        return self._packages [name]['source_name']
-
-    
-def is_string (x):
-    return type (x) == type ('')
-
-class DependencyManager (PackageManager):
-
-    """Manage packages that have dependencies and
-    build_dependencies in their package dicts"""
-
-    def __init__ (self, root, os_interface, **kwargs):
-        PackageManager.__init__ (self, root, os_interface, **kwargs)
-        self.include_build_deps = True
-
-    def dependencies (self, name):
-        assert is_string (name)
-        try:
-            return self.dict_dependencies (self._packages[name])
-        except KeyError:
-            print 'unknown package', name
-            return []
-
-    def dict_dependencies (self, dict):
-        deps = dict['dependencies_string'].split (';')
-        if self.include_build_deps:
-            deps += dict['build_dependencies_string'].split (';')
-
-        deps = [d for d in deps if d]
-        return deps
-
-
-################
-# UGh moveme
-
-
-def topologically_sorted_one (todo, done, dependency_getter,
-                              recurse_stop_predicate=None):
-    sorted = []
-    if done.has_key (todo):
-        return sorted
-
-    done[todo] = 1
-
-    deps = dependency_getter (todo)
-    for d in deps:
-        if recurse_stop_predicate and recurse_stop_predicate (d):
-            continue
-
-        assert type (d) == type (todo)
-
-        sorted += topologically_sorted_one (d, done, dependency_getter,
-                                            recurse_stop_predicate=recurse_stop_predicate)
-
-    sorted.append (todo)
-    return sorted
-
-def topologically_sorted (todo, done, dependency_getter,
-             recurse_stop_predicate=None):
-    s = []
-    for t in todo:
-        s += topologically_sorted_one (t, done, dependency_getter,
-                                       recurse_stop_predicate)
-
-    return s
-
-
-################################################################
-# UGH
-# this is too hairy. --hwn
-
-def gub_to_distro_deps (deps, gub_to_distro_dict):
-    distro = []
-    for i in deps:
-        if i in gub_to_distro_dict.keys ():
-            distro += gub_to_distro_dict[i]
-        else:
-            distro += [i]
-    return distro
-
-def get_base_package_name (name):
-    name = re.sub ('-devel$', '', name)
-
-    # breaks mingw dep resolution, mingw-runtime
-    ##name = re.sub ('-runtime$', '', name)
-    name = re.sub ('-doc$', '', name)
-    return name
-
-def get_source_packages (settings, todo):
-    """TODO is a list of (source) buildspecs.
-
-Generate a list of BuildSpec needed to build TODO, in
-topological order
-    
-"""
-
-    ## don't confuse callers by not modifying argument
-    todo = todo[:]
-
-    cross_packages = cross.get_cross_packages (settings)
-    spec_dict = dict ((p.name (), p) for p in cross_packages)
-    todo += spec_dict.keys ()
-    if cross_packages:
-        # see linux.py
-        print 'get_cross_packages is deprecated, update to get_build_dependencies.'
-    else:
-        todo += cross.get_build_dependencies (settings)
-
-    def name_to_dependencies_via_gub (name):
-        name = get_base_package_name (name)
-        if spec_dict.has_key (name):
-            spec = spec_dict[name]
-        else:
-            spec = targetpackage.get_build_spec (settings, name)
-            spec_dict[name] = spec
-
-        return map (get_base_package_name, spec.get_build_dependencies ())
-
-    def name_to_dependencies_via_distro (distro_packages, name):
-        if spec_dict.has_key (name):
-            spec = spec_dict[name]
-        else:
-            if name in todo or name not in distro_packages.keys ():
-                spec = targetpackage.get_build_spec (settings, name)
-            else:
-                spec = distro_packages[name]
-            spec_dict[name] = spec
-        return spec.get_build_dependencies ()
-
-    def name_to_dependencies_via_cygwin (name):
-        return name_to_dependencies_via_distro (cygwin.get_packages (), name)
-
-    def name_to_dependencies_via_debian (name):
-        return name_to_dependencies_via_distro (debian.get_packages (), name)
-
-    name_to_deps = name_to_dependencies_via_gub
-    if settings.platform == 'cygwin':
-        cygwin.init_dependency_resolver (settings)
-        name_to_deps = name_to_dependencies_via_cygwin
-    elif settings.platform in ('debian-arm', 'debian', 'mipsel'):
-        debian.init_dependency_resolver (settings)
-        name_to_deps = name_to_dependencies_via_debian
-
-    spec_names = topologically_sorted (todo, {}, name_to_deps)
-    spec_dict = dict ((n, spec_dict[n]) for n in spec_names)
-
-    # Fixup for build from url: spec_dict key is full url,
-    # change to base name
-    for name in spec_dict.keys ():
-        spec = spec_dict[name]
-        if name != spec.name ():
-            spec_dict[spec.name ()] = spec
-
-    cross.set_cross_dependencies (spec_dict)
-
-    if settings.is_distro:
-        def obj_to_dependency_objects (obj):
-            return [spec_dict[n] for n in obj.get_build_dependencies ()]
-    else:
-        def obj_to_dependency_objects (obj):
-            return [spec_dict[get_base_package_name (n)]
-                    for n in obj.get_build_dependencies ()]
-
-    sorted_specs = topologically_sorted (spec_dict.values (), {},
-                                         obj_to_dependency_objects)
-
-    # Make sure we build dependencies in order
-    sorted_names = [o.name () for o in sorted_specs]
-    return (sorted_names, spec_dict)
-
-def get_target_manager (settings):
-    target_manager = DependencyManager (settings.system_root,
-                      settings.os_interface)
-    return target_manager
-
-def add_packages_to_manager (target_manager, settings, package_object_dict):
-    
-    ## Ugh, this sucks: we now have to have all packages
-    ## registered at the same time.
-    
-    for spec in package_object_dict.values ():
-        for package in spec.get_packages ():
-            target_manager.register_package_dict (package.dict ())
-
-    return target_manager
--- a/lib/installer.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,346 +0,0 @@
-import os
-import re
-import time
-
-import context
-import darwintools
-import gup
-import targetpackage
-
-from context import subst_method
-from misc import *
-
-class Installer (context.Os_context_wrapper):
-    def __init__ (self, settings):
-        context.Os_context_wrapper.__init__ (self, settings)
-        
-        self.settings = settings
-        self.strip_command \
-            = '%(cross_prefix)s/bin/%(target_architecture)s-strip' 
-        self.no_binary_strip = []
-        self.no_binary_strip_extensions = ['.la', '.py', '.def', '.scm', '.pyc']
-        self.installer_uploads = settings.uploads
-        self.installer_version = None
-        self.installer_build = None
-        self.checksum = '0000'
-
-    @context.subst_method
-    def version (self):
-        return self.settings.installer_version
-
-    def strip_prefixes (self):
-        return ['', 'usr/']
-        
-    def strip_unnecessary_files (self):
-        "Remove unnecessary cruft."
-
-        delete_me = ''
-        for p in self.strip_prefixes ():
-            delete_me += p + '%(i)s '
-
-        for i in (
-            'bin/autopoint',
-            'bin/glib-mkenums',
-            'bin/guile-*',
-            'bin/*-config',
-            'bin/*gettext*',
-            'bin/gs??',
-            'bin/gsdj500',
-            'bin/dbftops',
-            'bin/dvipdf',
-            'bin/pf2afm',
-            'bin/printafm',
-            'bin/pv.sh',
-            'bin/unix-lpr.sh',
-            'bin/wftopfa',
-            'bin/idle',
-            'bin/font2c',
-            'bin/fixmswrd.pl',
-            'bin/dumphint',
-            
-            'bin/[cd]jpeg',
-            'bin/envsubst*',
-            'bin/glib-genmarshal*',
-            'bin/gobject-query*',
-            'bin/gspawn-win32-helper*',
-            'bin/gspawn-win32-helper-console*',
-            'bin/msg*',
-            'bin/pango-querymodules*',
-            'bin/xmlwf',
-            'cross',
-            'doc',
-            'include',
-            'info',
-            'lib/gettext',
-            'lib/gettext/hostname*',
-            'lib/gettext/urlget*',
-            'lib/glib-2.0/include/glibconfig.h',
-            'lib/glib-2.0',
-            'lib/libc.*',
-            'lib/libm.*',
-            'lib/pkgconfig',
-            'lib/*~',
-            'lib/*.a',
-            'lib/python*/distutils/command/wininst-6*',
-            'lib/python*/distutils/command/wininst-7.1*',
-            'man',
-            'share/doc',
-            'share/guile/*/ice-9/debugger/',
-            'share/gettext/intl',
-            'share/ghostscript/*/{Resource,doc,examples}/',
-            'share/gs/*/{Resource,doc,examples}/',
-            'share/gtk-doc',
-            'share/info',
-            'share/fonts/',
-            'share/man',
-            'share/omf',
-            'share/libtool/',
-
-            # prune harder
-            'lib/python*/bsddb',
-            'lib/python*/compiler',
-            'lib/python*/curses',
-            'lib/python*/distutils',
-            'lib/python*/email',
-            'lib/python*/hotshot',
-            'lib/python*/idlelib',
-            'lib/python*/lib-old',
-            'lib/python*/lib-tk',
-            'lib/python*/logging',
-            'lib/python*/test',
-# xml2ly needs xml.dom
-#                        'lib/python*/xml',
-            'share/lilypond/*/make',
-            'share/gettext',
-            'usr/share/aclocal',
-            'share/lilypond/*/tex',
-            'share/lilypond/*/fonts/source',
-# Keep svg fonts.  They are needed for usable/sharable svg output.
-#                        'share/lilypond/*/fonts/svg',
-            'share/lilypond/*/fonts/tfm',
-            'share/lilypond/*/fonts/type1/feta[0-9]*pfa',
-            'share/lilypond/*/fonts/type1/feta-braces-[a-z]*pfa',
-            'share/lilypond/*/fonts/type1/parmesan*pfa',
-            'share/omf',
-            ## 2.6 installer: leave c059*
-            'share/gs/fonts/[a-bd-z]*',
-            'share/gs/fonts/c[^0][^5][^9]*',
-            'share/gs/Resource',                        
-            ):
-
-            self.system ('cd %(installer_root)s && rm -rf ' + delete_me, {'i': i })
-
-    def strip_dir (self, dir):
-        import misc
-        misc.map_command_dir (self.expand (dir),
-                              self.expand ('%(strip_command)s'),
-                              self.no_binary_strip,
-                              self.no_binary_strip_extensions)
-        
-    def strip (self):
-        self.strip_unnecessary_files ()
-        self.strip_dir ('%(installer_root)s/usr/bin')
-        self.strip_dir ('%(installer_root)s/usr/lib')
-
-    def use_install_root_manager (self, manager):
-        pass
-    
-    def create (self):
-        self.system ("mkdir %(installer_root)s/license/", ignore_errors=True)
-        self.system ("cp %(sourcefiledir)s/gub.license %(installer_root)s/license/README", ignore_errors=True)
-
-    def write_checksum (self):
-        open (self.expand ('%(installer_checksum_file)s'), 'w').write (self.checksum)
-
-
-class DarwinRoot (Installer):
-    def __init__ (self, settings):
-        Installer.__init__ (self, settings)
-        self.strip_command += ' -S '
-        self.rewirer = darwintools.Rewirer (self.settings)
-
-    def use_install_root_manager (self, package_manager):
-        tarball = package_manager.package_dict ('darwin-sdk')['split_ball']
-        self.package_manager = package_manager
-        self.rewirer.set_ignore_libs_from_tarball (tarball)
-
-    def create (self):
-        Installer.create (self)
-        self.rewirer.rewire_root (self.expand ('%(installer_root)s'))
-        
-    
-class DarwinBundle (DarwinRoot):
-    def __init__ (self, settings):
-        DarwinRoot.__init__ (self, settings)
-        self.darwin_bundle_dir = '%(targetdir)s/LilyPond.app'
-        
-    def create (self):
-        DarwinRoot.create (self)
-        
-        osx_lilypad_version = self.package_manager.package_dict ('osx-lilypad')['version']
-
-        ## cpu_type = self.expand ('%(platform)s').replace ('darwin-', '')
-        cpu_type = 'ppc'
-        installer_version = self.settings.installer_version
-        installer_build = self.settings.installer_build
-        
-        bundle_zip = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.%(platform)s.tar.bz2', locals ())
-        self.system ('''
-rm -f %(bundle_zip)s 
-rm -rf %(darwin_bundle_dir)s
-tar -C %(targetdir)s -zxf %(downloads)s/osx-lilypad-%(cpu_type)s-%(osx_lilypad_version)s.tar.gz
-cp %(darwin_bundle_dir)s/Contents/Resources/subprocess.py %(installer_root)s/usr/share/lilypond/current/python/
-cp -pR --link %(installer_root)s/usr/* %(darwin_bundle_dir)s/Contents/Resources/
-mkdir -p %(darwin_bundle_dir)s/Contents/Resources/license/
-cp -pR --link %(installer_root)s/license*/* %(darwin_bundle_dir)s/Contents/Resources/license/
-''', locals ())
-        self.file_sub (
-            [('2.[0-9]+.[0-9]+-[0-9]',
-             '%(installer_version)s-%(installer_build)s'),
-            ('Build from .*',
-             'Build from %s' % time.asctime()),
-            ],
-            '%(darwin_bundle_dir)s/Contents/Info.plist',
-            env=locals (),
-            must_succeed=True)
-
-        majmin = '.'.join (installer_version.split ('.')[:2])
-        self.file_sub (
-            [('doc/v2.6/',
-             'doc/v%(majmin)s/'),
-            ],
-            '%(darwin_bundle_dir)s/Contents/Resources/Credits.html',
-            env=locals (),
-            must_succeed=True)
-        
-        self.file_sub (
-            [('2.6.0', installer_version),
-            ],
-            '%(darwin_bundle_dir)s/Contents/Resources/Welcome-to-LilyPond-MacOS.ly',
-            env=locals ())
-        
-        self.system ('cd %(darwin_bundle_dir)s/../ && tar cjf %(bundle_zip)s LilyPond.app',
-                     locals ())
-        
-        self.log_command ("Created %(bundle_zip)s\n", locals()) 
-        self.write_checksum ()
-        
-class MingwRoot (Installer):
-    def __init__ (self, settings):
-        Installer.__init__ (self, settings)
-        self.strip_command += ' -g '
-    
-class Nsis (MingwRoot):
-    def create (self):
-        MingwRoot.create (self)
-        
-        # FIXME: build in separate nsis dir, copy or use symlink
-        installer = os.path.basename (self.expand ('%(installer_root)s'))
-        ns_dir = self.expand ('%(installer_db)s')
-
-        self.dump (r'''
-!define INSTALLER_VERSION "%(installer_version)s"
-!define INSTALLER_BUILD "%(installer_build)s"
-!define INSTALLER_OUTPUT_DIR "%(ns_dir)s"
-!define ROOT "%(installer)s"
-!define PRETTY_NAME "%(pretty_name)s"
-!define CANARY_EXE "%(name)s"
-!define NAME "%(name)s"
-
-!addincludedir "${INSTALLER_OUTPUT_DIR}"
-OutFile "${INSTALLER_OUTPUT_DIR}/setup.exe"
-''',
-                   '%(ns_dir)s/definitions.nsh',
-                   env=locals ())
-        
-        self.system (r'''cp %(nsisdir)s/*.nsh %(ns_dir)s
-cp %(nsisdir)s/*.bat.in %(ns_dir)s
-cp %(nsisdir)s/*.nsi %(ns_dir)s
-cp %(nsisdir)s/*.sh.in %(ns_dir)s''', locals ())
-
-        root = self.expand ('%(installer_root)s')
-        files = [f.replace (root, '').replace ('/', '\\')
-                 for f in self.locate_files (root, '*')]
-
-        self.dump ('\r\n'.join (files) + '\r\n',
-                   '%(installer_root)s/files.txt',
-                   expand_string=False)
-
-        PATH = os.environ['PATH']
-        PATH = '%(local_prefix)s/bin:' + PATH
-        
-        self.system ('cd %(targetdir)s && makensis -NOCD %(ns_dir)s/definitions.nsh %(ns_dir)s/%(name)s.nsi', locals ())
-
-        final = '%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.exe'
-        self.system ('mv %(ns_dir)s/setup.exe %(installer_uploads)s/%(final)s', locals ())
-
-
-class Linux_installer (Installer):
-    def __init__ (self, settings):
-        Installer.__init__ (self, settings)
-        self.bundle_tarball = '%(targetdir)s/%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.tar.bz2'
-
-    def strip_prefixes (self):
-        return Installer.strip_prefixes (self)
-
-    def create_tarball (self):
-        self.system ('tar --owner=0 --group=0 -C %(installer_root)s -jcf %(bundle_tarball)s .', locals ())
-
-def create_shar (orig_file, hello, head, target_shar):
-    length = os.stat (orig_file)[6]
-
-    tarflag = tar_compression_flag (orig_file)
-
-    base_orig_file = os.path.split (orig_file)[1]
-    script = open (head).read ()
-
-    header_length = 0
-    header_length = len (script % locals ()) + 1
-
-    f = open (target_shar, 'w')
-    f.write (script % locals())
-    f.close ()
-
-        
-    cmd = 'cat %(orig_file)s >> %(target_shar)s' % locals ()
-    print 'invoking ', cmd
-    stat = os.system (cmd)
-    if stat:
-        raise 'create_shar() failed'
-    os.chmod (target_shar, 0755)
-
-class Shar (Linux_installer):
-    def create (self):
-        Linux_installer.create (self)
-        self.create_tarball ()
-        
-        target_shar = self.expand ('%(installer_uploads)s/%(name)s-%(installer_version)s-%(installer_build)s.%(platform)s.sh')
-
-        head = self.expand ('%(sourcefiledir)s/sharhead.sh')
-        tarball = self.expand (self.bundle_tarball)
-
-        hello = self.expand ("version %(installer_version)s release %(installer_build)s")
-        create_shar (tarball, hello, head, target_shar)
-        self.write_checksum ()
-        system ('rm %(tarball)s' % locals ())
-        
-def get_installer (settings, args=[]):
-
-    installer_class = {
-        'debian-arm' : Shar,
-        'darwin-ppc' : DarwinBundle,
-        'darwin-x86' : DarwinBundle,
-        'freebsd-x86' : Shar,
-        'freebsd4-x86' : Shar,
-        'freebsd6-x86' : Shar,
-        'linux-arm-softfloat' : Shar,
-        'linux-arm-vfp' : Shar,
-        'linux-x86' : Shar,
-        'linux-64' : Shar,
-        'linux-ppc' : Shar,
-        'mingw' : Nsis,
-#        'mingw' : MingwRoot,
-        'mipsel' : Shar,
-    }
-
-    return installer_class[settings.platform] (settings)
--- a/lib/linux-arm-softfloat.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,186 +0,0 @@
-import cross
-import gcc
-import gub
-import glibc
-import linux
-import targetpackage
-
-binutils_format = 'bz2'
-gcc_format = 'bz2'
-
-'''
-Configured with: /work/GNU/CodeSourcery/src/gcc-3.4.0/configure 
---target=arm-linux 
---host=i686-host_pc-linux-gnu 
---prefix=/usr/local/arm/gnu/release-3.4.0-vfp 
---with-headers=/usr/local/arm/gnu/release-3.4.0-vfp/arm-linux/include 
---with-local-prefix=/usr/local/arm/gnu/release-3.4.0-vfp/arm-linux 
---disable-nls 
---enable-threads=posix 
---enable-symvers=gnu 
---enable-__cxa_atexit 
---enable-languages=c,c++ 
---enable-shared 
---enable-c99 
---enable-clocale=gnu 
---enable-long-long
-'''
-
-code_sourcery = 'http://www.codesourcery.com/public/gnu_toolchain/%(name)s/arm-%(ball_version)s-%(name)s.src.tar.%(format)s'
-
-class Arm_none_elf (gub.BinarySpec, gub.SdkBuildSpec):
-    def install (self):
-        self.system ('''
-mv %(srcdir)s/*gz %(downloads)s
-mkdir -p %(install_root)s
-''')
-
-class Gcc (gcc.Gcc):
-    def patch (self):
-        gcc.Gcc.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-lib1asm.patch
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-nolibfloat.patch
-''')
-    def configure_command (self):
-        return (gcc.Gcc.configure_command (self)
-                + misc.join_lines ('''
---with-float=soft
-#--with-fpu=vfp
-'''))
-
-class Gcc_core (gcc.Gcc_core):
-    def patch (self):
-        gcc.Gcc_core.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-lib1asm.patch
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-3.4.0-arm-nolibfloat.patch
-''')
-    def configure_command (self):
-        return (gcc.Gcc_core.configure_command (self)
-                + misc.join_lines ('''
---with-float=soft
-#--with-fpu=vfp
-'''))
-
-class Glibc (glibc.Glibc):
-    def patch (self):
-        glibc.Glibc.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-wordexp-inline.patch
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-linux-2.4.23-arm-bus-isa.patch
-''')
-    def configure_command (self):
-        return (glibc.Glibc.configure_command (self)
-                + misc.join_lines ('''
---without-fp
-'''))
-
-class Glibc_core (glibc.Glibc_core):
-    def patch (self):
-        glibc.Glibc_core.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-wordexp-inline.patch
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-linux-2.4.23-arm-bus-isa.patch
-''')
-    def configure_command (self):
-        return (glibc.Glibc_core.configure_command (self)
-                + misc.join_lines ('''
---without-fp
-'''))
-
-#FIXME, c&p linux.py
-import mirrors
-import misc
-def _get_cross_packages (settings,
-                         linux_version, binutils_version, gcc_version,
-                         glibc_version, guile_version, python_version):
-    configs = []
-    if not settings.platform.startswith ('linux'):
-        configs = [
-            linux.Guile_config (settings).with (version=guile_version),
-            linux.Python_config (settings).with (version=python_version),
-            ]
-
-    import linux_headers
-    import debian
-    import binutils
-    import gcc
-    import glibc
-    headers = linux_headers.Linux_headers (settings)\
-        .with_tarball (mirror=mirrors.linux_2_6,
-                       version=linux_version,
-                       format='bz2')
-    if settings.package_arch == 'arm':
-        headers = debian.Linux_kernel_headers (settings)\
-            .with (version=linux_version,
-                   strip_components=0,
-                   mirror=mirrors.lilypondorg_deb,
-                   format='deb')
-    sdk = []
-    if binutils_version in ('2004-q1a',):
-        sdk += Arm_none_elf (settings).with (version=binutils_version,
-                                             format='bz2',
-                                             mirror=code_sourcery,
-                                             strip_components=0),
-    return sdk + [
-        headers,
-        binutils.Binutils (settings).with (version=binutils_version,
-                                           format=binutils_format,
-                                           mirror=mirrors.gnu),
-        Gcc_core (settings).with (version=gcc_version,
-                                  mirror=(mirrors.gcc
-                                          % {'name': 'gcc',
-                                             'ball_version': gcc_version,
-                                             'format': gcc_format,}),
-                                  format='bz2'),
-        Glibc_core (settings).with (version=glibc_version,
-                                    mirror=(mirrors.glibc_2_3_snapshots
-                                            % {'name': 'glibc',
-                                               'ball_version': glibc_version,
-                                               'format': 'bz2',}),
-                                    format='bz2'),
-        Gcc (settings).with (version=gcc_version,
-                                 mirror=mirrors.gcc, format=gcc_format),
-        Glibc (settings).with (version=glibc_version,
-                               mirror=mirrors.glibc_2_3_snapshots,
-                               format='bz2'),
-        ] + configs
-
-
-
-def get_cross_packages (settings):
-    return get_cross_packages_pre_eabi (settings)
-    #return get_code_sourcery_2004_q1a (settings)
-
-def get_code_sourcery_2004_q1a (settings):
-    global binutils_format, gcc_format
-    binutils_format = gcc_format = 'gz'
-    linux_version = '2.5.999-test7-bk-17'
-    binutils_version = '2004-q1a'
-    gcc_version = '2004-q1a'
-    glibc_version = '2.3-20070416'
-    guile_version = '1.6.7'
-    python_version = '2.4.1'
-    return _get_cross_packages (settings,
-                                linux_version, binutils_version,
-                                gcc_version, glibc_version,
-                                guile_version, python_version)
-
-def get_cross_packages_pre_eabi (settings):
-    #linux_version = '2.5.75'
-    linux_version = '2.5.999-test7-bk-17'
-    #linux_version = '2.4.34'
-    binutils_version = '2.16.1'
-    gcc_version = '3.4.6'
-    glibc_version = '2.3-20070416'
-    guile_version = '1.6.7'
-    python_version = '2.4.1'
-    return _get_cross_packages (settings,
-                                linux_version, binutils_version,
-                                gcc_version, glibc_version,
-                                guile_version, python_version)
-
-def change_target_package (p):
-    cross.change_target_package (p)
-    return p
--- a/lib/linux.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-def change_target_package (package):
-    import cross
-    import gub
-    import targetpackage
-    cross.change_target_package (package)
-    if isinstance (package, targetpackage.TargetBuildSpec):
-        gub.change_target_dict (package,
-                                {'LD': '%(target_architecture)s-ld --as-needed, ',})
-        gub.append_target_dict (package,
-                                {'LDFLAGS': ' -Wl,--as-needed ' })
-    return package
-
-def get_cross_packages (settings):
-    # obsolete
-    return []
-
-def get_cross_build_dependencies (settings):
-    return ['linux-headers', 'glibc']
-    
--- a/lib/locker.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-"""
-    Copyright (c) 2005--2007
-    Jan Nieuwenhuizen <janneke@gnu.org>
-    Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import os
-import fcntl
-
-class LockedError (Exception):
-    pass
-    
-class Locker:
-    def __init__ (self, lock_file_name):
-        self.lock_file = None
-        self.lock_file_name = None
-        
-        lock_file = open (lock_file_name, 'a')
-        lock_file.write ('')
-
-        try:
-            fcntl.flock (lock_file.fileno (),
-                         fcntl.LOCK_EX | fcntl.LOCK_NB)
-        except IOError:
-            raise LockedError ("Can't acquire lock: " + lock_file_name)
-
-        self.lock_file_name = lock_file_name
-        self.lock_file = lock_file
-
-    def unlock (self):
-        if self.lock_file_name:
-            os.remove (self.lock_file_name)
-            
-        if self.lock_file:
-            fcntl.flock (self.lock_file.fileno(), fcntl.LOCK_UN)
-	
-    def __del__ (self):
-	self.unlock ()
--- a/lib/mingw.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,75 +0,0 @@
-import os
-import re
-
-import mirrors
-import gub
-import cross
-
-class Gcc (cross.Gcc):
-    def patch (self):
-        for f in ['%(srcdir)s/gcc/config/i386/mingw32.h',
-                  '%(srcdir)s/gcc/config/i386/t-mingw32']:
-            self.file_sub ([('/mingw/include','/usr/include'),
-                            ('/mingw/lib','/usr/lib'),
-                            ], f)
-
-# UGH: MI
-class Mingw_runtime (gub.BinarySpec, gub.SdkBuildSpec):
-    def install (self):
-        self.system ('''
-mkdir -p %(install_root)s/usr/share
-tar -C %(srcdir)s/ -cf - . | tar -C %(install_root)s/usr -xf -
-mv %(install_root)s/usr/doc %(install_root)s/share
-''', locals ())
-
-class Cygcheck (gub.BinarySpec):
-    "Only need the cygcheck.exe binary."
-    def __init__ (self, settings):
-        gub.BinarySpec.__init__ (self, settings)
-        self.with (version='1.5.18-1', mirror=mirrors.cygwin_bin, format='bz2')
-        
-    def untar (self):
-        gub.BinarySpec.untar (self)
-
-        file = self.expand ('%(srcdir)s/usr/bin/cygcheck.exe')
-        cygcheck = open (file).read ()
-        self.system ('rm -rf %(srcdir)s/')
-        self.system ('mkdir -p %(srcdir)s/usr/bin/')
-        open (file, 'w').write (cygcheck)
-
-    def basename (self):
-        f = gub.BinarySpec.basename (self)
-        f = re.sub ('-1$', '', f)
-        return f
-
-
-# UGH: MI
-class W32api (gub.BinarySpec, gub.SdkBuildSpec):
-    def untar (self):
-        gub.BinarySpec.untar (self)
-        self.system ('''
-cd  %(srcdir)s/ && mkdir usr && mv include lib usr/
-''')
-
-def get_cross_packages (settings):
-    return [cross.Binutils (settings).with (version='2.16.1',
-                                            mirror=mirrors.gnu,
-                                            format='bz2'),
-            Gcc (settings).with (version='4.1.1',
-                                 mirror=mirrors.gcc_41),
-            Mingw_runtime (settings).with (version='3.9',
-                                           strip_components=0,
-                                           mirror=mirrors.mingw),
-            W32api (settings).with (version='3.6',
-                                    strip_components=0,
-                                    mirror=mirrors.mingw)
-            ]
-
-def change_target_package (p):
-    cross.change_target_package (p)
-
-    gub.change_target_dict (p,
-                    {
-            'DLLTOOL': '%(tool_prefix)sdlltool',
-            'DLLWRAP': '%(tool_prefix)sdllwrap',
-            })
--- a/lib/mipsel.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-
-#
-import cross
-import mirrors
-import gub
-import linux
-import misc
-import targetpackage
-
-class Mipsel_runtime (gub.BinarySpec, gub.SdkBuildSpec):
-    pass
-
-class Gcc_34 (cross.Gcc):
-    def languages (self):
-        return  ['c']
-        
-    def configure_command (self):
-        return misc.join_lines (cross.Gcc.configure_command (self)
-                               + '''
---program-suffix=-3.4
---with-ar=%(cross_prefix)s/bin/%(target_architecture)s-ar
---with-nm=%(cross_prefix)s/bin/%(target_architecture)s-nm
-''')
-
-    def configure (self):
-        cross.Gcc.configure (self)
-        #FIXME: --with-ar, --with-nm does not work?
-        for i in ('ar', 'nm', 'ranlib'):
-            self.system ('cd %(cross_prefix)s/bin && ln -sf %(target_architecture)s-%(i)s %(target_architecture)s-%(i)s-3.4', env=locals ())
-                
-    def install (self):
-        cross.Gcc.install (self)
-        # get rid of duplicates
-        self.system ('''
-rm -f %(install_root)s/usr/lib/libgcc_s.so
-rm -f %(install_root)s/usr/lib/libgcc_s.so.1
-rm -f %(install_root)s/usr/cross/lib/libiberty.a
-rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libiberty.a
-rm -rf %(install_root)s/usr/cross/info
-rm -rf %(install_root)s/usr/cross/man
-rm -rf %(install_root)s/usr/cross/share/locale
-''')
-        if 'c++' in self.languages ():
-            self.system ('''
-rm -rf %(install_root)s/usr/lib/libsupc++.la
-rm -rf %(install_root)s/usr/lib/libstdc++.la
-rm -rf %(install_root)s/usr/lib/libstdc++.so.6
-rm -rf %(install_root)s/usr/lib/libstdc++.so
-rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libsupc++.a
-rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/libstdc++.a
-rm -rf %(install_root)s/usr/cross/mipsel-linux/lib/debug/libstdc++.a
-''')
-
-def get_cross_packages (settings):
-    import debian
-    return debian.get_cross_packages (settings) + [
-        Gcc_34 (settings).with (version='3.4.6',
-                             mirror=(mirrors.gnubase
-                                     + '/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2'),
-                             format='bz2'),
-        ]
-
-def change_target_package (package):
-    cross.change_target_package (package)
-    return package
--- a/lib/mirrors.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,106 +0,0 @@
-
-def untar_flags (tarball):
-    flags = ''
-    if tarball.endswith ('.tar.gz') or tarball.endswith ('.tgz'):
-        flags = '-xzf'
-    elif tarball.endswith ('.tar.bz2'):
-        flags = '-jxf'
-    elif tarball.endswith ('.tar'):
-        flags = '-xf'
-    return flags
-
-gtk = 'ftp://ftp.gtk.org/pub/gtk/v%(gtk_version)s/%(name)s-%(ball_version)s.tar.%(format)s'
-gnome_213 ='http://ftp.gnome.org/pub/GNOME/platform/2.13/2.13.90/sources/%(name)s-%(ball_version)s.tar.%(format)s'
-
-gnome_214 ='http://ftp.gnome.org/pub/GNOME/platform/2.14/2.14.3/sources/%(name)s-%(ball_version)s.tar.%(format)s'
-
-gnome_216 ='http://ftp.gnome.org/pub/GNOME/platform/2.16/2.16.2/sources/%(name)s-%(ball_version)s.tar.%(format)s'
-
-gnome_218 ='http://ftp.gnome.org/pub/GNOME/platform/2.18/2.18.1/sources/%(name)s-%(ball_version)s.tar.%(format)s'
-
-gnubase = 'ftp://ftp.gnu.org/pub/gnu'
-    # FIXME: find complete GNU mirror
-    # base = 'ftp://dl.xs4all.nl/pub/mirror/gnu'
-    # base = 'ftp://sunsite.dk/pub/gnu'
-gnu = gnubase + '/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-gcc = gnubase + '/%(name)s/%(name)s-%(ball_version)s/%(name)s-%(ball_version)s.tar.%(format)s'
-glibc = gnubase + '/glibc/%(name)s-%(ball_version)s.tar.%(format)s'
-alphabase = 'ftp://alpha.gnu.org/pub/gnu'
-alpha = alphabase + '/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-nongnu_savannah = 'http://download.savannah.nongnu.org/releases/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-nongnu          = 'ftp://ftp.gnu.org/pub/gnu/non-gnu/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-freetype = 'http://download.savannah.gnu.org/releases/freetype/%(name)s-%(ball_version)s.tar.%(format)s'
-
-fontconfig = 'http://www.fontconfig.org/release/%(name)s-%(ball_version)s.tar.%(format)s'
-
-lilypondorg = 'http://lilypond.org/download/gub-sources/%(name)s-%(ball_version)s.tar.%(format)s'
-lilypondorg_deb = 'http://lilypond.org/download/gub-sources/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
-
-jantien = 'http://www.xs4all.nl/~jantien/%(name)s-%(ball_version)s.tar.%(format)s'
-
-opendarwin = 'http://www.opendarwin.org/downloads/%(name)s-%(ball_version)s.tar.%(format)s'
-# mesh is broken today
-#'http://mesh.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-sf = 'http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-libpng = 'http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(ball_version)s-config.tar.%(format)s'
-
-mingw = 'http://surfnet.dl.sourceforge.net/sourceforge/mingw/%(name)s-%(ball_version)s.tar.%(format)s'
-
-lp = 'http://lilypond.org/mingw/uploads/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
-
-zlib = 'http://www.zlib.net/%(name)s-%(ball_version)s.tar.%(format)s'
-
-sourceforge = sf
-
-sourceforge_homepage = 'http://%(name)s.sourceforge.net/%(name)s-%(ball_version)s.tar.%(format)s'
-
-fondu = 'http://%(name)s.sourceforge.net/%(name)s_src-%(ball_version)s.tgz'
-
-python = 'http://python.org/ftp/python/%(ball_version)s/Python-%(ball_version)s.tar.%(format)s' 
-
-cygwin_bin = 'http://mirrors.kernel.org/sourceware/cygwin/release/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-# FIXME: s/nl/%(gps-location)s/
-linux_2_4 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.4/linux-%(ball_version)s.tar.%(format)s'
-linux_2_5 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.5/linux-%(ball_version)s.tar.%(format)s'
-linux_2_6 = 'http://www.nl.kernel.org/pub/linux/kernel/v2.6/linux-%(ball_version)s.tar.%(format)s'
-
-cygwin = 'http://mirrors.kernel.org/sourceware/cygwin/release/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
-
-cygwin_gcc = 'http://mirrors.kernel.org/sourceware/cygwin/release/gcc/%(name)s/%(name)s-%(ball_version)s-src.tar.%(format)s'
-
-# FIXME:  %(version)s should probably be %(ball_version)s for download,
-# to include possible '-xyz' version part.
-cups = 'http://ftp.easysw.com/pub/%(name)s/%(version)s/espgs-%(version)s-source.tar.%(format)s'
-jpeg = 'ftp://ftp.uu.net/graphics/jpeg/jpegsrc.v6b.tar.gz'
-
-freebsd_ports = 'ftp://ftp.uk.freebsd.org/pub/FreeBSD/ports/local-distfiles/lioux/%(name)s-%(version)s.tar.%(format)s'
-
-freedesktop = 'http://%(name)s.freedesktop.org/releases/%(name)s-%(version)s.tar.%(format)s'
-
-glibc_deb = 'http://ftp.debian.org/debian/pool/main/g/glibc/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
-
-lkh_deb = 'http://ftp.debian.org/debian/pool/main/l/linux-kernel-headers/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
-
-libdbi_deb = 'http://ftp.debian.org/debian/pool/main/libd/libdbi/%(name)s_%(ball_version)s_%(package_arch)s.%(format)s'
-
-gcc_41 = 'ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-%(ball_version)s/gcc-%(ball_version)s.tar.bz2'
-gcc_snap = 'ftp://ftp.fu-berlin.de/unix/languages/gcc/snapshots/%(ball_version)s/gcc-%(ball_version)s.tar.bz2'
-
-boost_1_33_1 = 'http://surfnet.dl.sourceforge.net/sourceforge/boost/boost_1_33_1.tar.%(format)s'
-
-gnucvs =  ':pserver:anoncvs@cvs.sv.gnu.org:/cvsroot/%(name)s'
-
-redhat_snapshots = 'ftp://sources.redhat.com/pub/%(name)s/snapshots/%(name)s-%(ball_version)s.tar.%(format)s'
-
-#glibc_2_3_snapshots = redhat_snapshots
-glibc_2_3_snapshots = lilypondorg
-
-berlios = 'http://download.berlios.de/%(name)s/%(name)s-%(ball_version)s.tar.%(format)s'
-
-xerces_c = 'http://apache.cs.uu.nl/dist/xml/%(name)s/source/%(name)s-src_%(ball_version)s.tar.%(format)s'
--- a/lib/misc.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,233 +0,0 @@
-# misc utils
-import os
-import re
-import string
-import sys
-import urllib
- 
-def join_lines (str):
-    return str.replace ('\n', ' ')
-
-
-def bind(function, arg1):
-    def bound(*args, **kwargs):
-        return function(arg1, *args, **kwargs)
-
-    return bound
-
-def read_pipe (cmd, ignore_errors=False):
-    print 'executing pipe %s' % cmd
-    pipe = os.popen (cmd)
-
-    val = pipe.read ()
-    if pipe.close () and not ignore_errors:
-        raise SystemFailed ("Pipe failed: %s" % cmd)
-    
-    return val
-
-def grok_sh_variables_str (str):
-    dict = {}
-    for i in str.split ('\n'):
-        m = re.search ('^([^ =]+) *=\s*(.*)$', i)
-        if m:
-            k = m.group (1)
-            s = m.group (2)
-            dict[k] = s
-    return dict
-
-
-def grok_sh_variables (file):
-    return grok_sh_variables_str (open (file).read ())
-
-def itoa (x):
-    if type (x) == int:
-        return "%d" % x
-    return x
-
-def version_to_string (t):
-    return '%s-%s' % (string.join (map (itoa, t[:-1]), '.'), t[-1])
-
-def split_version (s):
-    m = re.match ('^(([0-9].*)-([0-9]+))$', s)
-    if m:
-        return m.group (2), m.group (3)
-    return s, '0'
-
-def string_to_version (s):
-    s = re.sub ('([^0-9][^0-9]*)', ' \\1 ', s)
-    s = re.sub ('[ _.-][ _.-]*', ' ', s)
-    s = s.strip ()
-    def atoi (x):
-        if re.match ('^[0-9]+$', x):
-            return int (x)
-        return x
-    return tuple (map (atoi, (string.split (s, ' '))))
-
-def is_ball (s):
-    return re.match ('^(.*?)-([0-9].*(-[0-9]+)?)(\.[a-z]*)?(\.tar\.(bz2|gz)|\.gu[bp])$', s)
-
-def split_ball (s):
-    m = is_ball (s)
-    if not m:
-        return (s, (0, 0), '')
-    return (m.group (1), string_to_version (string.join (split_version (m.group (2)), '-')), m.group (6))
-
-def list_append (lists):
-    return reduce (lambda x,y: x+y, lists, [])
-
-def uniq (list):
-    u = []
-    done = {}
-    for e in list:
-        if done.has_key (e):
-            continue
-
-        done[e] = 1
-        u.append (e)
-
-    return u
-
-
-
-def intersect (l1, l2):
-    return [l for l in l1 if l in l2]
-
-def bind_method (func, obj):
-    return lambda *args: func (obj, *args)
-
-
-def tar_compression_flag (ball):
-    compression_flag = ''
-    if ball.endswith ('gub'):
-        compression_flag = 'z'
-    elif ball.endswith ('gup'):
-        compression_flag = 'z'
-    elif ball.endswith ('bz2'):
-        compression_flag = 'j'
-    elif ball.endswith ('gz'):
-        compression_flag = 'z'
-    return compression_flag
-
-
-def file_is_newer (f1, f2):
-    return (not os.path.exists (f2)
-        or os.stat (f1).st_mtime > os.stat (f2).st_mtime)
-
-def find (dir, pattern):
-    """
-    Find files under DIR match the regex pattern.
-    """
-    
-    if type('') == type(pattern):
-        pattern = re.compile (pattern)
-
-    dir = re.sub ( "/*$", '/', dir)
-    results = []
-    for (root, dirs, files) in os.walk (dir):
-        root = root.replace (dir, '')
-        files = [os.path.join (root, f) for f in files if pattern.search (f)]
-        
-        results += files
-        
-    return results
-
-def download_url (url, dest_dir):
-    bufsize = 1024 * 50
-    filename = os.path.split (urllib.splithost (url)[1])[1]
-
-    if not os.path.isdir (dest_dir):
-        raise Exception ("not a dir", dest_dir)
-
-    out_filename = dest_dir + '/' + filename
-    print 'downloading', url
-    try:
-        output = open (out_filename, 'w')
-        opener = urllib.URLopener ()
-        url_stream = opener.open (url)
-        while True:
-            contents = url_stream.read (bufsize)
-            output.write (contents)
-            sys.stderr.write ('.')
-            sys.stderr.flush ()
-
-            if not contents:
-                break
-        sys.stderr.write ('\n')
-    except:
-        os.unlink (out_filename)
-        raise
-    
-def forall (generator):
-    v = True
-    try:
-        while v:
-            v = v and generator.next()
-    except StopIteration:
-        pass
-
-    return v
-            
-class SystemFailed (Exception):
-    pass
-
-
-def system (cmd, ignore_errors=False):
-    print 'Executing command %s' % cmd
-    stat = os.system (cmd)
-    if stat and not ignore_errors:
-        raise SystemFailed ('Command failed ' + `stat`)
-
-def file_mod_time (path):
-    import stat
-    return os.stat (path)[stat.ST_MTIME]
-
-
-def map_command_dir (dir, command, filter_out=[], extension_filter_out=[]):
-    import os
-    if not os.path.isdir (dir):
-        raise ('warning: no such dir: %(dir)s' % locals ())
-    (root, dirs, files) = os.walk (dir).next ()
-    for file in files:
-        if (os.path.basename (file) not in filter_out
-          and (os.path.splitext (file)[1] not in extension_filter_out)):
-            system ('%(command)s %(root)s/%(file)s' % locals (),
-                    ignore_errors=True)
-
-def ball_basename (ball):
-    s = ball
-    s = re.sub ('.tgz', '', s)
-    s = re.sub ('-src\.tar.*', '', s)
-    s = re.sub ('\.tar.*', '', s)
-    s = re.sub ('_%\(package_arch\)s.*', '', s)
-    s = re.sub ('_%\(version\)s', '-%(version)s', s)
-    return s
-
-class MethodOverrider:
-    """Override a object method with a function defined outside the
-class hierarchy.
-    
-    Usage:
-
-    def new_func (old_func, arg1, arg2, .. ):
-        ..do stuff..
-        pass
-    
-    old = obj.func
-    p.func = MethodOverrider (old,
-                              new_func,
-                              (arg1, arg2, .. ))
-    """
-    def __init__ (self, old_func, new_func, extra_args=()):
-        self.new_func = new_func
-        self.old_func = old_func
-        self.args = extra_args
-    def __call__ (self):
-        all_args = (self.old_func (),) + self.args  
-        return apply (self.new_func, all_args)
-
-def testme ():
-    print forall (x for x in [1, 1])
-    
-if __name__ =='__main__':
-    testme ()
-
--- a/lib/oslog.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,144 +0,0 @@
-import subprocess
-import sys
-import os
-import time
-import re
-import stat
-
-from misc import SystemFailed
-
-def now ():
-    return time.asctime (time.localtime ())
-
-class Os_commands:
-    '''Encapsulate OS/File system commands for proper logging.'''
-
-    def __init__ (self, logfile):
-        self.log_file = open (logfile, 'a')
-        self.log_file.write ('\n\n * Starting build: %s\n' %  now ())
-
-
-    ## TODO:
-    ## capture complete output of CMD, by polling output, and copying to tty.
-    def system_one (self, cmd, env, ignore_errors):
-        '''Run CMD with environment vars ENV.'''
-
-        self.log_command ('invoking %s\n' % cmd)
-
-        proc = subprocess.Popen (cmd, shell=True, env=env,
-                                 stderr=subprocess.STDOUT)
-
-        stat = proc.wait()
-
-        if stat and not ignore_errors:
-            m = 'Command barfed: %s\n' % cmd
-            self.log_command (m)
-
-            raise SystemFailed (m)
-
-        return 0
-
-    def log_command (self, str):
-        '''Write STR in the build log.'''
-
-        sys.stderr.write (str)
-        if self.log_file:
-            self.log_file.write (str)
-            self.log_file.flush ()
-
-
-    def system (self, cmd, env={}, ignore_errors=False, verbose=False):
-        '''Run os commands, and run multiple lines as multiple
-commands.
-'''
-
-        call_env = os.environ.copy ()
-        call_env.update (env)
-
-        if verbose:
-            keys = env.keys()
-            keys.sort()
-            for k in keys:
-                sys.stderr.write ('%s=%s\n' % (k, env[k]))
-
-            sys.stderr.write ('export %s\n' % ' '.join (keys))
-        for i in cmd.split ('\n'):
-            if i:
-                self.system_one (i, call_env, ignore_errors)
-
-        return 0
-
-    def dump (self, str, name, mode='w'):
-        dir = os.path.split (name)[0]
-        if not os.path.exists (dir):
-            self.system ('mkdir -p %s' % dir)
-
-        self.log_command ("Writing %s (%s)\n" % (name, mode))
-
-        f = open (name, mode)
-        f.write (str)
-        f.close ()
-
-    def file_sub (self, re_pairs, name, to_name=None,
-                  must_succeed=False, use_re=True):
-        '''Substitute RE_PAIRS in file NAME.
-If TO_NAME is specified, the output is sent to there.
-'''
-
-        self.log_command ('substituting in %s\n' % name)
-        self.log_command (''.join (map (lambda x: "'%s' -> '%s'\n" % x,
-                     re_pairs)))
-
-        s = open (name).read ()
-        t = s
-        for frm, to in re_pairs:
-            new_text = ''
-            if use_re:
-                new_text = re.sub (re.compile (frm, re.MULTILINE), to, t)
-            else:
-                new_text = t.replace (frm, to)
-
-            if (t == new_text and must_succeed):
-                raise Exception ('nothing changed!')
-            t = new_text
-
-        if s != t or (to_name and name != to_name):
-            stat_info = os.stat(name)
-            mode = stat.S_IMODE(stat_info[stat.ST_MODE])
-
-            if not to_name:
-                self.system ('mv %(name)s %(name)s~' % locals ())
-                to_name = name
-            h = open (to_name, 'w')
-            h.write (t)
-            h.close ()
-            os.chmod (to_name, mode)
-
-    def read_pipe (self, cmd, ignore_errors=False, silent=False):
-        if not silent:
-            self.log_command ('Reading pipe: %s\n' % cmd)
-
-        pipe = os.popen (cmd, 'r')
-        output = pipe.read ()
-        status = pipe.close ()
-
-        # successful pipe close returns None
-        if not ignore_errors and status:
-            raise Exception ('read_pipe failed')
-        return output
-
-    def shadow_tree (self, src, target):
-        '''Symlink files from SRC in TARGET recursively'''
-
-        target = os.path.abspath (target)
-        src = os.path.abspath (src)
-
-        self.log_command ("Shadowing %s to %s\n" % (src, target))
-        os.makedirs (target)
-        (root, dirs, files) = os.walk(src).next()
-        for f in files:
-            os.symlink (os.path.join (root, f),
-                  os.path.join (target, f))
-        for d in dirs:
-            self.shadow_tree (os.path.join (root, d),
-                     os.path.join (target, d))
--- a/lib/repository.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,664 +0,0 @@
-
-"""
-    Copyright (c) 2005--2007
-    Jan Nieuwenhuizen <janneke@gnu.org>
-    Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import misc
-import os
-import re
-import md5
-import locker
-import time
-import urllib
-import mirrors
-
-## Rename to Source/source.py?
-
-class Repository: 
-    def __init__ (self):
-        self.system = misc.system
-        self.read_pipe = misc.read_pipe
-        
-    def download (self):
-        pass
-
-    def get_checksum (self):
-        """A checksum that characterizes the entire repository.
-        Typically a hash of all source files."""
-
-        return '0'
-
-    def get_file_content (self, file_name):
-        return ''
-
-    def is_tracking (self):
-        "Whether download will fetch newer versions if available"
-        
-        return False
-    
-    def update_workdir (self, destdir):
-        "Populate (preferably update) DESTDIR with sources of specified version/branch"
-
-        pass
-
-    ## Version should be human-readable version.
-    def version  (self):
-        """A human-readable revision number. It need not be unique over revisions."""
-        return '0'
-
-class Version:
-    def __init__ (self, version):
-        self._version = version
-
-    def download (self):
-        pass
-
-    def get_checksum (self):
-        return self.version ()
-
-    def is_tracking (self):
-        return False
-
-    def update_workdir (self, destdir):
-        pass
-
-    def version (self):
-        return self._version
-
-class Darcs (Repository):
-    def __init__ (self, dir, source=''):
-        Repository.__init__ (self)
-        self.dir = dir + '.darcs'
-        self.source = source
-
-    def darcs_pipe (self, cmd):
-
-        dir = self.dir
-        return self.read_pipe ('cd %(dir)s && darcs %(cmd)s' % locals ())
-
-    def darcs (self, cmd):
-        dir = self.dir
-        return self.system ('cd %(dir)s && darcs %(cmd)s' % locals ())
-
-    def get_revision_description (self):
-        return self.darcs_pipe ('changes --last=1')
-    
-    def download (self):
-        dir = self.dir
-        source = self.source
-
-        if os.path.exists (dir + '/_darcs'):
-            self.darcs ('pull -a %(source)s' % locals ())
-        else:
-            self.system ('darcs get %(source)s %(dir)s' % locals ())
-        
-    def is_tracking (self):
-        return True
-
-    ## UGH.
-    def xml_patch_name (self, patch):
-        name_elts =  patch.getElementsByTagName ('name')
-        try:
-            return name_elts[0].childNodes[0].data
-        except IndexError:
-            return ''
-
-    def get_checksum (self):
-        import xml.dom.minidom
-        xml_string = self.darcs_pipe ('changes --xml ')
-        dom = xml.dom.minidom.parseString(xml_string)
-        patches = dom.documentElement.getElementsByTagName('patch')
-        patches = [p for p in patches if not re.match ('^TAG', self.xml_patch_name (p))]
-
-        patches.sort ()
-        release_hash = md5.new ()
-        for p in patches:
-            release_hash.update (p.toxml ())
-
-        return release_hash.hexdigest ()        
-
-    def update_workdir (self, destdir):
-        self.system ('mkdir -p %(destdir)s' % locals ())
-        dir = self.dir
-        
-        self.system ('rsync --exclude _darcs -av %(dir)s/* %(destdir)s/' % locals())
-
-    def get_file_content (self, file):
-        dir = self.dir
-        return open ('%(dir)s/%(file)s' % locals ()).read ()
-
-    
-class TarBall (Repository):
-    def __init__ (self, dir, url, version, strip_components=1):
-        Repository.__init__ (self)
-        if not os.path.isdir (dir):
-            self.system ('mkdir -p %s' % dir)
-
-        self.dir = dir
-        self.url = url
-        self._version = version
-        self.branch = None
-        self.strip_components = strip_components
-        
-    def is_tracking (self):
-        return False
-
-    def _file_name (self):
-        return re.search ('.*/([^/]+)$', self.url).group (1)
-    
-    def _is_downloaded (self):
-        name = os.path.join (self.dir, self._file_name  ())
-        return os.path.exists (name)
-    
-    def download (self):
-        if self._is_downloaded ():
-            return
-        misc.download_url (self.url, self.dir)
-
-    def get_checksum (self):
-        import misc
-        return misc.ball_basename (self._file_name ())
-    
-    def update_workdir_deb (self, destdir):
-        if os.path.isdir (destdir):
-            self.system ('rm -rf %s' % destdir)
-
-        tarball = self.dir + '/' + self._file_name ()
-        strip_components = self.strip_components
-        self.system ('mkdir %s' % destdir)       
-        self.system ('ar p %(tarball)s data.tar.gz | tar -C %(destdir)s --strip-component=%(strip_components)d -zxf -' % locals ())
-        
-    def update_workdir_tarball (self, destdir):
-        
-        tarball = self.dir + '/' + self._file_name ()
-        flags = mirrors.untar_flags (tarball)
-
-        if os.path.isdir (destdir):
-            self.system ('rm -rf %s' % destdir)
-
-        self.system ('mkdir %s' % destdir)       
-        strip_components = self.strip_components
-        self.system ('tar -C %(destdir)s --strip-component=%(strip_components)d %(flags)s %(tarball)s' % locals ())
-
-    def update_workdir (self, destdir):
-        if '.deb' in self._file_name () :
-            self.update_workdir_deb (destdir)
-        else:
-            self.update_workdir_tarball (destdir)
-
-    def version (self):
-        import misc
-        return self._version
-
-class NewTarBall (TarBall):
-    def __init__ (self, dir, mirror, name, ball_version, format='gz',
-                  strip_components=1):
-        TarBall.__init__ (self, dir, mirror % locals (), ball_version,
-                          strip_components)
-
-class RepositoryException (Exception):
-    pass
-
-class Git (Repository):
-    def __init__ (self, git_dir, source='', branch='', revision=''):
-        Repository.__init__ (self)
-        
-        self.repo_dir = os.path.normpath (git_dir) + '.git'
-        self.checksums = {}
-        self.local_branch = ''
-        self.remote_branch = branch
-        self.source = source
-        self.revision = revision
-
-        self.repo_url_suffix = re.sub ('.*://', '', source)
-
-        if self.repo_url_suffix:
-            # FIXME: logic copied foo times
-            fileified_suffix = re.sub ('/', '-', self.repo_url_suffix)
-            # FIXME: projection, where is this used?
-            self.repo_url_suffix = '-' + re.sub ('[:+]+', '-', fileified_suffix)
-        
-        if ':' in branch:
-            (self.remote_branch,
-             self.local_branch) = tuple (branch.split (':'))
-
-            self.local_branch = self.local_branch.replace ('/', '--')
-            self.branch = self.local_branch
-        elif source:
-            self.branch = branch
-
-            if branch:
-                self.local_branch = branch + self.repo_url_suffix
-                self.branch = self.local_branch
-        else:
-            self.branch = branch
-            self.local_branch = branch
-            
-    def version (self):
-        return self.revision
-
-    def is_tracking (self):
-        return self.branch != ''
-    
-    def __repr__ (self):
-        b = self.local_branch
-        if not b:
-            b = self.revision
-        
-        return '#<GitRepository %s#%s>' % (self.repo_dir, b)
-
-    def get_revision_description (self):
-        return self.git_pipe ('log --max-count=1 %s' % self.local_branch)  
-
-    def get_file_content (self, file_name):
-        committish = self.git_pipe ('log --max-count=1 --pretty=oneline %(local_branch)s'
-                                    % self.__dict__).split (' ')[0]
-        m = re.search ('^tree ([0-9a-f]+)',
-                       self.git_pipe ('cat-file commit %(committish)s'  % locals ()))
-
-        treeish = m.group (1)
-        for f in self.git_pipe ('ls-tree -r %(treeish)s' %
-                                locals ()).split ('\n'):
-            (info, name) = f.split ('\t')
-            (mode, type, fileish) = info.split (' ')
-
-            if name == file_name:
-                return self.git_pipe ('cat-file blob %(fileish)s ' % locals ())
-
-        raise RepositoryException ('file not found')
-        
-    def get_branches (self):
-        branch_lines = self.read_pipe (self.git_command () + ' branch -l ').split ('\n')
-
-        branches =  [b[2:] for b in branch_lines]
-        return [b for b in branches if b]
-
-    def git_command (self, dir, repo_dir):
-        if repo_dir:
-            repo_dir = '--git-dir %s' % repo_dir
-
-        c = 'git %(repo_dir)s' % locals ()
-        if dir:
-            c = 'cd %s && %s' % (dir, c)
-
-        return c
-        
-    def git (self, cmd, dir='', ignore_errors=False,
-             repo_dir=''):
-
-        if repo_dir == '' and dir == '':
-            repo_dir = self.repo_dir
-        
-        gc = self.git_command (dir, repo_dir)
-        cmd = '%(gc)s %(cmd)s' % locals ()
-            
-        self.system (cmd, ignore_errors=ignore_errors)
-
-    def git_pipe (self, cmd, ignore_errors=False,
-                  dir='', repo_dir=''):
-
-        if repo_dir == '' and dir == '':
-            repo_dir = self.repo_dir
-            
-        gc = self.git_command (dir, repo_dir)
-        return self.read_pipe ('%(gc)s %(cmd)s' % locals ())
-        
-    def download (self):
-        repo = self.repo_dir
-        source = self.source
-        revision = self.revision
-        
-        if not os.path.isdir (self.repo_dir):
-            self.git ('--git-dir %(repo)s clone --bare -n %(source)s %(repo)s' % locals ())
-
-            for (root, dirs, files) in os.walk ('%(repo)s/refs/heads/' % locals ()):
-                for f in files:
-                    self.system ('mv %s %s%s' % (os.path.join (root, f),
-                                                 os.path.join (root, f),
-                                                 self.repo_url_suffix))
-
-
-                head = open ('%(repo)s/HEAD' % locals ()).read ()
-                head = head.strip ()
-                head += self.repo_url_suffix
-
-                open ('%(repo)s/HEAD' % locals (), 'w').write (head)
-
-            return
-
-        if revision:
-            contents = self.git_pipe ('ls-tree %(revision)s' % locals (),
-                                      ignore_errors=True)
-
-            if contents:
-                return
-            
-            self.git ('--git-dir %(repo)s http-fetch -v -c %(revision)s' % locals ())
-
-        refs = '%s:%s' % (self.remote_branch, self.branch)
-
-        self.git ('fetch --update-head-ok %(source)s %(refs)s ' % locals ())
-        self.checksums = {}
-
-    def get_checksum (self):
-        if self.revision:
-            return self.revision
-        
-        branch = self.local_branch
-        if self.checksums.has_key (branch):
-            return self.checksums[branch]
-
-        repo_dir = self.repo_dir
-        if os.path.isdir (repo_dir):
-            ## can't use describe: fails in absence of tags.
-            cs = self.git_pipe ('rev-list  --max-count=1 %(branch)s' % locals ())
-            cs = cs.strip ()
-            self.checksums[branch] = cs
-            return cs
-        else:
-            return 'invalid'
-
-    def all_files (self):
-        branch = self.branch
-        str = self.git_pipe ('ls-tree --name-only -r %(branch)s' % locals ())
-        return str.split ('\n')
-
-    def update_workdir (self, destdir):
-
-        repo_dir = self.repo_dir
-        branch = self.local_branch
-        revision = self.revision
-        
-        if os.path.isdir (destdir + '/.git'):
-            self.git ('pull %(repo_dir)s %(branch)s' % locals (), dir=destdir)
-        else:
-            self.system ('git-clone -l -s %(repo_dir)s %(destdir)s' % locals ())
-
-        if not revision:
-            revision = open ('%(repo_dir)s/refs/heads/%(branch)s' % locals ()).read ()
-
-        if not branch:
-            branch = 'gub_build'
-            
-        open ('%(destdir)s/.git/refs/heads/%(branch)s' % locals (), 'w').write (revision)
-        self.git ('checkout %(branch)s' % locals (), dir=destdir) 
-
-class CVS(Repository):
-    cvs_entries_line = re.compile ("^/([^/]*)/([^/]*)/([^/]*)/([^/]*)/")
-    #tag_dateformat = '%Y/%m/%d %H:%M:%S'
-
-    def __init__ (self, dir,
-                  source='', module='', tag='HEAD'):
-        Repository.__init__ (self)
-        self.repo_dir = os.path.normpath (dir) + '.cvs'
-        self.module = module
-        self.checksums = {}
-        self.source = source
-        self.tag = tag
-        self.branch = tag # for vc_version_suffix
-        if not os.path.isdir (self.repo_dir):
-            self.system ('mkdir -p %s' % self.repo_dir)
-            
-    def _checkout_dir (self):
-        return '%s/%s' % (self.repo_dir, self.tag)
-
-    def is_tracking (self):
-        return True ##FIXME
-
-    def get_revision_description (self):
-        try:
-            contents = get_file_content ('ChangeLog')
-            entry_regex = re.compile ('\n([0-9])')
-            entries = entry_regex.split (contents)
-            descr = entries[0]
-            
-            changelog_rev = ''
-            
-            for (name, version, date, dontknow) in self.cvs_entries (self.repo_dir + '/CVS'):
-                if name == 'ChangeLog':
-                    changelog_rev  = version
-                    break
-
-            return ('ChangeLog rev %(changelog_rev)s\n%(description)s' %
-                    locals ())
-        
-        except IOError:
-            return ''
-
-    def get_checksum (self):
-        if self.checksums.has_key (self.tag):
-            return self.checksums[self.tag]
-        
-        file = '%s/%s/.vc-checksum' % (self.repo_dir, self.tag)
-
-        if os.path.exists (file):
-            cs = open (file).read ()
-            self.checksums[self.tag] = cs
-            return cs
-        else:
-            return '0'
-        
-    def get_file_content (self, file_name):
-        return open (self._checkout_dir () + '/' + file_name).read ()
-        
-    def read_cvs_entries (self, dir):
-        checksum = md5.md5()
-
-        latest_stamp = 0
-        for d in self.cvs_dirs (dir):
-            for e in self.cvs_entries (d):
-                (name, version, date, dontknow) = e
-                checksum.update (name + ':' + version)
-
-                if date == 'Result of merge':
-                    raise Exception ("repository has been altered")
-                
-                stamp = time.mktime (time.strptime (date))
-                latest_stamp = max (stamp, latest_stamp)
-
-        version_checksum = checksum.hexdigest ()
-        time_stamp = latest_stamp
-
-        return (version_checksum, time_stamp)
-    
-    def update_workdir (self, destdir):
-        dir = self._checkout_dir ()
-        ## TODO: can we get deletes from vc?
-        self.system ('rsync -av --delete --exclude CVS %(dir)s/ %(destdir)s' % locals ())
-        
-    def download (self):
-        suffix = self.tag
-        rev_opt = '-r ' + self.tag
-        source = self.source
-        dir = self._checkout_dir ()
-        lock_dir = locker.Locker (dir + '.lock')
-        module = self.module
-        cmd = ''
-        if os.path.isdir (dir + '/CVS'):
-            cmd += 'cd %(dir)s && cvs -q up -dCAP %(rev_opt)s' % locals()
-        else:
-            repo_dir = self.repo_dir
-            cmd += 'cd %(repo_dir)s/ && cvs -d %(source)s -q co -d %(suffix)s %(rev_opt)s %(module)s''' % locals ()
-
-        self.system (cmd)
-
-        (cs, stamp) = self.read_cvs_entries (dir)
-
-        open (dir + '/.vc-checksum', 'w').write (cs)
-        open (dir + '/.vc-timestamp', 'w').write ('%d' % stamp)
-        
-    def cvs_dirs (self, branch_dir):
-        retval =  []
-        for (base, dirs, files) in os.walk (branch_dir):
-            retval += [os.path.join (base, d) for d in dirs
-                       if d == 'CVS']
-            
-        return retval
-
-    def cvs_entries (self, dir):
-        entries_str =  open (os.path.join (dir, 'Entries')).read ()
-
-        entries = []
-        for e in entries_str.split ('\n'):
-            m = self.cvs_entries_line.match (e)
-            if m:
-                entries.append (tuple (m.groups ()))
-        return entries
-        
-    def all_cvs_entries (self, dir):
-        ds = self.cvs_dirs (dir)
-        es = []
-        for d in ds:
-            
-            ## strip CVS/
-            basedir = os.path.split (d)[0]
-            for e in self.cvs_entries (d):
-                file_name = os.path.join (basedir, e[0])
-                file_name = file_name.replace (self.repo_dir + '/', '')
-
-                es.append ((file_name,) + e[1:])
-            
-
-        return es
-
-    def all_files (self, branch):
-        entries = self.all_cvs_entries (self.repo_dir + '/' + branch)
-        return [e[0] for e in entries]
-    
-# FIXME: why are cvs, darcs, git so complicated?
-class SimpleRepo (Repository):
-    def __init__ (self, dir, repository, source, branch, revision='HEAD'):
-        Repository.__init__ (self)
-        self.repository = repository
-        self.dir = os.path.normpath (dir) + self.repository
-        self.source = source
-        self.revision = revision
-        self.branch = branch
-        if not os.path.isdir (self.dir):
-            self.system ('mkdir -p %(dir)s' % self.__dict__)
-
-    def is_tracking (self):
-        ## FIXME, probably wrong.
-        return self.revision == 'HEAD'
-
-    def update_workdir (self, destdir):
-        working = self._checkout_dir ()
-        self._copy_working_dir (working, destdir)
-
-    def download (self):
-        working = self._checkout_dir ()
-        if not os.path.isdir (working + '/' + self.repository):
-            self._checkout ()
-        if self._current_revision () != self.revision:
-            self._update (working, self.revision)
-
-    def _copy_working_dir (self, working, copy):
-        repository = self.repository
-        self.system ('rsync -av --exclude %(repository)s %(working)s/ %(copy)s'
-                     % locals ())
-
-    def _checkout_dir (self):
-        revision = self.revision
-        dir = self.dir
-        branch = self.branch
-        if branch:
-            branch += '-'
-        return '%(dir)s/%(branch)s%(revision)s' % locals ()
-
-    def get_file_content (self, file_name):
-        return open (self._checkout_dir () + '/' + file_name).read ()
-
-    def get_checksum (self):
-        return self._current_revision ()
-
-    def version (self):
-        return self.revision
-
-class Subversion (SimpleRepo):
-    def __init__ (self, dir, source, branch, module, revision='HEAD'):
-        SimpleRepo.__init__ (self, dir, '.svn', source, branch, revision)
-        self.module = module
-
-    def _current_revision (self):
-        working = self._checkout_dir ()
-        revno = self.read_pipe ('cd %(working)s && svn info' % locals ())
-        m = re.search  ('.*Revision: ([0-9]*).*', revno)
-        assert m
-        return m.group (1)
-        
-    def _checkout (self):
-        dir = self.dir
-        source = self.source
-        branch = self.branch
-        module = self.module
-        revision = self.revision
-        rev_opt = '-r %(revision)s ' % locals ()
-        cmd = 'cd %(dir)s && svn co %(rev_opt)s %(source)s/%(branch)s/%(module)s %(branch)s-%(revision)s''' % locals ()
-        self.system (cmd)
-        
-    def _update (self, working, revision):
-        rev_opt = '-r %(revision)s ' % locals ()
-        cmd = 'cd %(working)s && svn up %(rev_opt)s' % locals ()
-        self.system (cmd)
-
-class Bazaar (SimpleRepo):
-    def __init__ (self, dir, source, revision='HEAD'):
-        # FIXME: multi-branch repos not supported for now
-        SimpleRepo.__init__ (self, dir, '.bzr', source, '', revision)
-
-    def _current_revision (self):
-        working = self._checkout_dir ()
-        revno = self.read_pipe ('cd %(working)s && bzr revno' % locals ())
-        assert revno
-        return revno[:-1]
-
-    def _checkout (self):
-        dir = self.dir
-        source = self.source
-        revision = self.revision
-        rev_opt = '-r %(revision)s ' % locals ()
-        cmd = ('cd %(dir)s && bzr branch %(rev_opt)s %(source)s %(revision)s'''
-               % locals ())
-        self.system (cmd)
-        
-    def _update (self, working, revision):
-        rev_opt = '-r %(revision)s ' % locals ()
-        cmd = 'cd %(working)s && bzr pull %(rev_opt)s' % locals ()
-        self.system (cmd)
-
-def get_repository_proxy (dir, branch):
-    m = re.search (r"(.*)\.(bzr|git|cvs|svn|darcs)", dir)
-    
-    dir = m.group (1)
-    type = m.group (2)
-
-    if type == 'bzr':
-        return Bazaar (dir, branch=branch)
-    elif type == 'cvs':
-        return CVS (dir, branch=branch)
-    elif type == 'darcs':
-        return Darcs (dir)
-    elif type == 'git':
-        return Git (dir, branch=branch)
-    elif type == 'svn':
-        return Subversion (dir, branch=branch)
-    else:
-        raise UnknownVcSystem('repo format unknown: ' + dir)
-
-    return Repository('', '')
--- a/lib/settings.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,176 +0,0 @@
-import os
-import re
-import oslog
-import distcc
-import gub
-
-from context import *
-
-platforms = {
-    'debian-arm': 'arm-linux',
-    'cygwin': 'i686-cygwin',
-    'darwin-ppc': 'powerpc-apple-darwin7',
-    'darwin-x86': 'i686-apple-darwin8',
-    'debian': 'i686-linux',
-    'freebsd-x86': 'i686-freebsd4',
-    
-    'freebsd4-x86': 'i686-freebsd4',
-    'freebsd6-x86': 'i686-freebsd6',
-    'linux-arm-softfloat': 'armv5te-softfloat-linux',
-    'linux-arm-vfp': 'arm-linux',
-    'linux-x86': 'i686-linux',
-    'linux-64': 'x86_64-linux',
-    'linux-ppc': 'powerpc-linux',
-    'local': 'local',
-    'mingw': 'i686-mingw32',
-    'mipsel': 'mipsel-linux',
-}
-
-distros = ('debian-arm', 'cygwin', 'debian', 'mipsel')
-            
-class Settings (Context):
-    def __init__ (self, platform):
-        Context.__init__ (self)
-        self.platform = platform
-        self.target_architecture = platforms[self.platform]
-        self.cpu = self.target_architecture.split ('-')[0]
-        self.build_source = False
-        self.is_distro = platform in distros
-
-        self.target_gcc_flags = '' 
-        self.topdir = os.getcwd ()
-        self.logdir = self.topdir + '/log'
-        self.downloads = self.topdir + '/downloads'
-        self.patchdir = self.topdir + '/patches'
-        self.sourcefiledir = self.topdir + '/sourcefiles'
-        self.specdir = self.topdir + '/specs'
-        self.nsisdir = self.topdir + '/nsis'
-        self.gtk_version = '2.8'
-
-        self.tool_prefix = self.target_architecture + '-'
-        self.system_root = self.topdir + '/target/' + self.platform
-        self.targetdir = self.system_root + '/gubfiles'
-
-        ## Patches are architecture dependent, 
-        ## so to ensure reproducibility, we unpack for each
-        ## architecture separately.
-        self.allsrcdir = os.path.join (self.targetdir, 'src')
-        
-        self.allbuilddir = self.targetdir + '/build'
-        self.statusdir = self.targetdir + '/status'
-
-        ## Safe uploads, so that we can rm -rf target/*
-        ## and still cheaply construct a (partly) system root
-        ## from .gub packages.
-        self.uploads = self.topdir + '/uploads'
-        self.gub_uploads = self.uploads + '/' + self.platform
-
-        ## FIXME
-##        self.gub_cross_uploads = '%s/%s-cross' % (self.uploads, self.platform)
-
-        self.distcc_hosts = ''
-        
-        self.core_prefix = self.system_root + '/usr/cross/core'
-        # FIXME: rename to target_root?
-        self.cross_prefix = self.system_root + '/usr/cross'
-        self.installdir = self.targetdir + '/install'
-        self.local_prefix = self.topdir + '/target/local/usr'
-        self.cross_distcc_bindir = self.topdir + '/target/cross-distcc/bin'
-        self.native_distcc_bindir = self.topdir + '/target/native-distcc/bin'
-        
-	if self.target_architecture.startswith ('x86_64'):
-	    self.package_arch = 'amd64'
-            self.debian_branch = 'unstable'
-	else:
-            self.package_arch = re.sub ('-.*', '', self.target_architecture)
-            self.package_arch = re.sub ('i[0-9]86', 'i386', self.package_arch)
-            self.package_arch = re.sub ('arm.*', 'arm', self.package_arch)
-#            self.package_arch = re.sub ('powerpc.*', 'ppc', self.package_arch)
-            self.debian_branch = 'stable'
-        
-        self.keep_build = False
-        self.use_tools = False
-        self.build_autopackage = self.allbuilddir + '/autopackage'
-
-        if not os.path.isdir ('log'):
-            os.mkdir ('log')
-            
-        self.os_interface = oslog.Os_commands ('log/build-%s.log'
-                                               % self.target_architecture)
-        self.create_dirs ()
-        self.build_architecture = self.os_interface.read_pipe ('gcc -dumpmachine',
-                                                               silent=True)[:-1]
-
-        try:
-            self.cpu_count_str = '%d' % os.sysconf ('SC_NPROCESSORS_ONLN')
-        except ValueError:
-            self.cpu_count_str = '1'
-
-        ## make sure we don't confuse build or target system.
-        self.LD_LIBRARY_PATH = '%(system_root)s/'
-        
-    def verbose (self):
-        try:
-            return self.options.verbose
-        except AttributeError:
-            return False
-    
-    def create_dirs (self): 
-        for a in (
-            'downloads',
-            'logdir',
-            'gub_uploads',
-#            'gub_cross_uploads',
-            'specdir',
-            'allsrcdir',
-            'statusdir',
-            'system_root',
-            'core_prefix',
-            'cross_prefix',
-            'targetdir',
-            'local_prefix',
-            'topdir',
-            ):
-            dir = self.__dict__[a]
-            if os.path.isdir (dir):
-                continue
-
-            self.os_interface.system ('mkdir -p %s' % dir)
-
-
-    def set_distcc_hosts (self, options):
-        def hosts (xs):
-            return reduce (lambda x,y: x+y,
-                           [ h.split (',') for h in xs], [])
-        
-        self.cross_distcc_hosts = ' '.join (distcc.live_hosts (hosts (options.cross_distcc_hosts)))
-
-        self.native_distcc_hosts = ' '.join (distcc.live_hosts (hosts (options.native_distcc_hosts), port=3634))
-
-
-
-    def set_branches (self, bs):
-        "set branches, takes a list of name=branch strings."
-
-        self.branch_dict = {}
-        for b in bs:
-            (name, br) = tuple (b.split ('='))
-
-            self.branch_dict[name] = br
-            self.__dict__['%s_branch' % name]= br
-
-            
-def get_settings (platform):
-    settings = Settings (platform)
-    
-    if platform not in platforms.keys ():
-        raise 'unknown platform', platform
-        
-    if platform == 'darwin-ppc':
-        settings.target_gcc_flags = '-D__ppc__'
-    elif platform == 'mingw':
-        settings.target_gcc_flags = '-mwindows -mms-bitfields'
-
-    return settings
-
-
--- a/lib/targetpackage.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,169 +0,0 @@
-import os
-import gub
-import misc
-import re
-import imp
-import md5
-import cross
-
-from context import subst_method
-
-class TargetBuildSpec (gub.BuildSpec):
-    def configure_command (self):
-        return misc.join_lines ('''%(srcdir)s/configure
---config-cache
---enable-shared
---disable-static
---build=%(build_architecture)s
---host=%(target_architecture)s
---target=%(target_architecture)s
---prefix=/usr
---sysconfdir=/usr/etc
---includedir=/usr/include
---infodir=/usr/share/info
---mandir=/usr/share/man
---libdir=/usr/lib
-''')
-
-    def __init__ (self, settings):
-        gub.BuildSpec.__init__ (self, settings)
-
-    def install (self):
-        self.pre_install_libtool_fixup ()
-        gub.BuildSpec.install (self)
-
-    def pre_install_libtool_fixup (self):
-        ## Workaround for libtool bug.
-        ## libtool inserts -L/usr/lib into command line, but this is
-        ## on the target system. It will try link in libraries from
-        ## /usr/lib/ on the build system. This seems to be problematic for libltdl.a and libgcc.a on MacOS.
-        ##
-        for lt in self.locate_files ("%(builddir)s", '*.la'):
-            lt = lt.strip()
-            if not lt:
-                continue
-
-            dir = os.path.split (lt)[0]
-            suffix = "/.libs"
-            if re.search("\\.libs$", dir):
-                suffix = ''
-            self.file_sub ([
-                ("libdir='/usr/lib'", "libdir='%(dir)s%(suffix)s'"),
-                ],
-                   lt, env=locals ())
-
-    ## UGH. only for cross!
-    def config_cache_overrides (self, str):
-        return str
-
-    def config_cache_settings (self):
-        return self.config_cache_overrides (self, '')
-
-    def config_cache (self):
-        str = self.config_cache_settings ()
-        if str:
-            self.system ('mkdir -p %(builddir)s')
-            cache_file = '%(builddir)s/config.cache'
-            self.dump (self.config_cache_settings (), cache_file)
-            os.chmod (self.expand (cache_file), 0755)
-
-    def config_cache_settings (self):
-        import config_cache
-        return self.config_cache_overrides (config_cache.config_cache['all']
-                                            + config_cache.config_cache[self.settings.platform])
-
-    def compile_command (self):
-        c = gub.BuildSpec.compile_command (self)
-        if (self.settings.cross_distcc_hosts
-            and not self.broken_for_distcc ()
-            and re.search (r'\bmake\b', c)):
-            
-            jobs = '-j%d ' % (2*len (self.settings.cross_distcc_hosts.split (' ')))
-            c = re.sub (r'\bmake\b', 'make ' + jobs, c)
-
-            ## do this a little complicated: we don't want a trace of
-            ## distcc during configure.
-            c = 'DISTCC_HOSTS="%s" %s' % (self.settings.cross_distcc_hosts , c)
-            c = 'PATH="%(cross_distcc_bindir)s:$PATH" ' + c
-        elif self.settings.cpu_count_str:
-            c += ' -j%s '% self.settings.cpu_count_str
-        return c
-            
-    def configure (self):
-        self.config_cache ()
-        gub.BuildSpec.configure (self)
-
-    ## FIXME: this should move elsewhere , as it's not
-    ## package specific
-    def get_substitution_dict (self, env={}):
-        dict = {
-            'AR': '%(tool_prefix)sar',
-            'AS': '%(tool_prefix)sas',
-            'CC': '%(tool_prefix)sgcc %(target_gcc_flags)s',
-            'CC_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
-            'CCLD_FOR_BUILD': 'C_INCLUDE_PATH= CPATH= CPPFLAGS= LIBRARY_PATH= cc',
-
-
-            ## %(system_root)s/usr/include is already done by
-            ## GCC --with-sysroot config, but we  have to be sure
-            ## note that overrides some headers in sysroot/usr/include,
-            ## which is why setting C_INCLUDE_PATH breaks on FreeBSD. 
-            ## 
-            ## no %(local_prefix)s/usr/include, as this will interfere
-            ## with target headers.
-            ## The flex header has to be copied into the target compile manually.
-            ##
-            'C_INCLUDE_PATH': '',
-            'CPATH': '',
-            'CPLUS_INCLUDE_PATH': '',
-            'CXX':'%(tool_prefix)sg++ %(target_gcc_flags)s',
-
-#--urg-broken-if-set-exec-prefix=%(system_root)s/usr \
-## ugh, creeping -L/usr/lib problem
-## trying revert to LDFLAGS...
-##                        'LIBRARY_PATH': '%(system_root)s/usr/lib:%(system_root)s/usr/bin',
-            'LIBRARY_PATH': '',
-# FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken
-#            'LDFLAGS': '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api',
-            'LDFLAGS': '',
-            'LD': '%(tool_prefix)sld',
-            'NM': '%(tool_prefix)snm',
-            'PKG_CONFIG_PATH': '%(system_root)s/usr/lib/pkgconfig',
-            'PATH': '%(cross_prefix)s/bin:%(local_prefix)s/bin:' + os.environ['PATH'],
-            'PKG_CONFIG': '''pkg-config \
---define-variable prefix=%(system_root)s/usr \
---define-variable includedir=%(system_root)s/usr/include \
---define-variable libdir=%(system_root)s/usr/lib \
-''',
-            'RANLIB': '%(tool_prefix)sranlib',
-            'SED': 'sed', # libtool (expat mingw) fixup
-            }
-
-        # FIXME: usr/bin and w32api belongs to mingw/cygwin; but overriding is broken
-        # FIXME: how to move this to cygwin.py/mingw.py?
-        # Hmm, better to make wrappers for gcc/c++/g++ that add options;
-        # see (gub-samco branch) linux-arm-vfp.py?
-        if self.settings.platform in ('cygwin', 'mingw'):
-            dict['LDFLAGS'] = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
-
-        #FIXME: how to move this to arm.py?
-        if self.settings.target_architecture == 'armv5te-softfloat-linux':
-            dict['CFLAGS'] = '-O'
-
-        dict.update (env)
-        d = gub.BuildSpec.get_substitution_dict (self, dict).copy ()
-        return d
-
-def get_build_spec (settings, url):
-    """
-    Return TargetBuildSpec instance to build package from URL.
-
-    URL can be partly specified (eg: only a name, `lilypond'),
-    defaults are taken from the spec file.
-    """
-
-    package = gub.get_build_spec (TargetBuildSpec, settings, url)
-    crossmod = cross.get_cross_module (settings.platform)
-    crossmod.change_target_package (package)
-    return package
-    
--- a/lib/toolpackage.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,57 +0,0 @@
-import misc
-import os
-import re
-
-import gub
-
-class ToolBuildSpec (gub.BuildSpec):
-    def configure_command (self):
-        return (gub.BuildSpec.configure_command (self)
-            + misc.join_lines ('''
---prefix=%(local_prefix)s
-'''))
-
-    ## ugh: prefix= will trigger libtool relinks.
-    def install_command (self):
-        return '''make DESTDIR=%(install_root)s install'''
-
-    def install (self):
-        gub.BuildSpec.install (self)
-        self.wrap_executables ()
-                
-    def wrap_executables (self):
-        for e in (self.locate_files ('%(install_root)s/usr/bin', '*')
-                  + self.locate_files ('%(install_root)s/%(local_prefix)s/bin',
-                                       '*')):
-            dir = os.path.dirname (e)
-            file = os.path.basename (e)
-            self.system ('mv %(e)s %(dir)s/.%(file)s', locals ())
-            self.dump ('''#!/bin/sh
-LD_LIBRARY_PATH=%(system_root)s/usr/lib
-%(system_root)s/usr/bin/.%(file)s "$@"
-''', e, env=locals ())
-            os.chmod (e, 0755)
-
-    def compile_command (self):
-        return self.native_compile_command ()
-
-    ## we need to tar up %(install_root)/%(prefix)
-    def packaging_suffix_dir (self):
-        return '%(system_root)s'
-
-    def get_subpackage_names (self):
-        return ['']
-
-    def configure (self):
-        gub.BuildSpec.configure (self)
-        self.update_libtool ()
-
-    def get_substitution_dict (self, env={}):
-        dict = {
-            'C_INCLUDE_PATH': '%(local_prefix)s/include',
-            'LIBRARY_PATH': '%(local_prefix)s/lib',
-            'CPLUS_INCLUDE_PATH': '%(local_prefix)s/include',
-        }
-        dict.update (env)
-        d = gub.BuildSpec.get_substitution_dict (self, dict).copy ()
-        return d
--- a/lib/tools.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-# FIXME: why is this called tools iso local?
-def get_cross_build_dependencies (settings):
-    return []
-
-def get_cross_packages (settings):
-    return []
-
-def change_target_package (bla):
-    pass
-
--- a/lib/versiondb.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,219 +0,0 @@
-#!/usr/bin/env python
-
-"""
-    Copyright (c) 2005--2007
-    Jan Nieuwenhuizen <janneke@gnu.org>
-    Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import re
-import urllib
-import string
-import pickle
-import optparse
-import os
-
-platforms = ['linux-x86',
-             'linux-64',
-             'linux-ppc',
-             'darwin-ppc',
-             'darwin-x86',
-             'documentation',
-             'freebsd-x86',
-             'mingw',
-             'cygwin',
-             'source',
-             ]
-
-def get_url_versions (url):
-    opener = urllib.URLopener ()
-    index = opener.open (url).read ()
-
-    versions = []
-    def note_version (m):
-        name = m.group (1)
-        version = tuple (map (int,  m.group (2).split('.')))
-        build = 0
-        build_url = url + re.sub ("HREF=", '', m.group (0))
-        build_url = build_url.replace ('"', "")
-        
-        # disregard buildnumber for src tarball. 
-        if m.group(3):
-            build = int (m.group (4))
-            
-        versions.append ((name, version, build, build_url))
-        
-        return ''
-
-    # [^0-9] is to force that version no is not swalled by name. Check this for cygwin libfoo3  
-    # packages
-    re.sub (r'HREF="(.*[^0-9])-([0-9.]+)(-([0-9]+))?\.[0-9a-z-]+\.[.0-9a-z-]+"', note_version, index)
-
-    return versions
-
-class VersionDataBase:
-    def __init__ (self, file_name):
-        self._db = {}
-        self.file_name = file_name
-        if os.path.exists (file_name):
-            self.read ()
-            
-    def platforms (self):
-        return self._db.keys ()
-    
-    def get_sources_from_url (self, url):
-
-        ## ugh: should follow urls in the index.
-        directories = ['v0.0', 'v0.1', 'v1.0', 'v1.1', 'v1.2', 'v1.3',
-                       'v1.4', 'v1.5', 'v1.6', 'v1.7', 'v1.8', 'v1.9',
-                       'v2.0', 'v2.1', 'v2.2', 'v2.3', 'v2.4', 'v2.5',
-                       'v2.6', 'v2.7', 'v2.8', 'v2.9', 'v2.10', 'v2.11']
-
-        sources = []
-        for d in directories:
-            u = '%(url)ssources/%(d)s/' % locals ()
-            sources += get_url_versions (u)
-            
-        self._db['source'] = sources
-
-
-    def get_binaries_from_url (self, url):
-        package = os.path.basename (os.path.splitext (self.file_name)[0])
-        for p in platforms:
-            if p == 'source':
-                continue
-            
-            u = '%(url)sbinaries/%(p)s/' % locals ()
-            
-            if p == 'cygwin':
-                u += 'release/%(package)s/' % locals ()
-
-            try:
-                self._db[p] = get_url_versions (u)
-            except IOError, x:
-                print 'problem loading', u 
-                continue
-            
-    def write (self):
-        open (self.file_name,'w').write (pickle.dumps (self._db))
-
-    def read (self):
-        self._db = pickle.loads (open (self.file_name).read ())
-
-
-    ## UI functions:
-    def get_next_build_number (self, version_tuple):
-        assert (type (version_tuple) == type (()))
-        sub_db = {}
-        for platform in platforms:
-            sub_db[platform] = [0]
-            if self._db.has_key (platform):
-                sub_db[platform] = [buildnum
-                                    for (name, version, buildnum, url)
-                                    in self._db[platform]
-                                    if version == version_tuple]
-            
-        return max (max (bs + [0]) for (p, bs) in sub_db.items ()) + 1
-
-    def get_last_release (self, platform, version_tuple):
-        candidates = [(v, b, url) for (name, v, b, url) in  self._db[platform]
-                      if v[:len (version_tuple)] == version_tuple]
-        candidates.append ( ((0,0,0), 0, '/dev/null' ))
-        candidates.sort ()
-        
-        return candidates[-1]
-
-def get_cli_parser ():
-    p = optparse.OptionParser ()
-
-    p.usage='''versiondb.py  [OPTION]... COMMAND [PACKAGE]...
-
-Inspect lilypond.org download area, and write pickle of all version numbers.
-
-'''
-    p.description='Grand Unified Builder.  Specify --package-version to set build version'
-
-    p.add_option ('--dbfile', action='store',
-                  dest="dbfile",
-                  help="Pickle of version dict",
-                  default="uploads/lilypond.versions")
-                  
-    p.add_option ('--url', action='store',
-                  dest='url',
-                  default='http://lilypond.org/download/',
-                  help='download url')
-
-    p.add_option ('--download', action='store_true',
-                  dest='download',
-                  default=False,
-                  help='download new versions')
-
-
-    p.add_option ('--no-sources', action='store_false',
-                  dest='do_sources',
-                  default=True,
-                  help="do not look for versions of sources")
-
-    p.add_option ('--build-for', action='store',
-                  dest='version',
-                  default='',
-                  help='print build number for version')
-
-    p.add_option ('--test', action='store_true',
-                  dest='test',
-                  default=False,
-                  help='self test')
-
-    return p
-
-def main ():
-    cli_parser = get_cli_parser ()
-    (options, files) = cli_parser.parse_args ()
-
-    if options.url and not options.url.endswith ('/'):
-        options.url += "/"
-
-    db = VersionDataBase (options.dbfile)
-    if options.test:
-        print '2.9.28:', db.get_next_build_number ((2,9,28))
-        print '2.8.2:', db.get_next_build_number ((2,8,2))
-        print '2.9.28:', db.get_next_build_number ((2,9,28))
-        print '2.8.2:', db.get_next_build_number ((2,8,2))
-        print '2.10.0 next:', db.get_next_build_number ((2,10,0))
-        
-        print 'last mingw 2.9.26:', db.get_last_release ('mingw', (2,9,26))
-        print 'last mingw 2.9:', db.get_last_release ('mingw', (2,9))
-        print 'last mingw 2.9:', db.get_last_release ('mingw', (2,))
-        print 'last source:', db.get_last_release ('source', ())
-        return
-
-    if options.download:
-        
-        ##ugh
-        if options.do_sources: 
-            db.get_sources_from_url (options.url)
-            
-        db.get_binaries_from_url (options.url)
-        db.write ()
-
-    if options.version:
-        v = tuple (map (int, options.version.split ('.')))
-        print db.get_next_build_number (v)
-    
-    
-if __name__ == '__main__':
-    main ()
--- a/lib/with-lock.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-#!/usr/bin/env python
-
-
-"""
-    Copyright (c) 2005--2007
-    Jan Nieuwenhuizen <janneke@gnu.org>
-    Han-Wen Nienhuys <hanwen@xs4all.nl>
-
-    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, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
-"""
-
-import optparse
-import sys
-import os
-
-
-sys.path.insert (0, os.path.split (sys.argv[0])[0] + '/../lib/')
-
-import locker
-
-def parse_options ():
-    p = optparse.OptionParser ()
-    p.usage = "with-lock.py FILE COMMAND"
-    p.add_option ('--skip',
-		  action="store_true",
-		  dest="skip",
-		  help="return 0 if couldn't get lock.")
-
-    p.disable_interspersed_args()
-
-
-    (o,a) = p.parse_args ()
-    if len (a) < 2:
-	p.print_help()
-	sys.exit (2)
-	
-    return o,a
-
-def run_command_with_lock (lock_file_name, cmd, args):
-    lock_obj = locker.Locker (lock_file_name)
-    stat = os.spawnvp (os.P_WAIT, cmd, args)
-    return stat
-
-def main ():
-    (opts, args) = parse_options ()
-
-    lock_file_name = args[0]
-    cmd = args[1]
-
-    ## need to include binary too.
-    args = args[1:]
-
-
-    try:
-        stat = run_command_with_lock (lock_file_name, cmd, args)
-        sys.exit (stat)
-    except locker.LockedError:
-	print "Can't acquire lock %s" % lock_file_name
-	if opts.skip:
-	    sys.exit (0)
-	else:
-	    sys.exit (1)
-
-if __name__ == '__main__':
-    main ()
--- a/specs/a52dec.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-import targetpackage
-
-a52 = 'http://liba52.sourceforge.net/files/%(name)s-%(ball_version)s.tar.%(format)s'
-
-class A52dec (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=a52, version='0.7.4')
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + ' CFLAGS=-fPIC')
-        
--- a/specs/alien.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-
-## untested.
-        Alien (settings).with (version="8.60",
-                   mirror="http://www.kitenet.net/programs/alien/alien_8.60.tar.gz",
-                   format="gz"),
-
-
-class Alien (ToolBuildSpec):
-    def srcdir (self):
-        return '%(allsrcdir)s/alien'
-    def patch (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-
-    def configure (self):
-        ToolBuildSpec.configure (self)
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/alien.patch')
-    def configure_command (self):
-        return 'perl Makefile.PL'
-
--- a/specs/autoconf.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-import mirrors
-import toolpackage
-
-class Autoconf(toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-	toolpackage.ToolBuildSpec.__init__ (self, settings)
-	self.with (mirror=mirrors.gnu,
-		   version="2.59", format='bz2')
--- a/specs/automake.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-import mirrors
-import toolpackage
-
-class Automake (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-	toolpackage.ToolBuildSpec.__init__ (self, settings)
-	self.with (mirror=mirrors.gnu,
-		   version="1.10", format='gz')
--- a/specs/bash.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-import targetpackage
-
-class Bash (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='3.2',
-                   mirror='ftp://ftp.cwru.edu/pub/bash/bash-3.2.tar.gz',
-                   format='bz2')
-
-    def get_build_dependencies (self):
-        return ['libtool', 'gettext-devel']
--- a/specs/binutils.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-import cross
-import mirrors
-
-class Binutils (cross.Binutils):
-    def __init__ (self, settings):
-        cross.Binutils.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.gnu, version='2.16.1', format='bz2')
-
--- a/specs/boost.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-import mirrors
-import gub
-import misc
-import targetpackage
-#
-import os
-
-# TODO: AutoToolSpec
-class BjamBuildSpec (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        gub.append_target_dict (self, {'CFLAGS': ''})
-    def get_substitution_dict (self, env={}):
-        # FIXME: how to add settings to dict?
-        dict = targetpackage.TargetBuildSpec.get_substitution_dict (self, env)
-        dict['CFLAGS'] = ''
-        return dict
-    def patch (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-    def configure_command (self):
-        return 'true'
-    def compile_command (self):
-# FIXME: WTF, where has python_version gone?
-# only static because dynamic libs fail on linux-64..?
-#<runtime-link>static/dynamic
-# --without-test because is only available as shared lib
-
-# FIXME: how to add settings to dict?
-#'-sGCC=%(tool_prefix)sgcc %(CFLAGS)s
-#'-sGXX=%(tool_prefix)sg++ %(CFLAGS)s
-
-        return misc.join_lines ('''
-bjam
-'-sTOOLS=gcc'
-'-sGCC=%(tool_prefix)sgcc -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
-'-sGXX=%(tool_prefix)sg++ -fPIC -DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
-'-sNO_BZIP2=1'
-'-sNO_ZLIB=1'
-'-sBUILD=release <optimization>space <inlining>on <debug-symbols>off <runtime-link>static'
-'-sPYTHON_VERSION=2.4'
-'-scxxflags=-fPIC'
---without-python
---without-test
---with-python-root=/dev/null
---layout=system
---builddir=%(builddir)s
---with-python-root=/dev/null
---prefix=/usr
---exec-prefix=/usr
---libdir=/usr/lib
---includedir=/usr/include
-''')
-    def install_command (self):
-        return (self.compile_command ()
-                + ' install').replace ('=/usr', '=%(install_root)s/usr')
-
-class Boost (BjamBuildSpec):
-    def __init__ (self,settings):
-        BjamBuildSpec.__init__ (self, settings)
-        self.with (version='1.33.1', mirror=mirrors.boost_1_33_1, format='bz2')
-        gub.change_target_dict (self, {'CFLAGS': '-DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'})
-    def get_substitution_dict (self, env={}):
-        dict = BjamBuildSpec.get_substitution_dict (self, env)
-        dict['CFLAGS'] = '-DBOOST_PLATFORM_CONFIG=\\"boost/config/platform/linux.hpp\\"'
-        return dict
-    def license_file (self):
-        return '%(srcdir)s/LICENSE_1_0.txt'
-    def install (self):
-        BjamBuildSpec.install (self)
-        # Bjam `installs' header files by using symlinks to the source dir?
-        for i in self.locate_files ('%(install_root)s/usr/include/boost',
-                                    '*'):
-            if os.path.islink (i):
-                s = os.readlink (i)
-                self.system ('''
-rm %(i)s
-cp %(s)s %(i)s
-''',
-                             locals ())
-        cwd = os.getcwd ()
-        os.chdir (self.expand ('%(install_root)s/usr/lib'))
-        for i in self.locate_files ('%(install_root)s/usr/lib', 'libboost_*-s.a'):
-            f = os.path.basename (i)
-            os.symlink (f, f.replace ('-s.a', '.a'))
-        os.chdir (cwd)
-        
-class Boost__linux_arm_softfloat (BjamBuildSpec):
-    def configure_command (self):
-        self.system ('''
-cp -f boost/config/platform/linux.hpp boost/config/platform/linux-gnueabi.hpp
-''')
--- a/specs/distcc.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-from toolpackage import ToolBuildSpec
-
-class Distcc (ToolBuildSpec):
-    def patch (self):
-        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/distcc-substitute.patch")
-
-    def __init__ (self,s):
-        ToolBuildSpec.__init__ (self,s)
-        self.with (version='2.18.3',
-             mirror="http://distcc.samba.org/ftp/distcc/distcc-%(version)s.tar.bz2"),
--- a/specs/e2fsprogs.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-import mirrors
-import targetpackage
-
-class E2fsprogs (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.sf, version='1.38')
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' install-libs')
--- a/specs/expat.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-import mirrors
-import misc
-import targetpackage
-import toolpackage
-
-class Expat (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.95.8', mirror=mirrors.sf, format='gz')
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def patch (self):
-        self.system ("rm %(srcdir)s/configure")
-        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/expat-1.95.8-mingw.patch")
-        self.system ("touch %(srcdir)s/tests/xmltest.sh.in")
-        targetpackage.TargetBuildSpec.patch (self)
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        # # FIXME: libtool too old for cross compile
-        self.update_libtool ()
-
-    def makeflags (self):
-        return misc.join_lines ('''
-CFLAGS="-O2 -DHAVE_EXPAT_CONFIG_H"
-EXEEXT=
-RUN_FC_CACHE_TEST=false
-''')
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-            + self.makeflags ())
-
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + self.makeflags ())
-
-class Expat__local (toolpackage.ToolBuildSpec):
-    def __init__ (self,settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='1.95.8', mirror=mirrors.sf, format='gz')
-
-    def patch (self):
-        toolpackage.ToolBuildSpec.patch (self)
-        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/expat-1.95.8-mingw.patch")
-
-    def get_build_dependencies (self):
-        return ['libtool']            
--- a/specs/faac.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-import mirrors
-import targetpackage
-
-class Faac (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.sf, version='1.24')
--- a/specs/faad2.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,15 +0,0 @@
-import targetpackage
-
-faac = 'http://surfnet.dl.sourceforge.net/sourceforge/faac/%(name)s-%(ball_version)s.tar.%(format)s'
-
-class Faad2 (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=faac, version='2.5')
-    def patch (self):
-        self.system ('''
-cd %(srcdir)s && patch -p0 < %(patchdir)s/faad2-2.5.patch
-mkdir %(srcdir)s/plugins/bmp
-''')        
-        self.autoupdate ()
-
--- a/specs/ffmpeg.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-import misc
-import repository
-import targetpackage
-
-class Ffmpeg (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        # FIXME: fixed version for svn, what a mess
-        self.revision = '6017'
-        repo = repository.Subversion (
-            dir=self.get_repodir (),
-            source='svn://svn.mplayerhq.hu/ffmpeg',
-            branch='trunk',
-            module='.',
-            revision=self.revision)
-        def fixed_version (self):
-            return self.version ()
-        from new import instancemethod
-        repo.version = instancemethod (fixed_version, repo, type (repo))
-        self.with_vc (repo)
-    def version (self):
-        return self.revision
-    def get_build_dependencies (self):
-        return ['faac', 'faad2', 'a52dec']
-    def configure_command (self):
-        #FIXME: this is autoconf
-        #targetpackage.TargetBuildSpec.configure_command (self)
-        return misc.join_lines ('''
-CC=%(tool_prefix)sgcc CFLAGS=-fPIC %(srcdir)s/configure
---prefix=/usr
---cross-prefix=%(cross_prefix)s/bin/%(tool_prefix)s
---cpu=%(cpu)s
---enable-faad
---enable-a52
---enable-a52bin
---enable-pp
---enable-shared
---enable-pthreads
---enable-gpl
---disable-audio-beos
---disable-v4l
---disable-dv1394
---disable-ffserver
---disable-ffplay
---disable-debug
---disable-opts
-''')
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' INSTALLSTRIP=')
--- a/specs/flex.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,16 +0,0 @@
-import toolpackage
-import mirrors
-
-class Flex (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version="2.5.4a",
-                   mirror=mirrors.nongnu, format='gz'),
-    def srcdir (self):
-        return '%(allsrcdir)s/flex-2.5.4'
-    def install_command (self):
-        return self.broken_install_command ()
-    def packaging_suffix_dir (self):
-        return ''
-    def patch (self):
-        self.system ("cd %(srcdir)s && patch -p1 < %(patchdir)s/flex-2.5.4a-FC4.patch")
--- a/specs/fondu.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-import mirrors
-import targetpackage
-
-class Fondu (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version="060102",
-             mirror='http://fondu.sourceforge.net/fondu_src-060102.tgz')
-
-    def srcdir (self):
-        return '%(allsrcdir)s/' + ('fondu-%s' % self.version())
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
-    
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-        self.file_sub ([('wilprefix', 'prefix')],
-                       '%(srcdir)s/Makefile.in')
-        
-class Fondu__darwin (Fondu):
-    def patch(self):
-        Fondu.patch (self)
-        self.file_sub ([('/System/Library/',
-                '%(system_root)s/System/Library/')],
-               '%(srcdir)s/Makefile.in')
-        
--- a/specs/fontconfig.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,208 +0,0 @@
-import mirrors
-import gub
-import misc
-import targetpackage
-import toolpackage
-import repository
-
-fc_version = "0596d7296c94b2bb9817338b8c1a76da91673fb9"
-
-class Fontconfig (targetpackage.TargetBuildSpec):
-    '''Generic font configuration library 
-Fontconfig is a font configuration and customization library, which
-does not depend on the X Window System.  It is designed to locate
-fonts within the system and select them according to requirements
-specified by applications.'''
-
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_vc (repository.Git (self.get_repodir (),
-                                      source="git://anongit.freedesktop.org/git/fontconfig",
-                                      revision=fc_version))
-
-    def get_build_dependencies (self):
-        return ['libtool', 'expat-devel', 'freetype-devel']
-
-    def get_dependency_dict (self):
-        return {'': ['expat', 'freetype', 'libtool']}
-
-    def configure_command (self):
-        # FIXME: system dir vs packaging install
-
-        ## UGH  - this breaks  on Darwin!
-        ## UGH2 - the added /cross/ breaks Cygwin; possibly need
-        ## Freetype_config package (see Guile_config, Python_config)
-        return (targetpackage.TargetBuildSpec.configure_command (self) 
-                + misc.join_lines ('''
---with-arch=%(target_architecture)s
---with-freetype-config="%(system_root)s/usr/cross/bin/freetype-config
---prefix=%(system_root)s/usr
-"'''))
-
-    def configure (self):
-        self.system ('''
-rm -f %(srcdir)s/builds/unix/{unix-def.mk,unix-cc.mk,ftconfig.h,freetype-config,freetype2.pc,config.status,config.log}
-''')
-
-        targetpackage.TargetBuildSpec.configure (self)
-
-        ## FIXME: libtool too old for cross compile
-        self.update_libtool ()
-        self.file_sub ([('DOCSRC *=.*', 'DOCSRC=')],
-                       '%(builddir)s/Makefile')
-
-    def compile (self):
-
-        # help fontconfig cross compiling a bit, all CC/LD
-        # flags are wrong, set to the target's root
-
-        ## we want native freetype-config flags here. 
-        cflags = '-I%(srcdir)s -I%(srcdir)s/src ' \
-                 + self.read_pipe ('%(local_prefix)s/bin/freetype-config --cflags')[:-1]
-
-        libs = self.read_pipe ('%(local_prefix)s/bin/freetype-config --libs')[:-1]
-        for i in ('fc-case', 'fc-lang', 'fc-glyphname', 'fc-arch'):
-            self.system ('''
-cd %(builddir)s/%(i)s && make "CFLAGS=%(cflags)s" "LIBS=%(libs)s" CPPFLAGS= LDFLAGS= INCLUDES= 
-''', locals ())
-
-        targetpackage.TargetBuildSpec.compile (self)
-        
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.dump ('''set FONTCONFIG_FILE=$INSTALLER_PREFIX/etc/fonts/fonts.conf
-set FONTCONFIG_PATH=$INSTALLER_PREFIX/etc/fonts
-''', 
-             '%(install_root)s/usr/etc/relocate/fontconfig.reloc')
-        
-        
-class Fontconfig__mingw (Fontconfig):
-    def patch (self):
-        Fontconfig.patch (self)
-        self.file_sub ([('<cachedir>@FC_CACHEDIR@</cachedir>', '')],
-                       '%(srcdir)s/fonts.conf.in')
-
-    def configure (self):
-        Fontconfig.configure (self)
-        self.dump ('''
-#define sleep(x) _sleep (x)
-''',
-                   '%(builddir)s/config.h',
-                   mode='a')
-
-class Fontconfig__darwin (Fontconfig):
-    def configure_command (self):
-        cmd = Fontconfig.configure_command (self)
-        cmd += ' --with-add-fonts=/Library/Fonts,/System/Library/Fonts '
-        return cmd
-
-    def configure (self):
-        Fontconfig.configure (self)
-        self.file_sub ([('-Wl,[^ ]+ ', '')],
-               '%(builddir)s/src/Makefile')
-
-class Fontconfig__linux (Fontconfig):
-    def configure (self):
-        Fontconfig.configure (self)
-        self.file_sub ([
-            ('^sys_lib_search_path_spec="/lib/* ',
-            'sys_lib_search_path_spec="%(system_root)s/usr/lib /lib '),
-            # FIXME: typo: dl_search (only dlsearch exists).
-            # comment-out for now
-            #('^sys_lib_dl_search_path_spec="/lib/* ',
-            # 'sys_lib_dl_search_path_spec="%(system_root)s/usr/lib /lib ')
-            ],
-               '%(builddir)s/libtool')
-
-class Fontconfig__freebsd (Fontconfig__linux):
-    pass
-
-class Fontconfig__local (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (mirror="git://anongit.freedesktop.org/git/fontconfig",
-                   version=fc_version)
-        
-    def get_build_dependencies (self):
-        return ['libtool', 'freetype', 'expat']
-
-    def compile_command (self):
-        return (toolpackage.ToolBuildSpec.compile_command (self)
-                + ' DOCSRC="" ')
-
-    def install_command (self):
-        return (toolpackage.ToolBuildSpec.install_command (self)
-                + ' DOCSRC="" ')
-
-class Fontconfig__cygwin (Fontconfig):
-    def __init__ (self, settings):
-        Fontconfig.__init__ (self, settings)
-        self.with (mirror=mirrors.fontconfig, version='2.4.1')
-
-    def get_subpackage_definitions (self):
-        d = dict (Fontconfig.get_subpackage_definitions (self))
-        # urg, must remove usr/share. Because there is no doc package,
-        # runtime iso '' otherwise gets all docs.
-        d['runtime'] = ['/usr/lib']
-        return d
-
-    def get_subpackage_names (self):
-        #return ['devel', 'doc', '']
-        return ['devel', 'runtime', '']
-
-    def get_build_dependencies (self):
-        return ['libtool', 'libfreetype2-devel', 'expat']
-    
-    def get_dependency_dict (self):
-        return {
-            '': ['libfontconfig1'],
-            'devel': ['libfontconfig1', 'libfreetype2-devel'],
-            'runtime': ['expat', 'libfreetype26', 'zlib'],
-            }
-
-    def category_dict (self):
-        return {'': 'libs',
-                'runtime': 'libs',
-                'devel': 'devel libs',
-                'doc': 'doc'}
-
-    def description_dict (self):
-        # FIXME: fairly uninformative description for packages,
-        # unlike, eg, guile-devel.  This is easier, though.
-        d = {}
-        for i in self.get_subpackage_names ():
-            d[i] = self.get_subpackage_doc (i)
-        return d
-
-    def get_subpackage_doc (self, split):
-        flavor = {'': 'executables',
-                  'devel': 'development',
-                  'doc': 'documentation',
-                  'runtime': 'runtime'}[split]
-        return (Fontconfig.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
-                % locals ())
-
-    def configure_command (self):
-        return (Fontconfig.configure_command (self)
-                + ' --sysconfdir=/etc --localstatedir=/var')
-
-    def xxx_noconfig_configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + misc.join_lines ('''
---with-arch=%(target_architecture)s
---with-freetype-config="%(system_root)s/usr/bin/freetype-config
---prefix=%(system_root)s/usr
-"''')
-                + ' --sysconfdir=/etc --localstatedir=/var')
-
-    def install (self):
-        self.pre_install_smurf_exe ()
-        Fontconfig.install (self)
-        name = 'fontconfig-postinstall.sh'
-        postinstall = '''#! /bin/sh
-# cleanup silly symlink of previous packages
-rm -f /usr/X11R6/bin/fontconfig-config
-'''
-        self.dump (postinstall,
-                   '%(install_root)s/etc/postinstall/%(name)s',
-                   env=locals ())
--- a/specs/fontforge.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-import toolpackage 
-import re
-
-class Fontforge (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (mirror='http://lilypond.org/download/gub-sources/fontforge_full-%(version)s.tar.bz2',
-                   version="20060501")
-
-
-    def get_build_dependencies (self):
-        return ['freetype']
-
-    def patch (self):
-        toolpackage.ToolBuildSpec.patch (self)
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/fontforge-20060501-srcdir.patch')
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/fontforge-20060501-execprefix.patch')
-
-    def configure_command (self):
-        return (toolpackage.ToolBuildSpec.configure_command (self)
-                + ' --without-freetype-src ')
-
-    def srcdir (self):
-        return re.sub ('_full', '', toolpackage.ToolBuildSpec.srcdir (self))
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE' 
-        
-    def install_command (self):
-        return self.broken_install_command ()
-
-    def packaging_suffix_dir (self):
-        return ''
--- a/specs/freetype-config.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-import gub
-
-class Freetype_config (gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.SdkBuildSpec.__init__ (self, settings)
-        self.has_source = False
-        self.with (version='2.1.9')
-    def untar (self):
-        pass
-    def install (self):
-        gub.SdkBuildSpec.install (self)
-        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
-        
-        ft_version = self.version ()
-        prefix = '%(system_root)s/usr'
-        exec_prefix = '${prefix}'
-        includedir = '/usr/include'
-        libdir = '/usr/lib'
-        enable_shared = 'yes'
-        wl = '-Wl,'
-        hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
-        LIBZ = '-lz'
-
-        import re
-        import os
-        s = open (self.expand ('%(sourcefiledir)s/freetype-config.in')).read ()
-        s = re.sub (r'@(\w+?)@', r'%(\1)s', s)
-        s = s % locals ()
-        file = self.expand ('%(install_prefix)s/cross/bin/freetype-config')
-        self.dump (s, file)
-        os.chmod (file, 0755)
--- a/specs/freetype.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-import mirrors
-import gub
-import targetpackage
-import toolpackage
-
-class Freetype (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='2.1.10', mirror=mirrors.nongnu_savannah)
-
-    def license_file (self):
-        return '%(srcdir)s/docs/LICENSE.TXT'
-
-    def get_build_dependencies (self):
-        return ['libtool-devel', 'zlib-devel']
-
-    def get_subpackage_names (self):
-        return ['devel', '']
-
-    def get_dependency_dict (self):
-        return {'': ['zlib']}
-
-    def configure (self):
-#                self.autoupdate (autodir=os.path.join (self.srcdir (),
-#                                                       'builds/unix'))
-
-        self.system ('''
-        rm -f %(srcdir)s/builds/unix/{unix-def.mk,unix-cc.mk,ftconfig.h,freetype-config,freetype2.pc,config.status,config.log}
-''')
-        targetpackage.TargetBuildSpec.configure (self)
-
-        ## FIXME: libtool too old for cross compile
-        self.update_libtool ()
-
-        self.file_sub ([('^LIBTOOL=.*', 'LIBTOOL=%(builddir)s/libtool --tag=CXX')], '%(builddir)s/Makefile')
-
-    def munge_ft_config (self, file):
-        self.file_sub ([('\nprefix=[^\n]+\n',
-                         '\nlocal_prefix=yes\nprefix=%(system_root)s/usr\n')],
-                       file, must_succeed=True)
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.system ('mkdir -p %(install_root)s/usr/cross/bin/')
-        self.system ('mv %(install_root)s/usr/bin/freetype-config %(install_root)s/usr/cross/bin/freetype-config')
-        self.munge_ft_config ('%(install_root)s/usr/cross/bin/freetype-config')
-
-class Freetype__mingw (Freetype):
-    def configure (self):
-        Freetype.configure (self)
-        self.dump ('''
-# libtool will not build dll if -no-undefined flag is not present
-LDFLAGS:=$(LDFLAGS) -no-undefined
-''',
-             '%(builddir)s/Makefile',
-             mode='a')
-
-class Freetype__local (toolpackage.ToolBuildSpec, Freetype):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='2.1.10', mirror=mirrors.nongnu_savannah)
-
-    def get_build_dependencies (self):
-        # local is not split
-        #return ['libtool-devel']
-        return ['libtool']
-
-    # FIXME, mi-urg?
-    def license_file (self):
-        return Freetype.license_file (self)
-
-    def install (self):
-        toolpackage.ToolBuildSpec.install (self)
-        self.munge_ft_config ('%(install_root)s/%(local_prefix)s/bin/.freetype-config')
--- a/specs/gcc-core.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-import cross
-import gcc
-import mirrors
-import misc
-        
-class Gcc_core (gcc.Gcc):
-    def __init__ (self, settings):
-        gcc.Gcc.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.gnu,
-                           version='4.1.1', format='bz2', name='gcc')
-    def get_build_dependencies (self):
-        return filter (lambda x: x != 'gcc-core' and x != 'glibc-core',
-                       gcc.Gcc.get_build_dependencies (self))
-    def get_subpackage_names (self):
-        return ['']
-    def name (self):
-        return 'gcc-core'
-    def file_name (self):
-        return 'gcc-core'
-    def get_conflict_dict (self):
-        return {'': ['gcc', 'gcc-devel', 'gcc-doc', 'gcc-runtime']}
-    def configure_command (self):
-        return (misc.join_lines (gcc.Gcc.configure_command (self) + '''
---prefix=%(cross_prefix)s
---prefix=/usr
---with-newlib
---enable-threads=no
---without-headers
---disable-shared
-''')
-                .replace ('enable-shared', 'disable-shared')
-                .replace ('disable-static', 'enable-static')
-                .replace ('enable-threads=posix', 'enable-threads=no'))
-    def compile_command (self):
-        return (cross.Gcc.compile_command (self) + ' all-gcc')
-    def compile (self):
-        cross.Gcc.compile (self)
-    def install_command (self):
-        return (gcc.Gcc.install_command (self)
-                .replace (' install', ' install-gcc')
-                #+ ' prefix=/usr/cross/core'
-                )
-    def install (self):
-        # cross.Gcc moves libs into system lib places, which will
-        # make gcc-core conflict with gcc.
-        cross.CrossToolSpec.install (self)
-    def languages (self):
-        return  ['c']
-
--- a/specs/gcc.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-import cross
-import misc
-import mirrors
-
-class Gcc (cross.Gcc):
-    def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.gnu, version='4.1.1', format='bz2')
-    def get_build_dependencies (self):
-        return (cross.Gcc.get_build_dependencies (self)
-                + ['gcc-core', 'glibc-core'])
-    #FIXME: what about apply_all (%(patchdir)s/%(version)s)?
-    def patch (self):
-        if self.vc_repository._version == '4.1.1':
-            self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gcc-4.1.1-ppc-unwind.patch
-''')
-    def get_conflict_dict (self):
-        return {'': ['gcc-core'], 'doc': ['gcc-core'], 'runtime': ['gcc-core']}
-    def configure_command (self):
-        return (cross.Gcc.configure_command (self)
-                + misc.join_lines ('''
---with-local-prefix=%(system_root)s/usr
---disable-multilib
---disable-nls
---enable-threads=posix
---enable-__cxa_atexit
---enable-symvers=gnu
---enable-c99 
---enable-clocale=gnu 
---enable-long-long
-'''))
-    def install (self):
-        cross.Gcc.install (self)
-        self.system ('''
-mv %(install_root)s/usr/cross/lib/gcc/%(target_architecture)s/%(version)s/libgcc_eh.a %(install_root)s/usr/lib
-''')
--- a/specs/gettext.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-import mirrors
-import targetpackage
-import toolpackage
-
-class Gettext (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + ' --disable-threads --disable-csharp --disable-java ')
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-
-        ## FIXME: libtool too old for cross compile
-        self.update_libtool ()
-        self.file_sub ([
-                ('(SUBDIRS *=.*)examples', r'\1 '),
-                ],
-                       '%(builddir)s/gettext-tools/Makefile')
-
-class Gettext__freebsd (Gettext):
-    def get_dependency_dict (self):
-        d = Gettext.get_dependency_dict (self)
-        if self.settings.target_architecture == 'i686-freebsd4':
-            d[''].append ('libgnugetopt')
-        return d
-
-    def get_build_dependencies (self):
-        if self.settings.target_architecture == 'i686-freebsd4':
-            return ['libgnugetopt'] + Gettext.get_build_dependencies (self)
-        return Gettext.get_build_dependencies (self)
-
-class Gettext__mingw (Gettext):
-    def __init__ (self, settings):
-        Gettext.__init__ (self, settings)
-        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
-
-    def config_cache_overrides (self, str):
-        return (re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
-               str)
-            + '''
-# only in additional library -- do not feel like patching right now
-gl_cv_func_mbrtowc=${gl_cv_func_mbrtowc=no}
-jm_cv_func_mbrtowc=${jm_cv_func_mbrtowc=no}
-''')
-
-    def configure_command (self):
-        return Gettext.configure_command (self) + ' --disable-libasprintf'
-
-    def configure (self):
-        Gettext.configure (self)
-        self.file_sub ( [(' gettext-tools ', ' ')],
-                        '%(builddir)s/Makefile')
-
-    def install (self):
-        ## compile of gettext triggers configure in between.  (hgwurgh.)
-        self.update_libtool ()
-        Gettext.install (self)
-
-class Gettext__local (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__(self,settings)
-        self.with (version='0.15', mirror=mirrors.gnu, format='gz')
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def configure (self):
-        toolpackage.ToolBuildSpec.configure (self)
-        self.file_sub ([
-                ('(SUBDIRS *=.*)examples', r'\1 '),
-                ],
-                       '%(builddir)s/gettext-tools/Makefile')
--- a/specs/ghostscript.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,247 +0,0 @@
-import os
-import re
-
-import mirrors
-import repository
-import misc
-import targetpackage
-
-class Ghostscript (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        repo = repository.Subversion (
-            dir=self.get_repodir (),
-            source='http://svn.ghostscript.com:8080/ghostscript',
-            branch='trunk',
-            module='gs',
-            ## 8.56
-            revision='7881')
-
-        ## ugh: nested, with self shadow?
-        def version_from_VERSION (self):
-            s = self.get_file_content ('src/version.mak')
-            d = misc.grok_sh_variables_str (s)
-            v = '%(GS_VERSION_MAJOR)s.%(GS_VERSION_MINOR)s' % d
-            return v
-
-        from new import instancemethod
-        repo.version = instancemethod (version_from_VERSION, repo, type (repo))
-
-        self.with_vc (repo)
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE' 
-
-    def get_build_dependencies (self):
-        return ['libjpeg-devel', 'libpng-devel']
-
-    def get_dependency_dict (self):
-        return {'': ['libjpeg', 'libpng']}
-
-    def get_subpackage_names (self):
-        return ['doc', '']
-    
-    def srcdir (self):
-        return re.sub ('-source', '',
-                       targetpackage.TargetBuildSpec.srcdir (self))
-
-    def builddir (self):
-        return re.sub ('-source', '',
-                       targetpackage.TargetBuildSpec.builddir (self))
-
-    def name (self):
-        return 'ghostscript'
-
-    # FIXME: C&P.
-    def ghostscript_version (self):
-        return '.'.join (self.ball_version.split ('.')[0:2])
-
-    def patch (self):
-        disable_re = "(DEVICE_DEVS[0-9]+)=([^\n]+(%s))" %'|'.join (['tiff',
-                                                                    'pcx',
-                                                                    'uniprint',
-                                                                    'deskjet',
-                                                                    'djet500',
-                                                                    'bmp',
-                                                                    'pbm',
-                                                                    'bjc200',
-                                                                    'cdeskjet',
-                                                                    'faxg3',
-                                                                    'cljet5'])
-        
-
-        ## generate Makefile.in
-        self.system ('cd %(srcdir)s && ./autogen.sh --help')
-
-        self.file_sub ([(disable_re,
-                         r'#\1= -DISABLED- \2 ')],
-                       '%(srcdir)s/Makefile.in')
-
-
-        
-    def fixup_arch (self):
-        substs = []
-        arch = self.settings.target_architecture
-
-        cache_size = 1024*1024
-        big_endian = 0
-        can_shift = 1
-        
-        if arch.find ('powerpc') >= 0:
-            big_endian = 1
-            can_shift = 1
-            cache_size = 2097152
-        elif re.search ('i[0-9]86', arch):
-            big_endian = 0
-            can_shift = 0
-            cache_size = 1048576
-            
-        substs = [('#define ARCH_CAN_SHIFT_FULL_LONG .',
-             '#define ARCH_CAN_SHIFT_FULL_LONG %d' % can_shift),
-             ('#define ARCH_CACHE1_SIZE [0-9]+',
-             '#define ARCH_CACHE1_SIZE %d' % cache_size),
-             ('#define ARCH_IS_BIG_ENDIAN [0-9]',
-             '#define ARCH_IS_BIG_ENDIAN %d' % big_endian)]
-        
-        self.file_sub (substs, '%(builddir)s/obj/arch.h')
-
-    def compile_command (self):
-        return targetpackage.TargetBuildSpec.compile_command (self) + " INCLUDE=%(system_root)s/usr/include/ PSDOCDIR=/usr/share/doc/ PSMANDIR=/usr/share/man "
-        
-    def compile (self):
-        self.system ('''
-cd %(builddir)s && (mkdir obj || true)
-cd %(builddir)s && make CC=cc CCAUX=cc C_INCLUDE_PATH= CFLAGS= CPPFLAGS= GCFLAGS= LIBRARY_PATH= obj/genconf obj/echogs obj/genarch obj/arch.h
-''')
-        self.fixup_arch ()
-        targetpackage.TargetBuildSpec.compile (self)
-        
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-            + misc.join_lines ('''
---with-drivers=FILES
---without-x
---disable-cups
---without-ijs
---without-omni
---disable-compile-inits
-'''))
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        self.file_sub ([
-            ('-Dmalloc=rpl_malloc', ''),
-            ('GLSRCDIR=./src', 'GLSRCDIR=%(srcdir)s/src'),
-            ('PSSRCDIR=./src', 'PSSRCDIR=%(srcdir)s/src'),
-            ('PSLIBDIR=./lib', 'PSLIBDIR=%(srcdir)s/lib'),
-            ('ICCSRCDIR=icclib', 'ICCSRCDIR=%(srcdir)s/icclib'),
-            # ESP-specific: addonsdir, omit zillion of
-            # warnings (any important ones may be noticed
-            # easier).
-            ('ADDONSDIR=./addons', 'ADDONSDIR=%(srcdir)s/addons'),
-            (' -Wmissing-prototypes ', ' '),
-            (' -Wstrict-prototypes ', ' '),
-            (' -Wmissing-declarations ', ' '),
-
-            ## ugh:  GS compile adds another layer of shell expansion. Yuck.
-            (r'\$\${ORIGIN}', '\\$${ORIGIN}'),
-            ],
-               '%(builddir)s/Makefile')
-
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' install_prefix=%(install_root)s'
-                + ' mandir=/usr/share/man/ '
-                + ' docdir=/usr/share/doc/ghostscript/doc '
-                + ' exdir=/usr/share/doc/ghostscript/examples '
-                )
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.system ('mkdir -p %(install_root)s/usr/etc/relocate/')
-        self.dump ('''
-
-prependdir GS_FONTPATH=$INSTALLER_PREFIX/share/ghostscript/%(version)s/fonts
-prependdir GS_FONTPATH=$INSTALLER_PREFIX/share/gs/fonts
-prependdir GS_LIB=$INSTALLER_PREFIX/share/ghostscript/%(version)s/Resource
-prependdir GS_LIB=$INSTALLER_PREFIX/share/ghostscript/%(version)s/lib
-
-''', '%(install_root)s/usr/etc/relocate/gs.reloc')
-
-class Ghostscript__mingw (Ghostscript):
-    def __init__ (self, settings):
-        Ghostscript.__init__ (self, settings)
-        # Configure (compile) without -mwindows for console
-        # FIXME: should add to CPPFLAGS...
-        self.target_gcc_flags = '-mms-bitfields -D_Windows -D__WINDOWS__'
-
-    def patch (self):
-        Ghostscript.patch (self)
-        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.15-cygwin.patch")
-        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-make.patch")
-        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-gs_dll.h.patch")
-        self.file_sub ([('unix__=$(GLOBJ)gp_getnv.$(OBJ) $(GLOBJ)gp_unix.$(OBJ) $(GLOBJ)gp_unifs.$(OBJ) $(GLOBJ)gp_unifn.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gp_unix_cache.$(OBJ)',
-                         'unix__= $(GLOBJ)gp_mswin.$(OBJ) $(GLOBJ)gp_wgetv.$(OBJ) $(GLOBJ)gp_stdia.$(OBJ) $(GLOBJ)gsdll.$(OBJ) $(GLOBJ)gp_ntfs.$(OBJ) $(GLOBJ)gp_win32.$(OBJ)')],
-                       '%(srcdir)s/src/unix-aux.mak',
-                       use_re=False, must_succeed=True)
-#        self.system ("cd %(srcdir)s/ && patch --force -p1 < %(patchdir)s/ghostscript-8.50-unix-aux.mak.patch")
-
-    def configure (self):
-        Ghostscript.configure (self)
-        self.file_sub ([('^(EXTRALIBS *=.*)', '\\1 -lwinspool -lcomdlg32 -lz')],
-               '%(builddir)s/Makefile')
-
-        self.file_sub ([('^unix__=.*', misc.join_lines ('''unix__=
-$(GLOBJ)gp_mswin.$(OBJ)
-$(GLOBJ)gp_wgetv.$(OBJ)
-$(GLOBJ)gp_stdia.$(OBJ)
-$(GLOBJ)gsdll.$(OBJ)
-$(GLOBJ)gp_ntfs.$(OBJ)
-$(GLOBJ)gp_win32.$(OBJ)
-'''))],
-               '%(srcdir)s/src/unix-aux.mak')
-        self.file_sub ([('^(LIB0s=.*)', misc.join_lines ('''\\1
-$(GLOBJ)gp_mswin.$(OBJ)
-$(GLOBJ)gp_wgetv.$(OBJ)
-$(GLOBJ)gp_stdia.$(OBJ)
-$(GLOBJ)gsdll.$(OBJ)
-$(GLOBJ)gp_ntfs.$(OBJ)
-$(GLOBJ)gp_win32.$(OBJ)
-'''))],
-               '%(srcdir)s/src/lib.mak')
-
-        self.dump ('''
-GLCCWIN=$(CC) $(CFLAGS) -I$(GLOBJDIR)
-PSCCWIN=$(CC) $(CFLAGS) -I$(GLOBJDIR)
-include $(GLSRCDIR)/win32.mak
-include $(GLSRCDIR)/gsdll.mak
-include $(GLSRCDIR)/winplat.mak
-include $(GLSRCDIR)/pcwin.mak
-''',
-             '%(builddir)s/Makefile',
-             mode='a')
-
-    def install (self):
-        Ghostscript.install (self)
-        if self.settings.lilypond_branch == 'lilypond_2_6':
-            self.lily_26_kludge()
-
-    def lily_26_kludge (self):
-        gs_prefix = '/usr/share/ghostscript/%(ghostscript_version)s'
-        fonts = ['c059013l', 'c059016l', 'c059033l', 'c059036l']
-        for i in self.read_pipe ('locate %s.pfb' % fonts[0]).split ('\n'):
-            dir = os.path.dirname (i)
-            if os.path.exists (dir + '/' + fonts[0] + '.afm'):
-                break
-        fonts_string = ','.join (fonts)
-        self.system ('''
-mkdir -p %(install_root)s/%(gs_prefix)s/fonts
-cp %(dir)s/{%(fonts_string)s}{.afm,.pfb} %(install_root)s/%(gs_prefix)s/fonts
-''', locals ())
-
-class Ghostscript__freebsd (Ghostscript):
-    def get_dependency_dict (self):
-        d = Ghostscript.get_dependency_dict (self)
-        d[''].append ('libiconv')
-        return d
-
--- a/specs/git.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,86 +0,0 @@
-import toolpackage
-import targetpackage
-import repository
-
-class Git__local (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (mirror='http://kernel.org/pub/software/scm/git/git-%(version)s.tar.bz2',
-                   version='1.5.1.2')
-    def patch (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-        self.file_sub ([('git describe','true')],
-                       '%(srcdir)s/GIT-VERSION-GEN')
-
-    def configure (self):
-        self.dump ('prefix=%(system_root)s/usr', '%(builddir)s/config.mak')
-
-    def wrap_executables (self):
-        # GIT executables use ancient unix style smart name-based
-        # functionality switching.  Did Linus not read or understand
-        # Standards.texi?
-        pass
-
-class Git (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        source = 'git://repo.or.cz/git/mingw.git'
-        repo = repository.Git (self.get_repodir (),
-                               branch=settings.git_branch,
-                               source=source)
-        self.with_vc (repo)
-
-        ## strip -mwindows.
-        self.target_gcc_flags = ' -mms-bitfields '
-
-    def version (self):
-        return '1.5.0'
-
-    def get_dependency_dict (self):
-        return {'': [
-            'zlib',
-            'regex',
-            ]}
-
-    def get_subpackage_names (self):
-        return ['']
-
-    def get_build_dependencies (self):
-        return ['zlib-devel',
-                'regex-devel',
-                ]
-
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-        self.system ('rm -rf %(builddir)s')
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-        self.file_sub ([('git describe','true')],
-                        '%(srcdir)s/GIT-VERSION-GEN')
-
-
-class Git__mingw (Git):
-    def __init__ (self, settings):
-        Git.__init__ (self, settings)
-        self.target_gcc_flags = ' -mms-bitfields '
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        self.file_sub ([('CFLAGS = -g',
-                         'CFLAGS = -I compat/ -g')],
-                       '%(builddir)s/config.mak.autogen')
-        self.file_sub ([('-lsocket',
-                         '-lwsock32'),
-                        ('TRACK_CFLAGS *=', 'XXX_TRACK_CFLAGS = '),
-                        ],
-                       '%(builddir)s/Makefile')
-
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-                + ' uname_S=MINGW'
-                + ' SHELL_PATH=/bin/sh')
-
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' uname_S=MINGW'
-                + ' SHELL_PATH=/bin/sh')
-
--- a/specs/glib.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-import mirrors
-import toolpackage
-import targetpackage
-
-class Glib (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-
-
-        ## 2.12.4 : see bug  http://bugzilla.gnome.org/show_bug.cgi?id=362918
-        self.with (#version='2.12.4',   mirror=mirrors.gnome_216,
-            version='2.10.3',
-		   mirror=mirrors.gnome_214,
-		   format='bz2')
-
-    def get_build_dependencies (self):
-        return ['gettext-devel', 'libtool']
-
-    def get_dependency_dict (self):
-        d = targetpackage.TargetBuildSpec.get_dependency_dict (self)
-        d[''].append ('gettext')
-        return d
-    
-    def config_cache_overrides (self, str):
-        return str + '''
-glib_cv_stack_grows=${glib_cv_stack_grows=no}
-'''
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-
-        ## FIXME: libtool too old for cross compile
-        self.update_libtool ()
-        
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.system ('rm %(install_root)s/usr/lib/charset.alias',
-                     ignore_errors=True)
-        
-class Glib__darwin (Glib):
-    def configure (self):
-        Glib.configure (self)
-        self.file_sub ([('nmedit', '%(target_architecture)s-nmedit')],
-                       '%(builddir)s/libtool')
-        
-class Glib__mingw (Glib):
-    def get_dependency_dict (self):
-        d = Glib.get_dependency_dict (self)
-        d[''].append ('libiconv')
-        return d
-    
-    def get_build_dependencies (self):
-        return Glib.get_build_dependencies (self) + ['libiconv-devel']
-
-class Glib__freebsd (Glib):
-    def get_dependency_dict (self):
-        d = Glib.get_dependency_dict (self)
-        d[''].append ('libiconv')
-        return d
-    
-    def get_build_dependencies (self):
-        return Glib.get_build_dependencies (self) + ['libiconv-devel']
-    
-    def configure_command (self):
-        return Glib.configure_command (self) + ' --disable-threads'
-        
-class Glib__local (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='2.10.3',
-                   mirror=mirrors.gnome_214,
-                   format='bz2')
-
-    def install (self):
-        toolpackage.ToolBuildSpec.install(self)
-        self.system ('rm %(install_root)s/%(packaging_suffix_dir)s/usr/lib/charset.alias',
-                         ignore_errors=True)
-
-    def get_build_dependencies (self):
-        return ['gettext-devel', 'libtool']            
--- a/specs/glibc-core.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-import glibc
-import mirrors
-import misc
-import repository
-import targetpackage
-#
-import os
-
-# Hmm? TARGET_CFLAGS=-O --> targetpackage.py
-
-class Glibc_core (glibc.Glibc):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        #self.with_tarball (mirror=mirrors.gnu, version='2.3.6')
-        self.with_tarball (mirror=mirrors.lilypondorg,
-                           version='2.3-20070416', format='bz2', name='glibc')
-    def get_build_dependencies (self):
-        return ['gcc-core']
-    def get_subpackage_names (self):
-        return ['']
-    def get_conflict_dict (self):
-        return {'': ['glibc', 'glibc-devel', 'glibc-doc', 'glibc-runtime']}
-    def patch (self):
-        glibc.Glibc.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-core-install.patch
-''')
-    def compile_command (self):
-        return (glibc.Glibc.compile_command (self)
-                + ' lib')
-    def install_command (self):
-        return glibc.Glibc.install_command (self)
-    def install_command (self):
-        return (glibc.Glibc.install_command (self)
-                    .replace (' install ', ' install-lib-all install-headers '))
-    def install (self):
-        glibc.Glibc.install (self)
-        self.system ('''
-mkdir -p %(install_root)s/usr/include/gnu
-touch %(install_root)s/usr/include/gnu/stubs.h
-cp %(srcdir)s/include/features.h %(install_root)s/usr/include
-mkdir -p %(install_root)s/usr/include/bits
-cp %(builddir)s/bits/stdio_lim.h %(install_root)s/usr/include/bits
-''')
--- a/specs/glibc.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-import mirrors
-import misc
-import repository
-import targetpackage
-#
-import os
-
-# Hmm? TARGET_CFLAGS=-O --> targetpackage.py
-
-class Glibc (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        #self.with_tarball (mirror=mirrors.gnu, version='2.3.6')
-        self.with_tarball (mirror=mirrors.lilypondorg, version='2.3-20070416',
-                           format='bz2')
-    def get_build_dependencies (self):
-        return ['gcc', 'glibc-core']
-    def get_conflict_dict (self):
-        return {'': ['glibc-core'], 'devel': ['glibc-core'], 'doc': ['glibc-core'], 'runtime': ['glibc-core']}
-    def patch (self):
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/glibc-2.3-powerpc-initfini.patch
-''')
-    def configure_command (self):
-        add_ons = ''
-        for i in ('linuxthreads',):
-            # FIXME cannot expand in *_command ()
-            #if os.path.exists (self.expand ('%(srcdir)s/') + i):
-            if 1: #self.version () != '2.4':
-                add_ons += ' --enable-add-ons=' + i
-        return ('BUILD_CC=gcc '
-                + misc.join_lines (targetpackage.TargetBuildSpec.configure_command (self) + '''
---disable-profile
---disable-debug
---without-cvs
---without-gd
---without-tls
---without-__thread
-''')
-                + add_ons)
-    def FIXME_DOES_NOT_WORK_get_substitution_dict (self, env={}):
-        d = targetpackage.TargetBuildSpec.get_substitution_dict (self, env)
-        d['SHELL'] = '/bin/bash'
-        return d
-    def linuxthreads (self):
-        return repository.NewTarBall (dir=self.settings.downloads,
-                                      mirror=mirrors.glibc,
-                                      name='glibc-linuxthreads',
-                                      ball_version=self.version (),
-                                      format='bz2',
-                                      strip_components=0)
-    def download (self):
-        targetpackage.TargetBuildSpec.download (self)
-        if self.version () == '2.3.6':
-            self.linuxthreads ().download ()
-    def untar (self):
-        targetpackage.TargetBuildSpec.untar (self)
-        if self.version () == '2.3.6':
-            self.linuxthreads ().update_workdir (self.expand ('%(srcdir)s/urg-do-not-mkdir-or-rm-me'))
-            self.system ('mv %(srcdir)s/urg-do-not-mkdir-or-rm-me/* %(srcdir)s')
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-                + ' SHELL=/bin/bash')
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' install_root=%(install_root)s')
--- a/specs/gmp.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,107 +0,0 @@
-import re
-
-import mirrors
-import targetpackage
-from toolpackage import ToolBuildSpec
-
-class Gmp (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='4.2.1',
-                   mirror="http://ftp.sunet.se/pub/gnu/gmp/gmp-%(version)s.tar.bz2",
-                   format="bz2")
-        if not self.settings.platform.startswith ('darwin'):
-            self.target_architecture = re.sub ('i[0-9]86-', 'i386-', settings.target_architecture)
-
-    def get_dependency_dict (self):
-        return { '': [],
-                 'devel' : ['gmp'],
-                 'doc' : [], }
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def configure_command (self):
-        c = targetpackage.TargetBuildSpec.configure_command (self)
-
-        c += ' --disable-cxx '
-        return c
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        # # FIXME: libtool too old for cross compile
-        self.update_libtool ()
-        # automake's Makefile.in's too old for new libtool,
-        # but autoupdating breaks even more.  This nice
-        # hack seems to work.
-        self.file_sub ([('#! /bin/sh', '#! /bin/sh\ntagname=CXX')],
-               '%(builddir)s/libtool')
-        
-class Gmp__darwin (Gmp):
-    def patch (self):
-
-        ## powerpc/darwin cross barfs on all C++ includes from
-        ## a C linkage file.
-        ## don't know why. Let's patch C++ completely from GMP.
-
-        self.file_sub ([('__GMP_DECLSPEC_XX std::[oi]stream& operator[<>][^;]+;$', ''),
-                ('#include <iosfwd>', ''),
-                ('<cstddef>','<stddef.h>')
-                ],
-               '%(srcdir)s/gmp-h.in')
-        Gmp.patch (self)
-
-    def install (self):
-        Gmp.install (self)
-        self.file_sub ([('using std::FILE;','')],
-                       '%(install_root)s/usr/include/gmp.h')
-
-class Gmp__darwin__x86 (Gmp__darwin):
-    def configure_command (self):
-
-        ## bypass oddball assembler errors. 
-        c = Gmp__darwin.configure_command (self)
-        c = re.sub ('host=[^ ]+', 'host=none-apple-darwin8', c)
-        c = re.sub ('--target=[^ ]+', ' ', c)
-        return c
-
-class Gmp__cygwin (Gmp):
-    def __init__ (self,settings):
-        Gmp.__init__ (self, settings)
-        self.with (version='4.1.4')
-
-    def patch (self):
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gmp-4.1.4-1.patch
-''')
-
-class Gmp__mingw (Gmp):
-    def __init__ (self,settings):
-        Gmp.__init__ (self, settings)
-        
-        # Configure (compile) without -mwindows for console
-        self.target_gcc_flags = '-mms-bitfields'
-        
-    def patch (self):
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/gmp-4.1.4-1.patch
-''')
-
-    def configure (self):
-        Gmp.configure (self)
-
-    def install (self):
-        Gmp.install (self)
-        self.system ('''
-mv %(install_root)s/usr/lib/*dll %(install_root)s/usr/bin || true
-''')
-
-class Gmp__local (ToolBuildSpec):
-    def __init__ (self, s):
-        ToolBuildSpec.__init__ (self, s)
-        self.with (version='4.2.1',
-                   mirror="ftp://ftp.gnu.org/gnu/gmp/gmp-%(version)s.tar.bz2")
-
-    def get_build_dependencies (self):
-        return ['libtool']            
-
--- a/specs/guile-config.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,32 +0,0 @@
-import gub
-
-class Guile_config (gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.SdkBuildSpec.__init__ (self, settings)
-        self.has_source = False
-        self.with (version='1.8.0')
-
-    def untar (self):
-        pass
-
-    def install (self):
-        gub.SdkBuildSpec.install (self)
-        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
-        
-        import os
-        version = self.version ()
-	#FIXME: c&p guile.py
-        self.dump ('''\
-#! /bin/sh
-test "$1" = "--version" && echo "%(target_architecture)s-guile-config - Guile version %(version)s"
-#prefix=$(dirname $(dirname $0))
-prefix=%(system_root)s/usr
-test "$1" = "compile" && echo "-I$prefix/include"
-#test "$1" = "link" && echo "-L$prefix/lib -lguile -lgmp"
-# KUCH, debian specific, and [mipsel] reading .la is broken?
-test "$1" = "link" && echo "-L$prefix/lib -lguile -lguile-ltdl  -ldl -lcrypt -lm"
-exit 0
-''',
-             '%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config')
-        os.chmod ('%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config'
-                  % self.get_substitution_dict (), 0755)
--- a/specs/guile.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,386 +0,0 @@
-import re
-import os
-#
-import misc
-import targetpackage
-import repository
-
-class Guile (targetpackage.TargetBuildSpec):
-    def set_mirror (self):
-        source = 'git://repo.or.cz/guile.git'
-        source = 'http://lilypond.org/vc/guile.git'
-
-        repo = repository.Git (self.get_repodir (),
-                               branch='branch_release-1-8', 
-                               source=source)
-        repo.version = lambda: '1.8.2'
-        self.with_vc (repo)
-        self.so_version = '17'
-
-    def autogen_sh (self):
-        self.file_sub ([(r'AC_CONFIG_SUBDIRS\(guile-readline\)', '')],
-                       '%(srcdir)s/configure.in')
-        self.file_sub ([(r'guile-readline', '')],
-                       '%(srcdir)s/Makefile.am')
-        self.dump ('',
-                   '%(srcdir)s/doc/ref/version.texi')
-        self.dump ('',
-                   '%(srcdir)s/doc/tutorial/version.texi')
-        
-    def license_file (self):
-        return '%(srcdir)s/COPYING.LIB' 
- 
-    def get_subpackage_names (self):
-        return ['doc', 'devel', 'runtime', '']
-
-    def get_dependency_dict (self):
-        return {
-            '' : ['guile-runtime'],
-            'runtime': ['gmp', 'gettext', 'libtool-runtime'],
-            'devel': ['guile-runtime'],
-            'doc': ['texinfo'],
-            }
-
-    def get_build_dependencies (self):
-        return ['gettext-devel', 'gmp-devel', 'libtool']
-        
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.set_mirror ()
-
-    # FIXME: C&P.
-    def guile_version (self):
-        return '.'.join (self.ball_version.split ('.')[0:2])
-
-    def patch (self):
-        self.autogen_sh()
-
-        ## Don't apply patch twice.
-        if None == re.search ('reloc_p=', open (self.expand ('%(srcdir)s/configure.in')).read()):
-            self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/guile-reloc.patch')
-            self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/guile-cexp.patch')
-            self.dump ('''#!/bin/sh
-exec %(local_prefix)s/bin/guile "$@"
-''', "%(srcdir)s/pre-inst-guile.in")
-            
-        self.autoupdate ()
-
-    def configure_flags (self):
-        return misc.join_lines ('''
---without-threads
---with-gnu-ld
---enable-deprecated
---enable-discouraged
---disable-error-on-warning
---enable-relocation
---disable-rpath
-''')
-        
-    def configure_command (self):
-        return ('GUILE_FOR_BUILD=%(local_prefix)s/bin/guile '
-                + targetpackage.TargetBuildSpec.configure_command (self)
-                + self.configure_flags ())
-
-    def compile_command (self):
-        return ('preinstguile=%(local_prefix)s/bin/guile ' +
-                targetpackage.TargetBuildSpec.compile_command (self))
-    
-    def compile (self):
-
-        ## Ugh : broken dependencies barf with make -jX
-        self.system ('cd %(builddir)s/libguile && make scmconfig.h')
-        # No -L %(system_root)s in `guile-config link'
-        self.system ('cd %(builddir)s/libguile && make libpath.h')
-        self.file_sub ([('''-L *%(system_root)s''', '-L')],
-                       '%(builddir)s/libguile/libpath.h')
-        targetpackage.TargetBuildSpec.compile (self)
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        self.update_libtool ()
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        majmin_version = '.'.join (self.expand ('%(version)s').split ('.')[0:2])
-        
-        self.dump ("prependdir GUILE_LOAD_PATH=$INSTALLER_PREFIX/share/guile/%(majmin_version)s\n",
-                   '%(install_root)s/usr/etc/relocate/guile.reloc',
-                   env=locals())
-        
-        ## can't assume that /usr/bin/guile is the right one.
-        version = self.read_pipe ('''\
-GUILE_LOAD_PATH=%(install_prefix)s/share/guile/* guile -e main -s  %(install_prefix)s/bin/guile-config --version 2>&1\
-''').split ()[-1]
-	#FIXME: c&p linux.py
-        self.dump ('''\
-#! /bin/sh
-test "$1" = "--version" && echo "%(target_architecture)s-guile-config - Guile version %(version)s"
-#test "$1" = "compile" && echo "-I $%(system_root)s/usr/include"
-#test "$1" = "link" && echo "-L%(system_root)s/usr/lib -lguile -lgmp"
-#prefix=$(dirname $(dirname $0))
-prefix=%(system_root)s/usr
-test "$1" = "compile" && echo "-I$prefix/include"
-test "$1" = "link" && echo "-L$prefix/lib -lguile -lgmp"
-exit 0
-''',
-             '%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config')
-        os.chmod ('%(install_prefix)s/cross/bin/%(target_architecture)s-guile-config' % self.get_substitution_dict (), 0755)
-
-
-    
-class Guile__mingw (Guile):
-    def __init__ (self, settings):
-        Guile.__init__ (self, settings)
-        # Configure (compile) without -mwindows for console
-        self.target_gcc_flags = '-mms-bitfields'
-
-
-    def get_build_dependencies (self):
-        return Guile.get_build_dependencies (self) +  ['regex-devel']
-        
-    def get_dependency_dict (self):
-        d = Guile.get_dependency_dict (self)
-        d['runtime'].append ('regex')
-        return d
-
-# FIXME: ugh, C&P to Guile__freebsd, put in cross-Guile?
-    def configure_command (self):
-        # watch out for whitespace
-        builddir = self.builddir ()
-        srcdir = self.srcdir ()
-
-
-# don't set PATH_SEPARATOR; it will fuckup tool searching for the
-# build platform.
-
-        return (Guile.configure_command (self)
-           + misc.join_lines ('''
-LDFLAGS=-L%(system_root)s/usr/lib
-CC_FOR_BUILD="
-C_INCLUDE_PATH=
-CPPFLAGS=
-LIBRARY_PATH=
-LDFLAGS=
-cc
--I%(builddir)s
--I%(srcdir)s
--I%(builddir)s/libguile
--I.
--I%(srcdir)s/libguile"
-'''))
-
-    def config_cache_overrides (self, str):
-        return str + '''
-guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
-guile_cv_exeext=${guile_cv_exeext=}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(system_root)s/usr/lib"}
-'''
-
-    def configure (self):
-        if 0: # using patch
-            targetpackage.TargetBuildSpec.autoupdate (self)
-
-        if 1:
-            self.file_sub ([('''^#(LIBOBJS=".*fileblocks.*)''',
-                    '\\1')],
-                   '%(srcdir)s/configure')
-
-        Guile.configure (self)
-
-        ## probably not necessary, but just be sure.
-        for el in self.locate_files ('%(builddir)s', "Makefile"):
-            self.file_sub ([('PATH_SEPARATOR = .', 'PATH_SEPARATOR = ;'),
-                            ], el)
-            
-        self.file_sub ([
-            #('^(allow_undefined_flag=.*)unsupported', '\\1'),
-            ('-mwindows', ''),
-            ],
-               '%(builddir)s/libtool')
-
-        if os.path.exists (self.expand ('%(builddir)s/guile-readline/libtool')):
-            self.file_sub ([
-                #('^(allow_undefined_flag=.*)unsupported', '\\1'),
-                ('-mwindows', ''),
-                ],
-                           '%(builddir)s/guile-readline/libtool')
-
-    def install (self):
-        Guile.install (self)
-        # dlopen-able .la files go in BIN dir, BIN OR LIB package
-        self.system ('''mv %(install_root)s/usr/lib/lib*[0-9].la %(install_root)s/usr/bin''')
-
-class Guile__linux (Guile):
-    def compile_command (self):
-        # FIXME: when not x-building, guile runs guile without
-        # setting the proper LD_LIBRARY_PATH.
-        return ('export LD_LIBRARY_PATH=%(builddir)s/libguile/.libs:$LD_LIBRARY_PATH;'
-                + Guile.compile_command (self))
-
-class Guile__linux__ppc (Guile__linux):
-    def config_cache_overrides (self, str):
-        return str + "\nguile_cv_have_libc_stack_end=no\n"
-
-class Guile__freebsd (Guile):
-    def config_cache_settings (self):
-        return Guile.config_cache_settings (self) + '\nac_cv_type_socklen_t=yes'
-    def configure_command (self):
-        # watch out for whitespace
-        builddir = self.builddir ()
-        srcdir = self.srcdir ()
-        return (
-            ''' guile_cv_use_csqrt="no" '''
-           + Guile.configure_command (self)
-           + misc.join_lines ('''\
-CC_FOR_BUILD="
-C_INCLUDE_PATH=
-CPPFLAGS=
-LIBRARY_PATH=
-cc
--I%(builddir)s
--I%(srcdir)s
--I%(builddir)s/libguile
--I.
--I%(srcdir)s/libguile"
-'''))
-
-class Guile__darwin (Guile):
-    def install (self):
-        Guile.install (self)
-        pat = self.expand ('%(install_root)s/usr/lib/libguile-srfi*.dylib')
-        import glob
-        for f in glob.glob (pat):
-            directory = os.path.split (f)[0]
-            src = os.path.basename (f)
-            dst = os.path.splitext (os.path.basename (f))[0] + '.so'
-
-            self.system ('cd %(directory)s && ln -s %(src)s %(dst)s', locals())
- 
-class Guile__darwin__x86 (Guile__darwin):
-    def configure (self):
-        Guile__darwin.configure (self)
-        self.file_sub ([('guile-readline', '')],
-                       '%(builddir)s/Makefile')
-        
-class Guile__cygwin (Guile):
-    def __init__ (self, settings):
-        Guile.__init__ (self, settings)
-        self.with (version='1.8.1')
-
-    # Using gub dependencies only would be nice, but
-    # we need to a lot of gup.gub_to_distro_deps ().
-    def GUB_get_dependency_dict (self):
-        d = Guile.get_dependency_dict (self)
-        d['runtime'].append ('cygwin')
-        return d
-
-    # Using gub dependencies only would be nice, but
-    # we need to a lot of gup.gub_to_distro_deps ().
-    def GUB_get_build_dependencies (self):
-        return Guile.get_build_dependencies (self) + ['libiconv-devel']
-
-    # FIXME: uses mixed gub/distro dependencies
-    def get_dependency_dict (self):
-        d = Guile.get_dependency_dict (self)
-        d[''] += ['cygwin']
-        d['devel'] += ['cygwin'] + ['bash']
-        d['runtime'] += ['cygwin', 'crypt', 'libreadline6']
-        return d
- 
-    # FIXME: uses mixed gub/distro dependencies
-    def get_build_dependencies (self):
-        return ['crypt', 'libgmp-devel', 'gettext-devel', 'libiconv', 'libtool', 'readline']
-
-    def config_cache_overrides (self, str):
-        return str + '''
-guile_cv_func_usleep_declared=${guile_cv_func_usleep_declared=yes}
-guile_cv_exeext=${guile_cv_exeext=}
-libltdl_cv_sys_search_path=${libltdl_cv_sys_search_path="%(system_root)s/usr/lib"}
-'''
-    def configure (self):
-        if 1:
-            self.file_sub ([('''^#(LIBOBJS=".*fileblocks.*)''', '\\1')],
-                           '%(srcdir)s/configure')
-        Guile.configure (self)
-
-        ## ugh code dup. 
-        ## probably not necessary, but just be sure.
-        for i in self.locate_files ('%(builddir)s', "Makefile"):
-            self.file_sub ([
-                ('PATH_SEPARATOR = .', 'PATH_SEPARATOR = ;'),
-                ], i)
-
-        self.file_sub ([
-            ('^(allow_undefined_flag=.*)unsupported', '\\1'),
-            ],
-               '%(builddir)s/libtool')
-        self.file_sub ([
-            ('^(allow_undefined_flag=.*)unsupported', '\\1'),
-            ],
-               '%(builddir)s/guile-readline/libtool')
-
-    def patch (self):
-        pass
-
-    # FIXME: we do most of this for all cygwin packages
-    def category_dict (self):
-        return {'': 'interpreters',
-                'runtime': 'libs',
-                'devel': 'devel libs',
-                'doc': 'doc'}
-
-    def description_dict (self):
-        return {
-            '': """The GNU extension language and Scheme interpreter - executables
-Guile, the GNU Ubiquitous Intelligent Language for Extension, is a scheme
-implementation designed for real world programming, supporting a
-rich Unix interface, a module system, and undergoing rapid development.
-
-`guile' is a scheme interpreter that can execute scheme scripts (with a
-#! line at the top of the file), or run as an inferior scheme
-process inside Emacs.
-""",
-            'runtime': '''The GNU extension language and Scheme interpreter - runtime
-Guile shared object libraries and the ice-9 scheme module.  Guile is
-the GNU Ubiquitous Intelligent Language for Extension.
-''',
-            'devel': """The GNU extension language and Scheme interpreter - development
-`libguile.h' etc. C headers, aclocal macros, the `guile-snarf' and
-`guile-config' utilities, and static `libguile.a' libraries for Guile,
-the GNU Ubiquitous Intelligent Language for Extension.
-""",
-            'doc': """The GNU extension language and Scheme interpreter - documentation
-This package contains the documentation for guile, including both
-a reference manual (via `info guile'), and a tutorial (via `info
-guile-tut').
-""",
-    }
-
-import toolpackage
-class Guile__local (toolpackage.ToolBuildSpec, Guile):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.set_mirror ()
-
-    def get_build_dependencies (self):
-        return (toolpackage.ToolBuildSpec.get_build_dependencies (self)
-                + Guile.get_build_dependencies (self)
-                + ['automake'])
-
-    def patch (self):
-        self.autogen_sh ()
-        self.autoupdate ()
-
-    def configure_command (self):
-        return (toolpackage.ToolBuildSpec.configure_command (self)
-                + self.configure_flags ())
-
-    def configure (self):
-        toolpackage.ToolBuildSpec.configure (self)
-        self.update_libtool ()
-
-    def install (self):
-        toolpackage.ToolBuildSpec.install (self)
-
-        ## don't want local GUILE headers to interfere with compile.
-        self.system ("rm -rf %(install_root)s/%(packaging_suffix_dir)s/usr/include/ %(install_root)s/%(packaging_suffix_dir)s/usr/bin/guile-config ")
--- a/specs/hello.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-import mirrors
-import targetpackage
-
-class Hello (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.lilypondorg, version='1.0')
--- a/specs/icoutils.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-import toolpackage
-
-class Icoutils (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-	import mirrors
-        self.with (version='0.26.0', mirror=mirrors.nongnu_savannah)
-    def get_build_dependencies (self):
-        return ['libpng-devel']
-    def get_dependency_dict (self):
-        return {'': ['libpng']}
-    def configure_command (self):
-        return (toolpackage.ToolBuildSpec.configure_command (self)
-                + ' --with-libintl-prefix=%(system_root)s/usr/ ')
-
-class Icoutils__darwin (Icoutils):
-    def patch (self):
-        for f in 'wrestool', 'icotool':
-            self.file_sub ([(r'\$\(LIBS\)', '$(INTLLIBS) $(LIBS)')],
-                           '%(srcdir)s/' + f + "/Makefile.in")
-
-Icoutils__darwin__x86 = Icoutils__darwin
--- a/specs/imagemagick.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,9 +0,0 @@
-import toolpackage
-
-class Imagemagick (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (mirror='ftp://ftp.nluug.nl/pub/ImageMagick/ImageMagick-%(version)s-1.tar.bz2',
-                   version='6.3.1')
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
--- a/specs/libdbi-drivers-sqlite3.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +0,0 @@
-import mirrors
-import misc
-import repository
-import targetpackage
-
-class Libdbi_drivers_sqlite3 (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        #self.with (version='0.8.1', mirror=mirrors.sf, format='gz')
-        self.with_vc (repository.NewTarBall (self.settings.downloads, mirrors.sf, 'libdbi-drivers', '0.8.2'))
-
-    def get_build_dependencies (self):
-        return ['sqlite', 'libdbi', 'libtool']
-
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + misc.join_lines ('''
---disable-docs
---with-dbi-incdir=%(system_root)s/usr/include
---with-sqlite3
---with-sqlite3-libdir=%(system_root)s/usr/include
---with-sqlite3-incdir=%(system_root)s/usr/include
-'''))
-
-    def configure (self):
-        self.system ('''
-mkdir -p %(builddir)s/doc/include
-cd %(builddir)s && touch doc/Makefile.in doc/include/Makefile.in
-''')
-        targetpackage.TargetBuildSpec.configure (self)
-        self.update_libtool ()
-
-    def makeflags (self):
-        return ' doc_DATA= html_DATA='
-
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-                + self.makeflags ())
-
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + self.makeflags ())
-
-class Libdbi_drivers_sqlite3__debian__arm (Libdbi_drivers_sqlite3):
-    def get_build_dependencies (self):
-        return ['sqlite3-dev', 'libdbi', 'libtool']
-
--- a/specs/libdbi.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-import mirrors
-import targetpackage
-
-class Libdbi (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='0.8.1', mirror=mirrors.sf, format='gz')
-
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-        self.file_sub ([('SUBDIRS *=.*', 'SUBDIRS = src include')],
-                       '%(srcdir)s/Makefile.in')
-
--- a/specs/libgnugetopt.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-import mirrors
-import targetpackage
-
-class Libgnugetopt (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.3', format='bz2', mirror=mirrors.freebsd_ports)
-
-    def patch (self):
-        self.dump ('''
-prefix = /usr
-libdir = $(prefix)/lib
-includedir = $(prefix)/include
-install: all
-\tinstall -d $(DESTDIR)/$(libdir)/
-\tinstall -m 644 libgnugetopt.so.1 $(DESTDIR)/$(libdir)/
-\tinstall -d $(DESTDIR)/$(includedir)/
-\tinstall -m 644 getopt.h $(DESTDIR)/$(includedir)/
-''',
-             '%(srcdir)s/Makefile', mode='a')
-
-    def configure (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-
-    def license_file (self):
-
-        ## is (L)GPL, but doesn't distribute license file.
-        return '' 
--- a/specs/libiconv.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-import targetpackage
-import mirrors
-
-class Libiconv (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.11', mirror=mirrors.gnu)
-    
-    def broken_for_distcc (self):
-        return True
-    
-    def get_build_dependencies (self):
-        return ['gettext-devel', 'libtool']
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        # # FIXME: libtool too old for cross compile
-        self.update_libtool ()
-        
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.system ('rm %(install_root)s/usr/lib/charset.alias')
-
-    def license_file (self):
-        return '%(srcdir)s/COPYING.LIB'
--- a/specs/libjpeg.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-import re
-import os
-
-import mirrors
-import misc
-import targetpackage
-
-class Libjpeg (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='v6b', mirror=mirrors.jpeg)
-
-    def name (self):
-        return 'libjpeg'
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def get_subpackage_names (self):
-        return ['devel', '']
-    
-    def srcdir (self):
-        return re.sub (r'src\.v', '-', targetpackage.TargetBuildSpec.srcdir(self))
-
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                .replace ('--config-cache', '--cache-file=config.cache'))
-    
-    def update_libtool (self):
-        self.system ('''
-cd %(builddir)s && %(srcdir)s/ltconfig --srcdir %(srcdir)s %(srcdir)s/ltmain.sh %(target_architecture)s'''
-              , locals ())
-        
-        targetpackage.TargetBuildSpec.update_libtool (self)
-
-    def patch (self):
-        self.system ('cp %(sourcefiledir)s/jpeg.license %(license_file)s')
-
-    def configure (self):
-        guess = self.expand ('%(system_root)s/usr/share/libtool/config.guess')
-        sub = self.expand ('%(system_root)s/usr/share/libtool/config.sub')
-        for file in sub, guess:
-            if os.path.exists (file):
-                self.system ('cp -pv %(file)s %(srcdir)s',  locals ())
-
-        targetpackage.TargetBuildSpec.configure (self)
-        self.update_libtool ()
-        self.file_sub (
-            [
-            (r'(\(INSTALL_[A-Z]+\).*) (\$[^ ]+)$',
-            r'\1 $(DESTDIR)\2'),
-            ],
-            '%(builddir)s/Makefile')
-
-    def install_command (self):
-        return misc.join_lines ('''
-mkdir -p %(install_root)s/usr/include %(install_root)s/usr/lib
-&& make DESTDIR=%(install_root)s install-headers install-lib
-''')
-
-class Libjpeg__darwin (Libjpeg):
-    def update_libtool (self):
-        arch = 'powerpc-apple'
-        self.system ('''
-cd %(builddir)s && %(srcdir)s/ltconfig --srcdir %(srcdir)s %(srcdir)s/ltmain.sh %(arch)s
-''', locals ())
-        targetpackage.TargetBuildSpec.update_libtool (self)
-
-class Libjpeg__mingw (Libjpeg):
-    def configure (self):
-        Libjpeg.configure (self)
-        # libtool will not build dll if -no-undefined flag is
-        # not present
-        self.file_sub ([('-version-info',
-                '-no-undefined -version-info')],
-             '%(builddir)s/Makefile')
-
-class Libjpeg__linux (Libjpeg):
-    def compile (self):
-        Libjpeg.compile (self)
-        self.file_sub ([('^#define (HAVE_STDLIB_H) *', '''#ifdef \\1
-#define \\1
-#endif''')],
-               '%(builddir)s/jconfig.h')
-
--- a/specs/libpng.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-import mirrors
-import targetpackage
-
-class Libpng (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.2.8', mirror=mirrors.libpng)
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE' 
-
-    def get_dependency_dict (self):
-        return {'':['zlib']}
-    
-    def get_build_dependencies (self):
-        return ['zlib-devel']
-
-    def name (self):
-        return 'libpng'
-
-    def patch (self):
-        self.file_sub ([('(@INSTALL.*)@PKGCONFIGDIR@',
-                r'\1${DESTDIR}@PKGCONFIGDIR@')],
-               '%(srcdir)s/Makefile.in')
-        self.file_sub ([('(@INSTALL.*)@PKGCONFIGDIR@',
-                r'\1${DESTDIR}@PKGCONFIGDIR@')],
-               '%(srcdir)s/Makefile.am')
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        # # FIXME: libtool too old for cross compile
-        self.update_libtool ()
-
-    def compile_command (self):
-        c = targetpackage.TargetBuildSpec.compile_command (self)
-        ## need to call twice, first one triggers spurious Automake stuff.                
-        return '(%s) || (%s)' % (c,c)
-    
-class Libpng__mingw (Libpng):
-    def configure (self):
-        # libtool will not build dll if -no-undefined flag is
-        # not present
-        self.file_sub ([('-version-info',
-                '-no-undefined -version-info')],
-             '%(srcdir)s/Makefile.am')
-        self.autoupdate ()
-        Libpng.configure (self)
-
-import toolpackage 
-
-class Libpng__local (toolpackage.ToolBuildSpec, Libpng):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='1.2.8', mirror=mirrors.libpng)
-
-    def get_build_dependencies (self):
-        return ['libtool']
-
-    def patch (self):
-        Libpng.patch (self)
-
-    # FIXME, mi-urg?
-    def license_file (self):
-        return Libpng.license_file (self)
-
--- a/specs/libtool.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,74 +0,0 @@
-import targetpackage
-import gub
-import mirrors
-import toolpackage
-
-
-# FIXME, need for WITH settings when building dependency 'libtool'
-# This works without libtool.py:
-#    ./gub-builder.py -p mingw build http://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.20.tar.gz
-
-class Libtool (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.5.20', mirror=mirrors.gnu)
-        self.so_version = '3'
-
-    def get_subpackage_names (self):
-        return ['devel', 'doc', 'runtime', '']
-
-    def get_dependency_dict (self):
-        return { '': ['libtool-runtime'],
-                 'devel' : ['libtool'],
-                 'doc' : [],
-                 'runtime': [],}
-
-    def get_subpackage_definitions (self):
-        d = targetpackage.TargetBuildSpec.get_subpackage_definitions (self)
-        d['devel'].append ('/usr/bin/libtool*')
-        d['devel'].append ('/usr/share/libltdl')
-        return d
-
-class Libtool__darwin (Libtool):
-    def install (self):
-        Libtool.install (self)
-
-        ## necessary for programs that load dynamic modules.
-        self.dump ("prependdir DYLD_LIBRARY_PATH=$INSTALLER_PREFIX/lib",
-                   '%(install_root)s/usr/etc/relocate/libtool.reloc')
-
-class Libtool__cygwin (Libtool):
-    def __init__ (self, settings):
-        Libtool.__init__ (self, settings)
-        self.with (version='1.5.22')
-        # FIXME: next to impossible to untar and patch automatically
-        # should call for sanity on cygwin-apps@cygwin.com?
-        #self.with (version='1.5.23a',
-        #          mirror='http://mirrors.kernel.org/sourceware/cygwin/release/libtool/libtool1.5/libtool1.5-%(version)s-1-src.tar.bz2',)
-        # FIXME: build lib package naming: lib<NAME><MAJOR-SO-VERSION> into gub
-
-    def only_for_cygwin_untar (self):
-        cygwin.untar_cygwin_src_package_variant2 (self, self.file_name ())
-
-    def get_dependency_dict (self):
-        d = Libtool.get_dependency_dict (self)
-        d[''].append ('cygwin')
-        return d
-
-    # FIXME: we do most of this for all cygwin packages
-    def category_dict (self):
-        return {'': 'interpreters',
-                'runtime': 'libs',
-                'devel': 'devel libs',
-                'doc': 'doc'}
-
-class Libtool__local (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='1.5.20', mirror=mirrors.gnu)
-    def configure (self):
-        gub.BuildSpec.configure (self)
-    def wrap_executables (self):
-        # The libtool script calls the cross compilers, and moreover,
-        # it is copied.  Two reasons why it cannot be wrapped.
-        pass
--- a/specs/libxml2.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,10 +0,0 @@
-import mirrors
-import targetpackage
-
-class Libxml2 (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.gnome_218, version='2.6.27')
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + ' --without-python')
--- a/specs/lilypad.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-import mirrors
-import targetpackage
-import misc
-
-class LilyPad (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='0.0.7-1',
-                   mirror='http://lilypond.org/download/gub-sources/lilypad-0.0.7-1-src.tar.bz2',
-                   format='bz2')
-
-    def patch (self):
-        ## windres doesn't handle --nostdinc
-        self.file_sub ([('--nostdinc',' '),
-                (r'rc\.res:', r'rc.res.o:')],
-               "%(srcdir)s/Make.rules.in")
-    def makeflags (self):
-        # FIXME: better fix Makefile
-        return misc.join_lines ('''
-ALL_OBJS='$(OBJS)'
-WRC=%(cross_prefix)s/bin/%(target_architecture)s-windres
-CPPFLAGS=-I%(system_root)s/usr/include
-RC='$(WRC) $(CPPFLAGS)'
-LIBWINE=
-LIBPORT=
-MKINSTALLDIRS=%(srcdir)s/mkinstalldirs
-INSTALL_PROGRAM=%(srcdir)s/install-sh
-''')
-
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-           + self.makeflags ())
-
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.broken_install_command (self)
-           + self.makeflags ())
-    def license_file (self):
-        return ''
-
-Lilypad = LilyPad
--- a/specs/lilypond.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,498 +0,0 @@
-import os
-import re
-#
-import repository
-import gub
-import misc
-import targetpackage
-
-
-from context import *
-
-class LilyPond (targetpackage.TargetBuildSpec):
-    '''A program for printing sheet music
-LilyPond lets you create music notation.  It produces
-beautiful sheet music from a high-level description file.'''
-
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-
-
-        try:
-            source = os.environ['GUB_LILYPOND_SOURCE']
-        except KeyError:         
-            source = 'git://git.sv.gnu.org/lilypond.git'
-        
-        repo = repository.Git (self.get_repodir (),
-                               branch=settings.lilypond_branch,
-                               source=source)
-
-        ## ugh: nested, with self shadow?
-        def version_from_VERSION (self):
-            s = self.get_file_content ('VERSION')
-            d = misc.grok_sh_variables_str (s)
-            v = '%(MAJOR_VERSION)s.%(MINOR_VERSION)s.%(PATCH_LEVEL)s' % d
-            return v
-
-        from new import instancemethod
-        repo.version = instancemethod (version_from_VERSION, repo, type (repo))
-
-        self.with_vc (repo)
-
-        # FIXME: should add to C_INCLUDE_PATH
-        builddir = self.builddir ()
-        self.target_gcc_flags = (settings.target_gcc_flags
-                                 + ' -I%(builddir)s' % locals ())
-
-    def get_dependency_dict (self):
-        return {'': [
-            'fontconfig',
-            'gettext', 
-            'guile-runtime',
-            'pango',
-            'python-runtime',
-            'ghostscript'
-            ]}
-    
-    def get_subpackage_names (self):
-        return ['']
-    
-    def broken_for_distcc (self):
-        ## mf/ is broken
-        return True
-
-    def get_build_dependencies (self):
-        return ['fontconfig-devel',
-                'freetype-devel',
-                'gettext-devel',
-                'ghostscript',
-                'guile-devel',
-                'pango-devel',
-                'python-devel',
-                'urw-fonts']
-
-    def rsync_command (self):
-        c = targetpackage.TargetBuildSpec.rsync_command (self)
-        c = c.replace ('rsync', 'rsync --delete --exclude configure')
-        return c
-
-    def configure_command (self):
-        ## FIXME: pickup $target-guile-config
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + misc.join_lines ('''
---enable-relocation
---disable-documentation
---enable-static-gxx
---with-ncsb-dir=%(system_root)s/usr/share/fonts/default/Type1
-'''))
-
-    def configure (self):
-        self.autoupdate ()
-
-    def do_configure (self):
-        if not os.path.exists (self.expand ('%(builddir)s/FlexLexer.h')):
-            flex = self.read_pipe ('which flex')
-            flex_include_dir = os.path.split (flex)[0] + "/../include"
-            self.system ('''
-mkdir -p %(builddir)s
-cp %(flex_include_dir)s/FlexLexer.h %(builddir)s/
-''', locals ())
-            
-        self.config_cache ()
-        self.system ('''
-mkdir -p %(builddir)s 
-cd %(builddir)s && %(configure_command)s''')
-        self.file_sub ([(' -O2 ', ' -O2 -Werror ')],
-                       '%(builddir)s/config.make')
-
-    def compile (self):
-        d = self.get_substitution_dict ()
-        if (misc.file_is_newer ('%(srcdir)s/config.make.in' % d,
-                                '%(builddir)s/config.make' % d)
-            or misc.file_is_newer ('%(srcdir)s/GNUmakefile.in' % d,
-                                   '%(builddir)s/GNUmakefile' % d)
-            or misc.file_is_newer ('%(srcdir)s/config.hh.in' % d,
-                                   '%(builddir)s/config.hh' % d)
-            or misc.file_is_newer ('%(srcdir)s/configure' % d,
-                                   '%(builddir)s/config.make' % d)
-
-            ## need to reconfigure if dirs were added.
-            or (len (self.locate_files ('%(builddir)s', "GNUmakefile"))
-                != len (self.locate_files ('%(srcdir)s', "GNUmakefile")) + 1)):
-
-            self.do_configure ()
-            self.system ('touch %(builddir)s/config.hh')
-            
-        targetpackage.TargetBuildSpec.compile (self)
-
-    def name_version (self):
-        # FIXME: make use of branch for version explicit, use
-        # name-branch for src /build dir, use name-version for
-        # packaging.
-        try:
-            return self.build_version ()
-        except:
-            return targetpackage.TargetBuildSpec.name_version (self)
-
-    def build_version (self):
-        d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
-        v = '%(MAJOR_VERSION)s.%(MINOR_VERSION)s.%(PATCH_LEVEL)s' % d
-        return v
-
-    def pretty_name (self):
-        return 'LilyPond'
-    
-    def build_number (self):
-        import versiondb
-        db = versiondb.VersionDataBase (self.settings.lilypond_versions)
-        v = tuple (map (int, self.build_version ().split ('.')))
-        b = db.get_next_build_number (v)
-        return ('%d' % b)
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        # FIXME: This should not be in generic package, for installers only.
-        self.installer_install_stuff ()
-
-    def installer_install_stuff (self):
-        # FIXME: is it really the installer version that we need here,
-        # or do we need the version of lilypond?
-        installer_version = self.build_version ()
-        # WTF, current.
-        self.system ("cd %(install_root)s/usr/share/lilypond && mv %(installer_version)s current",
-                     locals ())
-
-        self.system ("cd %(install_root)s/usr/lib/lilypond && mv %(installer_version)s current",
-                     locals ())
-
-        self.system ('mkdir -p %(install_root)s/usr/etc/fonts/')
-        fc_conf_file = open (self.expand ('%(install_root)s/usr/etc/fonts/local.conf'), 'w')
-        fc_conf_file.write ('''
-<fontconfig>
-<selectfont>
- <rejectfont>
- <pattern>
-  <patelt name="scalable"><bool>false</bool></patelt>
- </pattern>
- </rejectfont>
-</selectfont>
-
-<cachedir>~/.lilypond-fonts.cache-2</cachedir>
-</fontconfig>
-''' % locals ())
-
-    def gub_name (self):
-        nv = self.name_version ()
-        p = self.settings.platform
-        return '%(nv)s.%(p)s.gub' % locals ()
-
-    def autoupdate (self, autodir=0):
-        autodir = self.srcdir ()
-
-        if (misc.file_is_newer (self.expand ('%(autodir)s/configure.in', locals ()),
-                                self.expand ('%(builddir)s/config.make',locals ()))
-            or misc.file_is_newer (self.expand ('%(autodir)s/stepmake/aclocal.m4', locals ()),
-                                   self.expand ('%(autodir)s/configure', locals ()))):
-            self.system ('''
-            cd %(autodir)s && bash autogen.sh --noconfigure
-            ''', locals ())
-            self.do_configure ()
-
-class LilyPond__cygwin (LilyPond):
-
-    def get_subpackage_names (self):
-        return ['doc', '']
-
-    def get_dependency_dict (self):
-        return {
-            '' :
-            [
-            'glib2',
-            'guile-runtime',
-            'fontconfig-runtime', ## 'libfontconfig1',
-            'libfreetype26',
-            'libiconv2',
-            'libintl8', 'libintl3',
-            'pango-runtime',
-            'python',
-            ]
-            + [
-            'bash',
-            'coreutils',
-            'cygwin',
-            'findutils',
-            'ghostscript',
-            ],
-            'doc': ['texinfo'],
-            }
-
-    def get_build_dependencies (self):
-
-        #FIXME: aargh, MUST specify bash, coreutils etc here too.
-        # If get_dependency_dict () lists any packages not
-        # part of build_dependencies, we get:
-
-	# Using version number 2.8.6 unknown package bash
-        # installing package: bash
-        # Traceback (most recent call last):
-        #   File "installer-builder.py", line 171, in ?
-        #     main ()
-        #   File "installer-builder.py", line 163, in main
-        #     run_installer_commands (cs, settings, commands)
-        #   File "installer-builder.py", line 130, in run_installer_commands
-        #     build_installer (installer_obj, args)
-        #   File "installer-builder.py", line 110, in build_installer
-        #     install_manager.install_package (a)
-        #   File "lib/gup.py", line 236, in install_package
-        #     d = self._packages[name]
-        # KeyError: 'bash'
-
-        return [
-            'gettext-devel',
-            ## FIXME: for distro we don't use get_base_package_name,
-            ## so we cannot use split-package names for gub/source
-            ## build dependencies
-            ##'guile-devel',
-            'guile',
-            'python',
-            'fontconfig', ##'libfontconfig-devel',
-            'libfreetype2-devel',
-            # cygwin bug: pango-devel should depend on glib2-devel
-            'pango-devel', 'glib2-devel',
-            'urw-fonts'] + [
-            'bash',
-            'coreutils',
-            'findutils',
-            'ghostscript',
-            ]
-
-    def configure_command (self):
-        return LilyPond.configure_command (self).replace ('--enable-relocation',
-                                                          '--disable-relocation')
-
-    def compile (self):
-        self.system ('''
-        cp -pv %(system_root)s/usr/share/gettext/gettext.h %(system_root)s/usr/include''')
-        LilyPond.compile (self)
-
-    def compile_command (self):
-        ## UGH - * sucks.
-        python_lib = "%(system_root)s/usr/bin/libpython*.dll"
-        LDFLAGS = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
-
-        ## UGH. 
-        return (LilyPond.compile_command (self)
-                + misc.join_lines ('''
-LDFLAGS="%(LDFLAGS)s %(python_lib)s"
-'''% locals ()))
-
-    def install (self):
-        ##LilyPond.install (self)
-        targetpackage.TargetBuildSpec.install (self)
-        self.install_doc ()
-
-    def install_doc (self):
-        installer_build = self.build_number ()
-        installer_version = self.build_version ()
-        docball = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.documentation.tar.bz2', env=locals ())
-        infomanball = self.expand ('%(uploads)s/lilypond-%(installer_version)s-%(installer_build)s.info-man.tar.bz2', env=locals ())
-
-
-        if not os.path.exists (docball):
-            ## can't run make, because we need the right variables (BRANCH, etc.)
-            raise Exception ("cannot find docball %s" % docball)
-            
-        self.system ('''
-mkdir -p %(install_root)s/usr/share/doc/lilypond
-tar -C %(install_root)s/usr/share/doc/lilypond -jxf %(docball)s
-tar -C %(install_root)s -jxf %(infomanball)s
-find %(install_root)s/usr/share/doc/lilypond -name '*.signature' -exec rm '{}' ';'
-find %(install_root)s/usr/share/doc/lilypond -name '*.ps' -exec rm '{}' ';'
-mkdir -p %(install_root)s/usr/share/info/lilypond
-cd %(install_root)s/usr/share/info/lilypond && ln -sf ../../doc/lilypond/Documentation/user/*png .
-''',
-                  locals ())
-
-    def category_dict (self):
-        return {'': 'publishing', 'doc': 'doc'}
-
-    def description_dict (self):
-        # FIXME: fairly uninformative description for packages,
-        # unlike, eg, guile-devel.  This is easier, though.
-        d = {}
-        for i in self.get_subpackage_names ():
-            d[i] = self.get_subpackage_doc (i)
-        return d
-
-    def get_subpackage_doc (self, split):
-        flavor = {'': 'executables', 'doc': 'documentation'}[split]
-        return (LilyPond.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
-                % locals ())
-        
-## shortcut: take python out of dependencies
-class LilyPond__no_python (LilyPond):
-    def get_build_dependencies (self):
-        d = LilyPond.get_build_dependencies (self)
-        d.remove ('python-devel')
-        return d
-
-    def get_dependency_dict (self):
-        d = LilyPond.get_dependency_dict (self)
-        d[''].remove ('python-runtime')
-        return d
-
-    def do_configure (self):
-        self.system ('mkdir -p %(builddir)s', ignore_errors=True) 
-        self.system ('touch %(builddir)s/Python.h') 
-        LilyPond.do_configure (self)
-        self.dump ('''
-all:
-	true
-
-install:
-	-mkdir -p $(DESTDIR)/usr/lib/lilypond/%(version)s
-''', '%(builddir)s/python/GNUmakefile')
-        
-class LilyPond__mingw (LilyPond):
-    def get_dependency_dict (self):
-        d = LilyPond.get_dependency_dict (self)
-        d[''].append ('lilypad')        
-        return d
-
-    def get_build_dependencies (self):
-        return LilyPond.get_build_dependencies (self) + ['lilypad']
-
-    ## ugh c&p
-    def compile_command (self):
-
-        ## UGH - * sucks.
-        python_lib = "%(system_root)s/usr/bin/libpython*.dll"
-        LDFLAGS = '-L%(system_root)s/usr/lib -L%(system_root)s/usr/bin -L%(system_root)s/usr/lib/w32api'
-
-        ## UGH. 
-        return (LilyPond.compile_command (self)
-                + misc.join_lines ('''
-LDFLAGS="%(LDFLAGS)s %(python_lib)s"
-'''% locals ()))
-    
-    def do_configure (self):
-        LilyPond.do_configure (self)
-
-        ## huh, why ? --hwn
-        self.config_cache ()
-
-        ## for console: no -mwindows
-        self.file_sub ([(' -mwindows', ' '),
-
-                ## gdb doesn't work on windows anyway.
-                (' -g ', ' '),
-                ],
-               '%(builddir)s/config.make')
-
-    def compile (self):
-        self.system ('cd %(builddir)s/lily && rm -f out/lilypond', ignore_errors=True)
-        LilyPond.compile (self)
-        self.system ('cd %(builddir)s/lily && mv out/lilypond out/lilypond-console')
-        self.system ('cd %(builddir)s/lily && make MODULE_LDFLAGS="-mwindows" && mv out/lilypond out/lilypond-windows')
-        self.system ('cd %(builddir)s/lily && touch out/lilypond')
-
-    def install (self):
-        LilyPond.install (self)
-        self.system ('''
-rm -f %(install_prefix)s/bin/lilypond-windows
-install -m755 %(builddir)s/lily/out/lilypond-windows %(install_prefix)s/bin/lilypond-windows.exe
-rm -f %(install_prefix)s/bin/lilypond
-install -m755 %(builddir)s/lily/out/lilypond-console %(install_prefix)s/bin/lilypond.exe
-cp %(install_root)s/usr/lib/lilypond/*/python/* %(install_root)s/usr/bin
-cp %(install_root)s/usr/share/lilypond/*/python/* %(install_root)s/usr/bin
-''')
-        import glob
-        for i in glob.glob (self.expand ('%(install_root)s/usr/bin/*')):
-            header = open (i).readline().strip ()
-            if header.endswith ('guile'):
-                self.system ('mv %(i)s %(i)s.scm', locals ())
-            elif header.endswith ('python') and not i.endswith ('.py'):
-                self.system ('mv %(i)s %(i)s.py', locals ())
-
-        for i in self.locate_files ('%(install_root)s', "*.ly"):
-            s = open (i).read ()
-            open (i, 'w').write (re.sub ('\r*\n', '\r\n', s))
-
-
-## please document exactly why if this is switched back.
-#        self.file_sub ([(r'gs-font-load\s+#f', 'gs-font-load #t')],
-#        '%(install_root)s/usr/share/lilypond/current/scm/lily.scm')
-
-class LilyPond__debian (LilyPond):
-    def get_dependency_dict (self):
-        import debian, gup
-        return {'': gup.gub_to_distro_deps (LilyPond.get_dependency_dict (self)[''],
-                                            debian.gub_to_distro_dict)}
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-
-    def get_build_dependencies (self):
-        #FIXME: aargh, MUST specify gs,  etc here too.
-        return [
-            'gettext',
-            'guile-1.6-dev',
-            'libfontconfig1-dev',
-            'libfreetype6-dev',
-            'libglib2.0-dev',
-            'python2.4-dev',
-            'libpango1.0-dev',
-            'zlib1g-dev',
-            'urw-fonts',
-            ] + ['gs']
-
-##
-class LilyPond__darwin (LilyPond):
-    def get_dependency_dict (self):
-        d = LilyPond.get_dependency_dict (self)
-
-        deps = d['']
-        deps.remove ('python-runtime')
-        deps += [ 'fondu', 'osx-lilypad']
-
-        d[''] = deps
-        return d
-
-    def get_build_dependencies (self):
-        return LilyPond.get_build_dependencies (self) + [ 'fondu', 'osx-lilypad']
-
-    def compile_command (self):
-        return LilyPond.compile_command (self) + " TARGET_PYTHON=/usr/bin/python "
-    
-    def configure_command (self):
-        cmd = LilyPond.configure_command (self)
-        cmd += ' --enable-static-gxx '
-
-        return cmd
-
-    def do_configure (self):
-        LilyPond.do_configure (self)
-
-        make = self.expand ('%(builddir)s/config.make')
-
-        if re.search ("GUILE_ELLIPSIS", open (make).read ()):
-            return
-        self.file_sub ([('CONFIG_CXXFLAGS = ',
-                         'CONFIG_CXXFLAGS = -DGUILE_ELLIPSIS=... '),
-
-## optionally: switch off for debugging.
-#                                (' -O2 ', '')
-                ],
-               '%(builddir)s/config.make')
-
-#Hmm
-Lilypond = LilyPond
-Lilypond__cygwin = LilyPond__cygwin
-Lilypond__darwin = LilyPond__darwin
-Lilypond__debian = LilyPond__debian
-Lilypond__mingw = LilyPond__mingw
-Lilypond__freebsd = LilyPond
-Lilypond__debian_arm = LilyPond__debian
-Lilypond__mipsel = LilyPond__debian
-
-
--- a/specs/linux-headers.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,41 +0,0 @@
-import gub
-import mirrors
-
-class Linux_headers (gub.BinarySpec, gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.BinarySpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.linux_2_4,
-                           version='2.4.34', format='bz2')
-    def get_subpackage_names (self):
-        return ['']
-    def patch (self):
-        self.system ('''
-cd %(srcdir)s && yes yes | make ARCH=%(package_arch)s oldconfig symlinks include/linux/version.h
-#cd %(srcdir)s && yes yes | make ARCH=i386 oldconfig
-#cd %(srcdir)s && make ARCH=%(package_arch)s symlinks include/linux/version.h
-cd %(srcdir)s && mv include .include
-cd %(srcdir)s && rm -rf *
-cd %(srcdir)s && mkdir usr
-cd %(srcdir)s && mv .include usr/include
-cd %(srcdir)s && rm -f\
- usr/include/scsi/sg.h\
- usr/include/scsi/scsi.h\
- usr/include/scsi/scsi_ioctl.h\
- usr/include/net/route.h
-''')
-
-import debian
-class Linux_headers__debian (debian.Linux_kernel_headers):
-    def __init__ (self, settings):
-        debian.Linux_kernel_headers.__init__ (self, settings)
-        self.with (name='linux-kernel-headers')
-
-Linux_headers__linux__ppc = Linux_headers__debian
-#Linux_headers__linux__64 = Linux_headers__debian
-Linux_headers__linux__arm__softfloat = Linux_headers__debian
-Linux_headers__linux__arm__vfp = Linux_headers__debian
-
-class Linux_headers__linux__64 (Linux_headers__debian):
-    def __init__ (self, settings):
-        Linux_headers__debian.__init__ (self, settings)
-        self.with (version='2.6.18-6', name='linux-kernel-headers')
--- a/specs/mftrace.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-from toolpackage import ToolBuildSpec
-
-class Mftrace (ToolBuildSpec):
-    def __init__ (self, settings):
-        ToolBuildSpec.__init__ (self, settings)
-        self.with (version='1.2.14',
-                   mirror="http://lilypond.org/download/sources/mftrace/mftrace-%(version)s.tar.gz")
-
--- a/specs/netpbm.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-import mirrors
-import toolpackage
-import repository
-
-class Netpbm (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-
-        # https://svn.sourceforge.net/svnroot/netpbm/advanced netpbm
-
-        repo = repository.Subversion (
-            dir=self.get_repodir (),
-            source='https://svn.sourceforge.net/svnroot/',
-            branch='netpbm',
-            module='stable',
-            revision="172")
-
-        
-        # self.with_vc (repo)
-        self.with (mirror='http://lilypond.org/download/gub-sources/netpbm-patched-10.35.tar.bz2',
-                   version='10.35')
-
-    def configure (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-        self.dump ('\n'*3 + 'static\n' + '\n'*18, '%(builddir)s/answers')
-
-        self.system ('cd %(builddir)s && %(srcdir)s/configure < answers')
-
-    def compile (self):
-        self.system ('''cd %(builddir)s && make CC=gcc \
-        CFLAGS="-O2 -fPIC"  \
-        LDFLAGS="-L%(builddir)s/pbm -L%(builddir)s/pgm -L%(builddir)s/pnm -L%(builddir)s/ppm" \
-        LADD="-lm" \
-        LINUXSVGALIB="NONE" \
-        XML2LIBS="NONE"
-
-''')
-    def install (self):
-        self.system ('mkdir -p %(install_root)s/')
-        self.system ('cd %(builddir)s && make package pkgdir=%(install_root)s/usr LINUXSVGALIB="NONE" XML2LIBS="NONE"')
-        self.system ('''rm -rf %(install_root)s/usr/misc 
-rm -rf %(install_root)s/usr/README
-rm -rf %(install_root)s/usr/VERSION
-rm -rf %(install_root)s/usr/link
-rm -rf %(install_root)s/usr/misc
-rm -rf %(install_root)s/usr/man
-rm -rf %(install_root)s/usr/pkginfo
-rm -rf %(install_root)s/usr/config_template
-''')
-    def packaging_suffix_dir (self):
-        return ''
-
-    def license_file (self):
-        return '%(srcdir)s/README'
-    
-        foo = '''
-        X11LIB=%{_libdir}/libX11.so \
-        JPEGINC_DIR=%{_includedir} \
-        PNGINC_DIR=%{_includedir} \
-        TIFFINC_DIR=%{_includedir} \
-        JPEGLIB_DIR=%{_libdir} \
-        PNGLIB_DIR=%{_libdir} \
-        TIFFLIB_DIR=%{_libdir} \
-        '''
--- a/specs/nsis.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-from toolpackage import ToolBuildSpec
-import os
-import repository
-
-class Nsis (ToolBuildSpec):
-    def __init__ (self, settings):
-        ToolBuildSpec.__init__(self, settings)
-
-        if 1:
-            self.with (version='2.23',
-                       mirror="http://surfnet.dl.sourceforge.net/sourceforge/%(name)s/%(name)s-%(version)s-src.tar.%(format)s",
-                       
-                       format="bz2")
-        else:
-            repo = repository.CVS (
-                self.get_repodir (),
-                source=':pserver:anonymous@nsis.cvs.sourceforge.net:/cvsroot/nsis',
-                module='NSIS',
-                tag='HEAD')
-            self.with_vc (repo)
-
-    def get_build_dependencies (self):
-        return ["scons"]
-
-    def patch (self):
-        self.system ('mkdir -p %(allbuilddir)s', ignore_errors=True)
-        self.system ('ln -s %(srcdir)s %(builddir)s')
-        #self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/nsis-2.22-contrib-math.patch')
-        
-    def configure (self):
-        pass
-
-    def compile_command (self):
-        ## no trailing / in paths!
-        return (' scons PREFIX=%(system_root)s/usr PREFIX_DEST=%(install_root)s '
-                ' DEBUG=yes '
-                ' NSIS_CONFIG_LOG=yes '
-                ' SKIPPLUGINS=System')
-    
-    def compile (self): 
-        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
-        self.system ('cd %(builddir)s/ && %(compile_command)s',
-                     env)
-
-    def install (self):
-        env = {'PATH': '%(topdir)s/target/mingw/usr/cross/bin:' + os.environ['PATH']}
-        self.system ('cd %(builddir)s/ && %(compile_command)s install ', env)
-
-
-
--- a/specs/osx-lilypad.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,17 +0,0 @@
-import mirrors
-import gub
-
-class Osx_lilypad (gub.NullBuildSpec):
-    pass
-
-class Osx_lilypad__darwin__ppc (gub.NullBuildSpec):
-    def __init__ (self, settings):
-        gub.NullBuildSpec.__init__ (self, settings)
-        self.with (version="0.2",
-                   mirror='http://lilypond.org/download/gub-sources/osx-lilypad-ppc-0.2.tar.gz')
-
-class Osx_lilypad__darwin__x86 (gub.NullBuildSpec):
-    def __init__ (self, settings):
-        gub.NullBuildSpec.__init__ (self, settings)
-        self.with (version="0.2",
-                   mirror='http://lilypond.org/download/gub-sources/osx-lilypad-x86-0.2.tar.gz')
--- a/specs/pango.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-import glob
-import os
-import shutil
-import mirrors
-import misc
-import targetpackage
-import re
-
-class Pango (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='1.14.8',
-                   mirror=mirrors.gnome_216,
-                   format='bz2')
-
-    def get_build_dependencies (self):
-        return ['freetype-devel', 'fontconfig-devel', 'glib-devel',
-                'libtool']
-
-    def get_dependency_dict (self):
-        return {'': ['freetype', 'fontconfig', 'glib', 'libtool-runtime']}
-
-
-    def configure_flags (self):
-        return misc.join_lines ('''
---without-x
---without-cairo
-''')
-
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + self.configure_flags ())
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)                
-        self.update_libtool ()
-
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-        self.system ('cd %(srcdir)s && patch --force -p1 < %(patchdir)s/pango-substitute-env.patch')
-
-    def fix_modules (self, prefix='/usr'):
-        etc = self.expand ('%(install_root)s/%(prefix)s/etc/pango', locals ())
-        self.system ('mkdir -p %(etc)s' , locals ())
-        for a in glob.glob (etc + '/*'):
-            self.file_sub ([('/%(prefix)s/', '$PANGO_PREFIX/')], a, locals ())
-
-        pango_module_version = None
-        for dir in glob.glob (self.expand ('%(install_root)s/%(prefix)s/lib/pango/*', locals ())):
-            m = re.search ("([0-9.]+)", dir)
-            if not m:
-                continue
-            
-            pango_module_version = m.group (1)
-            break
-        
-        if not pango_module_version:
-            raise 'No version found'
-        
-        open (etc + '/pangorc', 'w').write (
-        '''[Pango]
-ModuleFiles = $PANGO_PREFIX/etc/pango/pango.modules
-ModulesPath = $PANGO_PREFIX/lib/pango/%(pango_module_version)s/modules
-''' % locals ())
-        
-        shutil.copy2 (self.expand ('%(sourcefiledir)s/pango.modules'), etc)
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)                
-        self.dump ("""
-setfile PANGO_RC_FILE=$INSTALLER_PREFIX/etc/pango/pangorc
-setdir PANGO_PREFIX=$INSTALLER_PREFIX/
-""", '%(install_root)s/usr/etc/relocate/pango.reloc', env=locals())
-        self.fix_modules ()
-
-class Pango__linux (Pango):
-    def untar (self):
-        Pango.untar (self)
-        # FIXME: --without-cairo switch is removed in 1.10.1,
-        # pango only compiles without cairo if cairo is not
-        # installed linkably on the build system.  UGH.
-        self.file_sub ([('(have_cairo[_a-z0-9]*)=true', '\\1=false'),
-                        ('(cairo[_a-z0-9]*)=yes', '\\1=no')],
-                       '%(srcdir)s/configure')
-        os.chmod ('%(srcdir)s/configure' % self.get_substitution_dict (), 0755)
-
-class Pango__freebsd (Pango__linux):
-    def get_build_dependencies (self):
-        return Pango__linux.get_build_dependencies (self) + ['libiconv-devel']
-            
-
-class Pango__darwin (Pango):
-    def configure (self):
-        Pango.configure (self)
-        self.file_sub ([('nmedit', '%(target_architecture)s-nmedit')],
-                       '%(builddir)s/libtool')
-
-    def install (self):
-        Pango.install (self)                
-        self.dump ("""
-set PANGO_SO_EXTENSION=.so
-""", '%(install_root)s/usr/etc/relocate/pango.reloc', env=locals(), mode="a")
--- a/specs/pic.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,152 +0,0 @@
-import glob
-import os
-import re
-import shutil
-import cvs
-import gub
-import misc
-import targetpackage
-
-pic_cvs = ':pserver:anonymous@gforge.natlab.research.philips.com:/cvsroot/pfgpsc'
-
-from context import *
-
-class Pic (targetpackage.TargetBuildSpec):
-    def get_dependency_dict (self):
-        return {'': []}
-
-    def get_subpackage_names (self):
-        return ['']
-    
-    def broken_for_distcc (self):
-        ## upnpAllegro is broken
-        return True
-
-    def get_build_dependencies (self):
-        neon_debian = ['comerr-dev',
-                       'libcomerr2',
-                       'libneon24-dev',
-                       'libssl0.9.8',
-                       'libkrb53',
-                       'libxml2',
-                       'zlib1g',
-                       ]
-        return [
-                'libbluetooth1-dev',
-                'libboost-dev',
-                'libboost-filesystem-dev',
-                'libboost-thread1.32.0',
-                'libboost-thread-dev',
-                'libdbi0-dev',
-                'libexif-dev',
-                'libgphoto2-2-dev',
-                'libid3-3.8.3-dev',
-                'libobexftp-dev',
-                'libopenobex-1.0-0-dev',
-                'libstdc++5',
-                'libstdc++5-3.3-dev',
-                'libusb-dev',
-                'libxerces26',
-                'libxerces26-dev',
-                'uuid-dev',
-                'zlib1g-dev',
-                ]
-
-    def get_unstable_build_dependencies (self):
-        neon_debian = ['comerr-dev',
-                       'libcomerr2',
-                       'libneon25-dev',
-                       'libssl0.9.8',
-                       'libkrb53',
-                       'libxml2',
-                       'zlib1g',
-                       ]
-        return [
-                'libbluetooth1-dev',
-                'libboost-dev',
-                'libboost-filesystem-dev',
-                'libboost-thread-dev',
-                'libdbi0-dev',
-                'libexif-dev',
-                'libgphoto2-2-dev',
-                'libid3-3.8.3-dev',
-                'libobexftp-dev',
-                'libopenobex-1.0-0-dev',
-                'libusb-dev',
-                'libxerces26c2',
-                'libxerces26-dev',
-                'uuid-dev',
-                ]
-
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        # FIXME: lilypond_branch
-        self.with (version=settings.lilypond_branch, mirror=pic_cvs,
-                   vc_type='cvs')
-
-        # FIXME: should add to C_INCLUDE_PATH
-        builddir = self.builddir ()
-        self.target_gcc_flags = (settings.target_gcc_flags
-                    + ' -I%(builddir)s' % locals ())
-        self._downloader = self.cvs
-
-    def rsync_command (self):
-        c = targetpackage.TargetBuildSpec.rsync_command (self)
-        c = c.replace ('rsync', 'rsync --delete') # --exclude configure')
-        return c
-
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + misc.join_lines ('''
---enable-media-server
---disable-decui
---enable-static-gxx
-'''))
-
-    def patch (self):
-        self.system ('''
-sed -i 's/neon//' %(srcdir)s/comps/decDemo/CMakeLists.txt
-sed -i 's/id3/id3 z/' %(srcdir)s/comps/mtmTools/CMakeLists.txt
-sed -i 's/gphoto2_port/gphoto2_port dl/' %(srcdir)s/comps/mtmUsb/CMakeLists.txt
-''')
-
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        self.system ('''
-echo '#define HAVE_OBEXFTP_CLIENT_BODY_CONTENT 1' >> %(builddir)s/build/config.h
-''')
-#'
-
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-            + ' mediaServer')
-
-    def install_command (self):
-        return 'mkdir -p %(install_prefix)s/bin && cp -pv %(builddir)s/build/bin/mediaServer %(install_prefix)s/bin'
-
-    # FIXME: shared for all CVS packages
-    def srcdir (self):
-        return '%(allsrcdir)s/%(name)s-%(version)s'
-
-    # FIXME: shared for all CVS packages
-    def builddir (self):
-        return '%(targetdir)s/build/%(name)s-%(version)s'
-
-    def name_version (self):
-        # whugh
-        if os.path.exists (self.srcdir ()):
-            d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
-            return 'pic-%(VERSION)s' % d
-        #return targetpackage.TargetBuildSpec.name_version (self)
-        return 'pic-1.67'
-
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-
-    def gub_name (self):
-        nv = self.name_version ()
-        p = self.settings.platform
-        return '%(nv)s.%(p)s.gub' % locals ()
-
-#Hmm
-Pic__mipsel = Pic
--- a/specs/pjproject.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,26 +0,0 @@
-import repository
-import targetpackage
-
-class Pjproject (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_vc (repository.TarBall (self.settings.mirrorss,
-                                          url='http://www.pjsip.org/release/0.5.10.1/pjproject-0.5.10.1.tar.gz',
-                                          version='0.5.10.1',
-                                          strip_components=True))
-        # FIXME: broken for make -j2, why does broken_for_distcc not handle?
-        self.settings.cpu_count_str = '1'
-    def broken_for_distcc (self):
-        return True
-    def patch (self):
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/pjproject-install.patch')
-    def configure_command (self):
-#        return targetpackage.TargetBuildSpec.configure_command (self).replace ('/configure', '/aconfigure')
-        return (targetpackage.TargetBuildSpec.configure_command (self).replace ('%(srcdir)s/configure', './aconfigure')
-                + ' --disable-sound')
-    def configure (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-        targetpackage.TargetBuildSpec.configure (self)
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' prefix=/usr')
--- a/specs/pkg-config.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-import mirrors
-import toolpackage
-
-class Pkg_config (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version="0.20",
-                   mirror=mirrors.freedesktop),
-
-    def configure (self):
-        toolpackage.ToolBuildSpec.configure (self)
-        self.update_libtool ()
--- a/specs/potrace.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-import toolpackage
-
-class Potrace (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-	import mirrors
-        self.with (mirror=mirrors.sf, version="1.7"),
--- a/specs/python-config.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,22 +0,0 @@
-import gub
-
-class Python_config (gub.SdkBuildSpec):
-    def __init__ (self, settings):
-        gub.SdkBuildSpec.__init__ (self, settings)
-        self.has_source = False
-        self.with (version='2.4.1')
-    def untar (self):
-        pass
-    # FIXME: c&p python.py:install ()
-    def install (self):
-        import re
-        gub.SdkBuildSpec.install (self)
-        self.system ('mkdir -p %(cross_prefix)s/usr/bin')
-        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
-        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
-        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
-        import sys
-        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
-        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
-                   expand_string=False)
-        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
--- a/specs/python.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-import re
-import sys
-#
-import mirrors
-import glob
-import gub
-import targetpackage
-
-from context import *
-
-class Python (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='2.4.2',
-                   mirror=mirrors.python,
-                   format='bz2')
-
-        ## don't import settings from build system.
-	self.BASECFLAGS = ''
-        self.CROSS_ROOT = '%(system_root)s'
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
-
-    def get_subpackage_names (self):
-        return ['doc', 'devel', 'runtime', '']
-
-    def get_build_dependencies (self):
-        return ['expat-devel', 'zlib-devel']
-
-    def get_dependency_dict (self):
-        return { '': ['expat', 'python-runtime', 'zlib'],
-                 'devel' : ['libtool', 'python-devel'],
-                 'runtime': [], }
-
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-1.patch')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-configure.in-posix.patch')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-configure.in-sysname.patch')
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-configure.in-sysrelease.patch')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-import.patch')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-cross_root.patch')
-        self.file_sub ([('@CC@', '@CC@ -I$(shell pwd)')],
-                        '%(srcdir)s/Makefile.pre.in')
-
-    def configure (self):
-        self.system ('''cd %(srcdir)s && autoconf''')
-        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
-        targetpackage.TargetBuildSpec.configure (self)
-
-    def compile_command (self):
-        ##
-        ## UGH.: darwin Python vs python (case insensitive FS)
-        c = targetpackage.TargetBuildSpec.compile_command (self)
-        c += ' BUILDPYTHON=python-bin '
-        return c
-
-    def install_command (self):
-        ##
-        ## UGH.: darwin Python vs python (case insensitive FS)
-        c = targetpackage.TargetBuildSpec.install_command (self)
-        c += ' BUILDPYTHON=python-bin '
-        return c
-
-    # FIXME: c&p linux.py:install ()
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
-        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
-        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
-        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
-        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
-                   expand_string=False)
-        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
-
-
-    ### Ugh.
-    @subst_method
-    def python_version (self):
-        return '.'.join (self.ball_version.split ('.')[0:2])
-
-class Python__mingw_binary (gub.BinarySpec):
-    def __init__ (self, settings):
-        gub.BinarySpec.__init__ (self, settings)
-        self.with (mirror="http://lilypond.org/~hanwen/python-2.4.2-windows.tar.gz",
-                   version='2.4.2')
-
-    def python_version (self):
-        return '2.4'
-
-    def install (self):
-        gub.BinarySpec.install (self)
-
-        self.system ("cd %(install_root)s/ && mkdir usr && mv Python24/include  usr/ ")
-        self.system ("cd %(install_root)s/ && mkdir -p usr/bin/ && mv Python24/* usr/bin/ ")
-        self.system ("rmdir %(install_root)s/Python24/")
-
-
-class Python__mingw_cross (Python):
-    def __init__ (self, settings):
-        Python.__init__ (self, settings)
-        self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_root)s/usr/include' % self.settings.__dict__
-
-    # FIXME: first is cross compile + mingw patch, backported to
-    # 2.4.2 and combined in one patch; move to cross-Python?
-    def patch (self):
-        Python.patch (self)
-        self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-winsock2.patch
-''')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-selectmodule.patch')
-
-        ## to make subprocess.py work.
-        self.file_sub ([
-                ("import fcntl", ""),
-                ], "%(srcdir)s/Lib/subprocess.py",
-               must_succeed=True)
-
-    def config_cache_overrides (self, str):
-        # Ok, I give up.  The python build system wins.  Once
-        # someone manages to get -lwsock32 on the
-        # sharedmodules link command line, *after*
-        # timesmodule.o, this can go away.
-        return re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
-               str)
-
-    def install (self):
-        Python.install (self)
-        for i in glob.glob ('%(install_root)s/usr/lib/python%(python_version)s/lib-dynload/*.so*' \
-                  % self.get_substitution_dict ()):
-            dll = re.sub ('\.so*', '.dll', i)
-            self.system ('mv %(i)s %(dll)s', locals ())
-
-        ## UGH.
-        self.system ('''
-cp %(install_root)s/usr/lib/python%(python_version)s/lib-dynload/* %(install_root)s/usr/bin
-''')
-        self.system ('''
-chmod 755 %(install_root)s/usr/bin/*
-''')
-
-class Python__mingw (Python__mingw_cross):
-    pass
-
-
-import toolpackage
-class Python__local (toolpackage.ToolBuildSpec, Python):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='2.4.2',
-                   mirror=mirrors.python,
-                   format='bz2')
-
-    def configure (self):
-        self.system ('''cd %(srcdir)s && autoconf''')
-        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
-        targetpackage.TargetBuildSpec.configure (self)
-    def install (self):
-        toolpackage.ToolBuildSpec.install (self)
-
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
-
-    def wrap_executables (self):
-        pass
--- a/specs/python25.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,149 +0,0 @@
-import re
-import sys
-#
-import mirrors
-import glob
-import gub
-import targetpackage
-
-from context import *
-
-class Python (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        
-        ## don't import settings from build system.
-	self.BASECFLAGS=''
-        self.with (version='2.5',
-                   mirror=mirrors.python,
-                   format='bz2')
-
-    def configure_command (self):
-        return 'ac_cv_printf_zd_format=yes ' + targetpackage.TargetBuildSpec.configure_command (self)
-
-    def patch (self):
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.5.patch')
-
-        self.file_sub ([(r"'/usr/include'",
-                         r"'%(system_root)s/usr/include'")],
-                       "%(srcdir)s/setup.py", must_succeed=True)
-                        
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
-
-    def get_subpackage_names (self):
-        return ['doc', 'devel', 'runtime', '']
-
-    def get_build_dependencies (self):
-        return ['expat-devel', 'zlib-devel']
-
-    def get_dependency_dict (self):
-        return { '': ['expat', 'python-runtime', 'zlib'],
-                 'devel' : ['libtool', 'python-devel'],
-                 'runtime': [], }
-
-    def configure (self):
-        self.system ('''cd %(srcdir)s && autoconf''')
-        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
-        targetpackage.TargetBuildSpec.configure (self)
-
-    def compile_command (self):
-        ##
-        ## UGH.: darwin Python vs python (case insensitive FS)
-        c = targetpackage.TargetBuildSpec.compile_command (self)
-        c += ' BUILDPYTHON=python-bin '
-        return c
-
-    def install_command (self):
-        ##
-        ## UGH.: darwin Python vs python (case insensitive FS)
-        c = targetpackage.TargetBuildSpec.install_command (self)
-        c += ' BUILDPYTHON=python-bin '
-        return c
-
-    # FIXME: c&p linux.py:install ()
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        cfg = open (self.expand ('%(sourcefiledir)s/python-config.py.in')).read ()
-        cfg = re.sub ('@PYTHON_VERSION@', self.expand ('%(version)s'), cfg)
-        cfg = re.sub ('@PREFIX@', self.expand ('%(system_root)s/usr/'), cfg)
-        cfg = re.sub ('@PYTHON_FOR_BUILD@', sys.executable, cfg)
-        self.dump (cfg, '%(install_root)s/usr/cross/bin/python-config',
-                   expand_string=False)
-        self.system ('chmod +x %(install_root)s/usr/cross/bin/python-config')
-
-
-    ### Ugh.
-    @subst_method
-    def python_version (self):
-        return '.'.join (self.ball_version.split ('.')[0:2])
-
-class Python__mingw (Python):
-    def __init__ (self, settings):
-        Python.__init__ (self, settings)
-        self.target_gcc_flags = '-DMS_WINDOWS -DPy_WIN_WIDE_FILENAMES -I%(system_root)s/usr/include' % self.settings.__dict__
-
-    # FIXME: first is cross compile + mingw patch, backported to
-    # 2.4.2 and combined in one patch; move to cross-Python?
-    def patch (self):
-        Python.patch (self)
-        if 0:
-            self.system ('''
-cd %(srcdir)s && patch -p1 < %(patchdir)s/python-2.4.2-winsock2.patch
-''')
-        self.system ('cd %(srcdir)s && patch -p0 < %(patchdir)s/python-2.4.2-setup.py-selectmodule.patch')
-    def compile (self):
-        Python.compile (self)
-
-    def configure (self):
-        Python.configure (self)
-        self.file_sub ([('pwd pwdmodule.c', '')],
-                       '%(builddir)s/Modules/Setup')
-        self.file_sub ([(' Modules/pwdmodule.o ', ' ')],
-                       '%(builddir)s/Makefile')
-        self.system ("cp %(srcdir)s/PC/errmap.h %(builddir)s/")
-        
-    def config_cache_overrides (self, str):
-        # Ok, I give up.  The python build system wins.  Once
-        # someone manages to get -lwsock32 on the
-        # sharedmodules link command line, *after*
-        # timesmodule.o, this can go away.
-        return re.sub ('ac_cv_func_select=yes', 'ac_cv_func_select=no',
-                       str)
-
-    def install (self):
-        Python.install (self)
-        for i in glob.glob ('%(install_root)s/usr/lib/python%(python_version)s/lib-dynload/*.so*' \
-                  % self.get_substitution_dict ()):
-            dll = re.sub ('\.so*', '.dll', i)
-            self.system ('mv %(i)s %(dll)s', locals ())
-
-        ## UGH.
-        self.system ('''
-cp %(install_root)s/usr/lib/python%(python_version)s/lib-dynload/* %(install_root)s/usr/bin
-''')
-        self.system ('''
-chmod 755 %(install_root)s/usr/bin/*
-''')
-
-import toolpackage
-class Python__local (toolpackage.ToolBuildSpec, Python):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='2.5',
-                   mirror=mirrors.python,
-                   format='bz2')
-
-    def configure (self):
-        self.system ('''cd %(srcdir)s && autoconf''')
-        self.system ('''cd %(srcdir)s && libtoolize --copy --force''')
-        targetpackage.TargetBuildSpec.configure (self)
-    def install (self):
-        toolpackage.ToolBuildSpec.install (self)
-
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE'
-
-    def wrap_executables (self):
-        pass
--- a/specs/qtopia-core.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,109 +0,0 @@
-import context
-import gub
-import misc
-import targetpackage
-
-trolltech = 'ftp://ftp.trolltech.com/qt/source/%(name)s-opensource-src-%(ball_version)s.tar.%(format)s'
-
-# TODO: base class Qmake build.
-#       sort-out what exactly is Qmake build, qt, and qtopia-core specific
-
-class Qtopia_core (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=trolltech, version='4.2.2')
-        dict = {
-            'CC': 'gcc',
-            'CXX': 'g++',
-            #'LINK': '%(tool_prefix)sg++',
-            }
-        gub.change_target_dict (self, dict)
-    def get_build_dependencies (self):
-        return ['freetype', 'glib', 'tslib']
-    def patch (self):
-        self.file_sub ([('pkg-config', '$PKG_CONFIG')],
-                       '%(srcdir)s/configure')
-    def configure_command (self):
-        return misc.join_lines ('''
-unset CC CXX; bash -x %(srcdir)s/configure
--prefix /usr
--bindir /usr/bin
--libdir /usr/lib
--embedded %(cpu)s
--fast
--headerdir /usr/include
--datadir /usr/share
--sysconfdir /etc
--xplatform qws/%(qmake_target_architecture)s
--depths 8,24
-
--little-endian
--release
--no-cups
--no-accessibility
--no-freetype
--nomake demos
--nomake examples
--nomake tools
--qt-mouse-tslib
--qt-libjpeg
-
--confirm-license
-
--docdir /usr/share/doc/qtopia
--plugindir /usr/share/qtopia/plugins
--translationdir /usr/share/qtopia/translations
--examplesdir /usr/share/doc/qtopia/examples
--demosdir /usr/share/doc/qtopia/demos
--verbose
-''')
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        for i in misc.find (self.expand ('%(install_root)s'), 'Makefile'):
-            self.file_sub ([('-I/usr', '-I%(system_root)/usr')], i)
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + ' INSTALL_ROOT=%(install_root)s')
-    def license_file (self):
-        return '%(srcdir)s/LICENSE.GPL'
-    def install (self):
-        targetpackage.TargetBuildSpec.install (self)
-        self.system ('mkdir -p %(install_root)s/usr/lib/pkgconfig')
-        for i in ('QtCore.pc', 'QtGui.pc', 'QtNetwork.pc'):
-            self.system ('''
-mv %(install_root)s/usr/lib/%(i)s %(install_root)s/usr/lib/pkgconfig/%(i)s
-''',
-                         locals ())
-            self.file_sub ([('includedir', 'deepqtincludedir')],
-                           '%(install_root)s/usr/lib/pkgconfig/%(i)s',
-                           env=locals ())
-
-class Qtopia_core__linux__arm__softfloat (Qtopia_core):
-    @context.subst_method
-    def qmake_target_architecture (self):
-        return 'linux-arm-g++'
-    def patch (self):
-        Qtopia_core.patch (self)
-        self.file_sub ([('arm-linux', '%(target_architecture)s')],
-                       '%(srcdir)s/mkspecs/qws/%(qmake_target_architecture)s/qmake.conf')
-
-Qtopia_core__linux__arm__vfp = Qtopia_core__linux__arm__softfloat
-
-class Qtopia_core__linux__64 (Qtopia_core):
-    @context.subst_method
-    def qmake_target_architecture (self):
-        return 'linux-x86_64-g++'
-    def patch (self):
-        Qtopia_core.patch (self)
-        # ugh, dupe
-        self.system ('''
-#cd %(srcdir)s/mkspecs/qws && cp -R linux-x86_64-g++ %(target_architecture)s
-cd %(srcdir)s/mkspecs && cp -R linux-g++ %(qmake_target_architecture)s
-''')
-        self.file_sub ([
-                ('= gcc', '= %(target_architecture)s-gcc'),
-                ('= g\+\+', '= %(target_architecture)s-g++'),
-                ('= ar', '= %(target_architecture)s-ar'),
-                ('= ranlib', '= %(target_architecture)s-ranlib'),
-                ],
-                       '%(srcdir)s/mkspecs/qws/%(target_architecture)s/qmake.conf')
--- a/specs/regex.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,11 +0,0 @@
-import mirrors
-import targetpackage
-
-class Regex (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with (version='2.3.90-1',
-                   mirror=mirrors.lilypondorg, format='bz2')
-
-    def license_file (self):
-        return '%(srcdir)s/COPYING.LIB'
--- a/specs/scons.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,24 +0,0 @@
-import toolpackage
-import mirrors
-
-class Scons (toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='0.96.93',
-                   format='gz',
-                   mirror=mirrors.sf),
-
-    def compile (self):
-        pass
-
-    def patch (self):
-        pass
-    
-    def configure (self):
-        self.system ('mkdir %(builddir)s')
-    
-    def install_command (self):
-        return 'python %(srcdir)s/setup.py install --prefix=%(local_prefix)s --root=%(install_root)s'
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE.txt' 
--- a/specs/sqlite.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,18 +0,0 @@
-import targetpackage
-
-sqlite = 'http://www.sqlite.org/sqlite-%(ball_version)s.tar.%(format)s'
-
-class Sqlite (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=sqlite, version='3.3.16')
-    def configure_command (self):
-        return (targetpackage.TargetBuildSpec.configure_command (self)
-                + ' --disable-tcl --enable-threadsafe')
-    def patch (self):
-        open (self.expand ('%(srcdir)s/PUBLIC-DOMAIN'), 'w').write ('''
-Sqlite has no license, it is in the public domain.
-See http://www.sqlite.org/copyright.html .
-''')
-    def license_file (self):
-        return '%(srcdir)s/PUBLIC-DOMAIN'
--- a/specs/texinfo.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-import toolpackage
-import mirrors
-
-class Texinfo(toolpackage.ToolBuildSpec):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version="4.8",
-                   mirror=mirrors.gnu, format="bz2")
-    def patch (self):
-        toolpackage.ToolBuildSpec.patch (self)
-        self.system ('cd %(srcdir)s && patch -p1 <  %(patchdir)s/texinfo-4.8.patch')
-
-    ## TODO: should patch out info reader completely.
--- a/specs/texlive.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,250 +0,0 @@
-import repository
-import targetpackage
-
-texlive_svn = 'svn://username@tug.org/texlive'
-license_url = 'http://tug.org/svn/texlive/trunk/Master/LICENSE.TL'
-
-class Texlive (targetpackage.TargetBuildSpec):
-    '''The TeX Live text formatting system
-The TeX Live software distribution offers a complete TeX system.
-It  encompasses programs for editing, typesetting, previewing and printing
-of TeX documents in many different languages, and a large collection
-of TeX macros and font libraries.
- 
-The distribution also includes extensive general documentation about
-TeX, as well as the documentation accompanying the included software
-packages.'''
-
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        repo = repository.Subversion (
-            dir=self.get_repodir (),
-            source=texlive_svn,
-            branch='trunk',
-            module='Build/source',
-            revision='HEAD')
-
-        def fixed_version (self):
-            return '2006'
-
-        from new import instancemethod
-        repo.version = instancemethod (fixed_version, repo, type (repo))
-
-        self.with_vc (repo)
-
-        self.texmf_repo = repository.Subversion (
-# FIXME: module should be used in checkout dir name.            
-            dir=self.get_repodir () + '-texmf',
-#            dir=self.get_repodir () + 'vc_repository._checkout_dir (),
-            source=texlive_svn,
-            branch='trunk',
-            module='Master/texmf',
-            revision='HEAD')
-
-        self.texmf_dist_repo = repository.Subversion (
-# FIXME: module should be used in checkout dir name.            
-            dir=self.get_repodir () + '-texmf-dist',
-#            dir=self.get_repodir () + 'vc_repository._checkout_dir (),
-            source=texlive_svn,
-            branch='trunk',
-            module='Master/texmf-dist',
-            revision='HEAD')
-
-    def version (self):
-        return '2006'
-    
-    def get_subpackage_names (self):
-        return ['doc', 'devel', 'base', 'runtime', 'bin', '']
-
-    def get_subpackage_definitions (self):
-        d = targetpackage.TargetBuildSpec.get_subpackage_definitions (self)
-        d['doc'] += ['/usr/share/texmf/doc']
-        d['base'] = ['/usr/share/texmf']
-#        d['bin'] = ['/']
-        d['bin'] = ['/etc', '/usr']
-        return d
-
-    def download (self):
-        targetpackage.TargetBuildSpec.download (self)
-        self.texmf_repo.download ()
-        import misc
-        misc.download_url (license_url,  self.vc_repository._checkout_dir ())
-#        self.dump ('MAJOR_VERSION=2006', self.vc_repository.dir + '/VERSION')
-                           
-    def untar (self):
-        targetpackage.TargetBuildSpec.untar (self)
-#        self.texmf_repo.update_workdir (self.expand ('%(srcdir)s/texmf-dist'))
-        self.texmf_repo.update_workdir (self.expand ('%(srcdir)s/texmf'))
-
-    def rsync_command (self):
-        return targetpackage.TargetBuildSpec.rsync_command (self).replace ('rsync', 'rsync --exclude=.svn')
-
-    def configure_command (self):
-        import misc
-        #FIXME
-        return ('export TEXMFMAIN=%(srcdir)s/texmf;'
-                + 'bash '
-                + targetpackage.TargetBuildSpec.configure_command (self).replace ('--config-cache', '--cache-file=config.cache')
-                + misc.join_lines ('''
---disable-multiplatform
---enable-ipc
---enable-shared
---with-dialog
---with-etex
---with-omega
---with-oxdvik
---with-pdflatex
---with-pdftex
---with-pnglib-include=%(system_root)s/usr/include/libpng12
---with-system-freetype
---with-system-freetype2
---with-freetype2-include=%(system_root)s/usr/include/freetype2
---with-system-gd
---with-system-ncurses
---with-system-pnglib
---with-system-t1lib
---with-system-tifflib
---with-system-zlib
---with-x
---with-mf-x-toolkit=xaw
---with-xdvi-x-toolkit=xaw
---without-cjkutils
---without-dvi2tty
---without-dvipdfmx
---without-dvipng
---without-icu
---without-lcdf-typetools
---without-psutils
---without-sam2p
---without-t1utils
---without-texi2html
---without-texinfo
---without-ttf2pk
---without-xetex
---without-xdvipdfmx
---x-includes=%(system_root)s/usr/X11R6/include
---x-libraries=%(system_root)s/usr/X11R6/lib
-'''))
-
-    def install_command (self):
-        return self.broken_install_command ()
-
-    def install (self):
-    	targetpackage.TargetBuildSpec.install (self)
-        self.system ('''
-#rsync -v -a %(srcdir)s/texmf-dist/* %(install_root)s/usr/share/texmf-dist
-rsync -v -a %(srcdir)s/texmf/* %(install_root)s/usr/share/texmf/
-''')
-
-    def license_file (self):
-        return '%(srcdir)s/LICENSE.TL'
-
-    # FIXME: shared for all vc packages
-    def srcdir (self):
-        return '%(allsrcdir)s/%(name)s-%(version)s'
-
-    # FIXME: shared for all vc packages
-    def builddir (self):
-        return '%(targetdir)s/build/%(name)s-%(version)s'
-
-    def name_version (self):
-        # whugh
-        import os
-        if os.path.exists (self.srcdir ()):
-            d = misc.grok_sh_variables (self.expand ('%(srcdir)s/VERSION'))
-            return 'texlive-%(VERSION)s' % d
-        return 'texlive-3.0'
-
-class Texlive__cygwin (Texlive):
-    def __init__ (self, settings):
-        Texlive.__init__ (self, settings)
-
-    # FIXME: uses mixed gub/distro dependencies
-    def get_dependency_dict (self):
-        d = Texlive.get_dependency_dict (self)
-        d[''] += ['cygwin']
-#        d['devel'] += ['cygwin'] + ['bash']
-#        d['runtime'] += ['libjpeg62', 'libpng12', 't1lib', 'zlib']
-        d[''] += ['libfreetype26', 'libgd2', 'libjpeg62', 'libncurses7', 'libpng12', 't1lib', 'xorg-x11-bin-dlls', 'xaw3d', 'zlib']
-        return d
- 
-    # FIXME: uses mixed gub/distro dependencies
-    def get_build_dependencies (self):
-        return ['jpeg', 'libfreetype2-devel', 'libgd-devel', 'libncurses-devel', 'libpng12-devel', 'libtool', 't1lib', 'xorg-x11-devel', 'xaw3d', 'zlib']
-
-    def config_cache_overrides (self, str):
-        # split part to Texlive ?
-        return (str + '''
-xdvi_cv_bitmap_type=${xdvi_cv_bitmap_type='BMTYPE=int BMBYTES=4'}
-xdvi_cv_func_poll=${xdvi_cv_func_poll=yes}
-xdvi_cv_sys_streams=${xdvi_cv_sys_streams=no}
-xdvi_cv_sys_sunos_4=${xdvi_cv_sys_sunos_4=no}
-xdvi_cv_motif_include=${xdvi_cv_motif_include=no}
-xdvi_cv_motif_libdir=${xdvi_cv_motif_libdir=no}
-xdvi_cv_func_good_vsnprintf=${xdvi_cv_func_good_vsnprintf=yes}
-ac_cv_func_vfork_works=${ac_cv_func_vfork_works=yes}
-xdvi_cv_setsid_in_vfork=${xdvi_cv_setsid_in_vfork=yes}
-lt_cv_cc_dll_switch=${lt_cv_cc_dll_switch="-Wl,--dll -nostartfiles"}
-''')
-
-    def patch (self):
-        # FIXME: duh: cross-compile auto-enables t1lib
-        for i in self.locate_files ('%(srcdir)s', 'configure'):
-            self.file_sub ([
-                    ('ac_compile_t1lib=1', 'ac_compile_t1lib=0'),
-                    ('-lpng ', '-lpng12 '),
-                    ('-lpng"', '-lpng12"'),
-                    ], i)
-        self.file_sub ([('^(/\* kpsewhich --)', '#undef KPSE_DLL\n\\1')],
-                       '%(srcdir)s/texk/kpathsea/kpsewhich.c')
-
-    def configure (self):
-        Texlive.configure (self)
-        self.update_libtool ()
-        self.file_sub ([('(-version-info 4:0:0)', '\\1 -no-undefined')],
-                       '%(builddir)s/texk/kpathsea/Makefile')
-
-    def makeflags (self):
-        import misc
-        return misc.join_lines ('''
-CFLAGS="-O2 -g -DKPSE_DLL"
-''')
-
-    def compile_command (self):
-        return (Texlive.compile_command (self) + self.makeflags ())
-
-    def install (self):
-    	self.pre_install_smurf_exe ()
-        Texlive.install (self)
-        
-    # FIXME: we do most of this for all cygwin packages
-    def category_dict (self):
-        return {'': 'text publishing',
-                'base': 'text publishing',
-                'extra': 'text publishing',
-                'runtime': 'libs',
-                'devel': 'devel libs',
-                'doc': 'doc',
-                'x11': 'x11',
-                }
-
-    def description_dict (self):
-        # FIXME: fairly uninformative description for packages,
-        # unlike, eg, guile-devel.  This is easier, though.
-        d = {}
-        for i in self.get_subpackage_names ():
-            d[i] = self.get_subpackage_doc (i)
-        return d
-
-    def get_subpackage_doc (self, split):
-        flavor = {'': 'installer helper',
-                  'bin': 'executables',
-                  'base': 'base texmf tree',
-                  'extra': 'full texmf tree',
-                  'devel': 'development',
-                  'doc': 'documentation',
-                  'runtime': 'runtime',
-                  'x11': 'x11 executables',
-                  }[split]
-        return (Texlive.__doc__.replace ('\n', ' - %(flavor)s\n', 1)
-                % locals ())
--- a/specs/tslib.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,12 +0,0 @@
-import mirrors
-import targetpackage
-
-class Tslib (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.berlios, version='1.0', format='bz2')
-    def configure (self):
-        targetpackage.TargetBuildSpec.configure (self)
-        self.file_sub ([('#define malloc', '#define urg_malloc')],
-                       '%(builddir)s/config.h')
-    
--- a/specs/urw-fonts.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,19 +0,0 @@
-import gub
-
-class Urw_fonts (gub.BinarySpec):
-    def __init__ (self, settings):
-        gub.BinarySpec.__init__ (self, settings)
-
-        self.with (version='1.0.7pre41',
-                   mirror='ftp://ftp.gnome.ru/fonts/urw/release/urw-fonts-%(version)s.tar.bz2')
-        self.vc_repository.strip_components = 0
-    def compile (self):
-        self.system ('cd %(srcdir)s && rm README* COPYING ChangeLog TODO')
-    def install (self):
-        self.system ('mkdir -p %(install_root)s/usr/share/fonts/default/Type1')
-        self.system ('cp %(srcdir)s/* %(install_root)s/usr/share/fonts/default/Type1/')
-    def package (self):
-        gub.BuildSpec.package (self)
-    def get_subpackage_names (self):
-        return ['']
-
--- a/specs/xerces-c.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-import mirrors
-import gub
-import misc
-import targetpackage
-
-class Xerces_c (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-        self.with_tarball (mirror=mirrors.xerces_c, version='2_7_0')
-        self.compile_dict = {
-            'XERCESCROOT': '%(builddir)s',
-            'TRANSCODER': 'NATIVE',
-            'MESSAGELOADER': 'INMEM',
-            'NETACCESSOR': 'Socket',
-            'THREADS': 'pthread',
-            'BITSTOBUILD': '32',
-            'LIBS': ' -lpthread ',
-            'CFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
-            'CXXFLAGS': ' -DPROJ_XMLPARSER -DPROJ_XMLUTIL -DPROJ_PARSERS -DPROJ_SAX4C -DPROJ_SAX2 -DPROJ_DOM -DPROJ_DEPRECATED_DOM -DPROJ_VALIDATORS -DXML_USE_NATIVE_TRANSCODER -DXML_USE_INMEM_MESSAGELOADER -DXML_USE_PTHREADS -DXML_USE_NETACCESSOR_SOCKET ',
-            }
-        gub.change_target_dict (self, self.compile_dict)
-        # FIXME: broken for make -j2, why does broken_for_distcc not handle?
-        self.settings.cpu_count_str = '1'
-    def broken_for_distcc (self):
-        return True
-    def patch (self):
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-    def configure_command (self):
-        # We really did not understand autotools, so we cd and ENV
-        # around it until it breaks.  And see, our webserver is soo
-        # cool, it can serve the INSTALL file!  Let's remove it from
-        # the tarball!
-        return (self.makeflags () + ' '
-                + targetpackage.TargetBuildSpec.configure_command (self)
-                .replace ('/configure ', '/src/xercesc/configure ')
-                .replace ('--config-cache', '--cache-file=%(builddir)s/config.cache'))
-    def makeflags (self):
-        s = ''
-        for i in self.compile_dict.keys ():
-            s += ' ' + i + '="' + self.compile_dict[i] + '"'
-        return s
-    def xcompile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-                + self.makeflags ()
-                + ';' + targetpackage.TargetBuildSpec.compile_command (self)
-                + self.makeflags ()
-                + ';' + targetpackage.TargetBuildSpec.compile_command (self)
-                + self.makeflags ())
-    def compile_command (self):
-        return (targetpackage.TargetBuildSpec.compile_command (self)
-                + self.makeflags ())
-    def install_command (self):
-        return (targetpackage.TargetBuildSpec.install_command (self)
-                + self.makeflags ())
-    def configure (self):
-        self.config_cache ()
-        self.system ('cd %(builddir)s/src/xercesc && %(configure_command)s')
-    def compile (self):
-        self.system ('cd %(builddir)s/src/xercesc && %(compile_command)s')
-    def install (self):
-        self.system ('cd %(builddir)s/src/xercesc && %(install_command)s')
-
--- a/specs/zlib.py	Sun Apr 29 13:09:16 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,79 +0,0 @@
-import targetpackage
-import gub
-import toolpackage
-import re
-
-class Zlib (targetpackage.TargetBuildSpec):
-    def __init__ (self, settings):
-        targetpackage.TargetBuildSpec.__init__ (self, settings)
-	self.with (version='1.2.3',
-                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz')
-        
-    def patch (self):
-        targetpackage.TargetBuildSpec.patch (self)
-
-        self.system ('cp %(sourcefiledir)s/zlib.license %(license_file)s')
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/zlib-1.2.3.patch')
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-
-    def compile_command (self):
-        return targetpackage.TargetBuildSpec.compile_command (self) + ' ARFLAGS=r '
-
-    
-    def configure_command (self):
-        stripped_platform = self.settings.expand ('%(platform)s')
-        stripped_platform = re.sub ('-.*', '', stripped_platform)
-        stripped_platform = stripped_platform.replace ('darwin', 'Darwin')
-        
-        zlib_is_broken = 'SHAREDTARGET=libz.so.1.2.3 target=' + stripped_platform
-
-        ## doesn't use autoconf configure.
-        return zlib_is_broken + ' %(srcdir)s/configure --shared '
-
-    def install_command (self):
-        return targetpackage.TargetBuildSpec.broken_install_command (self)
-
-
-
-class Zlib__mingw (Zlib):
-    # FIXME: removeme, try zlib-1.2.3.patch
-    def x__init__ (self, settings):
-        Zlib.__init__ (self, settings)
-        self.with (version='1.2.2',
-                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.2.tar.gz')
-
-    def patch (self):
-        Zlib.patch (self)
-        self.file_sub ([("='/bin/true'", "='true'"),
-                        ('mgwz','libz'),
-                        ],
-                       '%(srcdir)s/configure')
-
-    def configure_command (self):
-        zlib_is_broken = 'target=mingw'
-        return zlib_is_broken + ' %(srcdir)s/configure --shared '
-
-class Zlib__local (toolpackage.ToolBuildSpec, Zlib):
-    def __init__ (self, settings):
-        toolpackage.ToolBuildSpec.__init__ (self, settings)
-        self.with (version='1.2.3',
-                   mirror='http://heanet.dl.sourceforge.net/sourceforge/libpng/zlib-1.2.3.tar.gz')
-
-        
-    def patch (self):
-        ## ugh : C&P
-        toolpackage.ToolBuildSpec.patch (self)
-        
-        self.system ('cp %(sourcefiledir)s/zlib.license %(license_file)s')
-        self.system ('cd %(srcdir)s && patch -p1 < %(patchdir)s/zlib-1.2.3.patch')
-        self.shadow_tree ('%(srcdir)s', '%(builddir)s')
-      
-    def install_command (self):
-        return toolpackage.ToolBuildSpec.broken_install_command (self)
-        
-    def install (self):
-        toolpackage.ToolBuildSpec.install (self)
-        self.system ('cd %(install_root)s && mkdir -p ./%(local_prefix)s && cp -av usr/* ./%(local_prefix)s && rm -rf usr')
-
-    def configure_command (self):
-        return Zlib.configure_command (self)