Downloading Tools

Compiler

sudo apt-get install build-essential

CMake

Note that CMake 3.18 or greater is required

sudo apt-get install cmake

or

Download install script from https://cmake.org/download/ and install into /usr

Downloading Gerbera Source

cd build-area

git clone https://github.com/gerbera/gerbera.git

Installing Dependencies 

Check https://docs.gerbera.io/en/stable/compile.html

sudo apt-get install -y uuid-dev libsqlite3-dev libmysqlclient-dev libmagic-dev \

libexif-dev libcurl4-openssl-dev libspdlog-dev libpugixml-dev libavutil-dev \

libavcodec-dev libavformat-dev libavdevice-dev libavfilter-dev libavresample-dev \

libswscale-dev libswresample-dev libpostproc-dev duktape-dev libmatroska-dev \

libsystemd-dev libtag1-dev ffmpeg


Installing npupnp

sudo apt-get install autoconf automake libtool

sudo apt-get install lpkg-config libexpat1-dev libmicrohttpd-dev libcurl4-gnutls-dev

git clone https://framagit.org/medoc92/npupnp.git

cd npupnp

./autogen.sh

./configure --prefix=/usr

make

sudo make install


Rebuild spdlog

git clone https://github.com/gabime/spdlog

cd spdlog

cmake -D "SPDLOG_FMT_EXTERNAL:BOOL=true" .

make

sudo make install

cd ..


Installing libfmt

sudo apt-get install libfmt-dev

or

git clone https://github.com/fmtlib/fmt

cd fmt

cmake .

make

sudo make install

cd ..


Build libupnp

wget "https://github.com/pupnp/pupnp/releases/download/release-1.14.10/libupnp-1.14.10.tar.bz2" -O libupnp-1.14.10.tar.bz2

tar -xf libupnp-1.14.10.tar.bz2

cd libupnp-1.14.10

./configure --enable-ipv6 --enable-reuseaddr

make

sudo make install

cd ..


Compiling

mkdir build
cd build
cmake .. -DWITH_JS=1 -DWITH_NPUPNP-DWITH_CURL=1 -DWITH_TAGLIB=1 -DWITH_WAVPACK=1 -DWITH_MAGIC=1 -DWITH_MATROSKA=1 -DWITH_AVCODEC=1 -DWITH_EXIF=1 -DWITH_EXIV2=1 -DWITH+FFMPEGTH=1 -DWITH_INOTIFY=1 | tee cmake.log 2>&1
make -j4 | tee make.log 2>&1