SUN Packaging Guide -

Introduction to create SUN software packages

In this document you will learn how to create simple SUN packages. Or, how to create SUN packages simple. :) This small howto is for developpers who want to simplifiy software installation. You should be experienced in compiling and installing software and you should be experienced in user management. All you need is a SUN/Solaris machine and a shell login. For creating system packages you need to be root.
The following chapters will deal how to build a package using the example of GNU bc, a small and simple commandline calculator.


First of all you need your compilation results as we want your files to be put in a package (PKG). There are two possibilities to get there:

• Using standard compiler and Solaris make

Unfortunately you have to compile your software twice: One time for getting all the files you want to put in the package and a second time for the final location.
I suggest you create somewhere public (like in /var/tmp) a subdirectory, where you can put all the files in and where "nothing bad can happen". Take this directory as installation prefix and do a

$ make install

In the following chapters you will see how to operate on this. Afterwards, you have to do the compilation and installation again for the final location.

• Using gcc and GNU make

You are a lucky winner! GNU make supports an installation variable called DESTDIR, which defines a installation root. For instance, if you compiled your software to be located in /usr/local then you can do:

$ ./configure --prefix=/usr/local ...
... <configuration and compilation output>
$ gmake install DESTDIR=/var/tmp/garex

gmake (as I call it) will then perform an installation at the DESTDIR as it would do in /usr/local, including the creation of all sub-directories of the former install-root "/". If you then got all the files together, just perform a

$ gmake install

again, and you are nearly done with the package. Unfortunately, not all Open Source source tarballs come with a proper file, where the DESTDIR variable has to be enabled during creation of the source tarball with GNU autoconf. But there is a way around, which is more the "hackers way". You will have to manually edit the Makefile and seek the "install:" section. Then add a


before every installation path.