Solaris Packaging 


Solaris package generation script and setup 

This scripts allow for the easy and near automatic generation of Solaris packages from source tarballs, and with a little tricky from other sources as well.

Requierments:
Gmake, gtar, md5 and at least one working compiler installation.

First we need to setup a directory struckture to work in. It can be placed anywhere one wishes, however, it should be accessible by root and have enough free space, since we store everything here.

/path/to/space/packaging/source
			/scripts
			/pkgs

Download a tar.gz of the directory structure and scripts here.

packaging holds controllfiles and the hirachy. source holds the source.tar.gz and other files needed to build the software. scripts holds our packaging scripts pkgs will hold the created packages.

First, we need a environment control file. penv, for packaging environment, it will be placed directly into ../packaging/ In penv we setup global config options that are valid for all packages we want to build, such as default compiler options and so on. To allows for different compilers to be used, its best to copy the penv and edit the copy to fit the needs of the other compiler.

for example: penv   for Sun Studio
             penv_gcc for gcc
	     penv_gcc4 for gcc4

Next we have the scripts/prototype.sh script, which is out framework for creating a packages specific script.

First, it needs to be configured for your needs, I place everything I build directly into /opt, if you want to use say /usr/local just replace /opt with /usr/local

Just copy the prototype and name it like you want the package to be named. For example BLglib2.sh

Then edit the so created script, most of the time with a well behaved configure and makefile only the parts at the top needs to be configured.

PACK is the name of the source.tar.gz gtk+-2.6.8.tar.gz -> gtk+
SOLPACK is the name we want the packages to have when its finished.
It defaults to a prefix, in my case BL and the $PACK -> BLgtk+ This can be edited as one wishes, for example addign a 2 to it to indicated that it is gtk+2 -> BL${PACK}2 -> BLgtk+2
PACKVERSION is the version string of the source, in this case 2.6.8
REVISION indicates the revision of the packages we want to create.
PACKAGER is who did the package creation, your name or email address.
DIRNAME is an internaly used variable for the source file
CAT is the cathegory of the software, util, system, application, etc
COPY is the copyright information
OSVERS and OSPLAT are internaly used.
PKGDIR you want to set to the right path where you placed the packaing directory.

If all works well, the ./configure line is the last one we have to touch here. Simply place all the normal ./configure options you want to use while building here.

Now to the tricky part, the install.. Most modern configure and Makefiles use $DESTDIR for the installation, which allows for the installation to be put somewhere else then the --prefix, this is the default setting. The second options is a --prefix call during the gmake install If both fail, consult the softwares documentation, if that has no guides, use a chroot enviroenment or even copy the files by hand into the staging area here.

Next is some packaging magic happeing and a dependancy gathering and check. For that in the source directory will be a directory created automaticaly with the PACK as name and .install and OSplatform and revision added. Inside you find a depend, depend.raw files depend.raw is a list of all installed packages which holds files the software is linked against. copy this to depend and depend.old Then edit depend to be a standard packaging depend file, means add P[space] in front of every line, you also want to check if all expected dependacy are listed. also throw out all lines that point to more then one type of the same dependancy, for example, software you build, and software that comes from sun. For example, YOURzlib and SUNWzlib, leave those in you have linked against.

As you have noticed, the first time you ran the packaing script, it stoped here compaling about missing dependancies. Just rerun the script and it should pick them up now. You only need to redit this file in case the dependancies on the system changed.

If your software needs post and pre instal/remove scripts, place them into this .install directory as well, and make them exceutable, they will be automaticaly picked up and added to the package.

And last, the packages will be assmbled and if you have md5 installed, you can point the script to the binary and an md5 sum of the package will be generated as well.

You now have a Solaris package ready for install in the pkgs dir.



barbie@gods-inc.de