예제 #1
0
 def _configure(self, context):
     if not os.path.exists(self.build_path):
         shutil.copytree(self.source_path,
                         self.build_path,
                         symlinks=True)
     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
예제 #2
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
            shutil.copytree(pj(self.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)
            shutil.copy2(
                pj(self.buildEnv.install_dir, 'share', 'icu', '58.2',
                   'icudt58l.dat'),
                pj(self.build_path, 'app', 'src', 'main', 'assets', 'icu',
                   'icudt58l.dat'))

            # 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=self.target.custom_name,
                                     custom_dir=pj(self.build_path, 'custom',
                                                   self.target.custom_name))
            self.buildEnv.run_command(command, self.source_path, context)
예제 #3
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)
예제 #4
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)
예제 #5
0
 def configure_option(self):
     options = ("--disable-samples --disable-tests --disable-extras "
                "--disable-dyload --enable-rpath "
                "--disable-icuio --disable-layoutex")
     platformInfo = self.buildEnv.platformInfo
     if platformInfo.build != 'native':
         icu_native_builder = get_target_step(
             'icu4c',
             'native_static' if platformInfo.static else 'native_dyn')
         options += " --with-cross-build={} --disable-tools".format(
             icu_native_builder.build_path)
     if platformInfo.build == 'android':
         options += " --with-data-packaging=archive"
     return options
예제 #6
0
 def _configure(self, context):
     try:
         shutil.rmtree(self.build_path)
     except FileNotFoundError:
         pass
     if not os.path.exists(self.build_path):
         shutil.copytree(pj(self.source_path, 'android-kiwix-lib-publisher'), self.build_path, symlinks=True)
     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, 'kiwixLibAndroid', 'src', 'main'))
예제 #7
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)
     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)
예제 #8
0
 def ndk_builder(self):
     return get_target_step('android-ndk', self.name)
예제 #9
0
 def sdk_builder(self):
     return get_target_step('android-sdk', 'neutral')
예제 #10
0
 def gradle_builder(self):
     return get_target_step('gradle', 'neutral')
예제 #11
0
 def tlc_source(self):
     return get_target_step('armhf', 'source')