This patch improves loading time of Samba 4 binaries a bit. This is
a rude hack that involves lorder(1) to change order of object files
being linked. Unfortunately, it cannot be used to reorder libraries,
i.e., the "-lfoo" items.
Bad thing is that we inject shell code into command line, which
forces us to switch shell=False to shell=True.
I have at least samba-4.0.17 compiled with this patch, and results are
promising a bit: ~15 secs instead of 30-60 secs previously.
If this is considered a good idea, I'll work on reordering of -lfoo.
--
WBR,
Vadim Zhukov
Index: patches/patch-buildtools_wafadmin_Tools_cc_py
===================================================================
RCS file: patches/patch-buildtools_wafadmin_Tools_cc_py
diff -N patches/patch-buildtools_wafadmin_Tools_cc_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-buildtools_wafadmin_Tools_cc_py 19 May 2014 14:45:35
-0000
@@ -0,0 +1,16 @@
+$OpenBSD$
+Reorder object files to minimize library interrefs count.
+Speeds up loading of library files.
+--- buildtools/wafadmin/Tools/cc.py.orig Mon May 19 17:29:02 2014
++++ buildtools/wafadmin/Tools/cc.py Mon May 19 18:05:26 2014
+@@ -93,8 +93,8 @@ cls = Task.simple_task_type('cc', cc_str, 'GREEN', ext
+ cls.scan = ccroot.scan
+ cls.vars.append('CCDEPS')
+
+-link_str = '${LINK_CC} ${CCLNK_SRC_F}${SRC}
${CCLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}'
+-cls = Task.simple_task_type('cc_link', link_str, color='YELLOW', ext_in='.o',
ext_out='.bin', shell=False)
++link_str = '${LINK_CC} ${CCLNK_SRC_F} `set -- ${SRC}; test $# -gt 0 && lorder
"$@" | tsort -q` ${CCLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}'
++cls = Task.simple_task_type('cc_link', link_str, color='YELLOW', ext_in='.o',
ext_out='.bin', shell=True)
+ cls.maxjobs = 1
+ cls.install = Utils.nada
+
Index: patches/patch-buildtools_wafadmin_Tools_cxx_py
===================================================================
RCS file: patches/patch-buildtools_wafadmin_Tools_cxx_py
diff -N patches/patch-buildtools_wafadmin_Tools_cxx_py
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-buildtools_wafadmin_Tools_cxx_py 19 May 2014 14:45:35
-0000
@@ -0,0 +1,14 @@
+$OpenBSD$
+Reorder object files to minimize library interrefs count.
+Speeds up loading of library files.
+--- buildtools/wafadmin/Tools/cxx.py.orig Mon May 19 18:30:35 2014
++++ buildtools/wafadmin/Tools/cxx.py Mon May 19 18:31:28 2014
+@@ -97,7 +97,7 @@ cls = Task.simple_task_type('cxx', cxx_str, color='GRE
+ cls.scan = ccroot.scan
+ cls.vars.append('CXXDEPS')
+
+-link_str = '${LINK_CXX} ${CXXLNK_SRC_F}${SRC}
${CXXLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}'
++link_str = '${LINK_CXX} ${CXXLNK_SRC_F} `set -- ${SRC}; test $# -gt 0 &&
lorder "$@" | tsort -q` ${CXXLNK_TGT_F}${TGT[0].abspath(env)} ${LINKFLAGS}'
+ cls = Task.simple_task_type('cxx_link', link_str, color='YELLOW',
ext_in='.o', ext_out='.bin', shell=False)
+ cls.maxjobs = 1
+ cls.install = Utils.nada