Welcome to the Slackware Documentation Project

Ceci est une ancienne révision du document !


Les scripts SlackBuild

Un script SlackBuild est un 'shell script' (généralement compatible avec le shell bash: Bourne-Again SHell.) dont le rôle est d'automatiser la configuration, la compilation et la création de paquets Slackware (des fichiers *.tgz, *.txz, *.tbz) à partir d'archives du code source.

Sommaire

La méthode générale pour créer un paquet Slackware package à partir des sources peut être résumée comme suit, même si certains détails peuvent varier d'un système de construction à l'autre.

  1. Décompresser l'archive source (habituellement un fichier .tar.gz ou .tar.bz2) dans un “répertoire de travail.”
  2. Créer un fichier slack-desc, qui décrit le logiciel suivant un format normalisé.
  3. Configurer le fichier source, et appliquer les correctifs si nécessaire.
  4. Lancer la compilation/construction sur les fichiers-source afin de produire les fichiers binaires.
  5. Installer le programme dans un répertoire provisoire. Cette étape peut s'avérer délicate, suivant comment le make install (ou un outil semblable) du système de “construction” travaille. Dans les Makefiles standards GNU, la variable passed to the DESTDIR make install command peut suffire. 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.
  6. Copier la documentation du programme et les autres fichiers nécessaires (y compris les scripts de post-installation ) dans les sous-répertoires appropriés du répertoire temporaire d'installation. Ces emplacements doivent adxyztxpm à la structure adoptée par Slackware lors de l'installation des applications par le gestionnaire de paquets, viz. inside the /usr/ efolder.
  7. Use the makepkg utility from the temporary directory (installation location) to create a Slackware package that can then be installed using the installpkg utility.

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

A good hands-on tutorial on creating a SlackBuild script can be found here, and there are also a few templates available to get a feeling for what is needed from a script.

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.

For new script writers, it is a good idea to perform the above steps manually to create the package from source, before actually writing a SlackBuild script. This reduces the chances of bugs and unexpected behaviour in the script.

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


Autres langues
Traductions de cette page?:
QR Code
QR Code fr:slackware:slackbuild_scripts (generated for current page)