Example #1
0
 def __init__(self):
     self._build_root = None
     self.build_target = build_target.make_host_build_target(
         level=build_level.RELEASE)
     self.host_build_target = build_target.make_host_build_target(
         level=build_level.RELEASE)
     self.root_dir = None
     self.deps_only = False
     self.disabled = False
     self.keep_going = False
     self.no_checksums = False
     self.no_network = False
     self.recipes_only = False
     self.scratch = False
     self.skip_tests = False
     self.skip_to_step = None
     self.source_dir = None
     self.source_git = None
     self.source_pcloud = None
     self.third_party_prefix = self.DEFAULT_THIRD_PARTY_PREFIX
     self.timestamp = time_util.timestamp()
     self.tmp_dir = None
     self.tools_only = False
     self.users = False
     self.verbose = False
     self.wipe = False
     self._performance = False
     self.timer = debug_timer('perf', 'debug', disabled=True)
     self._performance = False
     self._trash_dir = None
     self.artifacts_dir = None
     self.download_only = False
Example #2
0
 def __init__(self, build_target = None, downloads_manager = None, source_finder = None):
   build_target = build_target or BT.make_host_build_target()
   check.check_build_target(build_target)
   self._build_target = build_target
   if downloads_manager:
     check.check_git_download_cache(downloads_manager)
   self._downloads_manager = downloads_manager
   if source_finder:
     check.check_source_finder_chain(source_finder)
   self._source_finder = source_finder
def main():
  bt = build_target.make_host_build_target()
  mutations = bt.to_dict()
  del mutations['build_path']
  am = FPUT.make_artifact_manager(debug = False, recipes = FPUT.TEST_RECIPES, build_target = bt,
                                  mutations = mutations)
  wanted =  [
    package_descriptor('orange_juice', '1.4.5'),
    package_descriptor('smoothie', '1.0.0'),
   ]
  
  tm = tools_manager('/tmp/new_tools', am)
  tm.ensure_tools(wanted)
  tm.ensure_tools(wanted)
Example #4
0
 def __new__(clazz, read_contents=False, read_checksums=False, bt=None):
     bt = bt or build_target.make_host_build_target(
         level=build_level.RELEASE)
     return clazz.__bases__[0].__new__(clazz, read_contents,
                                       read_checksums, bt)
Example #5
0
    def create_package(self, filename, debug=False):
        tmp_dir = temp_file.make_temp_dir(delete=not debug)
        if debug:
            print('tmp_dir: %s' % (tmp_dir))
        stage_dir = path.join(tmp_dir, 'stage')
        files_dir = path.join(stage_dir, 'files')
        env_files_dir = path.join(stage_dir, 'env')
        file_util.mkdir(files_dir)
        file_util.mkdir(env_files_dir)
        temp_file.write_temp_files(files_dir, self.files)
        temp_file.write_temp_files(env_files_dir, self.env_files)

        tmp_compiler_dir = path.join(tmp_dir, 'objects')

        cc = compiler(build_target.make_host_build_target())

        include_path = []
        lib_path = []

        static_c_libs = self.objects.get('static_c_libs', [])
        for static_c_lib in static_c_libs:
            sources, headers = static_c_lib.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, static_c_lib.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, static_c_lib.filename)
            include_path.append(include_dir)
            lib_path.append(lib_dir)
            cflags = ['-I%s' % (include_dir)]
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            lib_filename = path.join(tmp_compiler_dir, static_c_lib.filename,
                                     path.basename(static_c_lib.filename))
            lib = cc.make_static_lib(lib_filename,
                                     [target.object for target in targets])
            file_util.copy(lib, path.join(files_dir, static_c_lib.filename))
            for header in headers:
                file_util.copy(header.path,
                               path.join(files_dir, header.filename))

        shared_c_libs = self.objects.get('shared_c_libs', [])
        for shared_c_lib in shared_c_libs:
            sources, headers = shared_c_lib.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, shared_c_lib.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, shared_c_lib.filename)
            include_path.append(include_dir)
            lib_path.append(lib_dir)
            cflags = ['-I%s' % (include_dir)]
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            lib_filename = path.join(tmp_compiler_dir, shared_c_lib.filename,
                                     path.basename(shared_c_lib.filename))
            lib = cc.make_shared_lib(lib_filename,
                                     [target.object for target in targets])
            file_util.copy(lib, path.join(files_dir, shared_c_lib.filename))
            for header in headers:
                file_util.copy(header.path,
                               path.join(files_dir, header.filename))

        c_programs = self.objects.get('c_programs', [])
        for c_program in c_programs:
            sources, headers = c_program.write_files(tmp_compiler_dir)
            include_dir = path.join(tmp_compiler_dir, c_program.filename,
                                    'include')
            lib_dir = path.join(tmp_compiler_dir, c_program.filename)
            cflags = ['-I%s' % (include_dir)]
            cflags += ['-I%s' % (inc) for inc in include_path]
            ldflags = ['-L%s' % (lib_dir)]
            ldflags += ['-L%s' % (lib) for lib in lib_path]
            ldflags += c_program.ldflags or []
            targets = cc.compile_c([source.path for source in sources],
                                   cflags=cflags)
            exe_filename = path.join(tmp_compiler_dir, c_program.filename,
                                     path.basename(c_program.filename))
            exe = cc.link_exe(exe_filename,
                              [target.object for target in targets],
                              ldflags=ldflags)
            file_util.copy(exe, path.join(files_dir, c_program.filename))

        pkg_desc = package_descriptor(self.metadata.name,
                                      self.metadata.build_version,
                                      properties=self.properties,
                                      requirements=self.requirements)
        return package.create_package(filename, pkg_desc,
                                      self.metadata.build_target, stage_dir)