These two threads where Thorsten took the time to actually answer how addons work should be a very good starting point:
If you search around you should also find a python script that bundles such a package for you on this board from a community member.