====== SlackBuilds ====== One of the hallmarks of Slackware is its SlackBuild system, a powerful yet easy-to-understand (and, incidentally, easy-to-learn, if you are interested) method of scripting how an application is built. The SlackBuild system enables the user to script exactly how applications are compiled so that the same SlackBuild can be used on a variety of computers (useful in a production studio with multiple installs). SlackBuilds result in ''.tgz'' or ''.txz'' files, so managing the applications after they have been compiled is as easy as using ''pkgtool''. There is a //unixy// beauty to this system in that there is nothing distribution-specific to it, and nothing redundant about it. It consists simply of a shell script which can be easily hosted on minimal storage, quickly downloaded, and used by anyone. The system has proven so powerful that, for Slackware 11.0, a group of Slackware users established a community around it, which can be found at [[http://slackbuilds.org]]. An advantage to this site is that hundreds of applications have had scripts built for them, which are all fully editable by the individual user so that the compiling options are exactly the way the user wants them. Each user can then either maintain their private repository of customized SlackBuilds or simply continue to use the Slackbuilds.org (//SBo// for short) versions. All of the scripts are reviewed and tested by the SBo administrators but can also be reviewed in advance by the user for security and functionality. The SlackBuilds.org community is extremely active, with script writers frequently updating available versions of their favourite applications. To keep up to date with what SlackBuild.org has to offer, subscribe to the [[http://lists.slackbuilds.org/mailman/listinfo/slackbuilds-users|SlackBuild user]] mailing list. ===== SlackBuild Quickstart ===== To use a Slackbuild: -Open a web browser -Search for, or navigate to, the tarball of the SlackBuild files and download it. -On your local machine, navigate to the downloaded file and untar it: ''tar -xzvf foo-sbo.tar.gz'' -Read the ''README'' and ''*.info'' files to confirm that you have all the dependencies installed. If you do not, repeat these steps for each dependency, and install each in the order they are required. -Download the source code. A Slackbuild script is just that: a script. It does not contain the source code for the application. The source code must be downloaded from the source code's website. -If there is a stable version of the source code that is more recent than what the Slackbuild was written for, you may change the ''$VERSION'' setting in the Slackbuild script to match the new version number. -Move the source code tarball into the SlackBuild directory: ''mv foo-src.tar.gz foo-sbo/'' -Change directory into the SlackBuild directory. -Make the SlackBuild script to be executable: ''chmod +x foo.SlackBuild'' -Run the SlackBuild, as root: ''su -c "./foo.SlackBuild" '' -Install the resulting package: ''su -c "installpkg /tmp/foo_sbo.tgz" '' ====Common SlackBuild Mods==== The great thing about a SlackBuild script is that it can be modified by you, the user. SlackBuilds have several properties that are set by the script's author to default values, but which can be over-ridden by the user. It is a convention is SlackBuild scripts from SlackBuilds.org that any value that can be defined by the user is written in CAPS. In theory, you can see most of these values in a script use ''egrep'': $ egrep '[A-Z]+=' audacity.SlackBuild In practise, there are certain strings that you will modify more often than others. {{anchor:versionmod}} **VERSION** If a site offers a SlackBuild for ''foo-1.0'' but you know that ''foo-2.0'' has just been released, update the VERSION string: $ VERSION=2.0 ./foo.SlackBuild {{anchor:optionmod}} **Options** Sometimes a SlackBuild author offers the user a choice in what should or should not be included in a build. For example, if a plugin is offered as both an LV2 and a VST, the author might provide the option to build both by default, with manual over-rides to drop one or the other. This is usually communicated to you in the README file. $ VST=no ./foo.SlackBuild ===== Using Sbopkg ===== Prior to the release of Slackware 12.1, a frontend to Slackbuilds.org called ''sbopkg'' was released. ''Sbopkg'' is a command-line and dialog-based tool to mirror the SlackBuilds.org repository and to operate on the local copy or to operate on a user's own repository of SlackBuild scripts. Sbopkg allows the user to browse the local copy, read associated ''ChangeLogs'', view pertinent ''README'' files, read and modify the SlackBuild script itself, the ''.info'' file, and the ''slack-desc'' files. ''Sbopkg'' also allows the user to select packages to build and will even download the source code for the user, check the ''md5sum'', and build a Slackware package. It will also optionally install the package onto the system. ''Sbopkg'' does not check or resolve dependencies. It does not automatically install packages. It does not track what has been installed. In other words, this is in no way ''apt-get'' or ''rpm'' for Slackware; it is a local front-end for [[http://slackbuilds.org]] and does not duplicate or overlap the function of ''pkgtool'' or the responsibilities of the user as the primary manager of the system. To obtain ''sbopkg'', visit [[http://sbopkg.org]] and download the Slackware package. Then, open a terminal and use either ''pkgtool'' or ''installpkg'': $ su -c 'installpkg sbopkg-VERSION-noarch_1-cng.tgz' Among the files installed along with ''sbopkg'' is ''/etc/sbopkg/sbopkg.conf'', which contains all pertinent configuration options for sbopkg. You might want to review it, but it is safe to use the default settings. To start ''sbopkg'', launch it as root by typing ''su -lc sbopkg'' (the ''-l'' obtains the root environment, which some packages require). [{{ sbopkg.png |The sbopkg interface.}}] Upon first launch, ''sbopkg'' creates, as defined in the ''sbopkg.conf'' file: * A local copy of the scripts available from [[http://slackbuilds.org]], by default located in ''/var/lib/sbopkg/SBo/x'' (where x is the latest stable release of Slackware) * A log in ''/var/log/sbopkg'' * A queue directory in ''/var/sbopkg/queues'' * A cache in ''/var/cache/sbopkg'' * A local ''tmp'' directory called ''/tmp/sbopkg'' After sbopkg has launched, the user is delivered to an ncurses (a simple GUI drawn in the shell) interface; use the ''Up'' and ''Down'' arrow keys to navigate through the main menu, and the ''Right'' and ''Left'' arrow keys to select which button on the bottom of the menu (''OK'', ''Cancel'', ''Back'', etc). The ''Return'' key, as you might expect, makes a selection. The first step with ''sbopkg'' is to sync with the remote server; this is the top selection in the ''sbopkg'' main menu. This copies all available scripts from SlackBuilds.org and saves them into directories corresponding with the categories defined by SlackBuilds.org (academic, accessibility, audio, etc). This allows the user to browse the mirrored repository in ''sbopkg'' whether or not the user is online, and also modify the scripts before using them to install software. After the initial rsync, the user can view the SlackBuilds.org ChangeLog, which documents the most recent updates applied to the SlackBuild repository, whether these are bug fixes in the scripts or updated packages. Finding a package to install is done with the ''Browse'' menu selection, or the ''Search'' selection. ''Browse'' shows a list of top-level categories as defined by SlackBuilds.org; use the ''Return'' key to select a category and browse through the packages. Pressing ''Return'' again displays the details about a package. To return to the list of packages or to the list of categories, use the Right arrow to select the Back button on the bottom row of the ''sbopkg'' interface, and press ''Return'' or type ''Alt B''. The convention of using the ''Up'' and ''Down'' arrow keys for the top menu of ''sbopkg'' and the ''Right'' and ''Left'' arrows for the bottom row is used throughout ''sbopkg'', except in textbox dialogs where the arrows scroll the text. The search function in ''sbopkg'' works as would be expected: hit ''Return'' on **Search** and type in term you are searching for into the search field. Searches are case-insensitive and wildcarded; if a search is performed for the term "ink" then ''sbopkg'' will return "link-grammar", "inkscape", "libnfnetlink", "elinks", "wink", and so on. Common ''BASH'' wildcard characters are also supported, such that a search for "?ink*" returns the same list minus "inkscape", which has no character prior to "ink". ==== Building and Installing with Sbopkg ==== ''Sbopkg'' can build and install software. These are two separate processes. If you elect to only build software, the resulting Slackware package (the ''.tgz'' file) is left in ''/tmp'' by default. This location is controlled by the ''OUTPUT'' variable in the ''sbopkg.conf'' file. It can then be installed via ''pkgtool'' or ''installpkg'', or taken to other machines of the same architecture and installed on those, or simply stored for later use. Alternatively, ''sbopkg'' can be set to install the software after it has been compiled. Building and/or installing can be done from different places; the ''Build'' item is the final menu item on each individual package menu of un-built packages, and it is invoked with the ''Process Queue'' item in the ''Queue'' sub-menus. ''Sbopkg'' will prompt the user to perform only a build of the software or a build-and-install. Slackermedia recommends build-and-install for single or small groups of users in which compile time is not an issue; for building larger install bases, it may be more efficient to build once and install the resulting binary rather than having each computer compile it individually. To build or install a package via ''sbopkg'', the first step should always be to view the ''README'' file. This displays a brief description of the application about to be installed, any options that may be passed to the SlackBuild, and any applications upon which the application depends (required dependencies can always be found on SlackBuilds.org). ''Sbopkg'' does not automatically resolve dependencies so it is up to the user to ensure that all listed dependencies are installed on the system before proceeding. Assuming that there are no dependencies, view the ''.info'' file, which is a SlackBuilds.org-specific file of metadata which lists the canonical program name, the version for which the SlackBuild script was written, the project's homepage, the exact link where the source code for the program can be downloaded, and the md5sum of that downloadable package. You can also view and edit the build script itself, if you have the knowledge to do so. A list of all SlackBuild packages installed on the user's system may be viewed via the Packages menu selection, which looks at ''/var/log/sbopkg'' and displays the packages installed whose tags match the currently active repo's tags (by default, _SBo). Similarly, selecting the Update menu item will compare installed packages to those available in the local mirror and identify any packages that have updates available. ==== The Sbopkg Queue ==== One of the most powerful features of ''sbopkg'' is its queue, which makes it possible for a user to create a list of packages to have installed in a particular order and feed that list to ''sbopkg'' for batch builds and batch installs. Slackermedia makes extensive use of queue files to co-ordinate which packages should be installed as a basis for a good multimedia system. To load and process a queue file, launch ''sbopkg'' and select ''Queue''. The ''Queue'' menu contains items to view the current queue, where you can modify a queue, load an existing queue, save a queue, rename or delete existing queues, add all installed packages to the queue (for creating package templates to enable restoration of the current package list or to transfer to another machine), and to process the current queue. A queue is created from the sbopkg GUI by finding a package via either Browse or Search and selecting Add to Queue. This adds the package to a temporary session-only queue file. A typical use for this would be, for instance, when installing ''Inkscape''. Doing a search for "inkscape" reveals that there is a SlackBuild available, but that it depends on a number of other packages such as ''pangomm'', ''cairomm'', and others. Adding ''Inkscape'' to the queue allows the user to then go seek out SlackBuild packages for its dependencies and either install them one by one, or add them to the queue as well. If they are added to the queue, then the queue exists, essentially, in reverse order (that is, the dependencies need to be compiled before the application that depends upon them). Fix this in the ''Sort Queue'' submenu by either manually rearranging the order of the queue, or have ''sbopkg'' reverse it for you. A simple reversal of the queue sometimes does work, but it may be insufficient since a dependency of one application may have its own dependencies which may require manual re-ordering to do sub-sorts in the queue. As is usually the case with Slackware, there is nothing being done here that you cannot do yourself. If you find the ''sbopkg'' interface limiting, you may create queue files manually in any text editor and load the file into ''sbopkg''. The Queue menu is accessed from the main ''sbopkg'' menu by selecting ''Queue''. From within the ''Queue'' screen, you can view the current queue (dynamically created by the user during an ''sbopkg'' session). Also in the ''Queue'' screen: *''Sort'' re-orders the list of applications in the queue. *''Remove'' deletes items from the queue. *''Save'' the current session's queue to ''/var/lib/sbopkg''for later use. To load a saved queue file into ''sbopkg'', select ''Queue'' → ''Load'' and check the desired queuefile(s) in the list. To run a queue file, select ''Process Queue'' from the ''Queue'' menu. For example, if you have downloaded a queue file from Slackermedia, then to load it into ''sbopkg'', you can invoke ''sbopkg'' as ''QUEUEDIR=/path/to/dir/containing_the_queuefile sbopkg'' and it will appear in the ''Load'' list. The queue file would then be loaded into ''sbopkg'' and you can view it, modify it, remove or reorder applications, and finally process it. ==== Advanced Uses of sbopkg ==== ''Sbopkg'' can be used directly from the command line. Find its usage and options with ''sbopkg -h'', or read about it in detail with ''man sbopkg''. The most direct and simple command is (to use the earlier example): su -lc "sbopkg -i foo" This searches for an application or queue file called "foo" and install it (if it is an application) or the programmes listed in it (if it is a queue file). If both an application and a queue file exists with the same name, you'll be prompted to specify which you meant. If a queue file is intended, using and specifying the ''.sqf'' extension to avoid the prompt. If you know the name of an application and feel confident that you you have met all its dependencies (or can meet them all within the same command), using ''sbopkg'' as a command is the easier and simpler than loading the graphical environment. Other command line options include causing ''sbopkg'' to rsync to slackbuilds.org, building without installing, diverse search options, viewing changelogs, and so on. It is also possible to maintain a local repository of customized SlackBuilds rather than, or in addition to, synchronizing with SlackBuilds.org. The local repository is stored in ''/var/lib/sbopkg/local'' by default and can be made active by either selecting it from ''Utilities'' → ''Repository'' or by invoking ''sbopkg'' as: sbopkg -V local Additionally, the location of the ''sbopkg'' repository can be defined in the ''/etc/sbopkg/sbopkg.conf'' file. If necessary, you may also pass the ''-d'' flag to specify an alternate directory for SlackBuilds repositories or by maintaining two configuration files, since ''sbopkg'' can be passed an alternate configuration file (with ''sbopkg -f foo.conf'') on the command line. ===== sport ===== ''Sport'', the "Slackware Port" system, is Slackermedia's shell frontend to [[http://slackbuilds.org]]. It is meant to be simpler and less interactive than ''sbopkg'', and it instead emulates the BSD ports system, or the ''emerge'' system from Gentoo. [{{ sport.png |The sport interface.}}] Like other Slackware package installation applications, ''sport'' is not a package manager as you would find in [[http://debian.org|Debian]] or [[http://redhat.com|Red Hat]]. However, it does help you search through your collection of SlackBuilds, read relevant files about each SlackBuild, and then execute the build and install processes. Since the most prolific and uniform collection of SlackBuilds is [[http://slackbuilds.org]], and since Slackermedia is so heavily reliant upon SlackBuilds.org, ''sport'' is largely modeled after the structure of SBo, although it is not restricted to it and technically will work with any collection of builds (such as your own personal collection of modified builds, or those of trusted associates). To install ''sport'', download its source code and use ''sport'' to install ''sport'' (yes, you use ''sport'' to install itself): $ git clone https://gitlab.com/slackport/sport.git sport.git $ cd sport.git $ su -lc './sport install .' ==== Setup ==== To use ''sport'', you must have a local repository of SlackBuilds. Since Slackermedia relies heavily upon slackbuilds.org, it is worth while to pull the entire listing of SlackBuild scripts from the site: $ su -c 'mkdir -p /usr/ports' $ su -c 'rsync -av rsync://slackbuilds.org /slackbuilds/$(awk '{print $2}' /etc/slackware-version)/ /usr/ports/' If you want to use ''sport'' and ''sbopkg'' on the same system, consider using the same location that ''sbopkg'' uses (or else use the ''sport'' location for ''sbopkg''). An example of the former: $ su -c 'mkdir -p /var/lib/sbopkg/SBo/$(awk '{print $2}' $ su -c 'rsync -av rsync://slackbuilds.org/slackbuilds/$(awk '{print $2}' /etc/slackware-version) /var/lib/sbopkg/SBo/xx.x/' Before you can use ''sport'', verify the location of your local SlackBuild repository. Open ''/etc/sport.conf'' and edit the ''SBOPATH'' and ''MASTER'' variables. For example, assuming ''xx.x'' is your version of Slackware: SBOPATH=/usr/ports MASTER="rsync://slackbuilds.org/slackbuilds/xx.x" There are a few different ways to use ''sport'', but it was written with BSD Ports in mind, so its intended workflow mimics the way that the [[https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/|BSD Handbook]] guides users through the intended usage of their Ports system. In general, the workflow would be: -Search for a term or package name that you want to install -Read about the package you find in order to learn about what libraries and other applications it depends on, as well as any important build notes -Download, build, install These tasks are each individual commands within the ''sport'' toolset. For each flag, you can use every common convention for switches. For example, these all do the same thing: *''sport --search foo'' *''sport search foo'' *''sport s foo'' *''sport -s foo'' ==== Sport Walkthrough ==== The first step in the workflow is to find what you want to install. If you only have an idea of what you want, then you'll want to search for matches to some keyword: # sport search foo network/emacs-foo.tar.gz ... emacs-foo (imaginary emacs mode) network/foo.tar.gz ... foo (fake network tool) audio/kfooplayer.tar.gz ... kfooplayer (fake audio tool) The search function of ''sport'' performs a fuzzy search on any term you provide. A search for "foo" therefore returns the category and packages names for both the stand-alone ''foo'' and, in this example, the ''emacs-foo''. It also returns a string in which "foo" appears; as in ''kfooplayer''. If you only want to browse through your SlackBuilds tree without having to think up search terms, cd into ''/usr/ports'' (or whatever you have set ''SBOPATH'' to) and browse its contents. From this point on, ''sport'' interaction is //not// fuzzy as the ''search'' is; use the proper name of the application from here on: If you find something of interest but want to see if you already have it installed, use ''sport check'': # sport check foo If nothing is returned, then you do not have that application installed. The next step in the typical workflow is to read about the package you are about to install, so that you know about any important build configuration options, or dependencies that you should install first. Use ''sport cat'' to see all relevant notes in a SlackBuild. $ sport c foo If you have changed directories into your SlackBuild tree and are in the same directory as the SlackBuild file, you can cheat and provide the path to the package with a dot-slash: $ sport cat ./foo Or if you are in the SlackBuild's directory, just use a dot. $ sport cat . This displays the ''README'' and the .info files of the package, so that you can see what the application claims to do, and what dependencies are recommended and required. If the package you want to install has dependencies, you should resolve those dependencies before continuing. Unlike the BSD Ports and Gentoo emerge systems, ''sport'' does not resolve dependencies for you. That way, if you have already have a package or a SlackBuild for a dependency (or you prefer to compile it yourself), you can use it instead of whatever an automated "package manager" happens to find lying around. //Resolving dependencies// may sound mysterious but all it means is that you will have to install some additional system libraries or smaller applications before you install the application you are trying to obtain. To resolve the dependencies of ''foo'', you would take note of the libraries it requires (''bar'' and ''baz'') and then use ''sport'' to install each one before then installing ''foo'' itself. Once you have resolved all dependencies, you are ready to build the package. There are two commands you can use; ''sport install'' will build the package and install it onto your system (leaving a copy of the finished Slack package in the default build location for SBo packages: ''/tmp''), while ''sport install --build-only'' just compiles the code but does //not// install the package. $ su -lc 'sport install foo' Again, if you are in the directory containing the SlackBuild you want to install, you can cheat and provide the path to the package with a dot, meaning that the build script is in the current directory: su -lc 'sport -i .' If you are fastidious about disk space or keeping a tidy SlackBuilds tree, use ''sport clean foo'' to remove the directory containing the source code and SlackBuild. It of course leaves any compressed copy of your SlackBuild directory (the SlackBuild.org structure). If you are //not// using the SlackBuild.org tree, then you should either keep your originals as compressed .tar.gz archives or you should either modify or not use the clean command. ''sport'' may be used from anywhere in your filesystem, or you can use it as you "crawl" through your SlackBuild tree. It's a handy and flexible tool that can help make the potentially repetitious process of downloading, compiling, and installing software easier. ==== Advanced Sport Usage ==== Since ''sport'' is just a BASH script, you can use the usual BASH conventions to add flexibility to your commands. To pass build options through ''sport'', provide the option (usually defined in the ''README'' of the SlackBuild). # WIDGETS=yes sport install foo To pass make flags through sport, use ''MAKEOPTS''. # MAKEOPTS='-j8' sport install foo If you need to do some special kind of install (such as an ''upgradepkg'' rather than an ''installpkg'') then preface your ''sport -i'' command with the ''INSTALLER'' environment variable: # INSTALLER=upgradepkg sport i . Or something more complex: # INSTALLER="upgradepkg --install-new" sport -i foo And so on. ==== Queue Files ==== ''Sport'' supports batch, or queue, files. For your initial Slackermedia install actions, you will use a Slackermedia [[http://slackermedia.info/downloads|queue file]] but you can also create and maintain your own queue files. To create your own queue, just echo the package names into a plain text file, newline delimited, in the order you wish for them to be installed. In the event of two packages sharing the same name, use both the category and package name. Usually, just the package name will do, as the SlackBuild maintainers try to keep all names unique. Here is an example of a simple queue file for the imaginary package ''foo'': baz bar foo Save these three lines as ''foo.list'' (or any filename; ''sport'' does not require any specific extension as long as the file is plain text) and then have ''sport'' process it using standard BASH re-direction: # sport $( < foo.list) ''Sport'' is not a complex application, but it is quite flexible; for even more details on using ''sport'', view the man and info pages bundled with it. [[pkg|R]] [[start|S]] [[dep|Q]]