changeset 3449:7619d58468a3

Merge branch 'gub' of git://git.sv.gnu.org/lilypond
author Han-Wen Nienhuys <hanwen@xs4all.nl>
date Wed, 09 May 2007 01:23:02 -0300
parents 54dc473307dd (current diff) d226617e202e (diff)
children bec99ae5bac5 bbb361d4d1d9
files
diffstat 21 files changed, 277 insertions(+), 212 deletions(-) [+]
line wrap: on
line diff
--- a/TODO	Fri May 04 17:11:44 2007 -0400
+++ b/TODO	Wed May 09 01:23:02 2007 -0300
@@ -1,17 +1,38 @@
-* Split build recipe's into Basic (configure??; make; make install),
-  AutoTools; move Scons, Bjam recipes to gub lib.  Softcode stages,
-  move autotools patching to autogen/prepare_configure stage.
+* Make test-gub work with plain, user-checked-out repositories again
+  (and/or remove lilypond hardcoding from cron-builder, move checkout
+   command from cron-builder to separate app (or into test-gub)).
+  Add option to send diffs again.  Use case
+
+     bzr branch http://foo/bar.bzr && test-gub bar
+
+  [or alternatively, something like
+
+     gub --stage=download http://foo/bar.bzr && test-gub bar]
+
+* Softcode stages.
+
+* move Scons, Bjam recipes to gub lib.
+
+* code cygwin installer as alternative build spec.
+
+* code .deb installer as alternative build spec.
+
+* look at other installer-builders -> build spec?
+
+* Split build recipes into Basic (configure??; make; make install),
+  AutoTools
+
+* move autotools patching to autogen/prepare_configure stage.
 
 * move makeflags () feature to buildspec.
 
-* Bootstrap whole toolchain from source on more platforms (freebsd)
+* Bootstrap whole toolchain from source on more platforms (freebsd)?
 
-* Install cross toolchain packages in target/local?
-
-* move and merge cross.Gcc, cross.Binutils into cross/gcc, cross/binutils.
 
 LOWER PRIORITY
 
+- replace os. calls with os.context wrapper ones
+
 - better name for gubb.py
 
 - Split gub/*py into packager, builder, platform
@@ -48,4 +69,5 @@
 	       libexpat-dev (for git),
 	       libjpeg-dev (for netpbm),
 	       libtiff-dev (for netpbm),
-	       libx11-dev (for netpbm)]
+	       libx11-dev (for netpbm),
+	       svn (for ghostscript)]
--- a/bin/gub	Fri May 04 17:11:44 2007 -0400
+++ b/bin/gub	Wed May 09 01:23:02 2007 -0300
@@ -213,6 +213,12 @@
                                  + '\n')
     return status
 
+def urg_add_more_settings_for_gub (settings, options):
+    settings.build_source = options.build_source
+    settings.lilypond_versions = options.lilypond_versions
+    settings.cpu_count = options.cpu_count
+    settings.set_distcc_hosts (options)
+
 def main ():
     cli_parser = get_cli_parser ()
     (options, files) = cli_parser.parse_args ()
@@ -223,6 +229,7 @@
         sys.exit (2)
 
     settings = gub.settings.Settings (options)
+    urg_add_more_settings_for_gub (settings, options)
 
     if options.inspect_key:
         inspect (settings, files)
--- a/bin/installer-builder	Fri May 04 17:11:44 2007 -0400
+++ b/bin/installer-builder	Wed May 09 01:23:02 2007 -0300
@@ -213,8 +213,6 @@
     (options, commands)  = parse_command_line ()
 
     settings = gub.settings.Settings (options)
-
-    settings.set_branches (options.branches)
     for s in options.settings:
         (k, v) = tuple (s.split ('='))
         if settings.__dict__.has_key (k):
--- a/bin/test-gub	Fri May 04 17:11:44 2007 -0400
+++ b/bin/test-gub	Wed May 09 01:23:02 2007 -0300
@@ -186,7 +186,7 @@
     logfile = 'test-%(canonicalize)s.log' %  locals ()
     logfile = os.path.join (options.result_dir, logfile)
     
-    cmd = "nice time %(target)s >& %(logfile)s" %  locals ()
+    cmd = "nice time %(target)s > %(logfile)s 2>&1" %  locals ()
 
     log_file.log (cmd)
 
--- a/compilers.make	Fri May 04 17:11:44 2007 -0400
+++ b/compilers.make	Wed May 09 01:23:02 2007 -0300
@@ -27,8 +27,6 @@
 default: cross-compilers
 compilers: cross-compilers
 
--include local.make
-
 ifeq ($(BUILD_PLATFORM),)
 $(error Must define BUILD_PLATFORM)
 endif
--- a/gub.make	Fri May 04 17:11:44 2007 -0400
+++ b/gub.make	Wed May 09 01:23:02 2007 -0300
@@ -1,7 +1,9 @@
 CWD:=$(shell pwd)
 PYTHON=python
-#PYTHONPATH=gub
-#export PYTHONPATH
+PYTHONPATH=.
+export PYTHONPATH
+
+-include local.make
 
 ## must always have one host.
 GUB_DISTCC_ALLOW_HOSTS=127.0.0.1
@@ -13,7 +15,7 @@
 
 ifneq ($(LOCAL_GUB_BUILDER_OPTIONS),)
 $(warning LOCAL_GUB_BUILDER_OPTIONS is deprecated, use LOCAL_GUB_OPTIONS)
-LOCAL_GUB_OPTIONS += LOCAL_GUB_BUILDER_OPTIONS
+LOCAL_GUB_OPTIONS += $(LOCAL_GUB_BUILDER_OPTIONS)
 endif
 
 INVOKE_GUB=$(GUB)\
--- a/gub/cross.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/cross.py	Wed May 09 01:23:02 2007 -0300
@@ -1,5 +1,3 @@
-import os
-#
 from gub import gubb
 from gub import misc
 
@@ -34,80 +32,6 @@
     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
 
@@ -144,6 +68,7 @@
     base = re.sub ('[-0-9].*', '', platform)
     for name in platform, base:
         file_name = 'gub/%(name)s.py' % locals ()
+        import os
         if os.path.exists (file_name):
             break
     settings.os_interface.info ('module-name: ' + file_name + '\n')
--- a/gub/gubb.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/gubb.py	Wed May 09 01:23:02 2007 -0300
@@ -838,11 +838,13 @@
                 settings.specdir):
         file_name = dir + '/' + file_base
         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 ()
-                break
+            if not klass:
+                klass = get_class_from_spec_file (settings, file_name, name)
+            import md5
+            # FIXME: pretty lame, checksum based on all matching
+            # specs found, eg
+            # linux-x86/cross/binutils, linux/cross/binutils, cross/binutils
+            checksum += md5.md5 (open (file_name).read ()).hexdigest ()
 
     if not klass:
         print 'NO SPEC for', name
--- a/gub/oslog.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/oslog.py	Wed May 09 01:23:02 2007 -0300
@@ -57,16 +57,22 @@
         while proc.poll () is None:
             line = proc.stdout.readline ()
             self.log (line, level['output'], verbose)
+            # FIXME: how to yield time slice in python?
             time.sleep (0.0001)
 
-        if proc.returncode and not ignore_errors:
-            m = 'Command barfed: %s\n' % cmd
+        line = proc.stdout.readline ()
+        self.log (line, level['output'], verbose)
+        if proc.returncode:
+            m = 'Command barfed: %(cmd)s\n' % locals ()
             self.error (m)
-            raise misc.SystemFailed (m)
+	    if not ignore_errors:
+        	raise misc.SystemFailed (m)
 
         return 0
 
     def log (self, str, threshold, verbose=None):
+        if not str:
+            return
         if not verbose:
             verbose = self.verbose
         if verbose >= threshold:
@@ -75,7 +81,6 @@
             self.log_file.write (str)
             self.log_file.flush ()
 
-
     # FIXME
     def action (self, str):
         self.log (str, level['action'], self.verbose)
--- a/gub/repository.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/repository.py	Wed May 09 01:23:02 2007 -0300
@@ -561,19 +561,19 @@
         return self.revision == 'HEAD'
 
     def update_workdir (self, destdir):
-        working = self._checkout_dir ()
-        self._copy_working_dir (working, destdir)
+        dir = self._checkout_dir ()
+        self._copy_working_dir (dir, destdir)
 
     def download (self):
-        working = self._checkout_dir ()
-        if not os.path.isdir (working + '/' + self.repository):
+        dir = self._checkout_dir ()
+        if not os.path.isdir (dir + '/' + self.repository):
             self._checkout ()
         if self._current_revision () != self.revision:
-            self._update (working, self.revision)
+            self._update (self.revision)
 
-    def _copy_working_dir (self, working, copy):
+    def _copy_working_dir (self, dir, copy):
         repository = self.repository
-        self.system ('rsync -av --exclude %(repository)s %(working)s/ %(copy)s'
+        self.system ('rsync -av --exclude %(repository)s %(dir)s/ %(copy)s'
                      % locals ())
 
     def _checkout_dir (self):
@@ -599,8 +599,8 @@
         self.module = module
 
     def _current_revision (self):
-        working = self._checkout_dir ()
-        revno = self.read_pipe ('cd %(working)s && svn info' % locals ())
+        dir = self._checkout_dir ()
+        revno = self.read_pipe ('cd %(dir)s && svn info' % locals ())
         m = re.search  ('.*Revision: ([0-9]*).*', revno)
         assert m
         return m.group (1)
@@ -615,9 +615,10 @@
         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):
+    def _update (self, revision):
+        dir = self._checkout_dir ()
         rev_opt = '-r %(revision)s ' % locals ()
-        cmd = 'cd %(working)s && svn up %(rev_opt)s' % locals ()
+        cmd = 'cd %(dir)s && svn up %(rev_opt)s' % locals ()
         self.system (cmd)
 
 class Bazaar (SimpleRepo):
@@ -626,33 +627,62 @@
         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 ())
+        revno = self.bzr_pipe ('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)
+        self.system ('''branch %(rev_opt)s %(source)s %(revision)s'''
+                     % locals ())
         
-    def _update (self, working, revision):
+    def _update (self, revision):
         rev_opt = '-r %(revision)s ' % locals ()
-        cmd = 'cd %(working)s && bzr pull %(rev_opt)s' % locals ()
-        self.system (cmd)
+        self.bzr_system ('pull %(rev_opt)s' % locals ())
+
+    def bzr_pipe (self, cmd):
+        dir = self._checkout_dir ()
+        return self.read_pipe ('cd %(dir)s && bzr %(cmd)s' % locals ())
+
+    def bzr_system (self, cmd):
+        dir = self._checkout_dir ()
+        return self.system ('cd %(dir)s && bzr %(cmd)s' % locals ())
+
+    def get_revision_description (self):
+        return self.bzr_pipe ('log --verbose -r-1')
 
+# FIXME: repository detection AND repositories only work if they are
+# checked-out in a dir named .../name.REPOSITORY Eg, for GIT, this
+# means that only the first arbitrary in .git in
+# `downloads/lilypond.git/.git' is `detected'.  Repositories passed to
+# test-gub must have the .REPOSITORY stripped, --repository=. does not
+# work.
+
+# This is not trivial to fix, as the DIR passed to Repository () is
+# not an existing directory, it gets `.REPOSITORY' appended in the
+# constructors.
+
+# Also, different revisions get checked-out in different directories:
+#, eg: foo.svn/trunk-7111, foo.svn/trunk-HEAD, etc.
+
+# For test-gub to work outside gub again, for now use a workaround
+# like
+#    mkdir foo.bzr && cd foo.bzr
+#    bzr branch URL HEAD
+#    cd HEAD && mkdir log
+#    test-gub --repository $(cd .. && pwd)
 def get_repository_proxy (dir, branch):
     m = re.search (r"(.*)\.(bzr|git|cvs|svn|darcs)", dir)
+
+    print 'dir:', dir
     
     dir = m.group (1)
     type = m.group (2)
 
     if type == 'bzr':
-        return Bazaar (dir, branch=branch)
+        return Bazaar (dir, source='unknown')
     elif type == 'cvs':
         return CVS (dir, branch=branch)
     elif type == 'darcs':
--- a/gub/settings.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/settings.py	Wed May 09 01:23:02 2007 -0300
@@ -42,16 +42,8 @@
         elif self.platform == 'mingw':
             self.target_gcc_flags = '-mwindows -mms-bitfields'
 
-        try:
-            self.options = options ##ugh
-            self.set_branches (options.branches)
-            self.build_source = options.build_source
-            self.lilypond_versions = options.lilypond_versions
-            self.cpu_count = options.cpu_count
-            self.set_distcc_hosts (options)
-        except:
-            pass
-
+        self.set_branches (options.branches)
+        self.options = options ##ugh
         self.verbose = self.options.verbose
         self.os = re.sub ('[-0-9].*', '', self.platform)
 
--- a/gub/specs/cross/binutils.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/cross/binutils.py	Wed May 09 01:23:02 2007 -0300
@@ -1,35 +1,10 @@
 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')
-
-# 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__cygwin (Binutils):
+class Binutils (cross.CrossToolSpec):
     def __init__ (self, settings):
-        Binutils.__init__ (self, settings)
-        self.with (version='2.17', format='bz2', mirror=mirrors.gnu)
-    def makeflags (self):
-        from gub import misc
-        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 Binutils__freebsd (Binutils):
-    def configure_command (self):
-        # Add --program-prefix, otherwise we get
-        # i686-freebsd-FOO iso i686-freebsd4-FOO.
-        from gub import misc
-        return (cross.Binutils.configure_command (self)
-            + misc.join_lines ('''
---program-prefix=%(tool_prefix)s
-'''))
+        cross.CrossToolSpec.__init__ (self, settings)
+        self.with_tarball (mirror=mirrors.gnu, version='2.16.1', format='bz2')
+    def install (self):
+        cross.CrossToolSpec.install (self)
+        self.system ('rm %(install_root)s/usr/cross/lib/libiberty.a')
--- a/gub/specs/cross/gcc-core.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/cross/gcc-core.py	Wed May 09 01:23:02 2007 -0300
@@ -3,14 +3,13 @@
 from gub import mirrors
 from gub import misc
         
-class Gcc_core (gcc.Gcc):
+class Gcc_core (gcc.Gcc_from_source):
     def __init__ (self, settings):
-        gcc.Gcc.__init__ (self, settings)
+        gcc.Gcc_from_source.__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))
+        return gcc.Gcc.get_build_dependencies (self)
     def get_subpackage_names (self):
         return ['']
     def name (self):
@@ -20,7 +19,8 @@
     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) + '''
+        return (misc.join_lines (gcc.Gcc_from_source.configure_command (self)
+                                 + '''
 --prefix=%(cross_prefix)s
 --prefix=/usr
 --with-newlib
@@ -32,16 +32,16 @@
                 .replace ('disable-static', 'enable-static')
                 .replace ('enable-threads=posix', 'enable-threads=no'))
     def compile_command (self):
-        return (cross.Gcc.compile_command (self) + ' all-gcc')
+        return (gcc.Gcc.compile_command (self) + ' all-gcc')
     def compile (self):
-        cross.Gcc.compile (self)
+        gcc.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
+        # Gcc moves libs into system lib places, which will
         # make gcc-core conflict with gcc.
         cross.CrossToolSpec.install (self)
     def languages (self):
--- a/gub/specs/cross/gcc.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/cross/gcc.py	Wed May 09 01:23:02 2007 -0300
@@ -1,24 +1,91 @@
 from gub import cross
 from gub import misc
 from gub import mirrors
+from gub import context
 
-class Gcc (cross.Gcc):
+#FIXME: merge fully with specs/gcc
+class Gcc (cross.CrossToolSpec):
     def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
+        cross.CrossToolSpec.__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)
+        return ['cross/binutils']
+
+    @context.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 = cross.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):
+        import os
+        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):
+        cross.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'))
+        import os
+        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
+''')
+
+class Gcc_from_source (Gcc):
+    def get_build_dependencies (self):
+        return (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']}
+    #FIXME: merge all configure_command settings with Gcc
     def configure_command (self):
-        return (cross.Gcc.configure_command (self)
+        return (Gcc.configure_command (self)
                 + misc.join_lines ('''
 --with-local-prefix=%(system_root)s/usr
 --disable-multilib
@@ -31,18 +98,20 @@
 --enable-long-long
 '''))
     def install (self):
-        cross.Gcc.install (self)
+        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
 ''')
 
-class Gcc__mingw (cross.Gcc):
+Gcc__linux = Gcc_from_source
+
+class Gcc__mingw (Gcc):
     #REMOVEME
     def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
+        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)
+        return (Gcc.get_build_dependencies (self)
                 + ['mingw-runtime', 'w32api'])
     def patch (self):
         for f in ['%(srcdir)s/gcc/config/i386/mingw32.h',
@@ -70,18 +139,26 @@
 --enable-threads
 '''))
 
-class Gcc__freebsd (cross.Gcc):
+class Gcc__darwin (Gcc):
+    #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
+''')
+
+class Gcc__freebsd (Gcc):
     #REMOVEME
     def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
+        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)
+        return (Gcc.get_build_dependencies (self)
                 + ['freebsd-runtime'])
     def configure_command (self):
         # Add --program-prefix, otherwise we get
         # i686-freebsd-FOO iso i686-freebsd4-FOO.
-        return (cross.Gcc.configure_command (self)
+        return (Gcc.configure_command (self)
             + misc.join_lines ('''
 --program-prefix=%(tool_prefix)s
 '''))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/cygwin/cross/binutils.py	Wed May 09 01:23:02 2007 -0300
@@ -0,0 +1,20 @@
+from gub.specs.cross import binutils
+
+# 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 (binutils.Binutils):
+    def __init__ (self, settings):
+        binutils.Binutils.__init__ (self, settings)
+        from gub import mirrors
+        self.with (version='2.17', format='bz2', mirror=mirrors.gnu)
+    def makeflags (self):
+        from gub import misc
+        return misc.join_lines ('''
+tooldir="%(cross_prefix)s/%(target_architecture)s"
+''')
+    def compile_command (self):
+        return (binutils.Binutils.compile_command (self)
+                + self.makeflags ())
+    def configure_command (self):
+        return (binutils.Binutils.configure_command (self)
+                 + ' --disable-werror ')
--- a/gub/specs/darwin/cross/gcc.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/darwin/cross/gcc.py	Wed May 09 01:23:02 2007 -0300
@@ -1,10 +1,10 @@
-from gub import cross
+from gub.specs.cross import gcc
 from gub import mirrors
 
-class Gcc (cross.Gcc):
+class Gcc (gcc.Gcc):
     def __init__ (self, settings):
         #FIXME: separate-out: darwin-ppc/gcc.py / class Gcc__darwin__powerpc ()
-        cross.Gcc.__init__ (self, settings)
+        gcc.Gcc.__init__ (self, settings)
         if self.settings.target_architecture.startswith ("powerpc"):
             self.with (version='4.1.1', mirror=mirrors.gcc_41, format='bz2')
         else:
@@ -18,13 +18,13 @@
                        "%(srcdir)s/libstdc++-v3/scripts/make_exports.pl")
 
     def configure_command (self):
-        c = cross.Gcc.configure_command (self)
+        c = gcc.Gcc.configure_command (self)
 #                c = re.sub ('enable-shared', 'disable-shared', c)
         return c
     
 
     def configure (self):
-        cross.Gcc.configure (self)
+        gcc.Gcc.configure (self)
 
     def rewire_gcc_libs (self):
 	import os
@@ -42,7 +42,7 @@
 ''', locals ())
         
     def install (self):
-        cross.Gcc.install (self)
+        gcc.Gcc.install (self)
         self.rewire_gcc_libs ()
 
     def get_build_dependencies (self):
@@ -50,12 +50,12 @@
     
 class Not_used__Gcc__darwin (Gcc):
     def configure (self):
-        cross.Gcc.configure (self)
+        gcc.Gcc.configure (self)
 
     def install (self):
         ## UGH ?
         ## Gcc.install (self)
 
-        cross.Gcc.install (self)
+        gcc.Gcc.install (self)
         self.rewire_gcc_libs ()
         
--- a/gub/specs/darwin/odcctools.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/darwin/odcctools.py	Wed May 09 01:23:02 2007 -0300
@@ -5,7 +5,8 @@
     def __init__ (self, settings):
         cross.CrossToolSpec.__init__ (self, settings)
         self.with (version='20060413',
-                   # version='20060608',
+                   ####version='20060608',
+                   #version='20061117',
                    mirror=mirrors.opendarwin,
                    format='bz2')
     def get_build_dependencies (self):
--- a/gub/specs/debian/cross/gcc-34.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/debian/cross/gcc-34.py	Wed May 09 01:23:02 2007 -0300
@@ -1,11 +1,11 @@
-from gub import cross
+from gub.specs.cross import gcc
 
-class Gcc_34__debian__mipsel (cross.Gcc):
+class Gcc_34__debian__mipsel (gcc.Gcc):
     def languages (self):
         return  ['c']
         
     def configure_command (self):
-        return misc.join_lines (cross.Gcc.configure_command (self)
+        return misc.join_lines (gcc.Gcc.configure_command (self)
                                + '''
 --program-suffix=-3.4
 --with-ar=%(cross_prefix)s/bin/%(target_architecture)s-ar
@@ -13,13 +13,13 @@
 ''')
 
     def configure (self):
-        cross.Gcc.configure (self)
+        gcc.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)
+        gcc.Gcc.install (self)
         # get rid of duplicates
         self.system ('''
 rm -f %(install_root)s/usr/lib/libgcc_s.so
--- a/gub/specs/debian/cross/gcc.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/debian/cross/gcc.py	Wed May 09 01:23:02 2007 -0300
@@ -1,21 +1,21 @@
-from gub import cross
+from gub.specs.cross import gcc
 from gub import debian
 from gub import mirrors
 
-class Gcc (cross.Gcc):
+class Gcc (gcc.Gcc):
     def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
+        gcc.Gcc.__init__ (self, settings)
         self.with_tarball (mirror=mirrors.gnu, version=debian.gcc_version,
                            format='bz2')
     def get_build_dependencies (self):
         return ['cross/binutils', 'libc6', 'libc6-dev', 'linux-kernel-headers']
     ## TODO: should detect whether libc supports TLS 
     def configure_command (self):
-        return cross.Gcc.configure_command (self) + ' --disable-tls '
+        return gcc.Gcc.configure_command (self) + ' --disable-tls '
 
 class Gcc__debian__arm (Gcc):
     def __init__ (self, settings):
-        cross.Gcc.__init__ (self, settings)
+        gcc.Gcc.__init__ (self, settings)
         self.with_tarball (mirror=mirrors.gnu, version='3.4.6', format='bz2')
 
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gub/specs/freebsd/cross/binutils.py	Wed May 09 01:23:02 2007 -0300
@@ -0,0 +1,11 @@
+from gub.specs.cross import binutils
+
+class Binutils__freebsd (binutils.Binutils):
+    def configure_command (self):
+        # Add --program-prefix, otherwise we get
+        # i686-freebsd-FOO iso i686-freebsd4-FOO.
+        from gub import misc
+        return (binutils.Binutils.configure_command (self)
+            + misc.join_lines ('''
+--program-prefix=%(tool_prefix)s
+'''))
--- a/gub/specs/linux-arm-softfloat/cross/gcc.py	Fri May 04 17:11:44 2007 -0400
+++ b/gub/specs/linux-arm-softfloat/cross/gcc.py	Wed May 09 01:23:02 2007 -0300
@@ -2,18 +2,18 @@
 from gub.specs.cross import gcc
 from gub import misc
 
-class Gcc (gcc.Gcc):
+class Gcc (gcc.Gcc_from_source):
     def __init__ (self, settings):
-        gcc.Gcc.__init__ (self, settings)
+        gcc.Gcc_from_source.__init__ (self, settings)
         self.with_tarball (mirror=mirrors.gnu, version='3.4.6', format='bz2')
     def patch (self):
-        gcc.Gcc.patch (self)
+        gcc.Gcc_from_source.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)
+        return (gcc.Gcc_from_source.configure_command (self)
                 + misc.join_lines ('''
 --with-float=soft
 #--with-fpu=vfp