1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-25 06:04:04 +03:00
samba-mirror/buildtools/wafsamba/samba_patterns.py
Andrew Tridgell d2bc45e7ff build: only use the git version on install, not in the build tree
having the git version in our version.h in the build tree is annoying
for developers, as every time you commit or rebase you need to spend
several minutes re-linking. This changes it to use the git version
only on install, which is much more useful as when you actually
install the binaries you may be using them in a way that reporting the
version is useful

Pair-Programmed-With: Andrew Bartlett <abartlet@samba.org>

Autobuild-User: Andrew Tridgell <tridge@samba.org>
Autobuild-Date: Fri Jun 17 08:37:06 CEST 2011 on sn-devel-104
2011-06-17 08:37:06 +02:00

31 lines
931 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)
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