The OS has been upgraded to Slackware 14.1 on Fri Aug 21 2015.
Table of Contents
A SlackBuild script is a shell script (usually Bourne shell compatible) that automates the process of configuring, compiling and creating a Slackware package (*.tgz, *.txz, *.tbz files) from source archives.
The basic process of creating a Slackware package from source can be summarized as follows, while details may vary from one build system to another.
- Uncompress the source archive (usually .tar.gz or .tar.bz2 file) into a “work directory.”
- Create a
slack-descfile, with the description of the software in the correct format.
- Configure the source, and apply patches if needed.
- Compile/build the source and generate the binaries.
- Install the program to a temporary directory. This step may be a little bit tricky, depending on how the
make install(or similar functionality) of the build system works. In standard GNU Makefiles, the
DESTDIRvariable passed to the
make installcommand should be sufficient. In non-standard Makefiles and build systems which don't support that option, this might involve patching the
Makefile(or similar file) or editing a build configuration setting of the build system.
- Copy the program documentation and other necessary files (including post-installation scripts) to the appropriate subdirectories in the temporary installation directory. These locations should adhere to default directory structure used by Slackware to store applications installed by the package manager, viz. inside the
- Use the
makepkgutility from the temporary directory (installation location) to create a Slackware package that can then be installed using the
While the above steps can be done by hand, the process is tedious, sometimes complex, and involves typing in a lot of commands. Automating the process by a shell script allows the user to share the process with the community at large. It also makes sense to use and modify existing SlackBuild scripts for upgrading the same program to a newer version.
Creating SlackBuild scripts
However, software may be written in different programming languages, use different build systems, or may even simply be written in an interpreted programming language with no obvious way to “install” it. In such cases, many steps involved in writing a SlackBuild script will differ from the standard way. Blindly copying and pasting commands from other SlackBuild scripts may or may not work.
It is recommended that anybody who wishes to write a SlackBuild script, study and understand the build system of a software project before attempting to write a SlackBuild script for it. A degree of proficiency in writing shell scripts is also a definite benefit, as it is the practice to use Bourne shell compatible scripts for SlackBuilds. Ideally, simple C projects which use the standard GNU Make system is a good way to start practicing writing SlackBuild scripts.
Submitting SlackBuild scripts to a public repository such as http://www.slackbuilds.org may additionally require adherence to certain conventions and coding standards. For instance, it would be necessary for the script to determine the target architecture at runtime rather than hard-coding it into the script. These standards attempt to make SlackBuild scripts as portable as possible.
Automated SlackBuild generators
Some tools exist that can assist you with creating a SlackBuild script. Here are a few examples.
A SlackBuild generator script by David Woodfall
- Originally written by V.Harishankar for the SlackDocs Wiki Project