Beispiel #1
0
 def add_build_tasks_for_first_host(cfg, host, component, host_group):
     host_b = host.build_cfg
     srcdir = component.vars.srcdir.get()
     objdir = cfg.objdir_path(host_b, 'linux')
     instdir = cfg.install_tree_path(host_b, _INST_NAME)
     task = BuildTask(cfg, host_group, 'linux-headers')
     task.provide_install(host_b, _INST_NAME)
     task.add_empty_dir(objdir)
     task.add_empty_dir(instdir)
     linux_arch = None
     target = cfg.target.get()
     for gnu_arch in _LINUX_ARCH_MAP:
         if target.startswith(gnu_arch):
             linux_arch = _LINUX_ARCH_MAP[gnu_arch]
             break
     if linux_arch is None:
         cfg.context.error('unknown Linux kernel architecture for %s' %
                           target)
     task.add_make([
         '-C', srcdir,
         'O=%s' % objdir,
         'ARCH=%s' % linux_arch,
         'INSTALL_HDR_PATH=%s' % instdir, 'headers_install'
     ], objdir)
     _contribute_headers_tree(cfg, host, host_group, True)
 def add_build_tasks_for_first_host_multilib(cfg, host, component,
                                             host_group, multilib):
     if multilib.libc is not component:
         return
     host_b = host.build_cfg
     inst_1 = cfg.install_tree_path(host_b, 'toolchain-1')
     bindir_1 = os.path.join(inst_1, cfg.bindir_rel.get())
     target_build = multilib.build_cfg
     srcdir = component.vars.srcdir.get()
     objdir = cfg.objdir_path(target_build, 'glibc')
     instdir = cfg.install_tree_path(target_build, 'glibc')
     group = BuildTask(cfg, host_group, 'glibc-%s' % target_build.name)
     group.depend_install(host_b, 'toolchain-1')
     group.env_prepend('PATH', bindir_1)
     group.provide_install(target_build, 'glibc')
     init_task = BuildTask(cfg, group, 'init')
     init_task.add_empty_dir(objdir)
     init_task.add_empty_dir(instdir)
     cfg_task = BuildTask(cfg, group, 'configure')
     cfg_cmd = [
         os.path.join(srcdir, 'configure'),
         '--build=%s' % host_b.triplet,
         '--host=%s' % target_build.triplet, '--prefix=/usr'
     ]
     cfg_cmd.extend(component.vars.configure_opts.get())
     cfg_cmd.extend(target_build.configure_vars())
     cfg_cmd.append('BUILD_CC=%s' % ' '.join(host_b.tool('c-compiler')))
     cfg_task.add_command(cfg_cmd, cwd=objdir)
     build_task = BuildTask(cfg, group, 'build')
     build_task.add_make([], objdir)
     install_task = BuildTask(cfg, group, 'install')
     install_task.add_make(
         ['-j1', 'install', 'install_root=%s' % instdir], objdir)
     _contribute_sysroot_tree(cfg, host, host_group, True, multilib)
Beispiel #3
0
 def add_build_tasks_for_first_host(cfg, host, component, host_group):
     task = BuildTask(cfg, host_group, 'first-host')
     host_b = host.build_cfg
     objdir = cfg.objdir_path(host_b, '%s-first' % component.copy_name)
     objdir2 = cfg.objdir_path(host_b, '%s-first2' % component.copy_name)
     task.add_empty_dir(objdir)
     # Test add_empty_dir_parent with and without the directory
     # existing.
     task.add_empty_dir_parent(os.path.join(objdir, 'x', 'y', 'z'))
     os.makedirs(os.path.join(objdir2, 'x', 'y', 'z'))
     task.add_empty_dir_parent(os.path.join(objdir2, 'x', 'y', 'z'))
     task.add_command(['sh', '-c',
                       'echo "all:; echo first-host \\$(X) > out" > '
                       '%s/GNUmakefile' % objdir])
     task.add_make(['all', 'X=Y'], objdir)
 def add_build_tasks_for_first_host(cfg, host, component, host_group):
     _contribute_headers_tree(cfg, host, component, host_group, True)
     _contribute_shared_tree(cfg, host, component, host_group, True)
     # Build glibc for the build system, and use its localedef to
     # build locales.  The normal glibc configure options are not
     # used for this (they may only be appropriate for the target),
     # so the common support for autoconf-based components isn't
     # used either.
     host_b = host.build_cfg
     srcdir = component.vars.srcdir.get()
     objdir = cfg.objdir_path(host_b, 'glibc-host')
     group = BuildTask(cfg, host_group, 'glibc-host')
     init_task = BuildTask(cfg, group, 'init')
     init_task.add_empty_dir(objdir)
     cfg_task = BuildTask(cfg, group, 'configure')
     cfg_cmd = [
         os.path.join(srcdir, 'configure'),
         '--build=%s' % host_b.triplet,
         '--host=%s' % host_b.triplet, '--prefix=/usr'
     ]
     cfg_cmd.extend(host_b.configure_vars())
     cfg_cmd.append('BUILD_CC=%s' % ' '.join(host_b.tool('c-compiler')))
     cfg_task.add_command(cfg_cmd, cwd=objdir)
     build_task = BuildTask(cfg, group, 'build')
     build_task.add_make([], objdir)
     group = BuildTask(cfg, host_group, 'glibc-locales')
     group.depend('/%s/glibc-host' % host.name)
     # Building the host glibc itself does not depend on the target
     # compiler.  Building the locales does depend on the target
     # compiler (but not on the target libc), as it is used to
     # determine the endianness of each locale.
     group.depend_install(host_b, 'toolchain-1')
     group.provide_install(host_b, 'glibc-locales')
     objdir2 = cfg.objdir_path(host_b, 'glibc-locales')
     instdir = cfg.install_tree_path(host_b, 'glibc-locales')
     init_task = BuildTask(cfg, group, 'init')
     init_task.add_empty_dir(objdir2)
     init_task.add_empty_dir(instdir)
     build_task = BuildTask(cfg, group, 'build')
     build_task.add_python(
         _generate_locales_makefile,
         (cfg, component, srcdir, objdir, objdir2, instdir))
     build_task.add_make([], objdir2)
def add_host_cfg_build_tasks(relcfg, host, component, parent, name, srcdir,
                             prefix, pkg_cfg_opts, target, make_target,
                             install_target, parallel):
    """Add and return a group of tasks using configure / make / make install.

    The parent task passed is the main task group for the host, or any
    other group within which this group is to be contained.  The host
    passed is a BuildCfg object.  The component passed is the
    ComponentInConfig object.  The name passed is a name to use for
    build directories and install trees as well as for task names; if
    None, the name of the component (copy) is used (this is
    appropriate unless a component is built multiple times for one
    host, e.g. multiple GCC builds for bootstrapping a cross
    compiler).  If srcdir is None, the source directory of that
    component is used (this is appropriate unless configuring a
    subdirectory, e.g. for gdbserver).  If prefix is None, the path to
    the install tree is used as the configured prefix (this is only
    appropriate for host libraries not referring to files in their
    configured prefix at runtime).  A --target configure option is
    passed unless target is None.  Any configure options from the
    configure_opts variable and component hook are added
    automatically.  If make_target is not None, it is the target
    passed to make for the main build step; install_target likewise
    specifies the target for the install step.

    If additional steps are required after installation, the caller
    should add a postinstall task or tasks to the group returned.

    """
    build = relcfg.build.get().build_cfg
    if name is None:
        name = component.copy_name
    if srcdir is None:
        srcdir = component.vars.srcdir.get()
    objdir = relcfg.objdir_path(host, name)
    instdir = relcfg.install_tree_path(host, name)
    if prefix is None:
        cfg_prefix = instdir
        destdir = None
    else:
        cfg_prefix = prefix
        destdir = instdir
    task_group = BuildTask(relcfg, parent, name)
    task_group.provide_install(host, name)
    init_task = BuildTask(relcfg, task_group, 'init')
    init_task.add_empty_dir(objdir)
    init_task.add_empty_dir(instdir)
    cfg_task = BuildTask(relcfg, task_group, 'configure')
    cfg_cmd = [os.path.join(srcdir, 'configure'),
               '--build=%s' % build.triplet,
               '--host=%s' % host.triplet,
               '--prefix=%s' % cfg_prefix]
    if target is not None:
        cfg_cmd.append('--target=%s' % target)
    cfg_cmd.extend(pkg_cfg_opts)
    cfg_cmd.extend(component.vars.configure_opts.get())
    cfg_cmd.extend(component.cls.configure_opts(relcfg, host))
    cfg_cmd.extend(host.configure_vars())
    cfg_cmd.extend(['CC_FOR_BUILD=%s'
                    % ' '.join(build.tool('c-compiler')),
                    'CXX_FOR_BUILD=%s'
                    % ' '.join(build.tool('c++-compiler'))])
    cfg_task.add_command(cfg_cmd, cwd=objdir)
    build_task = BuildTask(relcfg, task_group, 'build')
    if parallel:
        build_cmd = []
    else:
        build_cmd = ['-j1']
    if make_target is not None:
        build_cmd.append(make_target)
    build_task.add_make(build_cmd, objdir)
    install_task = BuildTask(relcfg, task_group, 'install')
    install_cmd = ['-j1', install_target]
    if destdir is not None:
        install_cmd.append('DESTDIR=%s' % destdir)
    install_task.add_make(install_cmd, objdir)
    return task_group