fbi-1.31.ebuild has a hardcoded dependency on both libungif and giflib. This is not necessary.
Created attachment 50190 [details, diff] this patch makes fbi depend on either giflib or libungif I tested this patch twice, having only giflib installed the first time and libungif the second time. Works fine here.
Actually, it's not that easy. Please notice that with only giflib installed, gif.c never gets compiled and with only libungif installed, the compilation fails (bug #78243).
I knew about bug #78243, but I couldn't reproduce it the other day. Now I even know why :) I just looked into this again, and you are partially right: Compilation fails if giflib is not installed _and_ USE=gif is set. This is the relevant line from the libungif ebuild: use gif && rm -r "${D}"/usr/bin "${D}"/usr/include/gif_lib.h It removes gif_lib.h, assuming giflib already provides it. fbi then fails to include the header. The fbi makefile only checks for libungif and ignores giflib as you rightly pointed out. fbi compiles fine with gif_lib.h from libungif (just tested). fbi should check the gif useflag and depend on both libgif and libungif if the flag is set, and on only libungif is the flag is not set. I could imagine that there are other ebuilds in the tree that trip over giflib/libungif madness. It's a nuisance, really. Damn patents... There actually is an open bug on this: bug #18820
If the 'gif' flag is not set, fbi shouldn't depend on either library, as it is likely that the user simply doesn't want support for the GIF fileformat.
that's exactly why the gif useflag is currently ambigious. again, please see bug #18820 and add your comments.
Fixed in -r1.