SlackBuild Scripts

From SlackWiki
Revision as of 16:31, 15 March 2014 by Rworkman (talk | contribs) (Reverted edits by Sinyorita (talk) to last revision by Rworkman)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

SlackBuild scripts are simple shell scripts which can automate the compiling and packaging of a program from source.

While not necessary to compile and create packages on Slackware, SlackBuilds serve as tools for scripting the compiling and packaging processes, which are often repetitive. Just as importantly, SlackBuilds also act as documentation of compile-time options and configurations for that particular package. For that reason, official Slackware packages come with SlackBuilds bundled with the source code, and the inclusion of a SlackBuild is desirable in third-party packages.

Using SlackBuild Scripts

In this example I'm going to use the Pidgin slackbuild. First you find on the mirror in the source directory and download the whole directory of Pidgin:

mkdir pidgin
cd pidgin
wget --passive-ftp*

This downloads the files needed for Slackware scripts. The same idea applies for SlackBuild scripts from other sources - you generally need to download all of the files in the directory that contains the build script. For example, in the pidgin source directory, you would need the following files:

pidgin-2.4.1.tar.bz2 pidgin-encryption-3.0.tar.gz pidgin.SlackBuild* slack-desc

There will sometimes be other files, such as, diff.gz patch files, and rc.* scripts in this directory.

Now, say you want to get the newest version of pidgin? Well, you download the tar.bz2 file (in Pidgin, the script uses tar.bz2). Now you open up pidgin.Slackbuild:


This is the line we are looking at. Now we can change this to


Now you can edit the compile flags and other cool things not covered here. Now that we have downloaded and edited the SlackBuild script, let's make it executable:

chmod +x pidgin.SlackBuild

Now this is executable, and we want to run as root for permissions and other reasons so we want to become root:

su -

Now we start the script, and this will compile Pidgin and make a Slackware package. Depending on how the script is written, the resulting package will be in /tmp, some directory of /tmp, or perhaps some other location - have a look at the SlackBuild script for some hints if you can't find the package that was built.

Once you find the package, you simply use 'installpkg' to install it normally (and you probably want to move it somewhere else on your system for safekeeping).


SlackBuild Archives

Other Resources

For a bit more detailed tutorial, see this entry: Writing A SlackBuild Script