Esempio n. 1
0
    def build_libssh2(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/libssh2.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            libssh2_cmake_line = list(cmake_line)
            libssh2_cmake_line.append('-DBUILD_SHARED_LIBS=OFF')
            libssh2_cmake_line.append('-DCRYPTO_BACKEND=OpenSSL')
            libssh2_cmake_line.append('-DENABLE_ZLIB_COMPRESSION=ON')
            libssh2_cmake_line.append('-DZLIB_USE_STATIC=ON')
            libssh2_cmake_line.append('-DOPENSSL_USE_STATIC=ON')
            libssh2_cmake_line.append('-DBUILD_EXAMPLES=OFF')
            libssh2_cmake_line.append('-DBUILD_TESTING=OFF')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(libssh2_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 2
0
    def build_rocksdb(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/rocksdb.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            common_cmake_line.append('-DFAIL_ON_WARNINGS=OFF')
            common_cmake_line.append('-DPORTABLE=ON')
            common_cmake_line.append('-DWITH_TESTS=OFF')
            common_cmake_line.append('-DWITH_SNAPPY=ON')
            common_cmake_line.append('-DWITH_ZLIB=ON')
            common_cmake_line.append('-DWITH_LZ4=ON')
            common_cmake_line.append('-DROCKSDB_INSTALL_ON_WINDOWS=ON')
            common_cmake_line.append('-DWITH_TOOLS=OFF')
            common_cmake_line.append('-DWITH_GFLAGS=OFF')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 3
0
    def build_lmdb(self, prefix_path):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone('https://github.com/fastogt/lmdb.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.chdir('libraries/liblmdb')
            make_lmdb = ['make', 'install_static_lib', 'prefix={0}'.format(prefix_path)]  # FIXME
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_lmdb, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 4
0
    def build_unqlite(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone('https://github.com/fastogt/unqlite.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 5
0
    def build_forestdb(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone('https://github.com/fastogt/forestdb.git', abs_dir_path, None, False)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            forestdb_cmake_line = list(cmake_line)
            forestdb_cmake_line.append('-DBUILD_SHARED_LIBS=OFF')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(forestdb_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 6
0
    def build_qscintilla(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone('https://github.com/fastogt/qscintilla.git', abs_dir_path)
            qsci_src_path = os.path.join(cloned_dir, 'Qt4Qt5')
            os.chdir(qsci_src_path)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            qscintilla_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(qscintilla_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 7
0
    def build_common(self, cmake_line, make_install):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/common.git', abs_dir_path)
            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=ON')
            common_cmake_line.append('-DSNAPPY_USE_STATIC=ON')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 8
0
    def build_upscaledb(self, prefix_path):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/upscaledb.git', abs_dir_path)
            os.chdir(cloned_dir)
            bootstrap_policy = run_command.CommonPolicy(print_message)
            bootstrap_upscaledb = ['sh', 'bootstrap.sh']
            run_command.run_command_cb(bootstrap_upscaledb, bootstrap_policy)

            configure_upscaledb = [
                './configure', '--prefix={0}'.format(prefix_path),
                '--disable-remote', '--enable-static-boost',
                '--disable-shared', '--disable-java', '--disable-simd',
                '--disable-encryption'
            ]
            configure_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(configure_upscaledb, configure_policy)

            make_install_upscaledb = ['make', 'install']  # FIXME
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_install_upscaledb, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 9
0
    def build_leveldb(self, prefix_path):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/leveldb.git', abs_dir_path)
            os.chdir(cloned_dir)

            make_leveldb = ['make', 'static']  # FIXME
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_leveldb, make_policy)

            copy_leveldb_includes = [
                'cp', '-r', 'include/leveldb',
                '{0}/include'.format(prefix_path)
            ]
            copy_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(copy_leveldb_includes, copy_policy)

            copy_leveldb_libs = [
                'cp', 'out-static/libleveldb.a', '{0}/lib'.format(prefix_path)
            ]
            run_command.run_command_cb(copy_leveldb_libs, copy_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 10
0
    def build_libmemcached(self, prefix_path):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/libmemcached.git', abs_dir_path)
            os.chdir(cloned_dir)

            bootstrap_policy = run_command.CommonPolicy(print_message)
            bootstrap_libmemcached = ['sh', 'bootstrap.sh']
            run_command.run_command_cb(bootstrap_libmemcached,
                                       bootstrap_policy)

            configure_libmemcached = [
                './configure', '--prefix={0}'.format(prefix_path),
                '--disable-shared', '--enable-static', '--enable-sasl'
            ]
            configure_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(configure_libmemcached,
                                       configure_policy)

            make_libmemcached = ['make', 'install']  # FIXME
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_libmemcached, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 11
0
    def build_jsonc(self, prefix_path):
        abs_dir_path = self.build_dir_path_
        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/json-c.git', abs_dir_path)
            os.chdir(cloned_dir)

            autogen_policy = run_command.CommonPolicy(print_message)
            autogen_jsonc = ['sh', 'autogen.sh']
            run_command.run_command_cb(autogen_jsonc, autogen_policy)

            configure_jsonc = [
                './configure', '--prefix={0}'.format(prefix_path),
                '--disable-shared', '--enable-static'
            ]
            configure_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(configure_jsonc, configure_policy)

            make_jsonc = ['make', 'install']  # FIXME
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_jsonc, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(abs_dir_path)
            raise ex
Esempio n. 12
0
    def build(self, cmake_project_root_path, 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(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'
        openssl_args = '-DOPENSSL_USE_STATIC=ON'

        cmake_line = [
            'cmake', cmake_project_root_abs_path, generator,
            '-DCMAKE_BUILD_TYPE=RELEASE', openssl_args, log_to_file_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 branding_options:
            cmake_line.extend(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 != None:
                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_signed = build_system_args
            make_apk_signed.append('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
            make_apk_signed_aligned = build_system_args
            make_apk_signed_aligned.append('apk_signed_aligned')
            try:
                common_policy = run_command.CommonPolicy(store)
                run_command.run_command_cb(make_apk_signed_aligned,
                                           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
Esempio n. 13
0
    def build(self, dir_path, bs, bs_external, prefix_path):
        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]

        if not bs_external:
            bs_external = system_info.SUPPORTED_BUILD_SYSTEMS[1]

        if prefix_path == None:
            prefix_path = self.platform_.arch().default_install_prefix_path()

        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()
        # bs_name = bs.name()

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

        # 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
        ]

        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))

        make_install = build_system_args
        make_install.append('install')

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/snappy.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/common.git', abs_dir_path)
            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=ON')
            common_cmake_line.append('-DSNAPPY_USE_STATIC=ON')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/qscintilla.git', abs_dir_path)
            qsci_src_path = os.path.join(cloned_dir, 'Qt4Qt5')
            os.chdir(qsci_src_path)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            qscintilla_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(qscintilla_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/libssh2.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            libssh2_cmake_line = list(cmake_line)
            libssh2_cmake_line.append('-DBUILD_SHARED_LIBS=OFF')
            libssh2_cmake_line.append('-DCRYPTO_BACKEND=OpenSSL')
            libssh2_cmake_line.append('-DENABLE_ZLIB_COMPRESSION=ON')
            libssh2_cmake_line.append('-DZLIB_USE_STATIC=ON')
            libssh2_cmake_line.append('-DOPENSSL_USE_STATIC=ON')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(libssh2_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        if is_android:
            return

        build_external_system_args = bs_external.cmd_line()

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/json-c.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/leveldb.git', abs_dir_path)
            os.chdir(cloned_dir)

            make_leveldb = list(build_external_system_args)
            make_leveldb.append('static')
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_leveldb, make_policy)

            copy_leveldb_includes = [
                'cp', '-r', 'include/leveldb',
                '{0}/include'.format(prefix_path)
            ]
            copy_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(copy_leveldb_includes, copy_policy)

            copy_leveldb_libs = [
                'cp', 'out-static/libleveldb.a', '{0}/lib'.format(prefix_path)
            ]
            run_command.run_command_cb(copy_leveldb_libs, copy_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/rocksdb.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            common_cmake_line.append('-DFAIL_ON_WARNINGS=OFF')
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/upscaledb.git', abs_dir_path)
            os.chdir(cloned_dir)
            bootstrap_policy = run_command.CommonPolicy(print_message)
            bootstrap_upscaledb = ['sh', 'bootstrap.sh']
            run_command.run_command_cb(bootstrap_upscaledb, bootstrap_policy)

            configure_upscaledb = [
                './configure', '--prefix={0}'.format(prefix_path),
                '--disable-remote', '--enable-static-boost',
                '--disable-shared', '--disable-java', '--disable-encryption'
            ]
            configure_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(configure_upscaledb, configure_policy)

            make_install_upscaledb = list(build_external_system_args)
            make_install_upscaledb.append('install')
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(make_install_upscaledb, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex

        try:
            cloned_dir = utils.git_clone(
                'https://github.com/fastogt/forestdb.git', abs_dir_path)
            os.chdir(cloned_dir)

            os.mkdir('build_cmake_release')
            os.chdir('build_cmake_release')
            common_cmake_line = list(cmake_line)
            cmake_policy = run_command.CmakePolicy(print_message)
            make_policy = run_command.CommonPolicy(print_message)
            run_command.run_command_cb(common_cmake_line, cmake_policy)
            run_command.run_command_cb(make_install, make_policy)
            os.chdir(abs_dir_path)
        except Exception as ex:
            os.chdir(pwd)
            raise ex