Sample Builds and Tutorials

Below are a few examples of commands for building Slackware packages from different types of source files with commentary explaining them. Most of these come from an article Drew Ames wrote for Linux.com.

Sample Builds

Commonly useful command line switches

The following user options are useful for builds:

  • -C – place finished package in the current directory
  • -N – generate a starting src2pkg script and slack-desc description file without building the package
  • -S – use a shell script for installation (install.sh by default)
  • -VV – be verbose – show all output from the build steps
  • -W – remove (wipe out) temporary build files
  • -X – run the first src2pkg or src2pkg.auto script in the current directory

Building a Package from the Internet (using a URL as the argument)

An example of building Emacs 22.1 taking advantage of src2pkg to download the source file and then build the package with this command:

src2pkg http://ftp.gnu.org/pub/gnu/emacs/emacs-22.1.tar.gz

Src2pkg successfully downloaded the source code archive, and configured, made, and built the package. The configure process automatically found the GTK libraries. When src2pkg finished, it displayed a message with the location of the Slackware package. I installed it, and Emacs 22.1 ran without a problem.

Converting an RPM Archive to a Slackware Package

To test src2pgk's ability to convert RPM files and its creation of build scripts, I downloaded a game called Orbit, file name orbital-1.01-691.i586.rpm, from the OpenSUSE 10.2 repository. The command:

src2pkg -N orbital-1.01-691.i586.rpm

built a src2pkg script called orbital.src2pkg.auto. The src2pkg script is in the same directory as the source file.

This command:

src2pkg -VV -C -W -X orbital-1.01-691.i586.rpm

built the package using the src2pkg script in that directory.

The build script generated by src2pkg is very simple, consisting of 44 lines. The following lines are where some users will want to add configuration options:

# Any extra options go here

# EXTRA_CONFIGS=''

# STD_FLAGS='-O2 -march=i486 -mtune=i686'

Build scripts can help users save specific configuration options so that they can be repeated each time the package is built. Additionally, build scripts can be real time-savers when you're troubleshooting a package build. Simply change a line or two in the script, build the package again, and repeat the process until the package is just the way you want it.

Building a Package that Runs a Shell Script During the Process

The web browser, Opera, distributes the browser's source code as a generic binary that uses an interactive shell script, install.sh, to configure and build the application. Therefore, src2pkg requires the use of the -S switch.

To build the package, I used the command:

src2pkg -C -VV -W -S opera-9.24-20071015.6-shared-qt.i386-en.tar.gz.

The interactive installation script successfully ran within the src2pgk process.

Tutorials

 
archive_v1/tutorials.txt · Last modified: 2012/03/31 10:20 (external edit)
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki