spack/lib/spack/docs/features.rst

109 lines
3.3 KiB
ReStructuredText
Raw Normal View History

2013-12-12 20:25:31 +08:00
Feature Overview
==================
2013-12-19 03:02:31 +08:00
This is a high-level overview of features that make Spack different
from other `package managers
<http://en.wikipedia.org/wiki/Package_management_system>`_ and `port
systems <http://en.wikipedia.org/wiki/Ports_collection>`_.
2013-12-12 20:25:31 +08:00
Simple package installation
----------------------------
2013-12-19 03:02:31 +08:00
Installing the default version of a package is simple. This will install
the latest version of the ``mpileaks`` package and all of its dependencies:
2013-12-12 20:25:31 +08:00
.. code-block:: sh
$ spack install mpileaks
Custom versions & configurations
-------------------------------------------
2013-12-19 03:02:31 +08:00
Spack allows installation to be customized. Users can specify the
version, build compiler, compile-time options, and cross-compile
platform, all on the command line.
2013-12-12 20:25:31 +08:00
.. code-block:: sh
# Install a particular version by appending @
$ spack install mpileaks@1.1.2
2013-12-19 03:02:31 +08:00
# Specify a compiler (and its version), with %
2013-12-12 20:25:31 +08:00
$ spack install mpileaks@1.1.2 %gcc@4.7.3
2013-12-19 03:02:31 +08:00
# Add special compile-time options with +
2013-12-12 20:25:31 +08:00
$ spack install mpileaks@1.1.2 %gcc@4.7.3 +debug
# Cross-compile for a different architecture with =
$ spack install mpileaks@1.1.2 =bgqos_0
2013-12-19 03:02:31 +08:00
Users can specify as many or few options as they care about. Spack
will fill in the unspecified values with sensible defaults.
2013-12-12 20:25:31 +08:00
Customize dependencies
-------------------------------------
2013-12-19 03:02:31 +08:00
Spack is unique in that it allows *dependencies* of a particualr
installation to be customized. Suppose that ``mpileaks`` depends
indirectly on ``libelf`` and ``libdwarf``. Using ``^``, users can add
custom configurations for the dependencies, as well:
2013-12-12 20:25:31 +08:00
.. code-block:: sh
# Install mpileaks and link it with specific versions of libelf and libdwarf
$ spack install mpileaks@1.1.2 %gcc@4.7.3 +debug ^libelf@0.8.12 ^libdwarf@20130729+debug
Non-destructive installs
-------------------------------------
2013-12-19 03:02:31 +08:00
Spack installs every unique package/dependency configuration into its
own prefix, so new installs will not break existing ones.
2013-12-12 20:25:31 +08:00
Packages can peacefully coexist
-------------------------------------
2013-12-19 03:02:31 +08:00
Spack avoids library misconfiguration by using ``RPATH`` to link
dependencies. When a user links a library or runs a program, it is
tied to the dependencies it was built with, so there is no need to
manipulate ``LD_LIBRARY_PATH`` at runtime.
2013-12-12 20:25:31 +08:00
Creating packages is easy
-------------------------------------
2013-12-19 03:02:31 +08:00
To create a new packages, all Spack needs is a URL for the source
archive. The ``spack create`` command will create a boilerplate
package file, and the package authors can fill in specific build steps
in pure Python.
2013-12-12 20:25:31 +08:00
.. code-block:: sh
2013-12-21 09:11:25 +08:00
$ spack create http://www.mr511.de/software/libelf-0.8.13.tar.gz
2013-12-12 20:25:31 +08:00
2013-12-21 09:11:25 +08:00
Creates ``libelf.py``:
2013-12-12 20:25:31 +08:00
.. code-block:: python
from spack import *
2013-12-21 09:11:25 +08:00
class Libelf(Package):
2013-12-12 20:25:31 +08:00
homepage = "http://www.example.com/"
2013-12-21 09:11:25 +08:00
url = "http://www.mr511.de/software/libelf-0.8.13.tar.gz"
versions = { '0.8.13' : '4136d7b4c04df68b686570afa26988ac' }
2013-12-12 20:25:31 +08:00
def install(self, prefix):
configure("--prefix=%s" % prefix)
make()
make("install")
2013-12-21 09:11:25 +08:00
It typically doesn't take much python coding to get from there to a
working package file:
.. literalinclude:: ../spack/packages/libelf.py
2013-12-19 03:02:31 +08:00
Spack also provides wrapper functions around common commands like
``configure``, ``make``, and ``cmake`` to make writing packages
simple.