0% found this document useful (0 votes)
127 views

Slackware PKG Presentation

This document introduces Slackware packages and the process of building packages for Slackware Linux. It describes the basic structure of Slackware packages, the main package management tools, and guidelines for package naming, versioning, and contents. It also explains the two main types of build scripts - SlackBuild and .build scripts - and the steps involved in using each type of script to compile software and create compliant Slackware packages.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
127 views

Slackware PKG Presentation

This document introduces Slackware packages and the process of building packages for Slackware Linux. It describes the basic structure of Slackware packages, the main package management tools, and guidelines for package naming, versioning, and contents. It also explains the two main types of build scripts - SlackBuild and .build scripts - and the steps involved in using each type of script to compile software and create compliant Slackware packages.
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 33

An introduction to Slackware packages

Stuart Winter
Sunday 27th Februrary
FOSDEM 2005

[email protected] www.slackware.com
Introduction: Slackware Linux

• First released in 1993

• Slackware aims to be the most “UNIX-like”


Linux distribution

• Simplicity and stability are of paramount


importance

• Patrick Volkerding is the project leader & sole


maintainer
Presentation agenda
• Introduce the basic structure of a Slackware
package

• Package management tools

• Package naming, version numbering, build numbers

• Package guidelines & policies

• Package Build scripts

• Checklist to help produce Slackware compliant


packages
Introduction: Slackware packages

Slackware Linux consists of a variety of software


packages that make up the distribution.

Slackware 10.1:

- 552 main packages ( slackware/ )

- 128 extra packages ( extra/ )


Overview of a Slackware package


gzipped tar archives (.tgz files) containing the
directory structure and files

Contains post install scripts

Contains package description

Typically monolithic (all-in-one) packages
Package management tools
Introducing the Slackware
package management tools
Command line tools

• installpkg: install packages

• removepkg: remove installed packages

• upgradepkg: upgrade installed packages


with new .tgz packages

• explodepkg: extract .tgz packages into the


current directory
Introducing the Slackware
package management tools
Curses based tools
Package anatomy
Package anatomy
Package naming scheme

packagename-version-architecture-buildnumber.tgz

Package names are either the name of a single


program or a collection/bundle of utilities.

autoconf-2.59-noarch-1.tgz: a single application

tcpip-0.17-i486-29.tgz: a bundle of utilities


Package anatomy
Package version numbers

Single programs: version number is that of the


released software.
autoconf-2.59-noarch-1.tgz

'Bundle' packages: version number usually relates


to the most major piece of software
contained within the package.
tcpip-0.17-i486-29.tgz
Package anatomy
Package architectures

The current official values are:


noarch - architecture independent files such as configfiles
i386 - for the i386 or newer
The normal value
i486 - for the i486 or newer
i586 - for the i586 or newer Re-packaged binaries
s390 - packages for the IBM s/390 mainframe

Slack/390
Package anatomy
Build numbers

• Supplements the major version number

• Changed only when the package maintainer makes


a change Version
Package
number Architecture
name
Example:

First build: foo-1.56-i486-1.tgz Build


number
Second build: foo-1.56-i486-2.tgz
Package anatomy
Exploding a package
drwxr-xr-x root/root 0 2005-01-26 03:23:42 ./
drwxr-xr-x root/root 0 2005-01-26 03:23:42 etc/
-r--r----- root/root 608 2005-01-26 03:23:41 etc/sudoers.new
drwxr-xr-x root/root 0 2005-01-26 03:23:42 usr/
drwxr-xr-x root/bin 0 2005-01-26 03:23:42 usr/bin/
-rws--x--x root/bin 93056 2005-01-26 03:23:41 usr/bin/sudo
drwxr-xr-x root/root 0 2005-01-26 03:23:42 usr/doc/
drwxr-xr-x root/root 0 2005-01-26 03:23:41 usr/man/
drwxr-xr-x root/root 0 2005-01-26 03:23:41 usr/man/man5/
-r--r--r-- root/root 18214 2005-01-26 03:23:41 usr/man/man5/sudoers.5.g
drwxr-xr-x root/bin 0 2005-01-26 03:23:41 usr/sbin/
-rwxr-xr-x root/bin 61352 2005-01-26 03:23:41 usr/sbin/visudo
-rw-r--r-- root/root 561 2005-01-26 03:23:42 install/doinst.sh
-rw-r--r-- root/root 869 2005-01-26 03:23:42 install/slack-desc
Package anatomy
Exploding a package: package description

sudo: sudo (give limited root privileges to certain users)


sudo:
sudo: 'sudo' is a command that allows users to execute some
sudo: commands as root. The /etc/sudoers file
sudo: (edited with 'visudo') specifies which users have access
sudo: to sudo and which commands they can run. 'sudo'
sudo: logs all its activities to /var/log/ so the system
sudo: administrator can keep an eye on things.
sudo:
sudo:
sudo:
Package anatomy
Exploding a package: post installation scripts

Two types of post installation script:

install/doinst.sh:
- non-interactive

/var/log/setup/setup.<package name>:
- curses based interactive script

/var/log/setup/setup.onlyonce.<package name>:
- run once only from the OS installer
- last used in 1993/1994 era –now deprecated
Package anatomy
Package policies & general guidelines
• Major binary directories are chown root:bin
• gzipped info/man pages and Kernel modules
• Hard links converted to soft links
• Soft links converted to shell script code within install/doinst.sh
• Stripping of static archives, shared objects & binaries
• Deletion of perllocal.pod files
• HTML man pages removed from /usr/doc if there is /usr/man
counterpart
• /usr/{doc,info,man} – not FHS (Filesystem Hierarchy) compliant
Package anatomy
Package dependencies

• Full installation of Slackware is the recommended option

• Official Slackware package tools do not handle dependencies

• Dependencies can be noted in the slack-desc or in config files

• a/aaa_elflibs package satisfies core dependencies

• 3rd party packages can help with dependency resolution but will
remain unsupported. Packages may require additional
metadata.
Building packages
Building packages
Build scripts: basic process
prepare build location/directory

prepare packaging location


extract source archives

configure source
compile software

install components into the packaging location

apply the policies to the package contents

create a binary package (.tgz)


Building packages
Introducing makepkg
• Produces .tgz packages from the contents of the $PWD

• Converts soft links to shell script code

• Checks for zero length files Convert soft links to


script code
Normal syntax:

# makepkg -l y -c n /tmp/foo-3.0-i486-1.tgz

Do not reset perms


& ownerships
Building packages
Two types of build script
SlackBuild
'Clean' package building scripts:

- Compiles software
- Installs package contents into a special build location
- Creates a binary .tgz package

.build
'Dirty' package building scripts

- Compiles software
- Installs onto the root filesystem!
Building packages
Build notes

• Packages are always built on 'disposable' development


machines

• Slackware packages are always built as root

• All packages are built on a full installation of Slackware

Most build scripts are available in the source directories of each


package.
Building packages
SlackBuild scripts

• Reproducible package builds

• Simple 'bash' shell scripts – no external calls to macros/functions

• Understandable at a glance and (usually) well commented

• Installs package into a pseudo root directory

• Sets Slackware packaging policy

The preferred method.


Building packages
SlackBuild scripts: example
Can override
VERSION=2.4 at shell
ARCH=${ARCH:=i486}
BUILD=${BUILD:=1}
setup build locations & extract source
./configure --prefix=/usr
make
make install DESTDIR=/tmp/package-foo Perms, ownerships
install docs into package stripping, gzipping
set Slackware packaging policies
makepkg -l y -c n /tmp/foo-$VERSION-$ARCH-$BUILD.tgz

To compile the software and build the package: Run from


# ./foo.SlackBuild source dir
Building packages
.build scripts
• Very basic shell scripts

• Do not set Slackware packaging policies

• Installs onto the root file system

• Does not produce packages!

• Used when the software's build system has no


provision for installing into pseudo root location
Replaced with
• Gradually being phased out of Slackware
SlackBuilds
Building packages
.build scripts: example

setup build location & extract source


./configure --prefix=/usr
make
make install
install docs onto the filesystem

To compile the software and install onto the filesystem:

# ./foo.build
Building packages
.build scripts: the process of package building
Log files & dirs on filesystem
Run .build script
Differences =
Log files & dirs on filesystem package
contents
diff both logs

Copy the differences to a pseudo root directory

Set Slackware policies within the pseudo root directory

Make a .tgz with makepkg


Building packages
Creating packages from .build scripts: slacktrack

• Originally written to be ARMedslack's primary build tool


• Slackware specific – only produces .tgz
• Can apply all Slackware packaging policies
• Can build replica packages from Slackware's .build scripts
• Can be found in 'extra/slacktrack' in recent Slackware releases
• Uses installwatch to track the installation
Tracks filesystem
• An alternate version is available: altertrack changes
Building packages
Creating packages from .build scripts: slacktrack

Set Slackware
policies

Example usage: Build script

# slacktrack -Qp foo-2.5-i486-1.tgz ./bar.build

Package
name
Building packages
Package building checklist
Non FHS
• Directory locations compliance

• install/slack-desc package description file 13 lines max,


70 chars wide
• install/doinst.sh post installation script
Relative paths;
• Binaries, shared & static libraries stripped ash compatible

• Permissions & ownerships / = chmod 755,


root:bin bin dirs & files
• Man pages: gzipped with no broken soft links

• Compare your package with the official .tgz (if applicable)


Summary

• Simple 'bash' build scripts

• Two types of build script: SlackBuild and


.build

• Build scripts available in source tree

• Read the 'OVERVIEW' file included with


slacktrack to learn more
www.slackware.com

You might also like