The following set of patches has already been sent to emacs-devel, but since nobody has time to review them I opening a bug report to keep track of their inclusion. The purpose is to have a `byte-recompile-file' function, and patch 2 to 4 makes use of it in several places.