Speeding up building debian packages
I have been away to blogging for a while and but am planning to write more on the work I do so that it may be useful to others and definitely useful when I read back.
As part of my work, I was building debian browser packages, which is firefox-esr.
We are bringing lots of the changes in the default settings, security and privacy and also changes on the branding.
The main problem that happens when building such big package is build time it takes for a complete build, for firfox-esr it takes 2.5 hrs on a i7 machine.
The best we can do reduce the time is to let the compiler to compile only the modified changes which are minimal in nature rather compiling the entire sources.
I have come across the ccache which is the best friend in this case. First make sure you have ccache installed on your debian machine.
sudo apt-get install ccache
Then if you are building the package first time use the following command.
debuild --preserve-envvar=CCACHE_DIR --prepend-path=/usr/lib/ccache -b -uc -us
In the above command I am build the debian package using debuild, the options
--preserve-envvar=CCACHE_DIR --prepend-path=/usr/lib/cache is passed to the ccache
The other option -b is to instruct to build only .deb packages and -uc -us are for building the unsigned packages
Please remember there won't be any error message if you don't have the ccache installed but then the recomilation takes complete rebuild.
I jumped to ccache without explaining about debian packages intro which I will add in later blogs.