summaryrefslogtreecommitdiff
path: root/buildtools/wafsamba/samba_patterns.py
blob: f064608f3a3051818fb7ddba9c42d10b8296402d (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
# a waf tool to add extension based build patterns for Samba

import Task
from TaskGen import extension
from samba_utils import *
from wafsamba import samba_version_file

def write_version_header(task):
    '''print version.h contents'''
    src = task.inputs[0].srcpath(task.env)
    tgt = task.outputs[0].bldpath(task.env)

    version = samba_version_file(src, task.env.srcdir, env=task.env, is_install=task.env.is_install)
    string = str(version)

    f = open(tgt, 'w')
    s = f.write(string)
    f.close()
    return 0


def SAMBA_MKVERSION(bld, target):
    '''generate the version.h header for Samba'''
    t = bld.SAMBA_GENERATOR('VERSION', 
                            rule=write_version_header,
                            source= 'VERSION',
                            target=target,
                            always=True)
    t.env.is_install = bld.is_install
Build.BuildContext.SAMBA_MKVERSION = SAMBA_MKVERSION