Take a look at the way various distributions package libcap and upstream anything that makes sense. https://sources.debian.org/patches/libcap2/1:2.44-1/
This is what gentoo uses: https://gitweb.gentoo.org/repo/gentoo.git/tree/sys-libs/libcap/files/libcap-2.52-build-system-fixes.patch
https://sources.debian.org/src/libcap2/1:2.44-1/debian/rules/ seems to be stuck in the rut of thinking 'make test' requires root. Whereas, 'make sudotest' was, at some point factored out in order for 'make test' to be runnable as anyone.
I've dropped the use of IPATH and replaced it with CPPFLAGS in approximately the way it was done in the gentoo patch: https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=d21a561ddb80cdc039f32eb5225f5d398d221291
This is what archlinux uses: https://github.com/archlinux/svntogit-packages/tree/master/libcap/trunk
KaOSx libcap has a nice build file with one stale dependency: https://github.com/KaOSx/core/issues/28
T2 SDE (http://t2sde.org/packages/libcap) seems to be carrying this patch: http://svn.exactcode.de/t2/trunk/package/base/libcap/hotfix.patch
The T2 patch looks stale to me. It checks for something that is now always defined from the previous lines of the cap_file.c.
https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=a0aaea6e27df499c4d3c548af16e3727b99ca918 https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=935ab8f7cd332f958738c5c90d88dc2111187594 https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=04f903f9155b23a6a9f0dd972b448ada5bfc5f82 https://git.kernel.org/pub/scm/libs/libcap/libcap.git/commit/?id=7a75dbc2bb0cc46666572845704b1764ab38a4bc