---
title: Operating System dependencies
sort_info: 300
---
Autoproj offers the possibility to use OS-packaged software instead of building
it, to leverage the underlying platform's software. This page details how it's
done.
Defining dependencies between source packages and OS packages
-------------------------------------------------------------
If a source package depends on an OS package, this dependency should be declared
in the same way than between source packages:
* either by adding the tag in the
manifest.xml, or
* by calling #depends_on("os_dep_name") in the autobuild file.
The os_dep_name above being the name of the package as declared in the OS
dependencies files defined below.
During the build, autoproj looks first for OS dependencies. If no dependency is
available for that particular platform, it will then look for a source package
definition and build it. If none of the two exist, an error is returned.
OS packages
-----------
The general format of the an OS package definition:
~~~~~~~~~~~~~~~~~~
name:
distribution1,distribution2:
version1,version2: [package_name1, package_name2]
~~~~~~~~~~~~~~~~~~
Where 'name' is the name used to declare the dependency (see above), `distribution`
the name of the distribution and version the
distribution's version, and package_name the name of the package in
the underlying OS.
Since the osdeps file is a YAML file, it could also be written
~~~~~~~~~~~~~~~~~~
name:
distribution1,distribution2:
version1,version2:
- package_name1
- package_name2
~~~~~~~~~~~~~~~~~~
If only one package needs to be installed, one can use the shortcut
~~~~~~~~~~~~~~~~~~
name:
distribution1,distribution2:
version1,version2: package_name
~~~~~~~~~~~~~~~~~~
Finally, if the package name is version-independent, the version can be omitted:
~~~~~~~~~~~~~~~~~~
name:
distribution1,distribution2: package_name
~~~~~~~~~~~~~~~~~~
Examples:
~~~~~~~~~~~~~~~~~~
ruby:
debian,ubuntu:
9.04,10.04,sid: libruby-dev
boost:
debian:
- libboost1.38-dev
- libboost-program1.38-dev
ubuntu:
9.04,10.04: libboost-dev
~~~~~~~~~~~~~~~~~~
At the time of this writing, autoproj is able to install packages on
Ubuntu/Debian and Gentoo. Support for other operating systems can be easily
added, so [contact me](http://github.com/doudou) if you want to do so.
RubyGems packages
-----------------
RubyGems packages are OS-independent. In the osdeps files, they can be referred
to by replacing the OS distribution name by 'gem'.
Example:
~~~~~~~~~~~~~~~~~~
hoe:
gem:
hoe
~~~~~~~~~~~~~~~~~~
If the OS dep name and the RubyGems name are the same, one can use the shortcut
~~~~~~~~~~~~~~~~~~
hoe: gem
~~~~~~~~~~~~~~~~~~
Note that it is possible to use a mixture of RubyGems and OS packages. For
instance, the following snippet will both install the gnuplot package and the
gnuplot RubyGems whenever an osdep on 'gnuplot' is declared.
~~~~~~~~~~~~~~~~~~
gnuplot:
gem: gnuplot
debian: gnuplot
~~~~~~~~~~~~~~~~~~
Ignoring some dependencies
--------------------------
It is possible that, on some operating systems, a given package should simply be
ignored. To do so, simply use the 'ignore' keyword. Example:
~~~~~~~~~~~~~~~~~~
gnuplot:
gem: gnuplot
debian: ignore
ubuntu: gnuplot
~~~~~~~~~~~~~~~~~~