The sf2text utility by Takashi Iwai that I've mentioned earlier does not directly generate an .ins file, but you can certainly convert the SF2 structure to text with it. Another related utility by the same autor is sftovkb, which is included in his
vkeybd program. They do not directly give you the final result, but the programs are open source, and easy to understand plain C code. The vkeybd program is a classic virtual keyboard for Linux, that was an inpiration for my VMPK, which also contains
a class to parse SF2 and other formats and generate an .ins file, but it doesn't export the drum names, only the patch names.
Anyway, my advice is to use some existing code as inspiration to parse the SF2 format, and write a conversion utility yourself.