I too was looking for a favicon solution and didn't want to rely on any third party web services. I couldn't find any generic solutions that would work as a simple build step so I created faviconbuild. It relies on ImageMagick so you can download the latest version of that for your system or use some I have provided in my releases.
I have released it under the MIT license so anyone is free to use it for commercial or personal use, or simply get some inspiration from it. If you find any bugs or want to extend it feel free to get involved.
I will be updating the project page with more detailed information, but it already has a really handy and standard help menu and works on Unix, Mac, and Windows.
You simply run either the .bat or .sh script in your terminal.
ex for Windows:
or for Unix / Mac (or Windows if using Cygwin):
This will give you the version information along with the available options. The script is designed to take an input image and output all the various images required along with the required html markup to include on your website.
This is an example of how I am using it in one of my project currently:
./faviconbuild/faviconbuild.sh -i ./source.png
I simply placed the faviconbuild folder into a project specific folder so I didn't have to touch the actual project files and along side that I placed my source.png. The default behavior of the script is to put everything into a nested build folder that is gitignored so it doesn't clash with the project if you are using git.
If I am missing anything please submit a feature request.
I also have a blog post with more information.
I hope you find this useful.