[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
slackware:package_management_hands_on [2014/02/17 06:53 (UTC)] – Work in progress kikinovakslackware:package_management_hands_on [2014/02/20 11:42 (UTC)] (current) – [Managing package dependencies] added missing formatting codes alienbob
Line 595: Line 595:
 # installpkg /tmp/audacious-plugins-3.3.1-i486-1.txz # installpkg /tmp/audacious-plugins-3.3.1-i486-1.txz
 </code> </code>
 +
 +===== Building third-party packages =====
 +
 +Slackware offers only a limited choice of packages compared to behemoth distributions like Ubuntu or Debian. More often than not, you'll want to install a package that's not provided by the distribution. In that case, what can a poor boy do?
 +
 +The [[http://slackbuilds.org|SlackBuilds.org website]] is probably the best address to find third-party software. You won't find any packages there, because SlackBuilds.org is //not// a binary package repository nor will it ever be. It's an extremely clean and well organized collection of build scripts, each one reviewed and tested. Using these scripts will enable you to build about every piece of third party software under the sun.
 +  
 +==== Building packages using the SlackBuilds.org scripts ====
 +
 +In the following example, we will build and install the ''cowsay'' package using the build script provided by SlackBuilds.org. 
 +
 +For a start, ''cd'' into the build directory we've defined earlier:
 +
 +<code>
 +# cd /root/source
 +</code>
 +
 +Download the following components into this directory :
 +
 +  - the compressed tarball containing the scripts to build the package;
 +  - the compressed source code tarball.
 +
 +In our case:
 +
 +<code>
 +# links http://slackbuilds.org
 +</code>
 +
 +  - In the Search field in the upper left corner of the screen, type ''cowsay'', move the cursor to ''Search'' (CursorDown key) and confirm by hitting <key>Enter</key>.
 +  - Follow the ''cowsay'' link on the search results page.
 +  - Once you're on the ''cowsay'' page, download the SlackBuild (''cowsay.tar.gz'') and the source code (''cowsay-3.03.tar.gz'') and quit Links.
 +
 +<note tip>Alternatively, use ''lynx'' instead of ''links''.</note>
 +
 +Here's our two downloaded tarballs:
 +
 +<code>
 +# ls -l cowsay*
 +-rw-r--r-- 1 root root 15136 nov.  25 08:14 cowsay-3.03.tar.gz
 +-rw-r--r-- 1 root root  2855 nov.  25 08:14 cowsay.tar.gz
 +</code>
 +
 +Uncompress the tarball containing the scripts:
 +
 +<code>
 +# tar xvzf cowsay.tar.gz 
 +cowsay/
 +cowsay/cowsay.SlackBuild.patch
 +cowsay/README
 +cowsay/slack-desc
 +cowsay/cowsay.SlackBuild
 +cowsay/cowsay.info
 +</code>
 +
 +Eventually, you can do a little cleanup and delete the tarball:
 +
 +<code>
 +# rm -f cowsay.tar.gz
 +</code>
 +
 +Now move the source tarball to the newly created ''cowsay/'' directory:
 +
 +<code>
 +# mv -v cowsay-3.03.tar.gz cowsay/
 +« cowsay-3.03.tar.gz » -> « cowsay/cowsay-3.03.tar.gz »
 +</code>
 +
 +Here's what we have:
 +
 +<code>
 +# tree cowsay
 +cowsay
 +|-- cowsay-3.03.tar.gz
 +|-- cowsay.info
 +|-- cowsay.SlackBuild
 +|-- cowsay.SlackBuild.patch
 +|-- README
 +`-- slack-desc
 +</code>
 +
 +Now ''cd'' into that directory. Check if the ''cowsay'' SlackBuild is executable, and then launch it to start the package construction:
 +
 +<code>
 +# cd cowsay/
 +# ls -l cowsay.SlackBuild
 +-rwxr-xr-x 1 kikinovak users 1475 mai   27  2010 cowsay.SlackBuild*
 +# ./cowsay.SlackBuild
 +...
 +</code>
 +
 +If everything goes well, the process spews out a package in ''/tmp'', or more exactly in the ''$OUTPUT'' directory defined by the script:
 +
 +<code>
 +...
 +Slackware package /tmp/cowsay-3.03-noarch-1_SBo.tgz created.
 +</code>
 +
 +All that's left to do is install the package using ''installpkg'':
 +
 +<code>
 +# installpkg /tmp/cowsay-3.03-noarch-1_SBo.tgz 
 +# cowsay Hi there ! 
 + -------------
 +< Hi there ! >
 + ------------- 
 +        \   ^__^
 +          (oo)\_______
 +            (__)\       )\/\
 +                ||----w |
 +                ||     ||
 +</code>
 +
 +==== Managing package dependencies ====
 +
 +Some packages require the presence of other packages, either to build (//build dependencies//) and/or to run (//runtime dependencies//) correctly. In some cases, a required package can depend itself on one or more other packages, and so on.
 +
 +To take an example, let's have a look at the ''libgnomeprint'' page on SlackBuilds.org. The package description is followed by the following caveat:
 +
 +<code>
 +This requires: libgnomecups.
 +</code>
 +
 +Moreover, every script tarball contains an ''*.info'' file which states explicitly all the required package dependencies. If we look at the ''libgnomeprint.info'' file, we'll find a ''REQUIRES'' field:
 +
 +<code>
 +PRGNAM="libgnomeprint"
 +VERSION="2.18.8"
 +HOMEPAGE="http://www.gnome.org"
 +...
 +REQUIRES="libgnomecups" ----> package dependency
 +...
 +</code>
 +
 +<note>The ''REQUIRES'' field has been introduced with Slackware 14.0.</note>
 +
 +This simply means that before we build the ''libgnomeprint'' package, we have to build and install the ''libgnomecups'' package.
 +
 +Besides strictly required dependencies, a package can also have some optional dependencies to offer some extra functionality. As an example, the Leafpad text editor can be built against the optional ''libgnomeprint'' and ''libgnomeprintui'' dependencies.
  
  
 slackware:package_management_hands_on ()