For .deb look at the "dh_make" tool and some of the packaging guides.