bz2 patch applied, but unfortunately it is not possible to do the same thing with jpeg - its internal headers lack include guards, and even with them, it is not possible to mix files beacause of #defines.
Maybe the solution here is to add proxy .c files for all jpeg sources...