Source

pyGAP / game / assets / wscript

Full commit
#!/usr/bin/env python
# encoding: utf-8

from waflib import TaskGen, Utils, Build
from tools import config, formats, pack
from tools.formats.common import Data
from tools.compilers import csv_text

top = '.'
out = '.build'


@TaskGen.feature('*')
@TaskGen.before('process_rule')
def dynamic_post(self):
    if not getattr(self, 'dynamic_source', None):
        return
    self.source = Utils.to_list(self.source)
    self.source.extend(self.path.get_bld().ant_glob(self.dynamic_source))


def options(opt):
    config.options(opt)


def configure(conf):
    config.configure(conf)


def build(bld):
    if bld.env.m64:
        Data.pointer = {
            'cast': 'uint64_t',
            'size': 8,
            'repr': 'Q',
        }
    Data.endianness = '>' if bld.env.big_endian else '<'
    bld.env.zip_module = __import__(bld.env.zip_module)
    pack.File.padding = bld.env.padding

    bld.post_mode = Build.POST_LAZY

    for f in formats.__all__:
        bld(rule=getattr(formats, f).export,
            target='inc/formats/%s.h' % f, color='PINK')
    bld.recurse('common')

    bld.add_group()
    bld(rule=pack.run, dynamic_source='**/*.etcz **/*.geoz **/*.bmfz',
        target='game.pak pack.csv')
    for lang in bld.env.languages:
        bld(rule=pack.run, dynamic_source='**/*.%sz' % lang,
            target='text_%s.pak text_%s.csv' % (lang, lang))
    bld(rule=csv_text.write_tags, target='inc/texts/tags.h')