Introduction to src2pkg

This pages presents an overview of src2pkg, its features, and how to get it and install it.

What src2pkg does

src2pkg makes the creation of installable Slackware packages easier and more reliable for both beginners and advanced users. It creates packages using the simple 'tgz' format used by Slackware and many of its' derivatives.

src2pkg makes it possible for beginners to create packages without knowing all the details of what makes a proper package. And it allows advanced package creators to focus on the more difficult aspects of package making which can't always be handled automatically, such as creating or modifying init scripts which allow the package to work properly when installed.

src2pkg can create packages from many sources using only simple command-line options or no options at all. For more advanced or difficult packages, a src2pkg script can be used, making many more options available. src2pkg scripts use a simple, easy-to-understand syntax which is mostly self-explanatory. Package creation is divided into 16 basic steps, each of which is performed by a certain block of src2pkg code. Each block is written as a shell function and is meant to work independently of the other functions. This makes it possible to leave out functions when they are not needed or when the package requires doing things in some non-standard way.

src2pkg can usually be used while logged in as a normal user. For some sources which are difficult to package without really installing the software, you must log in as user 'root' or other user with full permissions for writing files and running any commands on the system.

What src2pkg does not do

src2pkg is not a package manager or system updater. It is not designed to keep your system up-to-date with Slackware current. Nor is it designed to download and install pre-built packages, resolving dependencies as it goes. It is not meant to replace or perform the same functions as programs such as slackpkg, slapt-get or swaret.

src2pkg does not work with Slackbuild scripts or the Slackbuilds.org repository like sbopkg (http://www.sbopkg.org/)does.

How to get and install src2pkg

Download src2pkg here: http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/src2pkg/

The latest version is 1.9.9.

Notes for first installation of src2pkg

If you are installing src2pkg for the first time, simply use 'installpkg' to install the src2pkg package (src2pkg-X.X.X-noarch-X.tgz). Then,while still logged in as user 'root', run the command: src2pkg –setup to setup src2pkg for use on your system. The –setup switch automatically compiles and installs a few small helper applications.

Notes on upgrading

  • The syntax in the /etc/src2pkg.conf file has changed. If you already have a previous version of src2pkg installed, you should remove or change the name of the old src2okg.conf file before upgrading the src2pkg package.
  • The src2pkg-helpers version has been upgraded, so if you have a previous version of src2pkg installed, you'll need to run the command: src2pkg –setup as user root after upgrading to this version of src2pkg.
  • The version of the libsentry program and library has been upgraded. This requires the src2pkg-helpers package to be upgraded for use with src2pkg. src2pkg now includes code which detects the version of any installed package of src2pkg-helpers and notifies the user of the need to upgrade when the new src2pkg version is installed. The old src2pkg-helpers does not have to be manually removed. Simply running 'src2pkg –setup' after src2pkg is installed will build and package the new src2pkg-helper and install the package.

What's new in the latest release?

Please see the CHANGES file here: http://distro.ibiblio.org/pub/linux/distributions/amigolinux/download/src2pkg/CHANGES for details on new features in this, and previous versions.

For version 1.9.9:

  • src2pkg now supports multi-lib and cross-compile environments. The new command-line options -M32, -M64 or –machine= can be used to specify the '-m??' option to gcc. For instance, when using src2pkg to create a 32-bit program for use on a Slackware64 multi-lib system, passing -M32 causes gcc to build for the proper machine. The -L32, -L64 and –libdirsuffix= options control the library paths used for compiling and packaging. Use the -L options to set the proper options if the src2pkg defaults are not correct for your system. With Slackware64, you should only need to use the -M32 option in order to build 32-bit programs or libraries, provided you have installed the necessary 32-bit environment. The options –cc=?? and –cxx= can be used to specify which compiler to use when using src2pkg with cross-compilers or any other non-standard compiler.
  • A change has been made in the src2pkg API, but without breaking backward-compatibility. A new, optional instruction named 'build' has been added. src2pkg build scripts which contain a function named 'build' will use that instead of running the configure_source, compile_source and fake_install functions. This makes it much easier to copy and paste code from other build scripts, including SlackBuild scripts or 'port'-style scripts.
  • A new tool named sb2sp has been added. sb2sp 'translates' SlackBuild scripts into the src2pkg format. Translating code from other scripts is tricky, but this tool usually gets it right for most commonly-found SlackBuild formats, including the official build scripts and those found on slackbuilds.org. Most scripts can be translated in either a short or long form. The short form simply uses the options to the configure script which are found in the SlackBuild. The long form copies and translates all the useful middle parts of the SlackBuild, as well as the Copyright info. Many users will wonder what advantages there are to translating an already good SlackBuild, but using src2pkg can help to ensure complete and correct package creation, while keeping the build system cleaner. This is especially true for sources which do not respect the DESTDIR variable, or those which do not properly install all the needed files. By using src2pkg you can avoid ever having to 'spam' your system to create a package or having 'orphaned' files left behind after creating a package.
  • Commands for stripping executables and libraries are now fully configurable.
  • Drag-n-drop support has been added to the standard installation. src2pkg-dnd has been added to the files installed under /usr/bin and a src2pkg-dnd.desktop file has been added to the installation. This has only been tested with XFCE, but should be working for KDE desktops also.
  • Added the ability to pause the execution of a build at a named function.
  • Added 'instroot', 'DIST_ROOT' and 'BUILDROOT' to the list of supported DESTDIR types.

Features

src2pkg is able to automatically handle package creation from many different kinds of content. The original purpose was to create packages from source-code tarballs -unpacking, configuring, and compiling the sources before creating the package content. But, the modularity of the src2pkg functions makes it easy to create packages from so called 'noarch' conetent or from pre-compiled binary content, such as proprietary video drivers, media players or any other type of content. It can also convert foreign or generic binary packages, such as binary *.rpm or Debian *.deb packages, into the Slackware format.

Supported formats

a. autoconf sources -most commonly available sources use the 'autoconf/automake' system for configuration. src2pkg handles these automatically -even when the sources are incomplete or outdated. Incomplete sources are sources from CVS or SVN which must have their configuration files generated first before running 'configure'. Many sources also use outdated configuration files which are incompatible with the versions of autoconf and automake which are installed on your system. src2pkg recognizes these and runs extra commands to update them first. It also properly handles sources which use GNUmakefiles instead of the more common Makefiles.

b. src2pkg automatically handles sources which must be configured using cmake

c. It also handles sources which use the 'scons' SConstruct system.

d. It also handles sources which are configured to use the 'jam' system.

e. Sources which use no configuration and contain pre-made Makefiles are also handled automatically. src2pkg can even correct the hard-coded installation paths when these are different than your default choice.

e. src2pkg also handles sources whch use the Imake system for configuration.

f. It can also automatically handle creating packages from python modules which use a setup.py script

g. And it can also automatically handle sources which are normally installed by running an install.sh script.

h. binary packages -src2pkg automatically handles the conversion of binary archives which use the .rpm or .deb suffix. When these are unpacked, src2pkg recognizes them and converts them to the Slackware- conformant format regarding placement of files and ownership and permissions of files and directories.

i. generic binary content - Some programs sucg as the Opera browser are delivered as pre-compiled generic content. src2pkg can recognize these and create a package from such content.

j. source code with no installation routine- Some sources don't come with any Makefile rule or script to do the installation for you. Many times src2pkg is able to create a package from them, finding the binaries, included documents and man-pages and packaging them for you.

k. conversion/verification of Slackware-type packages- src2pkg can be used to repackage or verify the content of packages which already are in the Slackware format. This may sound strange at first, but it can be used to verify packages made by others which you have downloaded. A couple of users have reported using src2pkg to verify packages that they have using other methods -src2pkg is able to scan the content for comnmon mistakes such as misplaced documents/manpages and also correct wrong file or directory permissions and ownership

l. perl/CPAN modules- src2pkg automatically handles perl or CPAN modules which are built using a Makefile.pl file.

Supported File Formats

src2pkg transparently handles source archives which use the 'normal' gzip or bzip2 format -that is archives with these suffixes: .tar.gz .tgz .tar.bz2 .tbz It also handles rpm-type source archives which have the .rpm suffix. This includes rpm archives which contain compressed gzip or bzip2 archives, as above, and also those which conatin a simple .tar archive or which have the sources located in an already-uncompressed directory.

It also works with binary rpm packages that have the '.rpm' suffix and debian binary packages which have the '.deb' suffix. It also recognizes Slackware packages which have the '.tgz' suffix. src2pkg first uncompresses archives and then examines the content to figure out what it is so it can decide what to do with it.

Support is also planned for '.tar.lzma' or '.tlz' archives as they are becoming more common.

Compatibility with Slackware versions

src2pkg has been tested and works with the stable releases of Slackware 11.0, 12.0, 12.1, 12.2, and both 32-bit and 64-bit versions of Slackware 13.

Getting more help

src2pkg and trackinstall both include a 'usage' function which will print a help message to the screen. Running the command 'src2pkg –help' or 'trackinstall –help' will show the help message. You can also get slightly more detailed help by seeing the manpage for each of the programs. In a terminal, type 'man src2pkg' or 'man trackinstall' to see the man page for each program.

Other documents such as an FAQ are included with the program. Reading them will provide additional details which are not covered here.

The code itself contains many comments and explanations which are more suited to advanced users. These are found mostly in the files which contain the src2pkg functions, located in /usr/libexec/src2pkg.

Some of the basic behavior of src2pkg can be changed by editing the configuration file in /etc/src2pkg/src2pkg.conf. The file contains comments which will help you understand what can be changed and when or why you might want to do so. Note that the src2pkg.conf file is not needed for src2pkg to function properly. Most common defaults are set when src2pkg reads in the file /usr/libexec/src2pkg/DEFINES, but settings in the src2pkg.conf file will usually override these settings depending on how you specify them in the src2pkg.conf file.

You can always contact me directly for more help or if you have problems. e-mails can be sent to amigo@ibiblio.org. Be sure to include the word 'src2pkg' in the subject line so that I'll notice it. I get lots of spam e-mails so its' easy to overlook your message if it doesn't have 'src2pkg' in the subject line.

Also, many users post their questions on the official Slackware forum at linuxquestions.org. Since I am a frequent poster there you can usually get help there pretty quickly. Also there are many friendly users of src2pkg which are members of the forum and they often answer questions about src2pkg before I see the posts myself. I live in Europe so the time difference between myself and users in the Americas or Asia means that I sometimes don't see your question until the next day.

Author and Contributors

 
archive_v1/manual/00_introduction.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