Open Source / XRap

Fun with Autotools and XUL

In my quest to create a packager for XULRunner apps, I figured I should use the Autotools to package up the app and distribute it as a tarball. This will allow the developer to distribute on any flavor of Linux, and the end-user will just need to do the standard untar, configure, make, install.

For Autotools, I must use several command-line tools, autoscan, autoconf, and automake, and since im using it through my XUL app, I must reference to /usr/bin/ which is where these tools are stored.

function runAutoscan()


var appRootDir= Components.classes[“;1”]






var process = Components.classes[“;1”]



var args = [targetPath];, args, args.length);


  1. Where ‘appRootDir’ is an instance nsILocalFile, Initalize the path as the root directory ‘//’

  2. Append the each directory and the command to the root

  3. Create an instance of nsIProcess

  4. Initalize the process with the path to the command

  5. Include any agruments in a separate variable, in this case I used the directory of where I want to package

  6. Finally just run the process

This method works perfectly if you want to run command-line utilities in the directory you are working in, or in this case where the command takes in a source. Unfortunatly, autoconf and automake don’t seem to work if you are not in the working directory.


One thought on “Fun with Autotools and XUL

  1. Maybe you could try a bit of indirection. For example, starting a shell script that changes the working directory and then executes autoconf. However, I’m not sure if you can start shell scripts with nsIProcess. But there is another way.

    This method will simulate clicking double clicking a file for launching it:

    var file = Components.classes[“;1”]

    One big drawback of this method, unfortunately, is that you can’t pass arguments to the process.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s