motion

# Installing and Building from Source

### Installing with a release deb package

motion can also be installed from the release deb files. Download the appropriate deb from the Releases page and install using `dpkg` or `gdebi-core`.

### Building a deb package

A script has also been written to allow users to create their own deb package from either a tagged release or the most current master branch of the code. Download the script by using the following command. `wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/builddeb.sh`

Review the script and specify the following few optional parameters. `Username, EmailAddress, branch, install, arch`. If the parameters are not provided, the script will create defaults.

Once the script has been run and the deb file is created, install it as described above.

### Building Guide

Debian based distros

`sudo apt install autoconf automake autopoint build-essential pkgconf libtool libzip-dev libjpeg-dev git libavformat-dev libavcodec-dev libavutil-dev libswscale-dev libavdevice-dev libopencv-dev libwebp-dev gettext libmicrohttpd-dev libmariadb-dev libcamera-dev libcamera-tools libcamera-v4l2 libasound2-dev libpulse-dev libfftw3-dev`

Note: PostgreSQL or Sqlite3 database may also be added via `sudo apt install libpq-dev libsqlite3-dev`. If no database is running on the system, some functionality of motion will not be available.

Once packages are installed, run the following to build motion

`cd ~`
`git clone https://github.com/Motion-Project/motion.git`
`cd motion`
`autoreconf -fiv`
`./configure`
`make`
`make install`

### Additional Configure Options

The following custom configure options can be specified for motion.

Options | Description | Editors comment
--without-v4l2 | Exclude v4l2 |
--without-webp | Compile without webp image support |
--with-libcam=DIR | Specify the pkgconf dir for libcam | Use --without-libcam to disable
--with-ffmpeg=DIR | Specify the pkgconf dir for ffmpeg. | ffmpeg is required
--with-opencv=DIR | Specify the pkgconf dir for opencv. | Use --without-opencv to disable
--with-mariadb=DIR | Specify the pkgconf DIR for MariaDB | Use --without-mariadb to disable
--with-mysql=DIR | Specify the pkgconf dir for mysql | Use --without-mysql to disable
--with-pgsql=DIR | Specify the pkgconf DIR for PostgreSQL | Use --without-pgsql to disable
--with-sqlite3=DIR | Specify the pkgconf DIR for sqlite3. | Use --without-sqlite3 to disable
--with-pulse=DIR | Specify the pkgconf DIR for PulseAudio. | Use --without-pulse to disable
--with-alsa=DIR | Specify the pkgconf DIR for alsa. | Use --without-alsa to disable
--with-fftw3=DIR | Specify the pkgconf DIR for fftw3. | Use --without-fftw3 to disable
--with-developer-flags | Add additional warning flags for the compiler. |

### Additional Make Options

make cleanall
  This command creates a pristine directory without any of the files generated from the `autoreconf` command.

make maintainer-check
  Executes multiple configure and make using the developer flags for various combinations of the options.

make maintainer-clang
  Compile using clang.