The main GIMP building instructions are at Hacking:Building. This page is for Linux-specific additions to that page.
GIMP depends on a lot of other packages in addition to babl, gegl, libmypaint and mypaint-brushes. The requirements change frequently, but on a freshly installed Ubuntu 19.10 system in October 2019, this was enough for most of GIMP's dependencies (there are still a few missing formats, but it builds):
sudo apt install libtool intltool libjson-c-dev meson python3-venv \ python3-wheel cmake liblcms2-dev librsvg2-bin w3m libgtk2.0-dev \ gobject-introspection libjson-glib-dev libgirepository1.0-dev asciidoc \ ruby exiv2 libgexiv2-dev jasper liblensfun-dev libjpeg-dev \ libraw-dev librsvg2-dev libspiro-dev libtiff-dev libv4l-dev luajit \ libopenexr-dev libsdl2-dev libwebp-dev python-gi-dev libavcodec-dev \ libavformat-dev libavutil-dev libswscale-dev libumfpack5 libgtk-3-dev \ libbz2-dev libappstream-glib-dev libarchive-dev gtk-3-examples gjs \ libpoppler-glib-dev xsltproc gtk-doc-tools libaa1-dev \ libwebkit2gtk-4.0-dev libgudev-1.0-dev libwebkit2gtk-4.0-dev libgs-dev \ libopenjp2-7-dev libmng-dev libheif-dev