System-wide GAR

If you’re building Solaris packages using GAR from OpenCSW, you’re familiar with the GAR code inclusion practice. Each package build recipe can be checked out individually, and pulls GAR code using the svn:externals parameter. Try the following command if you don’t know what I mean:

svn co

This sort of works, but since SourceForge Subversion repository works somewhat slow, it can be irritating if there’s a GAR update you want to roll out to all your checked out packages.

As an alternative to svn:externals, you can use a system wide GAR installation, and use a symlink:

ln -s /opt/csw/src/gar/v2 gar

There’s currently no official GAR package, but you can build it yourself from its Subversion build recipe.

There’s one problem. If you don’t have the symlink and your Makefile tries to include the gar/ file, your command will fail with:

Makefile:29: gar/ No such file or directory
gmake: *** No rule to make target `gar/'.  Stop.

It would be nice to make the symlink if it didn’t exist, right? I’ve found a way to do it:

ifeq ($(shell test -h gar && echo yes || echo no), yes)
include gar/
        @echo "Making the symlink to GAR"
        ln -s /opt/csw/src/gar/v2 gar
        @echo "Please re-run your command."                     

The idea is that it only includes the file if the symlink exists. Otherwise, it makes the symlink and asks us to re-run the gmake command.

I haven’t so far found a way to make it work in one go.


Author: automatthias

You won't believe what a skeptic I am.