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:
%
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 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 8.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_delete blub
Repeat the above make print-PLIST command, which shouldn't find anything now:
#
make print-PLIST
Reinstall the binary package:
#
pkgadd .../blub.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 18, Submitting and Committing.