Well, we will need more info to help you.
Do you need to build a RPM (so that gcc-4.2 can be installed on many computers), or do you need it only on your machine (in that case you should just try to compile it, without bothering with a RPM)?
If you need to compile it, there should be some info in the source of gcc-4.2 (although I have no clue how it should be compiled, I'm used to using gcc to compile stuff :p).
If you want to create a RPM, you can have a look at
http://wiki.mandriva.com/en/Mandriva_RPM_HOWTOYou may also try to download an already packaged gcc-4.2 (I'm pretty sure there was gcc-4.2 in a former Mandriva) and to adapt its spec file for Mageia, I guess. I'm not a packager myself so I may be wrong.