Exemple #1
0
    def __init__(self, platform, arch_name, dir_path, prefix_path):
        platform_or_none = system_info.get_supported_platform_by_name(platform)

        if not platform_or_none:
            raise utils.BuildError('invalid platform')

        build_arch = platform_or_none.architecture_by_arch_name(arch_name)
        if not build_arch:
            raise utils.BuildError('invalid arch')

        if not prefix_path:
            prefix_path = build_arch.default_install_prefix_path()

        packages_types = platform_or_none.package_types()
        build_platform = platform_or_none.make_platform_by_arch(
            build_arch, packages_types)

        self.platform_ = build_platform
        build_dir_path = os.path.abspath(dir_path)
        if os.path.exists(build_dir_path):
            shutil.rmtree(build_dir_path)

        os.mkdir(build_dir_path)
        os.chdir(build_dir_path)

        self.build_dir_path_ = build_dir_path
        self.prefix_path_ = prefix_path
        print("Build request platform: {0}({1}) created".format(
            build_platform.name(), build_arch.name()))
Exemple #2
0
    def __init__(self, platform, arch_name):
        platform_or_none = system_info.get_supported_platform_by_name(platform)

        if not platform_or_none:
            raise utils.BuildError('invalid platform')

        arch = platform_or_none.architecture_by_arch_name(arch_name)
        if not arch:
            raise utils.BuildError('invalid arch')

        self.platform_ = platform_or_none.make_platform_by_arch(
            arch, platform_or_none.package_types())
        print("Build request for platform: {0}, arch: {1} created".format(
            platform, arch.name()))
Exemple #3
0
    def build_common(self):
        pwd = os.getcwd()
        cmake_project_root_abs_path = '..'
        if not os.path.exists(cmake_project_root_abs_path):
            raise utils.BuildError('invalid cmake_project_root_path: %s' %
                                   cmake_project_root_abs_path)

        # project static options
        prefix_args = '-DCMAKE_INSTALL_PREFIX={0}'.format(self.prefix_path_)

        cmake_line = [
            'cmake', cmake_project_root_abs_path, '-GUnix Makefiles',
            '-DCMAKE_BUILD_TYPE=RELEASE', prefix_args
        ]
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/common.git', pwd)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            common_cmake_line.append('-DQT_ENABLED=OFF')
            common_cmake_line.append('-DJSON_ENABLED=ON')
            common_cmake_line.append('-DBUILD_WITH_FPIC=ON')
            subprocess.call(common_cmake_line)
            subprocess.call(['make', 'install'])
            os.chdir(self.build_dir_path_)
            # shutil.rmtree(cloned_dir)
        except Exception as ex:
            os.chdir(self.build_dir_path_)
            raise ex
Exemple #4
0
    def build(self, bs):
        cmake_project_root_abs_path = '..'
        if not os.path.exists(cmake_project_root_abs_path):
            raise utils.BuildError('invalid cmake_project_root_path: %s' %
                                   cmake_project_root_abs_path)

        if not bs:
            bs = system_info.SUPPORTED_BUILD_SYSTEMS[0]

        prefix_path = self.platform_.arch().default_install_prefix_path()

        generator = bs.cmake_generator_arg()
        build_system_args = bs.cmd_line()
        # bs_name = bs.name()

        # project static options
        prefix_args = '-DCMAKE_INSTALL_PREFIX={0}'.format(prefix_path)
        cmake_line = [
            'cmake', cmake_project_root_abs_path, generator,
            '-DCMAKE_BUILD_TYPE=RELEASE', prefix_args
        ]

        make_install = build_system_args
        make_install.append('install')

        # abs_dir_path = self.build_dir_path_

        self.build_snappy(cmake_line, make_install)
        #        self.build_openssl(prefix_path)
        self.build_jsonc(prefix_path)
        self.build_libev(prefix_path)
        self.build_common(cmake_line, make_install)
Exemple #5
0
    def build_snappy(self):
        pwd = os.getcwd()
        cmake_project_root_abs_path = '..'
        if not os.path.exists(cmake_project_root_abs_path):
            raise utils.BuildError('invalid cmake_project_root_path: %s' % cmake_project_root_abs_path)

        # project static options
        prefix_args = '-DCMAKE_INSTALL_PREFIX={0}'.format(self.prefix_path_)

        cmake_line = ['cmake', cmake_project_root_abs_path, '-GNinja', '-DCMAKE_BUILD_TYPE=RELEASE',
                      '-DBUILD_SHARED_LIBS=OFF', '-DSNAPPY_BUILD_TESTS=OFF',
                      prefix_args]
        try:
            cloned_dir = utils.git_clone('https://github.com/fastogt/snappy.git', pwd)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            snappy_cmake_line = list(cmake_line)
            subprocess.call(snappy_cmake_line)
            subprocess.call(['ninja', 'install'])
            os.chdir(self.build_dir_path_)
            # shutil.rmtree(cloned_dir)
        except Exception as ex:
            os.chdir(self.build_dir_path_)
            raise ex
Exemple #6
0
    def __init__(self, platform, arch_bit, dir_path):
        platform_or_none = system_info.get_supported_platform_by_name(platform)

        if not platform_or_none:
            raise utils.BuildError('invalid platform')

        arch = platform_or_none.architecture_by_arch_name(arch_bit)
        if not arch:
            raise utils.BuildError('invalid arch')

        build_dir_path = os.path.abspath(dir_path)
        if os.path.exists(build_dir_path):
            shutil.rmtree(build_dir_path)

        os.mkdir(build_dir_path)
        os.chdir(build_dir_path)

        self.build_dir_path_ = build_dir_path

        self.platform_ = platform_or_none.make_platform_by_arch(
            arch, platform_or_none.package_types())
        print("Build request for platform: {0}, arch: {1} created".format(
            platform, arch.name()))
Exemple #7
0
    def build(self, bs):
        cmake_project_root_abs_path = '..'
        if not os.path.exists(cmake_project_root_abs_path):
            raise utils.BuildError('invalid cmake_project_root_path: %s' %
                                   cmake_project_root_abs_path)

        if not bs:
            bs = system_info.SUPPORTED_BUILD_SYSTEMS[0]

        prefix_path = self.platform_.arch().default_install_prefix_path()

        generator = bs.cmake_generator_arg()
        build_system_args = bs.cmd_line()
        # bs_name = bs.name()

        # project static options
        prefix_args = '-DCMAKE_INSTALL_PREFIX={0}'.format(prefix_path)
        cmake_line = [
            'cmake', cmake_project_root_abs_path, generator,
            '-DCMAKE_BUILD_TYPE=RELEASE', prefix_args
        ]

        make_install = build_system_args
        make_install.append('install')

        # abs_dir_path = self.build_dir_path_

        self.build_snappy(cmake_line, make_install)
        self.build_openssl(prefix_path)  #
        self.build_libssh2(cmake_line, prefix_path, make_install)
        self.build_jsonc(prefix_path)
        self.build_qscintilla(cmake_line, make_install)
        self.build_common(cmake_line, make_install)

        # databases libs builds
        self.build_hiredis(prefix_path)
        self.build_libmemcached(prefix_path)  #
        self.build_unqlite(cmake_line, make_install)
        self.build_lmdb(prefix_path)
        self.build_leveldb(cmake_line, make_install)
        self.build_rocksdb(cmake_line, make_install)
        self.build_upscaledb(prefix_path)  #
        self.build_forestdb(cmake_line, make_install)  #
        self.build_fastonosql_core(cmake_line, make_install)
Exemple #8
0
    def build(self, cmake_project_root_path, app_branding_options, dir_path,
              bs, package_types, saver):
        cmake_project_root_abs_path = os.path.abspath(cmake_project_root_path)
        if not os.path.exists(cmake_project_root_abs_path):
            raise utils.BuildError('invalid cmake_project_root_path: %s' %
                                   cmake_project_root_path)

        if not bs:
            bs = SUPPORTED_BUILD_SYSTEMS[0]

        if not package_types:
            package_types = self.platform_.package_types()

        abs_dir_path = os.path.abspath(dir_path)
        if os.path.exists(abs_dir_path):
            shutil.rmtree(abs_dir_path)

        is_android = self.platform_.name() == 'android'

        generator = bs.cmake_generator_arg()
        build_system_args = bs.cmd_line()
        build_system_policy = bs.policy()

        saver.update_progress_message_range(
            0.0, 9.0, "Start building project branding_options:\n{0}".format(
                "\n".join(app_branding_options)))

        pwd = os.getcwd()
        os.mkdir(abs_dir_path)
        os.chdir(abs_dir_path)

        # project static options
        log_to_file_args = '-DLOG_TO_FILE=ON'
        if is_android:
            openssl_args = ['-DOPENSSL_USE_STATIC_LIBS=OFF']
            zlib_args = '-DZLIB_USE_STATIC=OFF'
            bzip2_args = '-DBZIP2_USE_STATIC=OFF'
        else:
            prefix_path = self.platform_.arch().default_install_prefix_path()
            openssl_args = [
                '-DOPENSSL_USE_STATIC_LIBS=ON',
                '-DOPENSSL_ROOT_DIR={0}'.format(prefix_path)
            ]
            zlib_args = '-DZLIB_USE_STATIC=ON'
            bzip2_args = '-DBZIP2_USE_STATIC=ON'
        snappy_args = '-DSNAPPY_USE_STATIC=ON'
        jsonc_args = '-DJSONC_USE_STATIC=ON'

        cmake_line = [
            'cmake', cmake_project_root_abs_path, generator,
            '-DCMAKE_BUILD_TYPE=RELEASE', log_to_file_args, zlib_args,
            bzip2_args, snappy_args, jsonc_args
        ]
        cmake_line.extend(openssl_args)

        if is_android:
            toolchain_path = os.path.join(cmake_project_root_abs_path,
                                          'cmake/android.toolchain.cmake')
            cmake_line.append(
                '-DCMAKE_TOOLCHAIN_FILE={0}'.format(toolchain_path))

        if app_branding_options:
            cmake_line.extend(app_branding_options)

        saver.update_progress_message_range(10.0, 19.0,
                                            'Generate project build')

        def store(cb):
            def closure(progress, message):
                return cb(progress, message)

            return closure

        store = store(saver.on_update_progress_message)

        try:
            cmake_policy = run_command.CmakePolicy(store)
            run_command.run_command_cb(cmake_line, cmake_policy)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        make_install = build_system_args
        make_install.append('install')
        saver.update_progress_message_range(20.0, 79.0, 'Build project')
        try:
            policy = build_system_policy(store)
            run_command.run_command_cb(make_install, policy)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        saver.update_progress_message_range(80.0, 84.0,
                                            'Trying to get package file name')
        in_file = open('CPackConfig.cmake', 'r')
        for line in in_file.readlines():
            res = re.search(r'SET\(CPACK_PACKAGE_FILE_NAME "(.+)"\)', line)
            if res:
                filename = res.group(1)
                break
        in_file.close()

        saver.update_progress_message_range(85.0, 99.0, 'Start build package')
        file_names = []
        if is_android:
            make_apk_release = build_system_args
            make_apk_release.append('apk_release')
            try:
                common_policy = run_command.CommonPolicy(store)
                run_command.run_command_cb(make_apk_release, common_policy)
            except Exception as ex:
                os.chdir(pwd)
                raise ex

            make_apk_aligned = build_system_args
            make_apk_aligned.append('apk_aligned')
            try:
                common_policy = run_command.CommonPolicy(store)
                run_command.run_command_cb(make_apk_aligned, common_policy)
            except Exception as ex:
                os.chdir(pwd)
                raise ex

            make_apk_signed = build_system_args
            make_apk_signed('apk_signed')
            try:
                common_policy = run_command.CommonPolicy(store)
                run_command.run_command_cb(make_apk_signed, common_policy)
            except Exception as ex:
                os.chdir(pwd)
                raise ex

            file_names.append(
                os.path.join(
                    abs_dir_path, filename + '.' +
                    system_info.get_extension_by_package('APK')))
        else:
            for generator in package_types:
                make_cpack = ['cpack', '-G', generator]
                try:
                    common_policy = run_command.CommonPolicy(store)
                    run_command.run_command_cb(make_cpack, common_policy)
                    file_names.append(
                        os.path.join(
                            abs_dir_path, filename + '.' +
                            system_info.get_extension_by_package(generator)))
                except Exception as ex:
                    os.chdir(pwd)
                    raise ex

        os.chdir(pwd)

        saver.update_progress_message_range(
            100.0, 100.0,
            "Building finished successfully file_names: {0}".format(
                file_names))
        return file_names
Exemple #9
0
    ffmpeg_grp.add_argument('--without-ffmpeg', help='build without ffmpeg', dest='with_ffmpeg', action='store_false',
                            default=False)

    parser.add_argument('--platform', help='build for platform (default: {0})'.format(host_os), default=host_os)
    parser.add_argument('--architecture', help='architecture (default: {0})'.format(arch_host_os),
                        default=arch_host_os)
    parser.add_argument('--prefix_path', help='prefix_path (default: None)', default=None)

    argv = parser.parse_args()

    arg_platform = argv.platform
    arg_prefix_path = argv.prefix_path
    arg_architecture = argv.architecture
    sup_device = get_supported_device_by_name(argv.device)
    if not sup_device:
        raise utils.BuildError('invalid device')

    request = BuildRequest(sup_device, arg_platform, arg_architecture, 'build_' + arg_platform + '_env',
                           arg_prefix_path)
    if argv.with_system:
        request.install_system()

    if argv.with_device:
        request.install_device_specific()

    if argv.with_snappy:
        request.build_snappy()
    if argv.with_libev:
        request.build_libev()
    if argv.with_jsonc:
        request.build_jsonc()