Debugging
To check out all the gotchas when building a package, here are the steps
that I do in order to get a package working. Please note this is basically
the same as what was explained in the previous sections, only with some
debugging aids.
Be sure to set PKG_DEVELOPER=1
in /etc/mk.conf
Install pkgtools/url2pkg,
create a directory for a new package, change into it, then run
url2pkg:
&cprompt; mkdir /usr/pkgsrc/category/examplepkg
&cprompt; cd /usr/pkgsrc/category/examplepkg
&cprompt; url2pkg http://www.example.com/path/to/distfile.tar.gz
Edit the Makefile as requested.
Fill in the DESCR file
Run make configure
Add any dependencies glimpsed from documentation and the
configure step to the package's
Makefile.
Make the package compile, doing multiple rounds of
&cprompt; make
&cprompt; pkgvi ${WRKSRC}/some/file/that/does/not/compile
&cprompt; mkpatches
&cprompt; patchdiff
&cprompt; mv ${WRKDIR}/.newpatches/* patches
&cprompt; make mps
&cprompt; make clean
Doing as non-root user will ensure that no files are modified that
shouldn't be, especially during the build
phase. mkpatches,
patchdiff and pkgvi are
from the pkgtools/pkgdiff
package.
Look at the Makefile, fix if necessary;
see .
Generate a PLIST:
&rprompt; make install
&rprompt; make print-PLIST >PLIST
&rprompt; make deinstall
&rprompt; make install
&rprompt; make deinstall
You usually need to be root to do this.
Look if there are any files left:
&rprompt; make print-PLIST
If this reveals any files that are missing in
PLIST, add them.
Now that the PLIST is OK,
install the package again and make a binary package:
&rprompt; make reinstall
&rprompt; make package
Delete the installed package:
&rprompt; pkg_delete blub
Repeat the above make print-PLIST command,
which shouldn't find anything now:
&rprompt; make print-PLIST
Reinstall the binary package:
&rprompt; pkgadd .../blub.tgz
Play with it. Make sure everything works.
Run pkglint from
pkgtools/pkglint,
and fix the problems it reports:
&rprompt; pkglint
Submit (or commit, if you have cvs access);
see .