Date: Wed, 28 Jul 1999 16:21:30 -0400 (EDT) From: Ben Rosengart <ben@skunk.org> To: doc@freebsd.org Subject: A doc on creating custom packages Message-ID: <Pine.BSF.4.10.9907281619250.63701-200000@penelope.skunk.org>
index | next in thread | raw e-mail
[-- Attachment #1 --]
I wrote this up for work, and someone suggested I submit it to the
Project. Any interest?
--
Ben
UNIX Systems Engineer, Skunk Group
StarMedia Network, Inc.
[-- Attachment #2 --]
BACKGROUND
Under FreeBSD, packages are registered in /var/db/pkg. Every time a
port or package is installed, the installation utility (either make or
pkg_add) creates a subdirectory there with the name of the package:
# pkg_add ssh-1.2.26
[...]
# cd /var/db/pkg
# ls -d *ssh*
ssh-1.2.26
# cd ssh-1.2.26
# ls
+COMMENT +CONTENTS +DESC
#
+COMMENT is a one-line description of the package, +CONTENTS is a
packing list (more on this later), and +DESC is an extended description.
Of the three, +CONTENTS is the interesting one: despite the name, it
contains directives as well as filenames. The format is documented in
pkg_create(8). By editing this file, one can change file modes, add
steps to take on installation and on deinstallation, etc.
PACKAGES AND PORTS
A package is a binary distribution, whereas a port is source plus glue.
I have been using the ports as starting points for packages. Let's use
amanda as an example:
cd /usr/ports/misc/amanda24
vi Makefile
At this point, I added "--without-X" to the CONFIGURE_ARGS variable in
the Makefile, so amanda wouldn't depend on X -- X doesn't package well,
and it takes forever to build and requires user interaction as well.
Not good.
OTHER MODS
Although it would be nice, not *everything* is configurable in the
Makefile. For those things that aren't, run "make extract" to fetch (if
necessary) and unpack the source, then descend two levels (cd work/$PKGNAME)
and make the necessary changes.
TIME TO BUILD
Okay, so we've frobbed the frobbables, now to build the actual software.
This isn't hard:
# make build
The ports systems will fetch and build any ports on which this port
depends -- pay attention here, because you probably want to roll those
up into packages too.
PACKAGING
# make package
This is a weird target -- it wants to install the port, then grab the
installed bits out of the filesystem and tar them up. The problem with
this is that you may have already installed the port/package in
question, in which case you'll receive a message like this:
===> Installing for zsh-3.0.5
===> zsh-3.0.5 is already installed - perhaps an older version?
If so, you may wish to ``make deinstall'' and install
this port again by ``make reinstall'' to upgrade it properly.
If you really wish to overwrite the old port of zsh-3.0.5
without deleting it first, set the variable "FORCE_PKG_REGISTER"
in your environment or the "make install" command line.
*** Error code 1
Stop.
*** Error code 1
Stop.
*** Error code 1
Stop.
If and *only* if the version you have installed is the same as what you
want in the package, you can skip the installation step by doing "make
real-package". I don't know if this is a supported feature; it's a
workaround I found myself. Use it at your own risk.
DONE
If "make [real-]package" completes successfully, then you will have a .tgz
file in the current directory. When you get it where it's going, just run
"pkg_add filename"; pkg_add expects a gzipped tarball.
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.10.9907281619250.63701-200000>
