Today is the day when students start coding. To follow the timeline I made two things today: created the basic file structure for my extension (this was the easier) and after that created a Phing build script, which allows everyone to easily create an installable package from the SVN repository. In the next few paragraphs I'm going to introduce how you can build an installable package from the latest revision if you don't to wait for the official release.

Requirements

You need only two things to build a package: XAMPP (or an other web server application) and Phing. I use XAMPP on Linux, so the following information may be different on your own system.

Installing XAMPP

On Linux this is very easy, you need  only two commands. At the time of writing this blog entry, the latest version is 1.7.1:

$ wget http://www.apachefriends.org/download.php?xampp-linux-1.7.1.tar.gz
$ sudo tar xvfz xampp-linux-1.7.1.tar.gz -C /opt

And XAMPP is installed. You can start it with the following command (you need to have super user rights):

$ sudo /opt/lampp/lampp start 

Installing Phing

The default XAMMP package doesn't contain Phing, so you need to install it manually. It won't be more difficult than the XAMPP installation, you need just two lines of commands again:

$ sudo /opt/lampp/bin/pear channel-discover pear.phing.info
$ sudo /opt/lampp/bin/pear install phing/phing

And if everything goes well, you have Phing installed. For more information and configuration options look at the Extension development using eclipse and phing article on the Docs site.

Building the extension

To build my extension first you need to check it out. For this you need an SVN client. On Linux you can do it trough the command line. If svn is not installed on your system, use your package manager to install it. On Ubuntu this looks like the following:

$ sudo apt-get install subversion

If you use Eclipse for development, then you can install its SVN plugin too. For more information read the Setting up your workstation for Joomla! development article. Once your svn client is installed and ready to use, you need to check out the project's SVN repository (replacing 'targetdirectory' with the name of the directory where you want to check out the project):

$svn checkout  https://labs.joomla.org/svn/labs/playground/people/erdsiger/trunk /targetdirectory

After checking the repository out, you can find two directories in trunk called 'code' and 'scripts'. Code contains the files of the extension and script has the two build files which are necessary for Phing. Assumining that you are in the trunk directory, use the following command to build the package:

$  sudo /opt/lampp/bin/phing -f ./scripts/build/build.xml 

The command will provide the following output:

Buildfile: /htdocs/survey/trunk/scripts/build/build.xml

Survey Suite > config:

 [property] Loading /htdocs/survey/trunk/scripts/build/build.properties

Survey Suite > build:

    [mkdir] Created dir: /htdocs/survey/trunk/packages
    [mkdir] Created dir: /htdocs/survey/trunk/packages/tmp
[phingcall] Calling Buildfile '/htdocs/survey/trunk/scripts/build/build.xml' with target 'export'

Survey Suite > config:

 [property] Loading /htdocs/survey/trunk/scripts/build/build.properties

Survey Suite > export:

     [copy] Copying 6 files to /htdocs/survey/trunk/packages/tmp
      [tar] Building tar: /htdocs/survey/trunk/packages/survey.tar.gz
   [delete] Deleting directory /htdocs/survey/trunk/packages/tmp

BUILD FINISHED

Total time: 0.4778 seconds

After that you can notice that a new directory has been created with the name 'packages'. This directory contains the installable, gzip compressed package, that can be installed in Joomla! back-end. Just a note: at the moment the installation may fail, because I created the file structure just for the build script. I'll write an other blog entry soon, when the extension can be installed.