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=yes in mk.conf.
Install pkgtools/url2pkg,
create a directory for a new package, change into it, then run
url2pkg:
%mkdir /usr/pkgsrc/category/examplepkg%cd /usr/pkgsrc/category/examplepkg%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
%make%pkgvi ${WRKSRC}/some/file/that/does/not/compile%mkpatches%patchdiff%mv ${WRKDIR}/.newpatches/* patches%make mps%make clean
Doing this step 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 Section 11.1, “Makefile”.
Generate a PLIST:
#make install#make print-PLIST >PLIST#make deinstall#make install#make deinstall
You usually need to be root to do
this. Look if there are any files left:
#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:
#make reinstall#make package
Delete the installed package:
#pkg_deleteexamplepkg
Repeat the above make print-PLIST command, which shouldn't find anything now:
#make print-PLIST
Reinstall the binary package:
#pkg_add .../examplepkg.tgz
Play with it. Make sure everything works.
Run pkglint from pkgtools/pkglint, and fix the problems it
reports:
#pkglint
Submit (or commit, if you have cvs access); see Chapter 21, Submitting and Committing.