summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2010-10-25 06:33:39 +0000
committerStefan Metzmacher <metze@samba.org>2010-10-25 08:16:28 +0000
commit2b74cea5f0f3bdfc51f03cfb7641010c7954f222 (patch)
tree7c2ee8a99ba3e8d03ee996abdb4fe50c72fab1f7
parent8ea6f41ec9d3e2577432a8d9be100f1f42775787 (diff)
downloadsamba-2b74cea5f0f3bdfc51f03cfb7641010c7954f222.tar.gz
samba-2b74cea5f0f3bdfc51f03cfb7641010c7954f222.tar.bz2
samba-2b74cea5f0f3bdfc51f03cfb7641010c7954f222.zip
s3-waf: use git to calculate the version if available
metze
-rw-r--r--source3/wscript24
-rw-r--r--source3/wscript_build4
2 files changed, 17 insertions, 11 deletions
diff --git a/source3/wscript b/source3/wscript
index 20975f7189..96571748a5 100644
--- a/source3/wscript
+++ b/source3/wscript
@@ -3,6 +3,9 @@
srcdir = '..'
blddir = 'bin'
+APPNAME='samba'
+VERSION=None
+
import sys, os
from optparse import SUPPRESS_HELP
sys.path.insert(0, srcdir+"/buildtools/wafsamba")
@@ -11,9 +14,16 @@ import build.charset
import samba_utils
import samba3
-version = wafsamba.samba_version_file("./VERSION")
-
-VERSION=version.STRING
+def load_version(have_git=False):
+ '''load samba versions either from ./VERSION or git
+ return a version object for detailed breakdown'''
+ import samba_utils, Utils
+ if not have_git:
+ env = samba_utils.LOAD_ENVIRONMENT()
+ have_git = 'GIT' in env
+ version = wafsamba.samba_version_file("./VERSION", have_git=have_git)
+ Utils.g_module.VERSION = version.STRING
+ return version
def set_options(opt):
opt.BUILTIN_DEFAULT('NONE')
@@ -57,16 +67,12 @@ def set_options(opt):
def configure(conf):
from samba_utils import TO_LIST
- conf.DEFINE('PACKAGE_NAME', 'Samba', quote=True)
- conf.DEFINE('PACKAGE_STRING', 'Samba %s' % version.MAJOR, quote=True)
- conf.DEFINE('PACKAGE_TARNAME', 'samba', quote=True)
- conf.DEFINE('PACKAGE_URL', "", quote=True)
- conf.DEFINE('PACKAGE_VERSION', "%s" % version.MAJOR, quote=True)
- conf.DEFINE('PACKAGE_BUGREPORT', 'samba-technical@samba.org', quote=True)
+ version = load_version(have_git=True)
conf.DEFINE('CONFIG_H_IS_FROM_SAMBA', 1)
conf.DEFINE('_SAMBA_BUILD_', version.MAJOR, add_to_cflags=True)
conf.DEFINE('HAVE_CONFIG_H', 1, add_to_cflags=True)
+
if Options.options.developer:
conf.ADD_CFLAGS('-DDEVELOPER -DDEBUG_PASSWORD')
conf.env['developer'] = True
diff --git a/source3/wscript_build b/source3/wscript_build
index 3abcd178e6..0a05880960 100644
--- a/source3/wscript_build
+++ b/source3/wscript_build
@@ -904,6 +904,8 @@ t.env.BUILDDIR = bld.path.abspath()
bld.SETUP_BUILD_GROUPS()
+bld.SAMBA_MKVERSION('include/version.h')
+
bld.RECURSE('../lib/replace')
bld.RECURSE('../libcli/smbreadline')
print "SBINDIR=%s" % bld.env.SBINDIR
@@ -914,8 +916,6 @@ bld.RECURSE('librpc/idl')
bld.RECURSE('librpc')
bld.RECURSE('../libcli/security')
-bld.SAMBA_MKVERSION('include/version.h')
-
######################## SUBSYSTEMS #################################
bld.SAMBA_SUBSYSTEM('WBCOMMON',