Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r51853 - in sandbox/SCons: . tools/scons
From: loonycyborg_at_[hidden]
Date: 2009-03-19 08:57:08


Author: loonycyborg
Date: 2009-03-19 08:57:06 EDT (Thu, 19 Mar 2009)
New Revision: 51853
URL: http://svn.boost.org/trac/boost/changeset/51853

Log:
Added --install option.

Text files modified:
   sandbox/SCons/SConstruct | 5 ++++-
   sandbox/SCons/tools/scons/boost-libs.py | 30 +++++++++++++++++++++++++++++-
   2 files changed, 33 insertions(+), 2 deletions(-)

Modified: sandbox/SCons/SConstruct
==============================================================================
--- sandbox/SCons/SConstruct (original)
+++ sandbox/SCons/SConstruct 2009-03-19 08:57:06 EDT (Thu, 19 Mar 2009)
@@ -7,7 +7,8 @@
     ListVariable("link", "Library linking", "all", ["static", "dynamic"]),
     ListVariable("threading", "Multi-threading support", "multi", ["single", "multi"]),
     EnumVariable("layout", "Layout of library names and header locations", "versioned", ["versioned", "system"]),
- PathVariable("stagedir", "If --stage is passed install only compiled library files in this location", "stage", PathVariable.PathAccept)
+ PathVariable("stagedir", "If --stage is passed install only compiled library files in this location", "stage", PathVariable.PathAccept),
+ PathVariable("prefix", "Install prefix", "/usr/local", PathVariable.PathAccept)
 )
 env = Environment(toolpath = ["tools/scons"], tools = ["default", "boost-libs", "boost-build-variants", "boost-configure"], variables = vars, config_log = "$BOOST_BUILD_DIR/config.log")
 vars.Save("build-config.py", env)
@@ -29,3 +30,5 @@
 SConsignFile(File(env.subst("$BOOST_BUILD_DIR/sconsign.dblite")).path)
 
 SConscript("libs/SConscript")
+
+Alias("install-headers", env.Install("$prefix/include", "boost"))

Modified: sandbox/SCons/tools/scons/boost-libs.py
==============================================================================
--- sandbox/SCons/tools/scons/boost-libs.py (original)
+++ sandbox/SCons/tools/scons/boost-libs.py 2009-03-19 08:57:06 EDT (Thu, 19 Mar 2009)
@@ -1,6 +1,6 @@
 # vi: syntax=python:et:ts=4
 import distutils.sysconfig
-from SCons.Script import AddOption
+from SCons.Script import AddOption, COMMAND_LINE_TARGETS, BUILD_TARGETS
 
 def BoostLibrary(env, lib, sources):
     if env["LINK_DYNAMIC"]:
@@ -11,6 +11,9 @@
     if env.GetOption("stage"):
         env.Alias(lib, env.Install(env.Dir("$stagedir", "#"), lib_node))
     env.Default(env.Alias(lib, lib_node))
+
+ if env.GetOption("install"):
+ env.Alias(lib, env.Install("$prefix/lib", lib_node))
     return lib_node
 
 def BoostUseLib(env, lib):
@@ -25,6 +28,25 @@
             env.SharedLibrary(lib, sources, SHLIBPREFIX='', SHLIBSUFFIX=distutils.sysconfig.get_config_var("SO"), **kw)
             )
 
+def boost_copy_func(dest, source, env):
+ import os, stat, shutil
+
+ if os.path.isdir(source):
+ if os.path.exists(dest):
+ if not os.path.isdir(dest):
+ raise SCons.Errors.UserError, "cannot overwrite non-directory `%s' with a directory `%s'" % (str(dest), str(source))
+ else:
+ os.makedirs(dest)
+ for file in os.listdir(source):
+ if file == ".svn": continue
+ boost_copy_func(os.path.join(dest, file), os.path.join(source, file), env)
+ else:
+ shutil.copy2(source, dest)
+ st = os.stat(source)
+ os.chmod(dest, stat.S_IMODE(st[stat.ST_MODE]) | stat.S_IWRITE)
+
+ return 0
+
 def exists(env):
     return True
 
@@ -33,4 +55,10 @@
     env.AddMethod(BoostUseLib)
     env.AddMethod(PythonExtension)
 
+ env["INSTALL"] = boost_copy_func
+
     AddOption('--stage', dest='stage', action="store_true")
+ AddOption('--install', dest='install', action="store_true")
+
+ if env.GetOption("install"):
+ BUILD_TARGETS.extend(env.Alias("install-headers"))


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk