OpenSoalris的indiana項目正在Debian創始人Ian Murdock的帶領下有條不紊的展開著,隨著indiana子項目IPS的不斷成熟,Solaris將會像Debian/Ubuntu一樣容易安裝和更新軟件。你當然可以參與其中,下面我先以GNU開源軟件gperf為例講一下如何構建Solaris原來的軟件包。
1. 編譯源代碼並組織結構
# pwd
/home/sm207740/gperf
# tree usr
usr/
`-- sfw
|-- bin
| `-- gperf
`-- share
|-- doc
| `-- gperf
| `-- gperf.html
|-- info
`-- man
`-- gperf.1
2. 手工創建pkginfo文件
# cd /home/sm207740/gperf
# mkdir InfoFiles
# cat InfoFiles/pkginfo
PKG=SUNWgperf
NAME=gperf - GNU gperf is a perfect hash function generator
ARCH=i386
VERSION=3.0.3
CATEGORY=application
EMAIL=shuang.mi@kiev
BASEDIR=/
CLASSES=none
3. 半自動創建prototype文件
# cd /home/sm207740/gperf
# pkgproto ./usr > InfoFiles/prototype
在文件InfoFiles/prototype最開始添加一行
i ./pkginfo
這樣InfoFiles/prototype現在應該是這個樣子的
# cat InfoFiles/prototype
i ./pkginfo
d none usr 0755 sm207740 staff
d none usr/sfw 0755 sm207740 staff
d none usr/sfw/bin 0711 sm207740 staff
f none usr/sfw/bin/gperf 0711 sm207740 staff
d none usr/sfw/share 0755 sm207740 staff
d none usr/sfw/share/man 0711 sm207740 staff
f none usr/sfw/share/man/gperf.1 0600 sm207740 staff
d none usr/sfw/share/info 0711 sm207740 staff
d none usr/sfw/share/doc 0711 sm207740 staff
d none usr/sfw/share/doc/gperf 0711 sm207740 staff
f none usr/sfw/share/doc/gperf/gperf.html 0600 sm207740 staff
4. 構建軟件包
# cd InfoFiles
# pkgmk -r /home/sm207740/gperf -d /home/sm207740/gperf
5. 安裝軟件
# ls /home/sm207740/gperf
InfoFiles SUNWgperf usr
# cd /home/sm207740/gperf
# pkgadd -d `pwd` SUNWgperf
Processing package instance
from
gperf - GNU gperf is a perfect hash function generator(i386) 3.0.3
Using > as the package base directory.
## Processing package information.
## Processing system information.
## Verifying disk space requirements.
## Checking for conflicts with packages already installed.
The following files are already installed on the system and are being
used by another package:
/usr
/usr/sfw
/usr/sfw/bin
/usr/sfw/share
/usr/sfw/share/doc
/usr/sfw/share/info
/usr/sfw/share/man
Do you want to install these conflicting files [y,n,?,q] y
## Checking for setuid/setgid programs.
Installing gperf - GNU gperf is a perfect hash function generator as
## Installing part 1 of 1.
/usr/sfw/bin/gperf
/usr/sfw/share/doc/gperf/gperf.html
/usr/sfw/share/man/gperf.1
[ verifying class ]
Installation of was successful.
# pkgchk -v SUNWgperf
/usr
/usr/sfw
/usr/sfw/bin
/usr/sfw/bin/gperf
/usr/sfw/share
/usr/sfw/share/doc
/usr/sfw/share/doc/gperf
/usr/sfw/share/doc/gperf/gperf.html
/usr/sfw/share/info
/usr/sfw/share/man
/usr/sfw/share/man/gperf.1
# pkginfo -l SUNWggrp
PKGINST: SUNWggrp
NAME: ggrep - GNU grep utilities
CATEGORY: system
ARCH: i386
VERSION: 11.11.0,REV=2007.10.30.01.06
BASEDIR: /
VENDOR: Sun Microsystems, Inc.
DESC: ggrep - GNU grep utilities 2.5
PSTAMP: sfwnv-x20071030011619
INSTDATE: Nov 16 2007 17:53
HOTLINE: Please contact your local service provider
STATUS: completely installed
FILES: 29 installed pathnames
13 shared pathnames
2 linked files
13 directories
1 executables
444 blocks used (approx)