summaryrefslogtreecommitdiff
path: root/site_scons/site_tools/convlib.py
diff options
context:
space:
mode:
Diffstat (limited to 'site_scons/site_tools/convlib.py')
-rw-r--r--site_scons/site_tools/convlib.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/site_scons/site_tools/convlib.py b/site_scons/site_tools/convlib.py
new file mode 100644
index 0000000..3c174e2
--- /dev/null
+++ b/site_scons/site_tools/convlib.py
@@ -0,0 +1,30 @@
+# -*- coding: utf-8 -*-
+# -*- python -*-
+import SCons
+
+def generate(env, **kwargs):
+ """This is a utility function that creates the ConvenienceLibrary
+ Builder in an Environment if it is not there already.
+
+ If it is already there, we return the existing one.
+
+ Based on the stock StaticLibrary and SharedLibrary builders.
+ """
+ try:
+ convenience_lib = env['BUILDERS']['ConvenienceLibrary']
+ except KeyError:
+ action_list = [ SCons.Action.Action ("$ARCOM", "$ARCOMSTR") ]
+ if env['BUILDERS'].has_key('RANLIB'):
+ ranlib_action = SCons.Action.Action("$RANLIBCOM", "$RANLIBCOMSTR")
+ action_list.append(ranlib_action)
+
+ convenience_lib = SCons.Builder.Builder (action = action_list,
+ emitter = '$LIBEMITTER',
+ prefix = '$LIBPREFIX',
+ suffix = '$LIBSUFFIX',
+ src_suffix = '$SHOBJSUFFIX',
+ src_builder = 'SharedObject')
+ env['BUILDERS']['ConvenienceLibrary'] = convenience_lib
+
+def exists(env):
+ return True