1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-27 03:21:53 +03:00
samba-mirror/buildtools/wafsamba/samba_patterns.py
Andrew Tridgell 30dc87dab9 build: only use git when found by configure
this rebuilds version.h whenever the git version changes, so we always
get the right version with samba -V. That adds about 15s to the build
time on each git commit, which shouldn't be too onerous
2010-06-29 14:28:08 +10:00

32 lines
886 B
Python

# 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)
have_git = 'GIT' in task.env
version = samba_version_file(src, have_git=have_git)
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)
Build.BuildContext.SAMBA_MKVERSION = SAMBA_MKVERSION