18.3 Making Packages

Making Slackware packages can be either easy or difficult. There is no specific method for building a package. The only requirement is that the package be a tar gzipped file and if there is a postinstallation script, it must be /install/doinst.sh.

If you are interested in making packages for your system or for a network that you manage, you should have a look at the various build scripts in the Slackware source tree. There are several methods we use for making packages.

18.3.1 explodepkg

explodepkg(8) will do the same thing that installpkg does to extract the package, but it doesn't actually install it and it doesn't record it in the packages database. It simply extracts it to the current directory.

If you look at the Slackware source tree, you will see how we use this command for “framework” packages. These packages contain a skeleton of what the final package will look like. They hold all the necessary filenames (zero-length), permissions, and ownerships. The build script will cat the package contents from the source directory to the package build directory.

18.3.2 makepkg

makepkg(8) will package up the current directory into a valid Slackware package. It will search the tree for any symbolic links and add a creation block to the postinstallation script for creating them during the package install. It also warns of any zero-length files in the package tree.

This command is typically run after you have created your package tree.

18.3.3 SlackBuild Scripts

Slackware packages are built in many different ways by necessity. Not all software packages are written by their programmers to compile the same way. Many have compile time options that are not all included in the packages Slackware uses. Perhaps you need some of this functionality; you'll need to compile your own package then. Fortunately for many Slackware packages, you can find SlackBuild scripts in the package's source code.

So what is a SlackBuild script? SlackBuild scripts are executable shell scripts that you run as root to configure, compile, and create Slackware packages. You can freely modify these scripts in the source directory and run them to create your own versions of the default Slackware packages.

	举例,从www.slackbuilds.org
	下载 Source Downloads 源码包;
	下载 Download SlackBuild 下的tar.gz包,解压该文件包,然后将源码包放入该文件包
	直接将源码包放入即可,无需解压源码包,然后运行.SlackBuild脚本,
	在/tmp文件夹下会得到一个临时安装包,使用 installpkg 安装该临时包即可完成安装
	(可以使用removepkg来卸载已经安装的软件)