Specifications
Red Hat Enterprise Linux to Oracle Solaris Porting Guide
96
TABLE 10-3. CREATING A PACKAGE
RHEL ORACLE SOLARIS 11
On RHEL, consider that a tar file of the source is
created and put in the /path name/dir-name
directory. The specification (spec) file is created,
which contains information about the package and
has the following sections:
• The prep section (short for prepare) defines the
commands necessary to prepare for the build.
• The build section contains the commands for
building the software. Usually, this will include
just a few commands, since most of the real
instructions appear in the makefile.
• The install section holds the commands
necessary to install the newly built application or
library.
• The clean section cleans up the files that the
commands in the other sections create.
• The files section lists the files that go into the
binary RPM along with the defined file attributes.
Let us look at steps to create a package for a sample application.
Step 1—In Oracle Solaris 11, first create a workspace and a prototype
area where you want to create the package:
oracle@solaris_11:~$ cd ~/work
oracle@solaris_11:~/work$ mkdir proto_inst
Extract the sample application source code:
oracle@solaris_11:~/work$ tar -zxf my_sample_src.tar.gz
oracle@solaris_11:~/work$ ls
my_sample_src/ proto_inst/
Step 2—Configure, compile, and install the sample application using the
following commands:
oracle@solaris_11:~/work$ cd my_sample_src
Set the sample application target install drectories:
oracle@solaris_11:~/work/my_sample_src $ ./configure
exec_prefix=~/work/proto_inst prefix=/usr
Compile the sample application sources:
oracle@solaris_11X:~/work/my_sample_src $ make
Install the sample application:
oracle@solaris_11X:~/work/my_sample_src $ make install
We are now ready to take the next step to create an IPS package from the
files that were just installed in the proto_install area.
oracle@solaris_11X:~/work/my_sample_src $ cd
~/work/proto_inst
oracle@solaris_11X:~/work/proto_inst $ls
bin/ doc/ lib/ man/ scripts/
oracle@solaris_11X:~/work/proto_inst $ cd ~/work/
oracle@solaris_11X:~/work $
Step 3—Create package metadata:
cat > my_sample.txt << EOF
set name=pkg.fmri
value=developer/versioning/my_sample@2.4.1,0.1
set name=pkg.description value="my_sample is a sample
application"
set name=pkg.summary value="mysample is a popular
opensource sample application"
set name=variant.arch value=$(ARCH)
set name=info.classification
value="org.opensolaris.category.2008:Development/sample
application"
EOF