def dist_headers(conf, clean=True):
    util.cd(config.PATH_ROOT)

    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    dist_path = util.getpath(config.DIR_DIST)

    name = _generate_name(conf)

    include_path = os.path.join(dist_path, 'include', 'webrtc')

    if clean:
        shutil.rmtree(include_path, ignore_errors=True)

    os.makedirs(include_path, exist_ok=True)

    for directory in config.API_HEADERS:
        for file_path in glob.iglob(os.path.join(webrtc_src_path, directory,
                                                 '**', '*.h'),
                                    recursive=True):
            _copy_tree(webrtc_src_path, file_path, include_path)

    for directory in config.LEGACY_HEADERS:
        for file_path in glob.iglob(os.path.join(webrtc_src_path, directory,
                                                 '*.h'),
                                    recursive=False):
            _copy_tree(webrtc_src_path, file_path, include_path)

    if not conf['boringssl']:
        for directory in config.SSL_HEADERS:
            for file_path in glob.iglob(os.path.join(webrtc_src_path,
                                                     directory, '**', '*.h'),
                                        recursive=True):
                _copy_tree(webrtc_src_path, file_path, include_path)
def retrieve_commit(conf):
    util.cd(util.getpath(config.PATH_WEBRTC, 'src'))
    conf['webrtc_commit'] = util.exec_stdout(
        'git', 'log', '--format="%H"', '-n',
        '1').decode("utf-8").strip().strip("\"")

    if conf['boringssl']:
        util.cd(util.getpath(config.PATH_BORINGSSL))
        conf['boringssl_commit'] = util.exec_stdout(
            'git', 'log', '--format="%H"', '-n',
            '1').decode("utf-8").strip().strip("\"")

    return conf
Exemple #3
0
def setup(conf):
    util.cd(config.DIR_BUILD)
    if os.path.exists(util.getpath(config.PATH_DEPOT_TOOLS)):
        util.cd(config.PATH_DEPOT_TOOLS)
        util.exec('git', 'checkout', '-f', 'master')
        util.exec('git', 'pull')
    else:
        util.exec(
            'git', 'clone',
            'https://chromium.googlesource.com/chromium/tools/depot_tools.git',
            util.getpath(config.PATH_DEPOT_TOOLS))

    os.environ['PATH'] = util.getpath(
        config.PATH_DEPOT_TOOLS) + os.path.pathsep + os.environ['PATH']

    if sys.platform == 'win32':
        os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'

    if conf['boringssl']:
        if os.path.exists(util.getpath(config.PATH_BORINGSSL)):
            util.cd(config.PATH_BORINGSSL)
            util.exec('git', 'reset', '--hard')
            util.exec('git', 'fetch', '--all')
        else:
            util.exec('git', 'clone',
                      'https://boringssl.googlesource.com/boringssl.git',
                      util.getpath(config.PATH_BORINGSSL))

        util.cd(config.PATH_BORINGSSL)
        util.exec('git', 'checkout', '-f', conf['boringssl'])

        if os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src',
                                       'include')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src',
                                                  'include')
        elif os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src')
        else:
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL)

    if conf['platform'] in config.libcxx_url.keys():
        util.cd(config.PATH_LIBCXX)
        url = config.libcxx_url[conf['platform']]
        if not os.path.exists(os.path.abspath(url.split('/')[-1])):
            util.exec('wget', url)
        util.exec('tar', 'xvaf',
                  url.split('/')[-1], '--strip-components=1', '--wildcards',
                  '*/include/c++', '*/libc++*')
Exemple #4
0
def patch(conf):
    patches_path = util.getpath(config.DIR_PATCH)

    if conf['platform'] in config.patches.keys():
        for patch in config.patches[conf['platform']]:
            util.cd(patch[0])
            util.exec('git', 'apply', os.path.join(patches_path, patch[1]))
Exemple #5
0
def pull(conf):
    webrtc_path = util.getpath(config.PATH_WEBRTC)

    util.cd(webrtc_path)
    if not util.exists(webrtc_path, '.gclient'):
        os.rmdir(util.getpath(config.PATH_WEBRTC, 'src'))
        util.exec('fetch', '--nohooks', 'webrtc')

    util.cd(webrtc_path, 'src')

    util.exec('git', 'reset', '--hard')
    util.exec('git', 'fetch', 'origin')
    util.exec('git', 'checkout', "{}{}".format(config.WEBRTC_BRANCH_PREFIX,
                                               conf["branch"]))

    util.exec('gclient', 'sync', '-RD')
def archive(conf):
    util.cd(config.PATH_ROOT)

    dist_path = util.getpath(config.DIR_DIST)
    name = _generate_name(conf)

    format = 'zip'
    shutil.make_archive(name, format, dist_path)
def setup(conf):
    util.cd(config.DIR_BUILD)
    if os.path.exists(util.getpath(config.PATH_DEPOT_TOOLS)):
        util.cd(config.PATH_DEPOT_TOOLS)
        util.exec('git', 'checkout', '-f', 'master')
        util.exec('git', 'pull')
    else:
        util.exec(
            'git', 'clone',
            'https://chromium.googlesource.com/chromium/tools/depot_tools.git',
            util.getpath(config.PATH_DEPOT_TOOLS))

    os.environ['PATH'] = util.getpath(
        config.PATH_DEPOT_TOOLS) + os.path.pathsep + os.environ['PATH']

    if sys.platform == 'win32':
        os.environ['DEPOT_TOOLS_WIN_TOOLCHAIN'] = '0'

    if conf['boringssl']:
        if os.path.exists(util.getpath(config.PATH_BORINGSSL)):
            util.cd(config.PATH_BORINGSSL)
            util.exec('git', 'reset', '--hard')
            util.exec('git', 'fetch', '--all')
        else:
            util.exec('git', 'clone',
                      'https://boringssl.googlesource.com/boringssl.git',
                      util.getpath(config.PATH_BORINGSSL))

        util.cd(config.PATH_BORINGSSL)
        util.exec('git', 'checkout', '-f', conf['boringssl'])

        if os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src',
                                       'include')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src',
                                                  'include')
        elif os.path.exists(util.getpath(config.PATH_BORINGSSL, 'src')):
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL, 'src')
        else:
            conf['boringssl_path'] = util.getpath(config.PATH_BORINGSSL)
def dist_lib(conf, mode, clean=True):
    util.cd(config.PATH_ROOT)

    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    dist_path = util.getpath(config.DIR_DIST)

    name = _generate_name(conf)
    out_path = _generate_out(conf, mode)

    lib_path = os.path.join(dist_path, 'lib', mode.lower().capitalize())

    if clean:
        shutil.rmtree(lib_path, ignore_errors=True)

    os.makedirs(lib_path, exist_ok=True)

    for file_path in glob.iglob(
            os.path.join(webrtc_src_path, out_path, 'obj', '*.lib')):
        shutil.copy(file_path, lib_path)

    for file_path in glob.iglob(
            os.path.join(webrtc_src_path, out_path, 'obj', '*.a')):
        shutil.copy(file_path, lib_path)
def build(conf, mode):
    webrtc_src_path = util.getpath(config.PATH_WEBRTC, 'src')
    util.cd(webrtc_src_path)

    if sys.platform == 'linux':
        util.exec('bash', 'build/install-build-deps.sh', '--no-prompt')

    if conf['os'] == 'linux':
        util.exec('python', 'build/linux/sysroot_scripts/install-sysroot.py',
                  '--arch={}'.format(conf['cpu']))

    args = _generate_args(conf, mode)
    out_path = _generate_out(conf, mode)

    args_file = os.path.join(webrtc_src_path, out_path, 'args.gn')

    os.makedirs(util.getpath(webrtc_src_path, out_path), exist_ok=True)

    with open(args_file, 'w') as file:
        file.write('\n'.join(args))

    util.exec('gn', 'gen', out_path)

    util.exec('ninja', '-C', out_path)