Autobuilder Development and Packaging: Difference between revisions

From RISC OS
Jump to navigationJump to search
(Bring page up to date, and try and include stuf from older HTML documentation)
Line 1: Line 1:
Most information on autobuilder development is listed on the [[GCCSDK Development]] page. A few autobuilder specifics are detailed here.
Information on using the autobuilder is listed on the [[GCCSDK Development]] page. This page is about adding packages to it.

The specific aims of an autobuilder package are:

* Supply information on where to get the sources
* Perform any special build steps, especially for cross compiling
* Generate a [[RiscPkg]] package suitable for deployment

Given minimal information, the autobuilder knows how to do almost all of these steps by itself most of the time. But some packages deviate, and explicit instructions need to be given.



==Anatomy of an autobuilder package==
==Anatomy of an autobuilder package==

Note: some packages follow older conventions, and do not look exactly like what is described here. These are in the process of being updated.


To start, download a copy of the Autobuilder from SVN and look in the directory cli/tar. The heart of an autobuilder package is a file called 'setvars'. tar's has:
To start, download a copy of the Autobuilder from SVN and look in the directory cli/tar. The heart of an autobuilder package is a file called 'setvars'. tar's has:
Line 21: Line 32:
while [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Faudio%2Ftremor2%2Fsetvars&rev=0&sc=0 audio/tremor/setvars] has:
while [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Faudio%2Ftremor2%2Fsetvars&rev=0&sc=0 audio/tremor/setvars] has:
AB_SVN=http://svn.xiph.org/trunk/Tremor
AB_SVN=http://svn.xiph.org/trunk/Tremor

AB_CATEGORY is the category the package will be placed in on the website.


===setvars functions===
===setvars functions===


When producing a Zip package, the ab_package shell function is called to choose which files are to be placed in the zipfile. It should copy files from $S, the build directory, to $D, a destination directory ready for zipping.
When producing a Zip package, the ab_package shell function is called to choose which files are to be placed in the zipfile.


There are three main types of packages - the first type contains a standard RISC OS application, the second is a container for command line components, and the third contains development libraries and headers. In future, there will be another type generated along with the library one to contain a shared library.
===Other files===


====RISC OS Application====
Files ending .p are patches which the autobuilder will apply to the downloaded source tree. For this to work the file naming in the first two lines of the patch file must be correct - ensure you just have a relative path starting at the top level of the unpacked source tree.


XJig is a typical game, and its packaging looks like this:
Packages may depend on other packages. Normally this uses the Debian dependency information, but you may specify packages manually using a 'depends' file. This just has a list of package names - for an example see [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Fbrowser%2Ffirefox2%2Fdepends&rev=0&sc=0 browser/firefox2/depends]


ab_package() {
ab_create_app XJig Apps/Games
ab_makerun $S/xjig$AB_EXEEXT


cp -av $S/tina.gif $A/
== More information ==
rman -f HTML $S/xjig.man > $A/\!Help,faf


$AB_HOME/add-riscpkg -unixlib -depends Tinct
For further information about the autobuilder, see the Autobuilder.html and Packaging.html files within the autobuilder source tree. See [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2FAutoBuilder.html&rev=0&sc=0 Autobuilder.html] and [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2FPackaging.html&rev=0&sc=0 Packaging.html] in source form with HTML codes.
}


In the final package, the path Apps/Games/!XJig will be created, which is part of the RiscPkg structure. The !XJig application is copied from autobuilder/games/xjig/!Xjig by the ab_create_app command.

The ab_makerun copies the actual game binary, but also importantly, it converts it from a static ELF binary (it will complain if it is a dynamic ELF binary) to a RISC OS AIF, and will also calculate the required WimpSlot for the application. This will be substituted for 'WIMPSLOT' in the !Run file.

The rest of the commands copy required files, and then perform the final packaging steps.

====Command Line Applications====

For wget, which is a command line application:

ab_package() {
ab_create_command_app Wget Apps/Network
ab_add_commands $S/src/*$AB_EXEEXT
rman -f HTML $S/doc/wget.info > $A/\!Help,faf
cp -av $S/README $A
cp -av $S/AUTHORS $S/COPYING $S/MAILING-LIST $A
cp -av $S/NEWS $S/ChangeLog $A

$AB_HOME/add-riscpkg -unixlib
}

In this case, a !Wget application will be created. If !Wget already exists in the autobuilder directory, that will be copied.
''ab_add_commands'' is used in this case to add any command line commands. This will generate Alias variables in the !Boot
file.

Note the variables in use in these scripts:

$S - source directory. e.g, the directory from which 'make' was run.
$D - destination, top level of packaging. This is often not used.
$H - home, or directory containing 'setvars' for the package
$A - application directory created after call to ab_create_command_app
$AA - actual app name, in this case 'Wget'. Normally not used by setvars.

====Libraries====

To be added.

===Patch files===

Files ending .p are patches which the autobuilder will apply to the downloaded source tree. For this to work the file naming in the first two lines of the patch file must be correct - ensure you just have a relative path starting at the top level of the unpacked source tree.

Packages may depend on other packages. Normally this uses the Debian dependency information, but you may specify packages manually using a 'depends' file. This just has a list of package names - for an example see [http://www.riscos.info/websvn/filedetails.php?repname=gccsdk&path=%2Ftrunk%2Fautobuilder%2Fbrowser%2Ffirefox2%2Fdepends&rev=0&sc=0 browser/firefox2/depends]

Revision as of 18:38, 3 December 2009

Information on using the autobuilder is listed on the GCCSDK Development page. This page is about adding packages to it.

The specific aims of an autobuilder package are:

  • Supply information on where to get the sources
  • Perform any special build steps, especially for cross compiling
  • Generate a RiscPkg package suitable for deployment

Given minimal information, the autobuilder knows how to do almost all of these steps by itself most of the time. But some packages deviate, and explicit instructions need to be given.


Anatomy of an autobuilder package

Note: some packages follow older conventions, and do not look exactly like what is described here. These are in the process of being updated.

To start, download a copy of the Autobuilder from SVN and look in the directory cli/tar. The heart of an autobuilder package is a file called 'setvars'. tar's has:

AB_CATEGORY=Command
AB_URL=ftp://gnu.mirror.pacific.net.au/gnu/gnu/tar/tar-1.15.tar.gz
ab_package() {
  cp $S/src/tar$AB_EXEEXT $S/COPYING $D
}

Normally the autobuilder will make a best guess at how to build a package, so all that's needed are to specify in those areas it gets it wrong. The main work is done by the fetch* and build* collections of scripts in the top level of the autobuilder tree. As well as setting various key variables and providing some functions, the setvars script is run just before any configuration script so you can use it to fix up anything that the automatic steps missed.

setvars variables

If no URL is given the autobuilder will try to fetch the package of the same name from Debian's 'unstable' repository. Here we don't want that, so we explicitly give a URL in AB_URL of where the sources can be found. This can be a .tar.gz, a .tar.bz2 or a .zip file. Alternatively you can specify a CVS or SVN repository. For example, browser/firefox2/setvars has:

AB_CVS_ROOT=:pserver:anonymous@cvs-mirror.mozilla.org:/cvsroot
AB_CVS_TAGORBRANCH=FIREFOX_2_0_0_14_RELEASE
AB_CVS_MODULE=mozilla/client.mk

while audio/tremor/setvars has:

AB_SVN=http://svn.xiph.org/trunk/Tremor

setvars functions

When producing a Zip package, the ab_package shell function is called to choose which files are to be placed in the zipfile.

There are three main types of packages - the first type contains a standard RISC OS application, the second is a container for command line components, and the third contains development libraries and headers. In future, there will be another type generated along with the library one to contain a shared library.

RISC OS Application

XJig is a typical game, and its packaging looks like this:

 ab_package() {
   ab_create_app XJig Apps/Games
   ab_makerun $S/xjig$AB_EXEEXT
   cp -av $S/tina.gif $A/
   rman -f HTML $S/xjig.man > $A/\!Help,faf
   $AB_HOME/add-riscpkg -unixlib -depends Tinct
 }


In the final package, the path Apps/Games/!XJig will be created, which is part of the RiscPkg structure. The !XJig application is copied from autobuilder/games/xjig/!Xjig by the ab_create_app command.

The ab_makerun copies the actual game binary, but also importantly, it converts it from a static ELF binary (it will complain if it is a dynamic ELF binary) to a RISC OS AIF, and will also calculate the required WimpSlot for the application. This will be substituted for 'WIMPSLOT' in the !Run file.

The rest of the commands copy required files, and then perform the final packaging steps.

Command Line Applications

For wget, which is a command line application:

 ab_package() {
   ab_create_command_app Wget Apps/Network
   ab_add_commands $S/src/*$AB_EXEEXT
 
   rman -f HTML $S/doc/wget.info > $A/\!Help,faf

   cp -av $S/README $A
   cp -av $S/AUTHORS $S/COPYING $S/MAILING-LIST $A
   cp -av $S/NEWS $S/ChangeLog $A
   $AB_HOME/add-riscpkg -unixlib
 }

In this case, a !Wget application will be created. If !Wget already exists in the autobuilder directory, that will be copied. ab_add_commands is used in this case to add any command line commands. This will generate Alias variables in the !Boot file.

Note the variables in use in these scripts:

$S - source directory. e.g, the directory from which 'make' was run.
$D - destination, top level of packaging.  This is often not used.
$H - home, or directory containing 'setvars' for the package
$A - application directory created after call to ab_create_command_app
$AA - actual app name, in this case 'Wget'.  Normally not used by setvars.

Libraries

To be added.

Patch files

Files ending .p are patches which the autobuilder will apply to the downloaded source tree. For this to work the file naming in the first two lines of the patch file must be correct - ensure you just have a relative path starting at the top level of the unpacked source tree.

Packages may depend on other packages. Normally this uses the Debian dependency information, but you may specify packages manually using a 'depends' file. This just has a list of package names - for an example see browser/firefox2/depends