build: fixed a typo that prevented --bundled-libraries from working correctly
[samba.git] / buildtools / wafsamba / samba_pidl.py
index d6077c2a4ab3706ccba7d84d38aac6a841c70fb9..0b149cc252f77cb41e23ba651b4adc2917465397 100644 (file)
@@ -29,6 +29,8 @@ def SAMBA_PIDL(bld, pname, source,
                     '--client'            : 'ndr_%s_c.c ndr_%s_c.h',
                     '--python'            : 'py_%s.c',
                     '--tdr-parser'        : 'tdr_%s.c tdr_%s.h',
+                    '--dcom-proxy'       : '%s_p.c',
+                    '--com-header'       : 'com_%s.h'
                     }
 
     table_header_idx = None
@@ -46,20 +48,28 @@ def SAMBA_PIDL(bld, pname, source,
 
     # depend on the full pidl sources
     source = TO_LIST(source)
-    pidl_src = [x.relpath_gen(bld.path) for x in
-                bld.srcnode.ant_glob('pidl/**/*', flat=False)]
-    source.extend(pidl_src)
+    try:
+        pidl_src_nodes = bld.pidl_files_cache
+    except AttributeError:
+        bld.pidl_files_cache = bld.srcnode.ant_glob('pidl/lib/Parse/**/*.pm', flat=False)
+        bld.pidl_files_cache.extend(bld.srcnode.ant_glob('pidl', flat=False))
+        pidl_src_nodes = bld.pidl_files_cache
 
     # the cd .. is needed because pidl currently is sensitive to the directory it is run in
-    t = bld(rule='cd .. && ${PIDL} ${OPTIONS} --outputdir ${OUTPUTDIR} -- ${SRC[0].abspath(env)}',
-            ext_out = '.c',
-            before  = 'cc',
-            shell   = True,
-            source  = source,
-            target  = out_files,
-            name    = name)
-
-    t.env.PIDL = "../pidl/pidl"
+    t = bld(rule='cd .. && ${PIDL} --quiet ${OPTIONS} --outputdir ${OUTPUTDIR} -- ${SRC[0].abspath(env)}',
+            ext_out    = '.c',
+            before     = 'cc',
+            on_results = True,
+            shell      = True,
+            source     = source,
+            target     = out_files,
+            name       = name,
+            samba_type = 'PIDL')
+
+    # prime the list of nodes we are dependent on with the cached pidl sources
+    t.allnodes = pidl_src_nodes
+
+    t.env.PIDL = os.path.join(bld.srcnode.abspath(), 'pidl/pidl')
     t.env.OPTIONS = TO_LIST(options)
 
     # this rather convoluted set of path calculations is to cope with the possibility
@@ -67,15 +77,14 @@ def SAMBA_PIDL(bld, pname, source,
     # gen_ndr directory we end up generating identical output in gen_ndr for the old
     # build system and the new one. That makes keeping things in sync much easier.
     # eventually we should drop the gen_ndr files in git, but in the meanwhile this works
-    outdir = bld.bldnode.name + '/' + bld.path.find_dir(output_dir).bldpath(t.env)
+    outdir = bld.path.find_dir(output_dir).abspath(t.env)
 
-    if not os.path.lexists(outdir):
+    if symlink and not os.path.lexists(outdir):
         link_source = os.path.normpath(os.path.join(bld.curdir,output_dir))
-        link_source = os_path_relpath(link_source, os.path.dirname(outdir))
         os.symlink(link_source, outdir)
 
     real_outputdir = os.path.realpath(outdir)
-    t.env.OUTPUTDIR = os_path_relpath(real_outputdir, bld.bldnode.name + '/..')
+    t.env.OUTPUTDIR = os_path_relpath(real_outputdir, os.path.dirname(bld.env.BUILD_DIRECTORY))
 
     if table_header_idx is not None:
         pidl_headers = LOCAL_CACHE(bld, 'PIDL_HEADERS')
@@ -111,15 +120,19 @@ def collect(self):
 
 
 def SAMBA_PIDL_TABLES(bld, name, target):
+    '''generate the pidl NDR tables file'''
     headers = bld.env.PIDL_HEADERS
+    bld.SET_BUILD_GROUP('main')
     t = bld(
             features = 'collect',
             rule     = '${SRC} --output ${TGT} | sed "s|default/||" > ${TGT}',
             ext_out  = '.c',
             before   = 'cc',
+            on_results = True,
             shell    = True,
             source   = '../../librpc/tables.pl',
             target   = target,
             name     = name)
+    t.env.LIBRPC = os.path.join(bld.srcnode.abspath(), 'librpc')
 Build.BuildContext.SAMBA_PIDL_TABLES = SAMBA_PIDL_TABLES