I kept the patches in separate files as they have different purposes and the second one will most likely be fixed by upstream soon. I wrote the code according to the guide at http://devmanual.gentoo.org/ebuild-writing/functions/src_prepare/epatch/

I've merged both sed invocations.