summaryrefslogtreecommitdiffstats
path: root/waftools/generators/sources.py
blob: 1248ad90b4e34636a2877999e0f132d6a855dbd8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
from waflib.Build import BuildContext
import os

def __file2string_cmd__(ctx):
    return "${{BIN_PERL}} {0}/TOOLS/file2string.pl ${{SRC}} > ${{TGT}}" \
                .format(ctx.srcnode.abspath())

def __matroska_cmd__(ctx, argument):
    return "${{BIN_PERL}} {0}/TOOLS/matroska.pl {1} ${{SRC}} > ${{TGT}}" \
                .format(ctx.srcnode.abspath(), argument)

def __file2string__(ctx, **kwargs):
    ctx(
        rule   = __file2string_cmd__(ctx),
        before = ("c",),
        name   = os.path.basename(kwargs['target']),
        **kwargs
    )

def __matroska_header__(ctx, **kwargs):
    ctx(
        rule   = __matroska_cmd__(ctx, '--generate-header'),
        before = ("c",),
        name   = os.path.basename(kwargs['target']),
        **kwargs
    )

def __matroska_definitions__(ctx, **kwargs):
    ctx(
        rule   = __matroska_cmd__(ctx, '--generate-definitions'),
        before = ("c",),
        **kwargs
    )

BuildContext.file2string          = __file2string__
BuildContext.matroska_header      = __matroska_header__
BuildContext.matroska_definitions = __matroska_definitions__