If a pre-built SCons package is not available for your system,
then you can still easily build and install SCons using the native
Python distutils
package.
The first step is to download either the
scons-3.0.0.tar.gz
or scons-3.0.0.zip
,
which are available from the SCons download page at
http://www.scons.org/download.html.
Unpack the archive you downloaded,
using a utility like tar
on Linux or UNIX,
or WinZip on Windows.
This will create a directory called
scons-3.0.0
,
usually in your local directory.
Then change your working directory to that directory
and install SCons by executing the following commands:
#cd scons-3.0.0
#python setup.py install
This will build SCons,
install the scons
script
in the python which is used to run the setup.py's scripts directory
(/usr/local/bin
or
C:\Python25\Scripts
),
and will install the SCons build engine
in the corresponding library directory for the python used
(/usr/local/lib/scons
or
C:\Python25\scons
).
Because these are system directories,
you may need root (on Linux or UNIX) or Administrator (on Windows)
privileges to install SCons like this.
The SCons setup.py
script
has some extensions that support
easy installation of multiple versions of SCons
in side-by-side locations.
This makes it easier to download and
experiment with different versions of SCons
before moving your official build process to a new version,
for example.
To install SCons in a version-specific location,
add the --version-lib
option
when you call setup.py
:
# python setup.py install --version-lib
This will install the SCons build engine
in the
/usr/lib/scons-3.0.0
or
C:\Python25\scons-3.0.0
directory, for example.
If you use the --version-lib
option
the first time you install SCons,
you do not need to specify it each time you install
a new version.
The SCons setup.py
script
will detect the version-specific directory name(s)
and assume you want to install all versions
in version-specific directories.
You can override that assumption in the future
by explicitly specifying the --standalone-lib
option.
You can install SCons in locations other than
the default by specifying the --prefix=
option:
# python setup.py install --prefix=/opt/scons
This would
install the scons script in
/opt/scons/bin
and the build engine in
/opt/scons/lib/scons
,
Note that you can specify both the --prefix=
and the --version-lib
options
at the same type,
in which case setup.py
will install the build engine
in a version-specific directory
relative to the specified prefix.
Adding --version-lib
to the
above example would install the build engine in
/opt/scons/lib/scons-3.0.0
.
If you don't have the right privileges to install SCons
in a system location,
simply use the --prefix=
option
to install it in a location of your choosing.
For example,
to install SCons in appropriate locations
relative to the user's $HOME
directory,
the scons
script in
$HOME/bin
and the build engine in
$HOME/lib/scons
,
simply type:
$ python setup.py install --prefix=$HOME
You may, of course, specify any other location you prefer,
and may use the --version-lib
option
if you would like to install version-specific directories
relative to the specified prefix.
This can also be used to experiment with a newer
version of SCons than the one installed
in your system locations.
Of course, the location in which you install the
newer version of the scons
script
($HOME/bin
in the above example)
must be configured in your PATH
variable
before the directory containing
the system-installed version
of the scons
script.