build: replace SAMBA3_ADD_OPTION with samba_add_onoff_option
[gd/samba-autobuild/.git] / buildtools / wafsamba / samba3.py
index 369285c395ae3735d5b501b53945dfced2432a50..5aab2509b2490ae1ac65afb90314e1b6db1c347e 100644 (file)
@@ -1,29 +1,11 @@
 # a waf tool to add autoconf-like macros to the configure section
 # and for SAMBA_ macros for building libraries, binaries etc
 
-import Options, Build, os
-from optparse import SUPPRESS_HELP
+import os
+from waflib import Build
 from samba_utils import os_path_relpath, TO_LIST
 from samba_autoconf import library_flags
 
-def SAMBA3_ADD_OPTION(opt, option, help=(), dest=None, default=True,
-                      with_name="with", without_name="without"):
-    if help == ():
-        help = ("Build with %s support" % option)
-    if dest is None:
-        dest = "with_%s" % option.replace('-', '_')
-
-    with_val = "--%s-%s" % (with_name, option)
-    without_val = "--%s-%s" % (without_name, option)
-
-    #FIXME: This is broken and will always default to "default" no matter if
-    # --with or --without is chosen.
-    opt.add_option(with_val, help=help, action="store_true", dest=dest,
-                   default=default)
-    opt.add_option(without_val, help=SUPPRESS_HELP, action="store_false",
-                   dest=dest)
-Options.Handler.SAMBA3_ADD_OPTION = SAMBA3_ADD_OPTION
-
 def SAMBA3_IS_STATIC_MODULE(bld, module):
     '''Check whether module is in static list'''
     if module in bld.env['static_modules']:
@@ -49,28 +31,23 @@ def s3_fix_kwargs(bld, kwargs):
     '''fix the build arguments for s3 build rules to include the
     necessary includes, subdir and cflags options '''
     s3dir = os.path.join(bld.env.srcdir, 'source3')
-    s3reldir = os_path_relpath(s3dir, bld.curdir)
+    s3reldir = os_path_relpath(s3dir, bld.path.abspath())
 
     # the extra_includes list is relative to the source3 directory
-    extra_includes = [ '.', 'include', 'lib', '../lib/tdb_compat' ]
+    extra_includes = [ '.', 'include', 'lib' ]
     # local heimdal paths only included when USING_SYSTEM_KRB5 is not set
     if not bld.CONFIG_SET("USING_SYSTEM_KRB5"):
         extra_includes += [ '../source4/heimdal/lib/com_err',
+                            '../source4/heimdal/lib/krb5',
                             '../source4/heimdal/lib/gssapi',
-                            '../source4/heimdal_build' ]
-
-    if bld.CONFIG_SET('BUILD_TDB2'):
-        if bld.CONFIG_SET('USING_SYSTEM_TDB2'):
-            (tdb2_includes, tdb2_ldflags, tdb2_cpppath) = library_flags(bld, 'tdb')
-            extra_includes += tdb2_cpppath
-        else:
-            extra_includes += [ '../lib/tdb2' ]
+                            '../source4/heimdal_build',
+                            '../bin/default/source4/heimdal/lib/asn1' ]
+
+    if bld.CONFIG_SET('USING_SYSTEM_TDB'):
+        (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb')
+        extra_includes += tdb_cpppath
     else:
-        if bld.CONFIG_SET('USING_SYSTEM_TDB'):
-            (tdb_includes, tdb_ldflags, tdb_cpppath) = library_flags(bld, 'tdb')
-            extra_includes += tdb_cpppath
-        else:
-            extra_includes += [ '../lib/tdb/include' ]
+        extra_includes += [ '../lib/tdb/include' ]
 
     if bld.CONFIG_SET('USING_SYSTEM_TEVENT'):
         (tevent_includes, tevent_ldflags, tevent_cpppath) = library_flags(bld, 'tevent')