changeset 4456:ab1880655ffc

Grand hack to allow cross-platform build dependencies. TODO: populate specs with full [tools] build dependencies and junk toplevel makefile tools-* and bootstrap-* logic.
author Jan Nieuwenhuizen <janneke@gnu.org>
date Thu, 23 Oct 2008 15:48:32 +0200
parents 8c55e9064d87
children 8669a734ce20
files bin/gub compilers.make gub/build.py gub/buildrunner.py gub/commands.py gub/cross.py gub/dependency.py gub/gup.py gub/guppackage.py gub/logging.py gub/misc.py gub/specs/autoconf.py gub/specs/bash.py gub/specs/cross/binutils.py gub/specs/cross/gcc.py gub/specs/dhcp.py gub/specs/fontconfig.py gub/specs/freebsd-runtime.py gub/specs/libicu.py gub/specs/libtool.py gub/specs/libwsock32.py gub/specs/mingw-runtime.py gub/specs/raptor.py gub/specs/saxon-java.py gub/specs/texinfo.py gub/specs/urw-fonts.py gub/specs/w32api.py lilypond.make
diffstat 28 files changed, 218 insertions(+), 135 deletions(-) [+]
line wrap: on
line diff
--- a/bin/gub	Wed Oct 22 22:26:45 2008 +0200
+++ b/bin/gub	Thu Oct 23 15:48:32 2008 +0200
@@ -201,7 +201,7 @@
         names = files
 
     try:
-        manager = gup.get_target_manager (settings)
+        manager = gup.DependencyManager (settings.system_root)
         ## Todo: have a readonly lock for tools platform
     except locker.LockedError:
         logging.error ('another build in progress.  Skipping.')
@@ -260,10 +260,14 @@
 
     logging.default_logger.threshold = options.verbosity
 
+    if not options.platform and len (files) == 1:
+        options.platform, x = misc.split_platform (files[1])
+
     if not options.platform:
-        logging.error ('Must specify platform')
-        sys.exit(2)
-        
+        logging.error ('errror: platform not specied\n')
+        cli_parser.print_help ()
+        sys.exit (2)
+
     settings = gub.settings.Settings (options.platform)
 
     if options.inspect_key:
--- a/compilers.make	Wed Oct 22 22:26:45 2008 +0200
+++ b/compilers.make	Thu Oct 23 15:48:32 2008 +0200
@@ -25,7 +25,7 @@
 
 DISTCC_DIRS=target/cross-distcc/bin target/cross-distccd/bin target/native-distcc/bin 
 
-tools = texinfo
+tools = automake autoconf libtool texinfo
 
 # -texinfo: for binutils-2.18
 
--- a/gub/build.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/build.py	Thu Oct 23 15:48:32 2008 +0200
@@ -1,16 +1,15 @@
+import inspect
+import os
 import pickle
-import os
 import re
 import sys
-import inspect
-
 #
-from gub import misc
+from gub import commands
 from gub import context
 from gub import guppackage
+from gub import loggedos
 from gub import logging
-from gub import loggedos
-from gub import commands
+from gub import misc
 
 class Build (context.RunnableContext):
     '''How to build a piece of software
@@ -448,6 +447,18 @@
     def get_build_dependencies (self):
         return []
 
+    def with_platform (self, name):
+        return misc.with_platform (name, self.settings.platform)
+
+    def get_platform_build_dependencies (self):
+        return [self.with_platform (n) for n in self.get_build_dependencies ()]
+
+    def platform_name (self):
+        return self.with_platform (self.name ())
+
+    def platform (self):
+        return self.settings.platform
+
     def get_subpackage_definitions (self):
 	prefix_dir = self.settings.prefix_dir
         d = {
@@ -513,6 +524,7 @@
                 conflict_str = p._dict['conflicts_string'] + ';' + conflict_str
             p._dict['conflicts_string'] = conflict_str
 
+            dep_str = ';'.join (map (self.with_platform, dep_dict.get (sub, [])))
             dep_str = ';'.join (dep_dict.get (sub, []))
             if p._dict.has_key ('dependencies_string'):
                 dep_str = p._dict['dependencies_string'] + ';' + dep_str
--- a/gub/buildrunner.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/buildrunner.py	Thu Oct 23 15:48:32 2008 +0200
@@ -29,6 +29,8 @@
 from gub import gup
 from gub import logging
 from gub import runner
+import gub.settings   # otherwise naming conflict with settings local vars.
+
 
 def checksum_diff (b, a):
     return '\n'.join (difflib.unified_diff (a.split ('\n'),
@@ -40,7 +42,7 @@
 #FIXME: split spec_* into SpecBuiler?
 class BuildRunner:
     def __init__ (self, manager, settings, specs):
-        self.manager = manager
+        self.managers = {settings.platform : manager }
         self.settings = settings
         self.specs = specs
 
@@ -48,18 +50,23 @@
         self.checksums = {}
 
         PATH = os.environ['PATH']
-        ## cross_prefix is also necessary for building cross packages, such as GCC
+        # cross_prefix is also necessary for building cross packages, such as GCC
         os.environ['PATH'] = self.settings.expand ('%(cross_prefix)s/bin:' + PATH,
                                                    locals ())
+        self.add_packages_to_manager (self.specs)
 
-        ## UGH -> double work, see cross.change_target_packages () ?
-        sdk_pkgs = [p for p in self.specs.values ()
-                    if isinstance (p, build.SdkBuild)]
-        cross_pkgs = [p for p in self.specs.values ()
-                      if isinstance (p, cross.CrossToolsBuild)]
-
-        extra_build_deps = [p.name () for p in sdk_pkgs + cross_pkgs]
-        gup.add_packages_to_manager (self.manager, self.settings, self.specs)
+    def manager (self, platform):
+        if not self.managers.has_key (platform):
+            settings = gub.settings.Settings (platform)
+            self.managers[platform] = gup.DependencyManager (settings.system_root)
+        return self.managers[platform]
+        
+    def add_packages_to_manager (self, 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 ():
+                self.manager (package.platform ()).register_package_dict (package.dict ())
 
     def calculate_checksums (self):
         logging.stage ('calculating checksums\n')
@@ -79,7 +86,7 @@
         # checksum is per buildspec, only need to inspect one package.
         pkg = spec.get_packages ()[0]    
         name = pkg.name ()
-        pkg_dict = self.manager.package_dict (name)
+        pkg_dict = self.manager (pkg.platform ()).package_dict (name)
 
         try:
             build_checksum_ondisk = open (pkg_dict['checksum_file']).read ()
@@ -91,8 +98,8 @@
         if spec.source_checksum () != pkg_dict['source_checksum']:
             reason = 'source %s -> %s (memory)' % (spec.source_checksum (), pkg_dict['source_checksum'])
 
-        if reason == '' and self.checksums[spec.name ()] != build_checksum_ondisk:
-            reason = 'build diff %s' % checksum_diff (self.checksums[spec.name ()], build_checksum_ondisk)
+        if reason == '' and self.checksums[spec.platform_name ()] != build_checksum_ondisk:
+            reason = 'build diff %s' % checksum_diff (self.checksums[spec.platform_name ()], build_checksum_ondisk)
 
         hdr = pkg.expand ('%(split_hdr)s')
         if reason == '' and not os.path.exists (hdr):
@@ -115,11 +122,12 @@
         subname = ''
         if spec.name () != pkg_name:
             subname = pkg_name.split ('-')[-1]
+        manager = self.manager (spec.platform ())
         if spec.get_conflict_dict ().has_key (subname):
             for c in spec.get_conflict_dict ()[subname]:
-                if self.manager.is_installed (c):
+                if manager.is_installed (c):
                     print '%(c)s conflicts with %(pkg_name)s' % locals ()
-                    conflict_source = self.manager.source_name (c)
+                    conflict_source = manager.source_name (c)
                     # FIXME: implicit provides: foo-* provides foo-core,
                     # should implement explicit provides
                     if conflict_source + '-core' == pkg_name:
@@ -129,69 +137,76 @@
                                % locals ())
                         install_candidate = None
                         continue
-                    self.manager.uninstall_package (c)
+                    manager.uninstall_package (c)
         return install_candidate
 
     def pkg_install (self, spec, pkg):
-        if not self.manager.is_installed (pkg.name ()):
+        manager = self.manager (spec.platform ())
+        if not manager.is_installed (pkg.name ()):
             install_candidate = self.spec_conflict_resolution (spec, pkg)
             if install_candidate:
-                self.manager.unregister_package_dict (install_candidate.name ())
-                self.manager.register_package_dict (install_candidate.dict ())
-                self.manager.install_package (install_candidate.name ())
+                manager.unregister_package_dict (install_candidate.name ())
+                manager.register_package_dict (install_candidate.dict ())
+                manager.install_package (install_candidate.name ())
 
     def spec_install (self, spec):
         for pkg in spec.get_packages ():
             self.pkg_install (spec, pkg)
 
-    def spec_build (self, specname):
-        spec = self.specs[specname]
+    def spec_build (self, spec_name):
+        spec = self.specs[spec_name]
         
         all_installed = True
         for p in spec.get_packages ():
             all_installed = (all_installed
-                             and self.manager.is_installed (p.name ()))
+                             and self.manager (p.platform ()).is_installed (p.name ()))
         if all_installed:
             return
 
         # ugh, dupe
         checksum_fail_reason = self.spec_checksums_fail_reason (spec)
-            
-        is_installable = misc.forall (self.manager.is_installable (p.name ())
+
+        is_installable = misc.forall (self.manager (p.platform ()).is_installable (p.name ())
                                       for p in spec.get_packages ())
 
+	# ugh, dupe
         logger = logging.default_logger
+        if checksum_fail_reason:
+            logger.write_log ('checkum failed: %(spec_name)s\n' % locals (), 'stage')
+        else:
+            logger.write_log ('checkum ok: %(spec_name)s\n' % locals (), 'harmless')
+
+        if logging.get_numeric_loglevel ('command') > logger.threshold:
+            logger.write_log ('\n'.join (checksum_fail_reason.split ('\n')[:10]), 'command')
+        logger.write_log (checksum_fail_reason, 'output')
 
         if (not is_installable or checksum_fail_reason):
 
-            if logging.get_numeric_loglevel ('command') > logger.threshold:
-                logger.write_log ('\n'.join (checksum_fail_reason.split ('\n')[:10]), 'command')
-            logger.write_log (checksum_fail_reason, 'output')
-
             deferred_runner = runner.DeferredRunner (logger)
             spec.connect_command_runner (deferred_runner)
-            spec.runner.stage ('building package: %s\n' % specname)
+            spec.runner.stage ('building package: %s\n' % spec_name)
             spec.build ()
             spec.connect_command_runner (None)
             
             deferred_runner.execute_deferred_commands ()
 
-            file (spec.expand ('%(checksum_file)s'), 'w').write (self.checksums[specname])
+            file (spec.expand ('%(checksum_file)s'), 'w').write (self.checksums[spec_name])
 
         logger.write_log (' *** Stage: %s (%s, %s)\n'
                            % ('pkg_install', spec.name (),
-                              self.settings.platform), 'stage')
+                              spec.platform ()), 'stage')
         self.spec_install (spec)
+        logging.default_logger.write_log ('\n', 'stage')
 
     def uninstall_outdated_spec (self, spec_name):
 	spec = self.specs[spec_name]
-	# ugh, dupe
-	checksum_ok = '' == self.spec_checksums_fail_reason (self.specs[spec_name])
+        checksum_fail_reason = self.spec_checksums_fail_reason (self.specs[spec_name])
+	checksum_ok = '' == checksum_fail_reason
 	for pkg in spec.get_packages ():
-	    if (self.manager.is_installed (pkg.name ())
-		and (not self.manager.is_installable (pkg.name ())
+	    if (self.manager (pkg.platform ()).is_installed (pkg.name ())
+		and (not self.manager (pkg.platform ()).is_installable (pkg.name ())
 		     or not checksum_ok)):
-		self.manager.uninstall_package (pkg.name ())
+		self.manager (pkg.platform ()).uninstall_package (pkg.name ())
 
     def uninstall_outdated_specs (self, deps):
         for spec_name in reversed (deps):
--- a/gub/commands.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/commands.py	Thu Oct 23 15:48:32 2008 +0200
@@ -281,17 +281,6 @@
         autodir = None
         if not autodir:
             autodir = package.expand ('%(srcdir)s')
-        if os.path.isdir (os.path.join (package.srcdir (), 'ltdl')):
-            # --install is mandatory for libtool-2.2.x, but breaks with libtool-1.5.2
-            libtoolize = 'libtoolize --copy --force --automake --ltdl'
-            self.system (package.expand ('rm -rf %(autodir)s/libltdl && (cd %(autodir)s && %(libtoolize)s --install || %(libtoolize)s)',
-                                         locals ()), logger)
-        else:
-            # --install is mandatory for libtool-2.2.x, but breaks with libtool-1.5.2
-            libtoolize = 'libtoolize --copy --force --automake'
-            self.system (package.expand ('cd %(autodir)s && (%(libtoolize)s --install || %(libtoolize)s)',
-                                         locals ()), logger)
-
         if os.path.exists (os.path.join (autodir, 'bootstrap')):
             self.system (package.expand ('cd %(autodir)s && ./bootstrap', locals ()), logger)
         elif os.path.exists (os.path.join (autodir, 'bootstrap.sh')):
@@ -299,11 +288,23 @@
         elif os.path.exists (os.path.join (autodir, 'autogen.sh')):
             s = file (package.expand ('%(autodir)s/autogen.sh', locals ())).read ()
             noconfigure = ' --help'
-            if s.find ('--noconfigure'):
+            if '--noconfigure' in s:
                 noconfigure = ' --noconfigure' + noconfigure
             self.system (package.expand ('cd %(autodir)s && NOCONFIGURE=1 bash autogen.sh %(noconfigure)s',
                                          locals ()), logger)
         else:
+            libtoolize = misc.path_find (os.environ['PATH'], 'libtoolize')
+            if libtoolize:
+                s = file (libtoolize).read ()
+                libtoolize = 'libtoolize --copy --force --automake'
+                # --install is mandatory for libtool-2.2.x, but breaks with libtool-1.5.2x
+                if '--install' in s:
+                    libtoolize += ' --install'
+                if (os.path.isdir (os.path.join (autodir, 'ltdl'))
+                    or os.path.isdir (os.path.join (autodir, 'libltdl'))):
+                    libtoolize += ' --ltdl'
+                self.system (package.expand ('rm -rf %(autodir)s/libltdl %(autodir)s/ltdl && (cd %(autodir)s && %(libtoolize)s',
+                                             locals ()), logger)
             aclocal_opt = ''
             if os.path.exists (package.expand ('%(system_prefix)s/share/aclocal')):
                 aclocal_opt = '-I %(system_prefix)s/share/aclocal'
--- a/gub/cross.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/cross.py	Thu Oct 23 15:48:32 2008 +0200
@@ -1,11 +1,12 @@
+import md5
 import os
-import md5
 import re
-
+#
 from gub import build
-from gub import misc
 from gub import context
 from gub import logging
+from gub import misc
+from gub import toolsbuild
 
 class CrossToolsBuild (build.UnixBuild):
     """Package for cross compilers/linkers etc.
@@ -36,12 +37,14 @@
     packs = package_object_dict.values ()
     cross_packs = [p for p in packs if isinstance (p, CrossToolsBuild)]
     sdk_packs = [p for p in packs if isinstance (p, build.SdkBuild)]
+    tools_packs = [p for p in packs if isinstance (p, toolsbuild.ToolsBuild)]
     other_packs = [p for p in packs if (not isinstance (p, CrossToolsBuild)
                                         and not isinstance (p, build.SdkBuild)
-                                        and not isinstance (p, build.BinaryBuild))]
+                                        and not isinstance (p, build.BinaryBuild)
+                                        and not isinstance (p, toolsbuild.ToolsBuild))]
     
-    sdk_names = [s.name () for s in sdk_packs]
-    cross_names = [s.name () for s in cross_packs]
+    sdk_names = [s.platform_name () for s in sdk_packs]
+    cross_names = [s.platform_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,
@@ -80,7 +83,7 @@
 
 def get_build_dependencies (settings):
     mod = get_cross_module (settings)
-    return mod.get_cross_build_dependencies (settings)
+    return [misc.with_platform (n, settings.platform) for n in mod.get_cross_build_dependencies (settings)]
 
 def setup_linux_x86 (package, env={'PATH': os.environ['PATH']}):
     '''Hack for using 32 bit compiler on linux-64.
--- a/gub/dependency.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/dependency.py	Thu Oct 23 15:48:32 2008 +0200
@@ -8,7 +8,7 @@
 from gub import targetbuild
 from gub import toolsbuild
 
-def get_build_from_file (settings, file_name, name):
+def get_build_from_file (platform, file_name, name):
     gub_name = file_name.replace (os.getcwd () + '/', '')
     logging.info ('reading spec: %(gub_name)s\n' % locals ())
     module = misc.load_module (file_name, name)
@@ -19,12 +19,12 @@
                   .replace ('-', '_')
                   .replace ('++', '_xx_')
                   .replace ('+', '_x_')
-                  + ('-' + settings.platform).replace ('-', '__'))
+                  + ('-' + platform).replace ('-', '__'))
     logging.debug ('LOOKING FOR: %(class_name)s\n' % locals ())
     return misc.most_significant_in_dict (module.__dict__, class_name, '__')
 
-def get_build_class (settings, flavour, name):
-    cls = get_build_from_module (settings, name)
+def get_build_class (platform, flavour, name):
+    cls = get_build_from_module (platform, name)
     if not cls:
         logging.harmless ('making spec:  %(name)s\n' % locals ())
         cls = get_build_without_module (flavour, name)
@@ -33,7 +33,7 @@
 def get_build_from_module (settings, name):
     file = get_build_module (settings, name)
     if file:
-        return get_build_from_file (settings, file, name)
+        return get_build_from_file (settings.platform, file, name)
     return None
 
 def get_build_module (settings, name):
--- a/gub/gup.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/gup.py	Thu Oct 23 15:48:32 2008 +0200
@@ -22,6 +22,7 @@
 from gub import logging
 from gub import loggedos
 from gub import misc
+import gub.settings
 from gub import targetbuild
 
 class GupException (Exception):
@@ -261,7 +262,8 @@
         return self._packages.values ()
 
     def is_installable (self, name):
-        d = self._packages[name]
+        #d = self._packages[name]
+        d = self.package_dict (name)
         ball = '%(split_ball)s' % d
         hdr = '%(split_hdr)s' % d
         return os.path.exists (ball) and os.path.exists (hdr)
@@ -413,15 +415,15 @@
     name = re.sub ('-doc$', '', name)
     return name
 
-def get_source_packages (settings, todo):
+def get_source_packages (settings, const_todo):
     """TODO is a list of (source) builds.
 
     Generate a list of UnixBuild needed to build TODO, in
     topological order
     """
 
-    # don't confuse callers by not modifying argument
-    todo = todo[:]
+    # Do not confuse caller, do not modify caller's todo
+    todo = const_todo[:]
 
     cross_packages = cross.get_cross_packages (settings)
     spec_dict = dict ((p.name (), p) for p in cross_packages)
@@ -432,28 +434,36 @@
     else:
         todo += cross.get_build_dependencies (settings)
 
+    sets = {settings.platform: settings}
+
+    def with_platform (s, platform=settings.platform):
+        return misc.with_platform (s, platform)
+
+    def split_platform (u):
+        return misc.split_platform (u, settings.platform)
+
     def name_to_dependencies_via_gub (url):
-        # ugh ugh ugh
-        
+        platform, url = split_platform (url)
         if ':' in url:
-            base, unused_parameters = misc.dissect_url(url)
-            name = os.path.basename(base)
-            name = re.sub('\..*', '', name)
+            base, unused_parameters = misc.dissect_url (url)
+            name = os.path.basename (base)
+            name = re.sub ('\..*', '', name)
             key = url
         else:
-            # ugh.
-            name = url
+            name = get_base_package_name (url)
             url = None
-            name = get_base_package_name (name)
             key = name
             
-        if spec_dict.has_key (name):
-            spec = spec_dict[name]
+        key = with_platform (key, platform)
+        if spec_dict.has_key (key):
+            spec = spec_dict[key]
         else:
-            spec = dependency.Dependency (settings, name, url).build ()
+            if not sets.has_key (platform):
+                sets[platform] = gub.settings.Settings (platform)
+            spec = dependency.Dependency (sets[platform], name, url).build ()
             spec_dict[key] = spec
             
-        return map (get_base_package_name, spec.get_build_dependencies ())
+        return map (get_base_package_name, spec.get_platform_build_dependencies ())
 
     def name_to_dependencies_via_distro (distro_packages, name):
         if spec_dict.has_key (name):
@@ -464,7 +474,7 @@
             else:
                 spec = distro_packages[name]
             spec_dict[name] = spec
-        return spec.get_build_dependencies ()
+        return spec.get_platform_build_dependencies ()
 
     def name_to_dependencies_via_cygwin (name):
         return name_to_dependencies_via_distro (cygwin.get_packages (), name)
@@ -483,44 +493,31 @@
         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)
+    plain_spec_dict = dict ((n, spec_dict.get (n, with_platform (n))) for n in spec_names)
+#    spec_dict = plain_spec_dict
 
     # Fixup for build from url: spec_dict key is full url,
     # change to base name
     # must use list(dict.keys()), since dict changes during iteration.
-    for name in list (spec_dict.keys ()):
+    for name in (): #list (spec_dict.keys ()):
         spec = spec_dict[name]
-        if name != spec.name ():
+        ps = with_platform (spec.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 ()]
+            return [spec_dict[n] for n in obj.get_platform_build_dependencies ()]
     else:
         def obj_to_dependency_objects (obj):
             return [spec_dict[get_base_package_name (n)]
-                    for n in obj.get_build_dependencies ()]
+                    for n in obj.get_platform_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]
+    sorted_names = [o.platform_name () for o in sorted_specs]
     return (sorted_names, spec_dict)
-
-def get_target_manager (settings):
-    target_manager = DependencyManager (settings.system_root)
-    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/gub/guppackage.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/guppackage.py	Thu Oct 23 15:48:32 2008 +0200
@@ -2,6 +2,7 @@
 import pickle
 
 from gub import commands
+from gub import misc
 
 class GupPackage:
     "How to package part of an install_root."
@@ -15,6 +16,12 @@
         self._dependencies = []
         self._conflicts = []
         
+    def __repr__ (self):
+        cls = self.__class__.__name__
+        name = self.name ()
+        platform = self.platform ()
+        return '<%(cls)s: %(name)s %(platform)s>' % locals ()
+
     def set_dict (self, dict, sub_name):
         self._dict = dict.copy ()
         self._dict['sub_name'] = sub_name
@@ -59,3 +66,9 @@
 
     def name (self):
         return '%(split_name)s' % self._dict
+
+    def platform (self):
+        return self._dict['platform']
+
+    def platform_name (self):
+        return misc.with_platform ('%(split_name)s' % self._dict, self.platform ())
--- a/gub/logging.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/logging.py	Thu Oct 23 15:48:32 2008 +0200
@@ -65,7 +65,7 @@
                 os.makedirs (directory)
             self.log_file = open (self.log_file_name, 'a')
         self.start_marker = ' * Starting build: %s\n' %  now ()
-        self.write_log ('\n\n' + self.start_marker, 'info')
+        self.write_log_file ('\n\n' + self.start_marker)
 
     # ugh: the following should not be in the base class.
     def read_tail (self, size=10240, lines=100):
@@ -104,6 +104,8 @@
             return 0
         message_level = name_to_loglevel_mapping[message_type]
         if message_level <= self.threshold:
+            if '[]' in message:
+                barf
             sys.stderr.write (message)
 
         self.write_log_file (message)
--- a/gub/misc.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/misc.py	Thu Oct 23 15:48:32 2008 +0200
@@ -137,6 +137,13 @@
             file_name = os.readlink (file_name)
     return file_name
 
+def path_find (path, name):
+    for dir in path:
+        file_name = os.path.join (dir, name)
+        if os.path.isfile (file_name):
+            return file_name
+    return None
+
 def _find (dir, test_root_dir_files):
     dir = re.sub ( "/*$", '/', dir)
     result = []
@@ -486,6 +493,21 @@
     for d in dirs:
         shadow (os.path.join (root, d), os.path.join (target, d))
 
+def with_platform (s, platform):
+    if '::' in s:
+        return s
+    return platform + '::' + s
+
+def platform_adder (platform):
+    def f (name):
+        return with_platform (name, platform)
+    return f
+
+def split_platform (u, platform=None):
+    if '::' in u:
+        return u.split ('::')
+    return platform, u
+
 def test ():
     print forall (x for x in [1, 1])
     print dissect_url ('git://anongit.freedesktop.org/git/fontconfig?revision=1234')
--- a/gub/specs/autoconf.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/autoconf.py	Thu Oct 23 15:48:32 2008 +0200
@@ -1,8 +1,6 @@
-from gub import mirrors
 from gub import toolsbuild
 
 class Autoconf (toolsbuild.ToolsBuild):
-    def __init__ (self, settings, source):
-	toolsbuild.ToolsBuild.__init__ (self, settings, source)
-    source = mirrors.with_template (name='autoconf', mirror=mirrors.gnu,
-		   version="2.59", format='bz2')
+    source = 'ftp://ftp.gnu.org/pub/gnu/autoconf/autoconf-2.61.tar.gz'
+    def force_sequential_build (self):
+        return True
--- a/gub/specs/bash.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/bash.py	Thu Oct 23 15:48:32 2008 +0200
@@ -16,7 +16,6 @@
                             format='bz2', strip_components=2)
     def __init__ (self, settings, source):
         Bash.__init__ (self, settings, source)
-        print 'FIXME: serialization: ', __file__, ': strip-components'
         source.strip_components = 2
 
     def patch (self):
--- a/gub/specs/cross/binutils.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/cross/binutils.py	Thu Oct 23 15:48:32 2008 +0200
@@ -4,6 +4,8 @@
 class Binutils (cross.CrossToolsBuild):
     source = mirrors.with_tarball (name='binutils', mirror=mirrors.gnu, version='2.18', format='bz2')
     patches = ['binutils-2.18-makeinfo-version.patch', 'binutils-2.18-werror.patch' ]
+    def get_build_dependencies (self):
+        return ['tools::texinfo']
     def xconfigure_command (self):
         # --werror is broken
         return (cross.CrossToolsBuild.configure_command (self)
--- a/gub/specs/cross/gcc.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/cross/gcc.py	Thu Oct 23 15:48:32 2008 +0200
@@ -106,6 +106,7 @@
     def __init__ (self, settings, source):
         Gcc.__init__ (self, settings, source)
     source = mirrors.with_tarball (name='gcc', mirror=mirrors.gcc, version='4.1.1', format='bz2')
+    ##source = mirrors.with_tarball (name='gcc', mirror=mirrors.gcc, version='4.3.2', format='bz2')
     def get_build_dependencies (self):
         return (Gcc.get_build_dependencies (self)
                 + ['mingw-runtime', 'w32api'])
--- a/gub/specs/dhcp.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/dhcp.py	Thu Oct 23 15:48:32 2008 +0200
@@ -7,7 +7,6 @@
     source = mirrors.with_vc (repository.TarBall (self.settings.downloads, url, strip_components=2))
     def __init__ (self, settings, source):
         targetbuild.TargetBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source.strip_components = 2
     def get_subpackage_names (self):
         return ['']
--- a/gub/specs/fontconfig.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/fontconfig.py	Thu Oct 23 15:48:32 2008 +0200
@@ -25,6 +25,9 @@
         targetbuild.TargetBuild.__init__ (self, settings, source)
         #self.with_vc (repository.Git (self.get_repodir (), source="git://anongit.freedesktop.org/git/fontconfig", revision=fc_version))
 
+    def patch (self):
+        self.dump ('\nAC_SUBST(LT_AGE)', '%(srcdir)s/configure.in', mode='a', permissions=0755)
+        targetbuild.TargetBuild.patch (self)
 
     @context.subst_method
     def freetype_cflags (self):
--- a/gub/specs/freebsd-runtime.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/freebsd-runtime.py	Thu Oct 23 15:48:32 2008 +0200
@@ -5,7 +5,6 @@
     source = mirrors.with_template (name='freebsd-runtime', version='4.10-2', strip_components=0, mirror=mirrors.lilypondorg)
     def __init__ (self, settings, source):
         build.BinaryBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source.strip_components = 0
     def untar (self):
         build.BinaryBuild.untar (self)
--- a/gub/specs/libicu.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/libicu.py	Thu Oct 23 15:48:32 2008 +0200
@@ -10,7 +10,6 @@
     patches = ['libicu-3.8.1-cross.patch']
     def __init__ (self, settings, source):
         targetbuild.TargetBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': version'
         source._version = '3.8.1'
     def stages (self):
         return misc.list_insert_before (targetbuild.TargetBuild.stages (self),
--- a/gub/specs/libtool.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/libtool.py	Thu Oct 23 15:48:32 2008 +0200
@@ -1,18 +1,38 @@
+from gub import build
 from gub import targetbuild
-from gub import build
-from gub import mirrors
 from gub import toolsbuild
 
-
 # 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
 
+'''
+report bug:
+libtool: link: i686-mingw32-gcc -mwindows -mms-bitfields -shared  libltdl/loaders/.libs/libltdl_libltdl_la-preopen.o libltdl/.libs/libltdl_libltdl_la-lt__alloc.o libltdl/.libs/libltdl_libltdl_la-lt_dlloader.o libltdl/.libs/libltdl_libltdl_la-lt_error.o libltdl/.libs/libltdl_libltdl_la-ltdl.o libltdl/.libs/libltdl_libltdl_la-slist.o libltdl/.libs/argz.o libltdl/.libs/lt__strl.o libltdl/.libs/libltdlS.o  libltdl/.libs/libltdl.lax/dlopen.a/dlopen.o  libltdl/.libs/libltdl.lax/loadlibrary.a/loadlibrary.o   -L/home/janneke/vc/gub/target/mingw/root/usr/lib -L/home/janneke/vc/gub/target/mingw/root/usr/bin -L/home/janneke/vc/gub/target/mingw/root/usr/lib/w32api  -mwindows -mms-bitfields   -o libltdl/.libs/libltdl-7.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker libltdl/.libs/libltdl.dll.a
+Creating library file: libltdl/.libs/libltdl.dll.alibltdl/.libs/libltdl.lax/dlopen.a/dlopen.o: In function `vm_sym':
+/home/janneke/vc/gub/target/mingw/src/libtool-2.2.6.a/libltdl/loaders/dlopen.c:227: undefined reference to `_dlsym'
+libltdl/.libs/libltdl.lax/dlopen.a/dlopen.o: In function `vm_close':
+/home/janneke/vc/gub/target/mingw/src/libtool-2.2.6.a/libltdl/loaders/dlopen.c:212: undefined reference to `_dlclose'
+libltdl/.libs/libltdl.lax/dlopen.a/dlopen.o: In function `vm_open':
+/home/janneke/vc/gub/target/mingw/src/libtool-2.2.6.a/libltdl/loaders/dlopen.c:194: undefined reference to `_dlopen'
+collect2: ld returned 1 exit status
+'''
+
 class Libtool (targetbuild.TargetBuild):
+    #source = 'ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.22.tar.gz'
+    source = 'ftp://ftp.gnu.org/pub/gnu/libtool/libtool-1.5.26.tar.gz'
+    #source = 'ftp://ftp.gnu.org/pub/gnu/libtool/libtool-2.2.6a.tar.gz'
     def __init__ (self, settings, source):
         targetbuild.TargetBuild.__init__ (self, settings, source)
-        # KUGH
+        Libtool.set_sover (self)
+    def get_build_dependencies (self):
+        return ['tools::libtool']
+    @staticmethod
+    def set_sover (self):
+        # FIXME: how to automate this?
         self.so_version = '3'
+        if self.source._version in ('2.2.4', '2.2.6.a'):
+            self.so_version = '7'
     def get_subpackage_names (self):
         return ['devel', 'doc', 'runtime', '']
     def get_dependency_dict (self):
@@ -34,9 +54,6 @@
                    '%(install_prefix)s/etc/relocate/libtool.reloc')
 
 class Libtool__cygwin (Libtool):
-    def __init__ (self, settings, source):
-        Libtool.__init__ (self, settings, source)
-    source = mirrors.with_template (name='libtool', version='1.5.22')
     def only_for_cygwin_untar (self):
         cygwin.untar_cygwin_src_package_variant2 (self, self.file_name ())
     # FIXME: we do most of this for all cygwin packages
@@ -48,8 +65,10 @@
         return {'': 'Devel'}
 
 class Libtool__tools (toolsbuild.ToolsBuild):
+    source = Libtool.source
     def __init__ (self, settings, source):
         toolsbuild.ToolsBuild.__init__ (self, settings, source)
+        Libtool.set_sover (self)
     def configure (self):
         build.UnixBuild.configure (self)
     def wrap_executables (self):
--- a/gub/specs/libwsock32.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/libwsock32.py	Thu Oct 23 15:48:32 2008 +0200
@@ -20,7 +20,6 @@
     source = 'http://lilypond.org/download/gub-sources/libwsock32-0.9.25.tar.gz'
     def __init__ (self, settings, source):
         build.BinaryBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': version'
         source._version = '0.9.25'
         source.strip_components = 0
     def untar (self):
--- a/gub/specs/mingw-runtime.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/mingw-runtime.py	Thu Oct 23 15:48:32 2008 +0200
@@ -5,7 +5,6 @@
     source = mirrors.with_template (name='mingw-runtime', version='3.14', strip_components=0, mirror=mirrors.mingw)
     def __init__ (self, settings, source):
         build.BinaryBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source.strip_components = 0
     def install (self):
         self.system ('''
--- a/gub/specs/raptor.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/raptor.py	Thu Oct 23 15:48:32 2008 +0200
@@ -7,7 +7,8 @@
     def get_build_dependencies (self):
         return ['expat-devel', 'libxml2-devel']
     def autoupdate (self):
-        #self.runner._execute (commands.ForcedAutogenMagic (self))
+        self.runner._execute (commands.ForcedAutogenMagic (self))
+        return
 #        self.system ('cd %(srcdir)s && bash ./autogen.sh --help')
         self.system ('''
 #cd %(srcdir)s && libtoolize
--- a/gub/specs/saxon-java.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/saxon-java.py	Thu Oct 23 15:48:32 2008 +0200
@@ -4,7 +4,6 @@
     source = 'http://surfnet.dl.sourceforge.net/sourceforge/saxon/saxonb9-1-0-2j.zip'
     def __init__ (self, settings, source):
         build.BinaryBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source._version = '9.1.0.2j'
     def untar (self):
         build.BinaryBuild.untar (self)
--- a/gub/specs/texinfo.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/texinfo.py	Thu Oct 23 15:48:32 2008 +0200
@@ -1,6 +1,6 @@
 from gub import mirrors
 from gub import toolsbuild
 
-class Texinfo (toolsbuild.ToolsBuild):
+class Texinfo__tools (toolsbuild.ToolsBuild):
     source = mirrors.with_template (name='texinfo', version="4.11",
                                     mirror=mirrors.gnu, format="bz2")
--- a/gub/specs/urw-fonts.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/urw-fonts.py	Thu Oct 23 15:48:32 2008 +0200
@@ -8,7 +8,6 @@
         build.BinaryBuild.__init__ (self, settings, source)
         # FIXME: TODO: find nice way to pass strip_components
         # parameter to TarBall
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source.strip_components = 0
     def compile (self):
         self.system ('cd %(srcdir)s && rm README* COPYING ChangeLog TODO')
--- a/gub/specs/w32api.py	Wed Oct 22 22:26:45 2008 +0200
+++ b/gub/specs/w32api.py	Thu Oct 23 15:48:32 2008 +0200
@@ -5,7 +5,6 @@
     source = mirrors.with_template (name='w32api', version='3.11', strip_components=0, mirror=mirrors.mingw)
     def __init__ (self, settings, source):
         build.BinaryBuild.__init__ (self, settings, source)
-        print 'FIXME: serialization:', __file__, ': strip-components'
         source.strip_components = 0
     def untar (self):
         build.BinaryBuild.untar (self)
--- a/lilypond.make	Wed Oct 22 22:26:45 2008 +0200
+++ b/lilypond.make	Thu Oct 23 15:48:32 2008 +0200
@@ -236,7 +236,6 @@
 # compilers and tools
 
 tools +=\
- automake\
  distcc\
  expat\
  flex\