Compiling LXD on Devuan

About a year ago I've posted on the lxc-users mailing-list how I've managed to successfully compile and run LXD on Devuan Jessie (the same applies to Debian Jessie).
During last year some things changed and people asked me how to compile LXD 2.x on Jessie, so I'm explaining how to do it.

Preparatory actions

First of all the golang compiler and the lxc library have to be installed from backports in order to be able to compile LXD:
# apt-get install golang-go liblxc1
To successfully compile LXD also some headers and a pkgconfig's file have to be installed in the system. Headers and pkgconfig's file are prepared getting lxc's sources from backports and compiling them:
# apt-get source lxc
# apt-get build-dep lxc
$ cd /usr/src/lxc-2.0.0/
$ dpkg-buildpackage -b
once compiled the files have to be copied in the right directory in /usr/local/:
$ mkdir /usr/local/share/pkgconfig
$ cp -a lxc.pc /usr/local/share/pkgconfig
$ cp -ar src/lxc /usr/local/include
Linking liblxc.so to liblxc.so.1.2.0 is also needed to let the linker find the library, installed with liblxc1 package, during compilation:
# cd /usr/lib/x86_64-linux-gnu/
# ln -s liblxc.so.1.2.0 liblxc.so

LXD compiling and packaging

Download LXD sources (v.2.0.3 at the time of writing) and untar them:
$ cd /usr/src
$ wget https://linuxcontainers.org/downloads/lxd/lxd-2.0.3.tar.gz
$ tar -zxvf lxd_2.0.3.tar.gz
copy my prepared debian directory in sources's one and update changelog and control files:
$ cd lxd-2.0.3
$ tar -xvf ../lxd-debian.tar
$ $EDITOR debian/changelog
$ $EDITOR debian/control
so prepare packages:
$ dpkg-buildpackage -b
if all is ok in /usr/src there will be five packages ready to be installed:
 176286  golang-github-lxc-lxd-dev_2.0.3_all.deb
   4408  lxc2_2.0.3_all.deb
4058778  lxd_2.0.3_amd64.deb
1836780  lxd-client_2.0.3_amd64.deb
1354034  lxd-tools_2.0.3_amd64.deb
If you need some help drop me an email, or better post on lxc mailing list and I'll be happy to try to help you.