You are on page 1of 3

Set up the directory structure

Set up a source directory like /u01/drmoorejr/apache2 to contain the installed. In


many cases, the default installation directory is /opt/apache2.

I make a symbolic link in /opt like this:

# ln –s /u01/drmoorejr/GGapache-2.0.55 /opt/GGapache-2.0.55

I do this for temporary use that way the program is compiled with the home dir of
apache 2.0.55 in /opt/apache2…. But I want to do the “work” in my home
directory… so I can compile/install into a sub dir … for preparation for building the
Solaris package.

 Compile the program and install into /usr/local or elsewhere

To start off I downloaded Apache 2.0.55 from an Apache download site.

The source files were named: httpd-2.0.55.tar.gz, next I unzip and untar the file…
in my home directory.

Now, cd into the directory that’s created from un-tar-ing the above file.

You now must get your program to compile and run. Go to the directory containing
the source and read the instructions. Most programs have detailed installation
instructions either in a README, INSTALL, or similar file. Once you have the program
compiled you will need to run something like "make install". This will put the files in
wherever you specify using the “--prefix=”. Here is an example of my Apache2
config.nice file:

#! /bin/sh
#
# Created by configure

"./configure" \
"--prefix=/opt/GGapache-2.0.55" \
"--enable-cgi" \
"--enable-access" \
"--enable-s0" \
"--enable-auth" \
"--enable-userdir" \
"--enable-rewrite" \
"--enable-mods-shared=all" \
"$@"

After running configure and make && make install

I now have Apache installed in /u01/drmoorejr/GGapache-2.0.55

But compiled as /opt/GGapache-2.0.55...


 Create the prototype and pkginfo files

Go into the /u01/drmoorejr/GGapache-2.0.55 directory with

and run the command

unix# find . -print | pkgproto > prototype

This will produce the prototype file in /u01/drmoorejr/GGapache-2.0.55.

Now take your editor and edit out the line that has the prototype file name in it.
Then add a line like

i pkginfo=./pkginfo

on the first line.

Finally, convert all the user and group ownerships from whatever they are to bin
and bin

An example file looks like

d none include 0755 bin bin


f none include/apr.h 0644 bin bin
f none include/apr_allocator.h 0644 bin bin
f none include/apr_atomic.h 0644 bin bin
f none include/apr_compat.h 0644 bin bin
f none include/apr_dso.h 0644 bin bin
f none include/apr_env.h 0644 bin bin
f none include/apr_errno.h 0644 bin bin
f none include/apr_file_info.h 0644 bin bin
f none include/apr_file_io.h 0644 bin bin
f none include/apr_fnmatch.h 0644 bin bin
It is very important that you change the ownerships. The program might not work when installed if owned
by another user. Not changing these properly is one of the most common problems we have encountered.
BUT, as pointed out by several readers of this page, there may be some situations where the files might
need to be owned by root or some other such privileged user or group. You will want to study the
programs installation instructions to see if any special ownerships may be needed.
Now in /usr/local create a file pkginfo with contents for your package like
PKG="GGapache-2.0.55"
NAME="GGapache-2.0.55"
ARCH="sparc"
VERSION="2.0.55"
CATEGORY="application"
VENDOR="Apache Software Foundation"
EMAIL="david.moore@contractor.thomson.com"
PSTAMP="David Russell Moore Jr."
BASEDIR="/opt/GGapache-2.0.55"
CLASSES="none"

These values are fairly obvious, but they mean


PKG = the name you have chosen for the package directory
NAME = the program name
ARCH = the operating system version
VERSION = the version number for your program
CATEGORY = the program is an application
VENDOR = whoever wrote the software
EMAIL = an email contact
PSTAMP = the person who did the port perhaps
BASEDIR = the /usr/local directory where the files install
CLASSES = just put none here
 Run pkgmk
Now while in /usr/local, run
unix# pkgmk -r `pwd`
This places a file in /var/spool/pkg called GGapache2.
 Run pkgtrans
Now do
unix# cd /var/spool/pkg
and then
unix# pkgtrans -s `pwd` /tmp/apache-2.0.55
You will be asked to select which package you want to make. Select you package
name (like GGapache2) by number.
This now creates a file called GGapache-2.0.55 in /tmp.
 gzip GGapache-2.0.55 and obtain GGapache-2.0.55.gz.
Now run
unix# gzip GGapache-2.0.55
in /tmp to produce the gzipped version GGapache-2.0.55.gz that you can move to
where ever you want to store packages. This completes the packaging process. It is
relatively easy to write scripts to do this.
Now I remove (or unlink) /opt/GGapache-2.0.55… and make a real dir called
GGapache-2.0.55 in /opt.

 Test the packaging

unix# gunzip GGapache-2.0.55.gz


to get back prog-1.00. Then running as root user, I do
unix# pkgadd -d GGapache-2.0.55

 Postinstall scripts
….I haven;’t added any here…. But a link in /etc/init.d called GGapache-2.0.55
pointing to /opt/GGapache-2.0.55/bin/apachectl would be appropriate I believe.

You might also like