summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bokovoy <ab@samba.org>2012-04-13 17:53:04 +0300
committerAlexander Bokovoy <ab@samba.org>2012-04-13 18:34:39 +0200
commit1a8405c320f115d584a9094bf5878b8cf6d58893 (patch)
treed362fcfec3c7f49c91e709c01623b901d66c09c3
parentb8dea7e82d0acb9e55e8bfe9a089c250d7380102 (diff)
downloadsamba-1a8405c320f115d584a9094bf5878b8cf6d58893.tar.gz
samba-1a8405c320f115d584a9094bf5878b8cf6d58893.tar.bz2
samba-1a8405c320f115d584a9094bf5878b8cf6d58893.zip
wafsamba: add support for separate rules in stages
bld.process_separate_rule(rule) and conf.process_separate_rule(rule) will cause WAF to import wscript_<stage>_<rule> script into current context. Files wscript_<configure|build>_<rule> should exist in the current directory. This can be used to provide rules specific for alternative implementations of certain libraries Autobuild-User: Alexander Bokovoy <ab@samba.org> Autobuild-Date: Fri Apr 13 18:34:39 CEST 2012 on sn-devel-104
-rw-r--r--buildtools/wafadmin/Utils.py5
-rw-r--r--buildtools/wafsamba/samba_utils.py25
-rw-r--r--wscript_build15
-rw-r--r--wscript_build_embedded_heimdal2
-rw-r--r--wscript_build_system_heimdal2
-rw-r--r--wscript_build_system_mitkrb52
6 files changed, 43 insertions, 8 deletions
diff --git a/buildtools/wafadmin/Utils.py b/buildtools/wafadmin/Utils.py
index 080d928214..41dad570eb 100644
--- a/buildtools/wafadmin/Utils.py
+++ b/buildtools/wafadmin/Utils.py
@@ -111,9 +111,6 @@ class WscriptError(WafError):
return (frame[0], frame[1])
return (None, None)
-class WscriptCheckSkipped(WscriptError):
- pass
-
indicator = is_win32 and '\x1b[A\x1b[K%s%s%s\r' or '\x1b[K%s%s%s\r'
try:
@@ -648,8 +645,6 @@ class Context(object):
try:
try:
exec(compile(txt, file_path, 'exec'), dc)
- except WscriptCheckSkipped:
- pass
except Exception:
exc_type, exc_value, tb = sys.exc_info()
raise WscriptError("".join(traceback.format_exception(exc_type, exc_value, tb)), base)
diff --git a/buildtools/wafsamba/samba_utils.py b/buildtools/wafsamba/samba_utils.py
index 519b77bdf0..bdf96fef88 100644
--- a/buildtools/wafsamba/samba_utils.py
+++ b/buildtools/wafsamba/samba_utils.py
@@ -3,7 +3,7 @@
import Build, os, sys, Options, Utils, Task, re, fnmatch, Logs
from TaskGen import feature, before
-from Configure import conf
+from Configure import conf, ConfigurationContext
from Logs import debug
import shlex
@@ -624,3 +624,26 @@ def get_tgt_list(bld):
sys.exit(1)
tgt_list.append(t)
return tgt_list
+
+from Constants import WSCRIPT_FILE
+def process_separate_rule(self, rule):
+ ''' cause waf to process additional script based on `rule'.
+ You should have file named wscript_<stage>_rule in the current directory
+ where stage is either 'configure' or 'build'
+ '''
+ ctxclass = self.__class__.__name__
+ stage = ''
+ if ctxclass == 'ConfigurationContext':
+ stage = 'configure'
+ elif ctxclass == 'BuildContext':
+ stage = 'build'
+ file_path = os.path.join(self.curdir, WSCRIPT_FILE+'_'+stage+'_'+rule)
+ txt = load_file(file_path)
+ if txt:
+ dc = {'ctx': self}
+ if getattr(self.__class__, 'pre_recurse', None):
+ dc = self.pre_recurse(txt, file_path, [])
+ exec(compile(txt, file_path, 'exec'), dc)
+
+Build.BuildContext.process_separate_rule = process_separate_rule
+ConfigurationContext.process_separate_rule = process_separate_rule
diff --git a/wscript_build b/wscript_build
index e3cacbf734..eeefeb3a19 100644
--- a/wscript_build
+++ b/wscript_build
@@ -111,8 +111,19 @@ bld.RECURSE('libcli/samsync')
bld.RECURSE('libcli/registry')
bld.RECURSE('source4/lib/policy')
bld.RECURSE('libcli/named_pipe_auth')
-if not bld.CONFIG_SET("USING_SYSTEM_KRB5"):
- bld.RECURSE('source4/heimdal_build')
+
+if bld.CONFIG_SET("USING_SYSTEM_KRB5"):
+ if bld.CONFIG_SET("HEIMDAL_KRB5_CONFIG") and bld.CONFIG_SET("KRB5_CONFIG"):
+ if bld.CONFIG_GET("HEIMDAL_KRB5_CONFIG") != bld.CONFIG_GET("KRB5_CONFIG"):
+ # When both HEIMDAL_KRB5_CONFIG and KRB5_CONFIG are set and not equal,
+ # it means one is Heimdal-specific (krb5-config.heimdal, for example)
+ # and there is system heimdal
+ bld.process_separate_rule('system_heimdal')
+ else:
+ bld.process_separate_rule('system_krb5')
+else:
+ bld.process_separate_rule('embedded_heimdal')
+
bld.RECURSE('libcli/smbreadline')
bld.RECURSE('codepages')
bld.RECURSE('source4/setup')
diff --git a/wscript_build_embedded_heimdal b/wscript_build_embedded_heimdal
new file mode 100644
index 0000000000..5cde65253b
--- /dev/null
+++ b/wscript_build_embedded_heimdal
@@ -0,0 +1,2 @@
+print "\tSelected embedded Heimdal build"
+bld.RECURSE('source4/heimdal_build')
diff --git a/wscript_build_system_heimdal b/wscript_build_system_heimdal
new file mode 100644
index 0000000000..e548d16a6f
--- /dev/null
+++ b/wscript_build_system_heimdal
@@ -0,0 +1,2 @@
+print "\tSelected system Heimdal build"
+bld.RECURSE('source4/heimdal_build')
diff --git a/wscript_build_system_mitkrb5 b/wscript_build_system_mitkrb5
new file mode 100644
index 0000000000..efe5dd1e51
--- /dev/null
+++ b/wscript_build_system_mitkrb5
@@ -0,0 +1,2 @@
+print "\tSelected system MIT krb5 libraries, Heimdal use is disabled"
+#bld.RECURSE('source4/heimdal_build')