build: finally got LIBRARY<->LIBRARY reductions working
authorAndrew Tridgell <tridge@samba.org>
Tue, 30 Mar 2010 12:08:01 +0000 (23:08 +1100)
committerAndrew Tridgell <tridge@samba.org>
Tue, 6 Apr 2010 10:27:20 +0000 (20:27 +1000)
the install size is now 100M

buildtools/wafsamba/samba_deps.py

index ef0bc793ae2d71e53e8ea2e977f71de711722cc1..674dc0725451aa0e796a255b8bf29908a90b3b1f 100644 (file)
@@ -603,7 +603,9 @@ def calculate_final_deps(bld, tgt_list, loops):
                     dependency_loop(loops, t, t2.sname)
                     t2.final_libs.remove(t.sname)
 
-    for type in ['BINARY', 'PYTHON']:
+    rely_on = {}
+
+    for type in ['BINARY', 'PYTHON', 'LIBRARY']:
         for t in tgt_list:
             if t.samba_type != type: continue
             # if we will indirectly link to a target then we don't need it
@@ -617,15 +619,23 @@ def calculate_final_deps(bld, tgt_list, loops):
                           t.sname, t.samba_type, dup, t2.samba_type, l)
                     new = new.difference(dup)
                     changed = True
+                    if not l in rely_on:
+                        rely_on[l] = set()
+                    rely_on[l] = rely_on[l].union(dup)
             t.final_objects = new
 
+    # add back in any objects that were relied upon by the reduction rules
+    for r in rely_on:
+        t = bld.name_to_obj(r, bld.env)
+        t.final_objects = t.final_objects.union(rely_on[r])
+
     for loop in loops:
         debug('deps: Found dependency loops for target %s : %s', loop, loops[loop])
 
     # we now need to make corrections for any library loops we broke up
     # any target that depended on the target of the loop and doesn't
     # depend on the source of the loop needs to get the loop source added
-    for type in ['BINARY','PYTHON','LIBRARY']:
+    for type in ['BINARY','PYTHON','LIBRARY','BINARY']:
         for t in tgt_list:
             if t.samba_type != type: continue
             for loop in loops: