waf: disable-python - add option globally to build system
[samba.git] / buildtools / wafsamba / samba_headers.py
index a03254e328506d4c556576d3f7d3a5779650ed37..0a800826196bcdfae993ae9be8916ca1d5bc74dd 100644 (file)
@@ -1,7 +1,8 @@
 # specialist handling of header files for Samba
 
-import Build, re, Task, TaskGen, shutil, sys
-from samba_utils import *
+import os, re, sys, fnmatch
+import Build, Logs, Utils
+from samba_utils import TO_LIST, os_path_relpath
 
 
 def header_install_path(header, header_path):
@@ -87,6 +88,11 @@ def create_public_header(task):
         if found:
             continue
 
+        if task.env.public_headers_allow_broken:
+            Logs.warn("Broken public header include '%s' in '%s'" % (hpath, relsrc))
+            outfile.write(line)
+            continue
+
         # try to be nice to the developer by suggesting an alternative
         suggested = find_suggested_header(hpath)
         outfile.close()
@@ -99,6 +105,23 @@ def create_public_header(task):
     outfile.close()
 
 
+def public_headers_simple(bld, public_headers, header_path=None, public_headers_install=True):
+    '''install some headers - simple version, no munging needed
+    '''
+    if not public_headers_install:
+        return
+    for h in TO_LIST(public_headers):
+        inst_path = header_install_path(h, header_path)
+        if h.find(':') != -1:
+            s = h.split(":")
+            h_name =  s[0]
+            inst_name = s[1]
+        else:
+            h_name =  h
+            inst_name = os.path.basename(h)
+        bld.INSTALL_FILES('${INCLUDEDIR}', h_name, destname=inst_name)
+
+
 def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install=True):
     '''install some headers
 
@@ -107,8 +130,12 @@ def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install
     directories relative to INCLUDEDIR
     '''
     bld.SET_BUILD_GROUP('final')
+
     if not bld.env.build_public_headers:
-        bld.env.build_public_headers = ''
+        # in this case no header munging neeeded. Used for tdb, talloc etc
+        public_headers_simple(bld, public_headers, header_path=header_path,
+                              public_headers_install=public_headers_install)
+        return
 
     # create the public header in the given path
     # in the build tree
@@ -136,13 +163,6 @@ def PUBLIC_HEADERS(bld, public_headers, header_path=None, public_headers_install
 
         header_map[src_path] = target_path
 
-        build_dir = os.path.join(bld.bldnode.abspath(),
-                                 'default',
-                                 bld.env.build_public_headers,
-                                 inst_path)
-        if not os.path.exists(build_dir):
-            mkdir_p(build_dir)
-
         t = bld.SAMBA_GENERATOR('HEADER_%s/%s/%s' % (relpath2, inst_path, inst_name),
                                 group='headers',
                                 rule=create_public_header,