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-0.98.1.tar.gz or scons-0.98.1.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-0.98.1, usually in your local directory. Then change your working directory to that directory and install SCons by executing the following commands:
# cd scons-0.98.1 # python setup.py install
This will build SCons, install the scons script in the default system scripts directory (/usr/local/bin or C:\Python2.2\Scripts), and will install the SCons build engine in an appropriate stand-alone library directory (/usr/local/lib/scons or C:\Python2.2\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-0.98.1 or C:\Python2.2\scons-0.98.1 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-0.98.1.
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.