The following provides the links to the Motion releases, source code, build instructions and scripts to build deb files.

Releases Source Code Repository
Build Guide(version 4.7.x) Build Guide(version 5)
Deb Creation Script