Follow the ffmpeg compilation guide here: https://trac.ffmpeg.org/wiki/CompilationGuide/Ubuntu
copy "lib" and "include" directories from NDI sdk to ffmpeg_sources/ndi
use this modified build command:
cd ~/ffmpeg_sources && wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 && tar xjvf ffmpeg-snapshot.tar.bz2 && cd ffmpeg && PATH="$HOME/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --pkg-config-flags="--static" --extra-cflags="-I$HOME/ffmpeg_build/include -I$HOME/ffmpeg_sources/ndi/include" --extra-ldflags="-L$HOME/ffmpeg_build/lib -L$HOME/ffmpeg_sources/ndi/lib/x86_64-linux-gnu" --extra-libs="-lpthread -lm" --bindir="$HOME/bin" --enable-gpl --enable-libass --enable-libfreetype --enable-libvorbis --enable-libx264 --enable-libx265 --enable-libndi_newtek --enable-nonfree && PATH="$HOME/bin:$PATH" make -j4 && make install && hash -r
(I omitted some libraries I do not need, --enable what suits you better)