wiki:SlackBuildBuilder

SBBuilder

Manual Page

NAME

sbbuilder - A Simple script to create SlackBuild files with directory structure

SYNOPSIS

sbbuilder --package=foo --version=42 [--user=Bill] [--build=1] ...

Help Options:

--package Name of the package to build SlackBuild for.

--version Version of the package to build SlackBuild for.

--link Direct link to the source tarball.

--help Show this script help information.

--manual Read manual.

OPTIONS

--package=string

Name of the package.

--version=string

Version of the package.

--build=string

Build number.

--user=string

Author of the SlackBuild.

--ldoptions=string

Extra ldoptions.

--type=string

Type of SlackBuild. There are 5 types of SlackBuilds :

normal . Default configure; make and make install flags.

perl . !Slackbuild for perl packages.

python . Slackbuild for python packages.

noarch . noarch package? This is for you.

cmake . Use cmake instead GNU autoconf.

--link=string

Enter a download link if you know where you can find the source tarball.

If this option is set and nor package nor version are, sbbuilder will try to guess them from the file. Alert: No success guaranteed, sbbuilder expects a standard naming scheme.

Example: sbbuilder --link= http://foobar.com/foo-2.3.tar.gz [--user=Bill] [--build=1] ...

--configure_options=string

Pass arguments to the configure script, in general quotes are required.

Example: sbbuilder --link= http://foobar.com/foo-2.3.tar.gz --configure_options="--without-x"

--add=string

Add explicit package as dependency. Usually needed when a software has a non binary dependency.

Example: sbbuilder --link= http://foobar.com/foo-2.3.tar.gz --add="package_name >= 1.0-i586-1vl60"

--exclude=string

Remove a package from the dependencies list.

Example: sbbuilder --link= http://foobar.com/foo-2.3.tar.gz --exclude="package_name >= 1.0-i586-1vl60"

--noconfig

Do not include the execution of a configure script.

--xdesktop

Include the generation of a Desktop Entry in the SlackBuild?.

--help

Show the brief help information.

--manual

Read the manual, with examples.

--version

Show the version number and exit.

DESCRIPTION

Sbbuilder is a perl script for generating SlackBuilds for the VectorLinux? repository. It was written for helping to build packages compliant with Vectorlinux repository standards in a consistent way.

AUTHORS

kidd, rbistolfi

LICENSE

GNU General Public License

Development

Sbbuilder uses TemplateToolkit perl module for passing the values given by the options from the command line to a SlackBuild template. Adding new features and writing templates is very easy.

Adding a feature

We are using GetOpt::Long for parsing the options. The first thing to do is to register a new variable after line 141 of current code.

# main
my $user;
my $type;
my $package;
...
my $option;

Then you will need to associate the string that will be used as an option to a variable that will store its value, You do that by using the GetOptions section:

GetOptions( 
        "user=s"              => \$user,
        "type=s"              => \$type,
        "package=s"           => \$package,
        ...
        "your_option"         => \$option);

Now you can pass --your_option="some value" to sbbuilder from the command line, and "some value" will be stored in the $option variable. You will note that some options are flaged with "=s", for example "user=s". That means that an argument is required for that option. If the option does not require a value, the matching variable will be just set to "true", you can see an example in --without_config.

Finally, we need to pass the value of the new option to the templates. Find the $vars dictionary (line 209 in the current code) and append a new entry like this:

my $vars = {user              => $user,
            type              => $type,
            'package'         => $package,
            version           => $version,
            ...
            your_option       => $option}

With this, "your_option" will be available in the template.

Writing a template

Work in progress