Building LevelDB Debian (.deb) packages

Problem:

You intend to install LevelDB, but you don’t want to manually install & compile it as described here.

Instead, you just want to use the debian packaging system and some reproducible method of creating a DEB package from LevelDB.

Reasons for preferring not to compile & install manually could be:

  • You want to deploy LevelDB to one ore more environments that don’t have a complete build environment
  • You prefer a clean install-uninstall-purge package lifetime management
  • You need a reproducible process to deploy LevelDB

Solution:

You can use the script listed here in order to build your own deb package.

In order to run this script, you need to install some dependencies first.

sudo apt-get install devscripts debhelper libsnappy-dev

Keep in mind, however, that this script doesn’t generate a package that conforms to the debian packaging specifications – the changelog just contains a dummy message, no maintainer is given etc.

The script always compiles LevelDB with Snappy support, therefore the packages can’t be installed without Snappy. Note that the libsnappy-dev package is only present in Ubuntu, for Debian you need to install Snappy manually and/or remove the snappy dependency in the build script.

Just place it in a (preferably empty) directory of your choice and execute it – LevelDB is downloaded and built automatically. After finishing, three deb files (containing the library, C++ headers and documentation) plus some debuild meta files should be present in the directory you placed the script in. If this is not the case, please read the error messages and act accordingly.

See http://wiki.debian.org/IntroDebianPackaging for a general introduction to debian packaging. You might need deeper knowledge of deb package building to understand and modify the script.

The script has been tested on Ubuntu 12.04 and Ubuntu 13.04.

The script is hosted on my deb-buildscripts repository, which now contains different scripts for standalone builds of different software as deb without special prerequisites.

Click this link to see the script: deb-leveldb.sh