Ubuntu Packaging Guide - rules
< Continued from page 1
&& mv usr/info usr/man usr/share cp -a NEWS debian/copyright $(docdir) cp -a debian/changelog $(docdir)/changelog.Debian cp -a ChangeLog $(docdir)/changelog cd $(docdir) && gzip -9 changelog changelog.Debian gzip -r9 debian/tmp/usr/share/man gzip -9 debian/tmp/usr/share/info/* dpkg-shlibdeps debian/tmp/usr/bin/hello dpkg-gencontrol -isp chown -R root:root debian/tmp chmod -R u+w,go=rX debian/tmp dpkg --build debian/tmp ..
First, notice that this rule calls the checkroot rule to make sure the package is built as root and calls the build rule to compile the source. Then the debian/tmp/DEBIAN and debian/tmp/usr/share/doc/hello files are created, and the postinst and the prerm> scripts are installed to debian/tmp/DEBIAN. Then make install is run with a prefix that installs to the debian/tmp/usr directory. Afterward the documentation files (NEWS, ChangeLog, and the debian changelog) are gzipped and installed. dpkg-shlibdeps is invoked to find the shared library dependencies of the hello executable, and it stores the list in the debian/substvars file for the ${shlibs:Depends} variable in control. Then dpkg-gencontrol is run to create a control file for the binary package, and it makes the substitutions created by dpkg-shlibdeps. Finally, after the permissions of the debian/tmp have been set, dpkg --build is run to build the binary .deb package and place it in the parent directory.
&& mv usr/info usr/man usr/share cp -a NEWS debian/copyright $(docdir) cp -a debian/changelog $(docdir)/changelog.Debian cp -a ChangeLog $(docdir)/changelog cd $(docdir) && gzip -9 changelog changelog.Debian gzip -r9 debian/tmp/usr/share/man gzip -9 debian/tmp/usr/share/info/* dpkg-shlibdeps debian/tmp/usr/bin/hello dpkg-gencontrol -isp chown -R root:root debian/tmp chmod -R u+w,go=rX debian/tmp dpkg --build debian/tmp ..
First, notice that this rule calls the checkroot rule to make sure the package is built as root and calls the build rule to compile the source. Then the debian/tmp/DEBIAN and debian/tmp/usr/share/doc/hello files are created, and the postinst and the prerm> scripts are installed to debian/tmp/DEBIAN. Then make install is run with a prefix that installs to the debian/tmp/usr directory. Afterward the documentation files (NEWS, ChangeLog, and the debian changelog) are gzipped and installed. dpkg-shlibdeps is invoked to find the shared library dependencies of the hello executable, and it stores the list in the debian/substvars file for the ${shlibs:Depends} variable in control. Then dpkg-gencontrol is run to create a control file for the binary package, and it makes the substitutions created by dpkg-shlibdeps. Finally, after the permissions of the debian/tmp have been set, dpkg --build is run to build the binary .deb package and place it in the parent directory.
Source...