Slackware packages
Contents
Standard tools
Building
packages from source
Building packages from
Perl modules
Checking package
installation with pkgcheck
Standard tools
The standard package tools provided with Slackware 13 are:
- installpkg -
installs a package
- removepkg - removes
a package
- upgradepkg -
upgrades a package
- makepkg - builds a
package
- pkgtool - curses
interface to installpkg
and removepkg
I never use pkgtool - it
doesn't support upgrading of packages, and it's no friendlier than the
command-line tools.
I've also written a Java program pkgcheck that checks
for problems in package installation.
Building packages from
source
I have in the past used checkinstall to build packages from source,
but it was always buggy and now apparently doesn't work at all with
later versions of coreutils.
The main reason for using checkinstall was to find out what files
were being installed where when one did 'make install'.
Apparently, many (most?) source packages have an undocumented option to
'make install' that can be used to install to a temporary directory.
One can then use makepkg to build a Slackware package from the contents
of this temporary directory.
Where possible, we are using the user boxer as the owner of
installed files. This makes it easier to spot files installed from our
packages in directory listings.
We obviously cannot do this for setuid-root executables.
The basic procedure for building a Slackware package from source is
(using "foobar" as the name of the package, and 6.7.8 as the version
number):
- su - boxer # So most installed files will belong to boxer.
- cd /usr/local/src
- tar xf .../foobar-6.7.8.tgz
- cd foobar-6.7.8
- # Check that DESTDIR is supported.
- find . -name Makefile\* | xargs grep DESTDIR | less
- ./configure --help # to see if any
options needed
- ./configure ...
- make
- make install DESTDIR=/tmp/foobar
- cd /tmp/foobar
- mkdir install
- cp ~/slack-desc install; vim install/slack-desc # create package
description
- # Have to actually build the package as root, since directories
have to belong to root.
- su
- # At this point, any special file ownership and permissions can
be set.
- makepgk /usr/local/packages/foobar-6.7.8-i686-1fog.tgz
- installpkg /usr/local/packages/foobar-6.7.8-i686-1fog.tgz # or
upgradepkg ...
The DESTDIR option to 'make install' may also be called other names,
such as INSTALL_ROOT.
The slack-desc package description file should contain up to 11 (or
13?) lines starting with 'foobar: '.
Each line can have at most 70 characters after the ':'.
Useful information to put in slack-desc:
- Website: The URL of the source package's website.
- Needed for: What this package was needed for - e.g. what other
package(s)
depend on this package.
- Needs: What other packages this package depends on.
- Build: The ./configure command-line that was used, and any other
unusual
build commands that were needed.
When running makepkg, answer 'y' to the question about removing
symbolic links and putting them in the do-inst.sh script.
Also answer 'y' to the question about changing directory ownership to
root.
Before building from a particular source package, it's probably
worth checking slackbuilds.org to
see if there is a script there for it.
If there is, you can tell from the script whether DESTDIR (or a
variant) is supported, and what options to ./configure might be useful.
It may also forewarn you of potential problems. We don't want to
actually use the SlackBuild scripts, since they install under /usr
whereas we want to install under /usr/local.
Building packages
from Perl modules
Normally one downloads and installs Perl modules using CPAN. This is a
very handy mechanism - it will automatically download and install
pre-requisites, and will usually test the installed module as well. The
downside is that one has no idea what files are being installed where.
Fortunately, there is a utility called cpan2tgz (from http://software.jaos.org/) that
will download a Perl module using CPAN and create a Slackware package
from it.
Typical use is:
cpan2tgz
--ignoreinstalled --pkgdir /usr/local/packages --build-number 1
--build-tag fog --no-install Mail::SpamAssassin
where "Mail::SpamAssassin"
is the name of the Perl module, and the options are:
Option |
Meaning |
--ignoreinstalled |
Build the package even
if the module is already installed. |
--pkgdir |
Directory that built package (i.e. the tgz file) shoud be put
in. |
--build-number |
The build-number and build-tag together form the
"revision" part of the package name. In the above example, the package
would be called
perl-mail-spamassassin-3.1.7-i486-1fog. |
--build-tag |
--no-install |
Prevents actual
installation of the package (useful if you want to use upgradepkg). |
The man page for cpan2tgz provides a bit more information, but there
doesn't seem to be any other documentation. It would be nice to know,
for example, whether it's OK to use removepkg on these packages or
whether this might confuse the Perl system.
Checking package
installation with pkgcheck
pkgcheck is a program (written by me) that reads package descriptions
from /var/log/packages
and compares the lists of files in these descriptions with the files
actually present.
Usage is:
pkgcheck
[options] [dir...]
where the options are:
Option |
Meaning |
-m |
Check for missing files |
-c |
Check for files common
to two or more packages |
-r |
Check for redundant
packages |
-s |
Check for subsumed packages |
-i |
Check for uninstalled
packages in /usr/local/packages (so you can remove them) |
Any directory arguments are checked (recursively) for files not
belonging to any package.
Suggested usage:
pkgcheck
-ms /bin /sbin /lib /usr