コード例 #1
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _make_dist(self, context):
     context.try_skip(self.build_path)
     command = "make dist"
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=True,
                                 cross_path=True)
     run_command(command, self.build_path, context, env=env)
コード例 #2
0
 def _make_dist(self, context):
     command = "git archive -o {build_dir}/{name}.tar.gz --prefix={name}/ HEAD"
     command = command.format(
         build_dir = self.build_path,
         name = self.target.full_name()
     )
     run_command(command, self.source_path, context, buildEnv=self.buildEnv)
コード例 #3
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _install(self, context):
     context.try_skip(self.build_path)
     command = "{} -v install".format(neutralEnv('ninja_command'))
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=False,
                                 cross_path=True)
     run_command(command, self.build_path, context, env=env)
コード例 #4
0
 def _configure(self, context):
     context.try_skip(self.build_path)
     cross_option = ""
     if not self.target.force_native_build and self.buildEnv.cmake_crossfile:
         cross_option = "-DCMAKE_TOOLCHAIN_FILE={}".format(
             self.buildEnv.cmake_crossfile)
     command = ("cmake {configure_option}"
                " -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
                " -DCMAKE_INSTALL_PREFIX={install_dir}"
                " -DCMAKE_INSTALL_LIBDIR={libdir}"
                " {source_path}"
                " {cross_option}")
     command = command.format(configure_option=self.configure_option,
                              install_dir=self.buildEnv.install_dir,
                              libdir=self.buildEnv.libprefix,
                              source_path=self.source_path,
                              cross_option=cross_option)
     env = Defaultdict(str, os.environ)
     if self.buildEnv.platformInfo.static:
         env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
         env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
     if self.configure_env:
         for k in self.configure_env:
             if k.startswith('_format_'):
                 v = self.configure_env.pop(k)
                 v = v.format(buildEnv=self.buildEnv, env=env)
                 self.configure_env[k[8:]] = v
         env.update(self.configure_env)
     run_command(command,
                 self.build_path,
                 context,
                 env=env,
                 buildEnv=self.buildEnv,
                 cross_env_only=True)
コード例 #5
0
 def _install(self, context):
     context.try_skip(self.build_path)
     command = "make {make_install_target} {make_option}".format(
         make_install_target=self.make_install_target,
         make_option=self.make_option
     )
     run_command(command, self.build_path, context, buildEnv=self.buildEnv)
コード例 #6
0
 def _configure(self, context):
     context.try_skip(self.build_path)
     if os.path.exists(self.build_path):
         shutil.rmtree(self.build_path)
     os.makedirs(self.build_path)
     configure_option = self.configure_option.format(buildEnv=self.buildEnv)
     cross_option = ""
     if not self.target.force_native_build and self.buildEnv.meson_crossfile:
         cross_option = "--cross-file {}".format(
             self.buildEnv.meson_crossfile)
     command = ("{command} . {build_path}"
                " --buildtype={build_type} {strip_option}"
                " --default-library={library_type}"
                " {configure_option}"
                " --prefix={buildEnv.install_dir}"
                " --libdir={buildEnv.libprefix}"
                " {cross_option}")
     command = command.format(command=neutralEnv('meson_command'),
                              build_type=self.build_type,
                              strip_option=self.strip_option,
                              library_type=self.library_type,
                              configure_option=configure_option,
                              build_path=self.build_path,
                              buildEnv=self.buildEnv,
                              cross_option=cross_option)
     run_command(command,
                 self.source_path,
                 context,
                 buildEnv=self.buildEnv,
                 cross_env_only=True)
コード例 #7
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _patch(self, context):
     context.try_skip(self.source_path)
     for p in self.patches:
         with open(pj(SCRIPT_DIR, 'patches', p), 'r') as patch_input:
             run_command("patch -p1",
                         self.source_path,
                         context,
                         input=patch_input.read())
コード例 #8
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _compile(self, context):
     context.try_skip(self.build_path)
     command = "make -j4 {make_target} {make_option}".format(
         make_target=self.make_target, make_option=self.make_option)
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=True,
                                 cross_path=True)
     run_command(command, self.build_path, context, env=env)
コード例 #9
0
 def _test(self, context):
     if (self.buildEnv.platformInfo.build == 'android'
             or (self.buildEnv.platformInfo.build != 'native'
                 and not self.buildEnv.platformInfo.static)):
         raise SkipCommand()
     command = "{} --verbose {}".format(neutralEnv('mesontest_command'),
                                        self.test_option)
     run_command(command, self.build_path, context, buildEnv=self.buildEnv)
コード例 #10
0
ファイル: flatpak.py プロジェクト: serg585/kiwix-build
 def _setup_remote(self, context):
     command = "flatpak --user remote-add --if-not-exists {remote_name} {remote_url}"
     command = command.format(
         remote_name='flathub',
         remote_url='https://flathub.org/repo/flathub.flatpakrepo')
     run_command(command,
                 self.buildEnv.build_dir,
                 context,
                 buildEnv=self.buildEnv)
コード例 #11
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _git_update(self, context):
     command = "git fetch origin {}".format(self.git_ref)
     run_command(command, self.git_path, context)
     try:
         command = "git merge --ff-only origin/{}".format(self.git_ref)
         run_command(command, self.git_path, context)
     except subprocess.CalledProcessError:
         raise WarningMessage(
             "Cannot update, please check log for information")
コード例 #12
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _compile(self, context):
     context.try_skip(self.build_path)
     command = "./gradlew {gradle_target} {gradle_option}"
     command = command.format(gradle_target=self.gradle_target,
                              gradle_option=self.gradle_option)
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=True,
                                 cross_path=True)
     run_command(command, self.build_path, context, env=env)
コード例 #13
0
ファイル: flatpak.py プロジェクト: soumyankar/kiwix-build
 def _install_sdk(self, context):
     command = "flatpak --user install -y {remote_name} {name}.Sdk//{version} {name}.Platform//{version}"
     command = command.format(remote_name='flathub',
                              name=self.target.name,
                              version=self.target.version())
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=False,
                                 cross_path=False)
     run_command(command, self.buildEnv.build_dir, context, env=env)
コード例 #14
0
ファイル: flatpak.py プロジェクト: soumyankar/kiwix-build
 def _setup_remote(self, context):
     command = "flatpak --user remote-add --if-not-exists {remote_name} {remote_url}"
     command = command.format(
         remote_name='flathub',
         remote_url='https://flathub.org/repo/flathub.flatpakrepo')
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=False,
                                 cross_path=False)
     run_command(command, self.buildEnv.build_dir, context, env=env)
コード例 #15
0
 def _install(self, context):
     context.try_skip(self.build_path)
     command = "cp {ctpp2c}* {install_dir}".format(
         ctpp2c=pj(self.build_path, 'ctpp2c'),
         install_dir=pj(self.buildEnv.install_dir, 'bin'))
     run_command(command,
                 self.build_path,
                 context,
                 buildEnv=self.buildEnv)
コード例 #16
0
ファイル: flatpak.py プロジェクト: serg585/kiwix-build
 def _install_sdk(self, context):
     command = "flatpak --user install -y {remote_name} {name}.Sdk//{version} {name}.Platform//{version}"
     command = command.format(remote_name='flathub',
                              name=self.target.name,
                              version=self.target.version())
     run_command(command,
                 self.buildEnv.build_dir,
                 context,
                 buildEnv=self.buildEnv)
コード例 #17
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _configure(self, context):
     context.try_skip(self.build_path)
     command = "{configure_script} {configure_option}"
     command = command.format(configure_script=pj(self.source_path,
                                                  self.configure_script),
                              configure_option=self.all_configure_option)
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=True,
                                 cross_path=True)
     self.set_configure_env(env)
     run_command(command, self.build_path, context, env=env)
コード例 #18
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _test(self, context):
     context.try_skip(self.build_path)
     if (self.buildEnv.platformInfo.build == 'android'
             or (self.buildEnv.platformInfo.build != 'native'
                 and not self.buildEnv.platformInfo.static)):
         raise SkipCommand()
     command = "{} --verbose {}".format(neutralEnv('mesontest_command'),
                                        self.test_option)
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=False,
                                 cross_path=True)
     run_command(command, self.build_path, context, env=env)
コード例 #19
0
 def _compile(self, context):
     platformInfo = self.buildEnv.platformInfo
     if platformInfo.build == 'native':
         return super()._compile(context)
     context.try_skip(self.build_path)
     command = "make -j4 {make_target} {make_option}".format(
         make_target=self.make_target,
         make_option=self.make_option
     )
     libmagic_native_builder = get_target_step('libmagic', 'native_static')
     env = Defaultdict(str, os.environ)
     env['PATH'] = ':'.join([pj(libmagic_native_builder.build_path, 'src'), env['PATH']])
     run_command(command, self.build_path, context, buildEnv=self.buildEnv, env=env)
コード例 #20
0
ファイル: android_ndk.py プロジェクト: sjha2048/kiwix-build
 def _build_platform(self, context):
     context.try_skip(self.build_path)
     script = pj(self.source_path, 'build/tools/make_standalone_toolchain.py')
     add_execution_right(script)
     command = '{script} --arch={arch} --api={api} --install-dir={install_dir} --force'
     command = command.format(
         script=script,
         arch=self.arch,
         api=self.api,
         install_dir=self.install_path
     )
     context.force_native_build = True
     run_command(command, self.build_path, context, buildEnv=self.buildEnv)
コード例 #21
0
ファイル: android_ndk.py プロジェクト: soumyankar/kiwix-build
 def _build_platform(self, context):
     context.try_skip(self.build_path)
     script = pj(self.source_path,
                 'build/tools/make_standalone_toolchain.py')
     add_execution_right(script)
     command = '{script} --arch={arch} --api={api} --install-dir={install_dir} --force'
     command = command.format(script=script,
                              arch=self.arch,
                              api=self.api,
                              install_dir=self.install_path)
     env = self.buildEnv.get_env(cross_comp_flags=False,
                                 cross_compilers=False,
                                 cross_path=False)
     run_command(command, self.build_path, context, env=env)
コード例 #22
0
 def _configure(self, context):
     context.try_skip(self.build_path)
     cross_option = ""
     command = ("qmake {configure_option}"
                " {env_option}"
                " {source_path}"
                " {cross_option}")
     command = command.format(
         configure_option=self.configure_option,
         env_option=self.env_option,
         source_path=self.source_path,
         cross_option=cross_option
     )
     run_command(command, self.build_path, context, buildEnv=self.buildEnv, cross_env_only=True)
コード例 #23
0
ファイル: libmagic.py プロジェクト: soumyankar/kiwix-build
 def _compile(self, context):
     platformInfo = self.buildEnv.platformInfo
     if platformInfo.build == 'native':
         return super()._compile(context)
     context.try_skip(self.build_path)
     command = "make -j4 {make_target} {make_option}".format(
         make_target=self.make_target, make_option=self.make_option)
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=True,
                                 cross_path=True)
     libmagic_native_builder = get_target_step('libmagic',
                                               'native_static')
     env['PATH'] = ':'.join(
         [pj(libmagic_native_builder.build_path, 'src'), env['PATH']])
     run_command(command, self.build_path, context, env=env)
コード例 #24
0
ファイル: android_sdk.py プロジェクト: soumyankar/kiwix-build
 def _build_platform(self, context):
     context.try_skip(self.install_path)
     tools_dir = pj(self.install_path, 'tools')
     shutil.copytree(self.source_path, tools_dir)
     script = pj(tools_dir, 'android')
     command = '{script} --verbose update sdk -a --no-ui --filter {packages}'
     packages = [
         'tools','platform-tools',
         'build-tools-28.0.3', 'build-tools-27.0.3',
         'android-28', 'android-27'
     ]
     command = command.format(
         script=script,
         packages = ','.join(packages)
     )
     run_command(command, self.install_path, context, input="y\n")
コード例 #25
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _configure(self, context):
     context.try_skip(self.build_path)
     cross_option = ""
     command = ("qmake {configure_option}"
                " {env_option}"
                " {source_path}"
                " {cross_option}")
     command = command.format(configure_option=self.configure_option,
                              env_option=self.env_option,
                              source_path=self.source_path,
                              cross_option=cross_option)
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=False,
                                 cross_path=True)
     self.set_configure_env(env)
     run_command(command, self.build_path, context, env=env)
コード例 #26
0
 def _build_platform(self, context):
     context.try_skip(self.install_path)
     tools_dir = pj(self.install_path, 'tools')
     shutil.copytree(self.source_path, tools_dir)
     script = pj(tools_dir, 'android')
     command = '{script} --verbose update sdk -a --no-ui --filter {packages}'
     command = command.format(
         script=script,
         packages = ','.join(str(i) for i in [1,2,8,34,162])
     )
     # packages correspond to :
     # - 1 : Android SDK Tools, revision 25.2.5
     # - 2 : Android SDK Platform-tools, revision 25.0.3
     # - 8 : Android SDK Build-tools, revision 24.0.1
     # - 34 : SDK Platform Android 7.0, API 24, revision 2
     # - 162 : Android Support Repository, revision 44
     run_command(command, self.install_path, context, input="y\n")
コード例 #27
0
        def _configure(self, context):
            # Copy kiwix-android in build dir.
            kiwix_android_source = get_target_step('kiwix-android', 'source')
            if not os.path.exists(self.build_path):
                shutil.copytree(kiwix_android_source.source_path, self.build_path)

            # Copy kiwix-lib application in build dir
            try:
                shutil.rmtree(pj(self.build_path, 'kiwixlib', 'src', 'main'))
            except FileNotFoundError:
                pass
            for arch in option('android_arch'):
                try:
                    kiwix_builder = get_target_step('kiwix-lib', 'android_{}'.format(arch))
                except KeyError:
                    pass
                else:
                    copy_tree(pj(kiwix_builder.buildEnv.install_dir, 'kiwix-lib'),
                              pj(self.build_path, 'kiwixlib', 'src', 'main'))
            os.makedirs(
                pj(self.build_path, 'app', 'src', 'main', 'assets', 'icu'),
                exist_ok=True)
            for arch in option('android_arch'):
                try:
                    kiwix_builder = get_target_step('kiwix-lib', 'android_{}'.format(arch))
                except KeyError:
                    pass
                else:
                    shutil.copy2(pj(kiwix_builder.buildEnv.install_dir, 'share', 'icu', '58.2',
                                    'icudt58l.dat'),
                                 pj(self.build_path, 'app', 'src', 'main', 'assets',
                                    'icu', 'icudt58l.dat'))
                    break
            # Generate custom directory
            try:
                shutil.rmtree(pj(self.build_path, 'custom'))
            except FileNotFoundError:
                pass
            os.makedirs(pj(self.build_path, 'custom'))
            command = "./gen-custom-android-directory.py {custom_name} --output-dir {custom_dir}"
            command = command.format(
                custom_name=option('android_custom_app'),
                custom_dir=pj(self.build_path, 'custom', option('android_custom_app'))
            )
            run_command(command, self.source_path, context, buildEnv=self.buildEnv)
コード例 #28
0
ファイル: ios_fat_lib.py プロジェクト: soumyankar/kiwix-build
 def _merge_libs(self, context):
     lib_dirs = []
     for arch in option('ios_arch'):
         plt = PlatformInfo.get_platform('iOS_{}'.format(arch))
         lib_dirs.append(pj(plt.buildEnv.install_dir, 'lib'))
     libs = []
     for f in os.listdir(lib_dirs[0]):
         if os.path.islink(pj(lib_dirs[0], f)):
             continue
         if f.endswith('.a') or f.endswith('.dylib'):
             libs.append(f)
     os.makedirs(pj(self.buildEnv.install_dir, 'lib'), exist_ok=True)
     command_tmp = "lipo -create {input} -output {output}"
     for l in libs:
         command = command_tmp.format(
             input=" ".join(pj(d, l) for d in lib_dirs),
             output=pj(self.buildEnv.install_dir, 'lib', l))
         run_command(command, self.buildEnv.install_dir, context)
コード例 #29
0
 def _configure(self, context):
     context.try_skip(self.build_path)
     command = "{configure_script} {configure_option}"
     command = command.format(
         configure_script=pj(self.source_path, self.configure_script),
         configure_option=self.all_configure_option
     )
     env = Defaultdict(str, os.environ)
     if self.buildEnv.platformInfo.static:
         env['CFLAGS'] = env['CFLAGS'] + ' -fPIC'
         env['CXXFLAGS'] = env['CXXFLAGS'] + ' -fPIC'
     if self.configure_env:
         for k in self.configure_env:
             if k.startswith('_format_'):
                 v = self.configure_env.pop(k)
                 v = v.format(buildEnv=self.buildEnv, env=env)
                 self.configure_env[k[8:]] = v
         env.update(self.configure_env)
     run_command(command, self.build_path, context, buildEnv=self.buildEnv, env=env)
コード例 #30
0
ファイル: base.py プロジェクト: soumyankar/kiwix-build
 def _configure(self, context):
     context.try_skip(self.build_path)
     cross_option = ""
     if not self.target.force_native_build and self.buildEnv.cmake_crossfile:
         cross_option = "-DCMAKE_TOOLCHAIN_FILE={}".format(
             self.buildEnv.cmake_crossfile)
     command = ("cmake {configure_option}"
                " -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON"
                " -DCMAKE_INSTALL_PREFIX={install_dir}"
                " -DCMAKE_INSTALL_LIBDIR={libdir}"
                " {source_path}"
                " {cross_option}")
     command = command.format(configure_option=self.configure_option,
                              install_dir=self.buildEnv.install_dir,
                              libdir=self.buildEnv.libprefix,
                              source_path=self.source_path,
                              cross_option=cross_option)
     env = self.buildEnv.get_env(cross_comp_flags=True,
                                 cross_compilers=False,
                                 cross_path=True)
     self.set_configure_env(env)
     run_command(command, self.build_path, context, env=env)