<?xml version="1.0"?>
<linuxdoc><article opts="null"><titlepag><title>RPM-for-Unix HOW-TO</title><author><name>Al Dev (Alavoor Vasudevan)        <htmlurl url="mailto:alavoor[AT]yahoo.com" name="alavoor[AT]yahoo.com"></htmlurl></name></author><date>v1.8, 27 Mar 2002</date><abstract>This document will help you to setup Redhat RPM program on various Unix operating
systems like Solaris, AIX, Irix, HPUX and many others.
The information in this document applies to all flavors of Unix like - Solaris, HPUX, AIX, SCO, Sinix, BSD, NetBSD, Apple Macintosh (which is BSD),
UnixWare, etc.. and may be
useful to other operating systems (MS Windows 2000) which support "C" compiler.</abstract></titlepag><toc></toc><sect><heading>Introduction</heading><p><bf>(The latest version of this document is 
at <url url="http://www.milkywaygalaxy.freeservers.com" name="ent"></url>. You may
want to check there for changes).</bf></p><p>Redhat RPM program is the key program to install Redhat Linux Source RPMs.
There are more than 8000 Redhat application programs available 
on the internet in rpm source-code format. If you just install 
<bf>rpm</bf> program
on other flavors of Unix like Solaris, AIX, Irix or HPUX, then you can
very easily compile, build and install any of those 8000 application source
RPMs. </p><p>RPM is the "gateway" to thousands of applications and programs, which are in 
source code rpm format.</p><p>Maintainence of application programs is extremely easy with RPM program.
You can very easily remove, add and upgrade the application package from the
system. Using RPM program you can query the system to find the list of
packages installed and you can even list the files installed by a particular
package. RPM program can also give the exact path locations of the files
installed by a particular package. </p><p>The upgrades and updates can be automated using the 
<bf>rpm</bf> program
and the Redhat Network support.</p><p><it>The redhat <bf>rpm</bf> program is extremely powerful, extremely easy to use and is the
most popular packaging program in the world. Packaging programs on other Unix platforms like 
pkgadd, smitt are very primitive and are not as powerful as <bf>rpm</bf> program. And
<bf>rpm</bf> program is very portable and works on most Unix operating systems.</it></p><p>The guidelines given here can be useful for setting up
Debian package program
<bf>deb</bf> on Solaris and other Unix flavors.
GNU Debian Linux is another popular distribution and uses <bf>deb</bf> program
which is similar to 
<bf>rpm</bf> program
. You can use either 
<bf>rpm</bf> or
<bf>deb</bf> program.</p></sect><sect><heading>Install RPM</heading><p>To install RPM program you need gcc and BerkeleyDB.
First you should decide the version of Redhat Linux which you want
to use. The versions of Redhat Linux are 7.1 (latest), 6.2, 5.x (old versions).</p><p>To build
<bf>rpm</bf> 
package you need atleast BerkeleyDB and gcc compiler.
It is very important that you MUST select proper versions of gcc, BerkeleyDB
and RPM source based on whether you want to represent Redhat 7.1, Redhat 6.2
or 5.x. If you happen to have a Redhat Linux box then do -
<code>bash$ rpm -qa | grep -i gcc
bash$ rpm -qi gcc-2.96-81

bash$ rpm -qa | grep -i db3
bash$ rpm -qi db3-3.1.17-7

bash$ rpm -qa | grep -i rpm
bash$ rpm -qi rpm-4.0.2-8 </code>
From above, you can get the proper version numbers. </p><p><bf>WARNING: <it>If you do not use proper version numbers of 
gcc, db3 and rpm combinations then RPM program may not compile or work properly.</it></bf>.</p><p>For example - to target Redhat Linux 7.1 on Solaris, you should use gcc version 2.96,
Sleepycat Berkeley DB version 3.1.17 and RPM source version 4.0.2. 
Any other combination of versions <bf>WILL NOT</bf> work.</p><p>You can see the list of files and programs needed to build rpm. Login on linux box and:
<code>bash$ rpm -qR rpm-4.0.2-8
gawk
fileutils
textutils
mktemp
popt
glibc ent= 2.1.92
db1 = 1.85
/bin/sh
/bin/sh
/sbin/ldconfig
ld-linux.so.2
libbz2.so.1
libc.so.6
libdb-3.1.so
libdb.so.2
libpopt.so.0
librpm.so.0
librpmbuild.so.0
librpmio.so.0
libz.so.1
/bin/sh
libc.so.6(GLIBC_2.0)
libc.so.6(GLIBC_2.1)
libc.so.6(GLIBC_2.1.3)
libc.so.6(GLIBC_2.2)
libdb.so.2(GLIBC_2.0)
rpmlib(CompressedFileNames) ent= 3.0.4-1
bash$

To see to which package gawk belongs to do:

bash$ rpm -qif /usr/bin/gawk
Name        : gawk                         Relocations: (not relocateable)
Version     : 3.0.6                             Vendor: Red Hat, Inc.
Group       : Applications/Text             Source RPM: gawk-3.0.6-1.src.rpm</code></p><sect1><heading>Get Gnu "gcc"</heading><p>First, you need to install the Gnu C compiler gcc. 
You can use one of the following three sources: 
<itemize><item> Unix gcc package from 
<ref id="Solaris package" name="ent"></ref>,
<ref id="AIX package" name="ent"></ref>,
<ref id="IRIX package" name="ent"></ref>,
<ref id="HPUX package" name="ent"></ref>,
<ref id="UnixWare package" name="ent"></ref>,
<ref id="Mac OS package" name="ent"></ref>.
<p></p></item><item> Redhat source rpm from cdrom or from <url url="http://www.redhat.com" name="ent"></url>
or from <url url="http://www.rpmfind.net" name="ent"></url>
<p></p></item><item> Download binaries from <url url="http://www.gnu.org" name="ent"></url>
or <url url="http://www.gnu.org/software/gcc/gcc.html" name="gcc-home"></url>
where you can find <url url="http://www.gnu.org/software/gcc/install/binaries.html" name="gcc binary for Unix"></url>.</item></itemize></p><p>If you downloaded Solaris/Unix package:
<code># su - root
# man pkgadd
# pkgadd -d gcc-sparc*.pkg</code></p><p>If you downloaded rpm package:
<code>bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ rpm2cpio gcc-*.src.rpm | cpio -dimv
bash$ tar zxvf gcc*.tar.gz
bash$ cd gcc-2.96
bash$ ./configure
bash$ make</code></p></sect1><sect1><heading>Get BerkeleyDB</heading><p>Second, you need to install the BerkeleyDB embedded database from 
<url url="http://www.sleepycat.com" name="ent"></url>.
RPM internally uses the embedded database BerkeleyDB to store the package information.
You can use one of the following three sources: 
<itemize><item> Redhat source rpm from cdrom or from <url url="http://www.redhat.com" name="ent"></url>
or from <url url="http://www.rpmfind.net" name="ent"></url>
<p></p></item><item> Download binaries from 
<url url="http://www.sleepycat.com" name="ent"></url> go here and see
<url url="http://www.sleepycat.com/update/index.html" name="Berkeley DB Patches and ChangeLogs"></url>
scroll down and select proper version like 3.1.17 (one which matches with Redhat Linux 7.1).
<p></p></item><item> Unix gcc package from 
<ref id="Solaris package" name="ent"></ref>,
<ref id="AIX package" name="ent"></ref>,
<ref id="IRIX package" name="ent"></ref>,
<ref id="HPUX package" name="ent"></ref>,
<ref id="UnixWare package" name="ent"></ref>,
<ref id="Mac OS package" name="ent"></ref>.</item></itemize></p><p>If you downloaded source rpm or source tar.gz file:
<code>bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ rpm2cpio db3-3.1.17-7.src.rpm | cpio -dimv 
bash$ tar zxvf db3*.tar.gz
bash$ cd db3-3.1.17
bash$ cd build_unix
bash$ ../dist/configure --enable-compat185
bash$ make
bash$ make install</code></p><p>If you downloaded Unix package:
<code># su - root
# man pkgadd
# pkgadd -d db-3*-sparc*.pkg</code></p></sect1></sect><sect><heading>BerkeleyDB and gcc <label id="Unix packages"></label></heading><p>Download BerkeleyDB and gcc for Unix as given below:</p><sect1><heading>Solaris - BerkeleyDB and gcc <label id="Solaris package"></label></heading><p>You can get gcc and BerkeleyDB for Solaris from:
<itemize><item> Solaris gcc package from <url url="http://www.sunfreeware.com" name="ent"></url>
<p></p></item><item> Sparc, Sun Solaris, Ultra Sparc <url url="http://www.ultralinux.org" name="ent"></url></item></itemize></p></sect1><sect1><heading>AIX - BerkeleyDB and gcc
<label id="AIX package"></label></heading><p>You can get gcc and BerkeleyDB for AIX from:
<itemize><item> IBM main site <url url="http://www-1.ibm.com/servers/aix/library" name="ent"></url> and 
<url url="http://www-1.ibm.com/servers/aix/library/downloads.html" name="download-site"></url>.
<p></p></item><item> Univ of California AIX site <url url="http://aixpdslib.seas.ucla.edu" name="ent"></url>
<p></p></item><item> Norcal org site <url url="http://www.aiche-norcal.org/AIXtip/freeware.htm" name="ent"></url>
<p></p></item><item> Bull site <url url="http://www.bull.de/pub" name="ent"></url>
<p></p></item><item>The PowerPC arch rpms are at <url url="http://penguinppc.org" name="ent"></url>.</item></itemize></p></sect1><sect1><heading>IRIX Silicon Graphics - BerkeleyDB and gcc
<label id="IRIX package"></label></heading><p>You can get gcc and BerkeleyDB for SGI IRIX from:
<itemize><item> SGI main site <url url="http://freeware.sgi.com" name="ent"></url>
<p></p></item><item> SGI freware alphabetical listing <url url="http://freeware.sgi.com/index-by-alpha.html" name="ent"></url></item></itemize></p></sect1><sect1><heading>HPUX - BerkeleyDB and gcc
<label id="HPUX package"></label></heading><p>You can get gcc and BerkeleyDB for HPUX from:
<itemize><item> Gnu gcc for HPUX <url url="http://devresource.hp.com/OpenSource/Tools/gcc/gcc.html" name="ent"></url>
<p></p></item><item> HPUX opensource tools <url url="http://devresource.hp.com/OpenSource/Tools" name="ent"></url>
and <url url="http://devresource.hp.com/OpenSource/Tools/OpenSourceLib.html" name="tool-list"></url>
<p></p></item><item> <url url="http://bak-px.online.sh.cn/mirrors/hpux.freeware" name="HPUX freeware"></url>
<p></p></item><item> HPUX Porting and Archive Center <url url="http://hpux.cs.utah.edu" name="ent"></url>
and <url url="http://hpux.cs.utah.edu/hppd/hpux" name="alphabetical listing"></url>
and <url url="http://hpux.cs.utah.edu/hppd/hpux/Gnu/alpha.html" name="Gnu"></url></item></itemize></p></sect1><sect1><heading>UnixWare - BerkeleyDB and gcc
<label id="UnixWare package"></label></heading><p>You can get gcc and BerkeleyDB for UnixWare from:
<itemize><item> FreeBird site <url url="http://www.freebird.org" name="ent"></url>
<p></p></item><item> Skunkware site <url url="http://www.sco.com/skunkware" name="ent"></url>
<p></p></item><item> Gnu gcc for 
<url url="http://www.freebird.org/sw-map/developer.html" name="gcc-unixware"></url>
and
<url url="http://www.faqs.org/faqs/unix-faq/unixware/overview/section-1.html" name="faq-site"></url></item></itemize></p></sect1><sect1><heading>Apple Macintosh OS X (Unix) - BerkeleyDB and gcc
<label id="Mac OS package"></label></heading><p>You can get gcc and BerkeleyDB for Apple Macintosh OS X (which is BSD Unix) from:
<itemize><item> Gnu gcc for Apple Mac OS shipped with OS  called "ProjectBuilder IDE"
<url url="http://developer.apple.com/tools/projectbuilder" name="ent"></url>
and
<url url="http://maccentral.macworld.com/news/0007/13.macosx.shtml" name="faq"></url>
<p></p></item><item> List of Opensource packages for Mac <url url="http://www.publicsource.apple.com/projects/darwin/1.2/projects.html" name="Darwin-project"></url>
<p></p></item><item> See also <url url="http://fink.sourceforge.net" name="Fink Project"></url>
Fink uses Debian tools like dpkg and apt-get to provide powerful binary package management.</item></itemize></p></sect1></sect><sect><heading>Compiling RPM</heading><p>After building Berkeley DB3 and gcc, compile rpm program now.
Get rpm source code from one of the following two sources: 
<itemize><item> Redhat source rpm from cdrom or from <url url="http://www.redhat.com" name="ent"></url>
or from <url url="http://www.rpmfind.net" name="ent"></url> and look for proper version like 7.1
<p></p></item><item> Download source code of rpm from 
<url url="http://www.rpm.org" name="ent"></url> go here 
and select proper version like 4.0.2 (one which matches with Redhat Linux 7.1).
Download from <url url="ftp://ftp.rpm.org/pub" name="ftp-site"></url>.</item></itemize></p><p></p><p>If you downloaded rpm*.tar.gz file:
<code>bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ tar zxvf rpm*.tar.gz
bash$ cd rpm-4.0.2
bash$ export LIBS='-L/usr/local/BerkeleyDB.3.1/lib'
bash$ export CPPFLAGS='-I/usr/local/BerkeleyDB.3.1/include'
bash$ ./configure
bash$ make</code></p><p>If you downloaded rpm source code file follow the steps below.
But you may need rpm2cpio program, which is packaged in rpm package. Get rpm package
(may be old version like 3.0) from 
<ref id="Unix packages" name="ent"></ref>.
<code>bash$ mkdir my_temp_build
bash$ cd my_temp_build
bash$ rpm2cpio rpm-4.0.2-8.src.rpm | cpio -dimv 
bash$ tar zxvf rpm*.tar.gz
bash$ cd rpm-4.0.2
bash$ export LIBS='-L/usr/local/BerkeleyDB.3.1/lib'
bash$ export CPPFLAGS='-I/usr/local/BerkeleyDB.3.1/include'
bash$ ./configure
bash$ make</code></p><sect1><heading>Troubleshooting RPM Compile<label id="troubleshoot"></label></heading><p>If you encounter any problem in compiling rpm program, you may have to do some minor
corrections.</p><p>In case of Solaris 8 and rpm v4.0.2, I got these problems:
<itemize><item> Error db3/db.h not found in lib/db3.c. Solution is - create a soft link:
<code>bash# ln -s /usr/local/BerkeleyDB.3.1.17/include  /usr/include/db3

Or edit the file lib/db3.c and change 
#include entdb3/db.hent 
to 
#include entdb.hent </code>
<p></p></item><item> Edit Makefile and put -L before libmisc.a at line 186
<p></p></item><item> Compile error in file rpmsort.c: Function errx() not found. 
Solution is - edit the file rpmsort.c and copy and paste the 
function errx() from misc/err*.c. Or comment out line having errx() 
and put fprintf(stderr, "Error encountered - blah, blah"); exit(0);</item></itemize></p></sect1></sect><sect><heading>Using RPM</heading><p>See also <url url="http://linuxdoc.org/HOWTO/RPM-HOWTO/use.html" name="RPM-HOWTO"></url> document.</p><sect1><heading>Basic RPM Commands<label id="basicrpm"></label></heading><p>In its simplest form, RPM can be used to install, erase or upgrade packages: 
<code>bash# rpm -i foobar-1.0-1.i386.rpm   ...(to install packages)
bash# rpm -i ftp://ftp.redhat.com/pub/redhat/RPMS/foo-1.0-1.i386.rpm ...(to install package via ftp)
bash# rpm -e foobar  ...(to uninstall package)
bash# rpm -U foobar-1.0-1.i386.rpm  ...(to upgrade package)
bash# rpm --help  ...(to see help on rpm options)
bash# man rpm  ...(to read online manual page)</code></p></sect1><sect1><heading>RPM Build Commands<label id="buildrpm"></label></heading><p>To build rpm packages
<code>bash# rpm -i foobar*.src.rpm
bash# cd /usr/src/redhat/SPECS
bash# rpm -ba foobar-1.0-1.spec

To build in incremental steps, do:
bash# rpm -bp foobar-1.0-1.spec    ...( to do prep stage)
bash# rpm --short-circuit -bc foobar-1.0-1.spec    ...( to do build stage)
bash# rpm --short-circuit -bi foobar-1.0-1.spec    ...( to do install stage)
bash# rpm -ba foobar-1.0-1.spec  ... (to do binary and source package)</code></p></sect1><sect1><heading>RPM Query Commands<label id="queryrpm"></label></heading><p>You can query the rpm database with these powerful commands:
<code>bash$ rpm -qpl foobar-1.0-1.i386.rpm  ....(list of files in a rpm package)
bash$ rpm -ql foobar-1.0-1   ....(list of files from already installed package)

bash$ rpm -qpR foobar-1.0-1.i386.rpm  ....(list packages on which this package depends)
bash$ rpm -qR foobar-1.0-1  ....(list packages on which this installed package depends)

bash$ # rpm -q foo  ...(print package name, version, and release number of package foo)
foo-2.0-1

bash$ rpm -qa | less   ....(list all the installed package)
bash$ rpm -qa | grep -i kde   ....(list all the installed package matching kde)
bash$ rpm -qif /bin/ls ....(list the package which installed the file /bin/ls)

To show the values RPM will use for all of the options that may be set in rpmrc files
(/usr/lib/rpm/rpmrc, /etc/rpmrc, ~/.rpmrc ), type:
bash$ rpm --showrc | less</code></p></sect1><sect1><heading>RPM Verify Commands<label id="verifyrpm"></label></heading><p>Verifying a package compares information about files installed from a 
package with the same information from the original package. Among other 
things, verifying compares the size, MD5 sum, permissions, type, owner 
and group of each file. </p><p>The command <bf>rpm -V</bf> verifies a package. You can use any of the
Package Selection Options listed for querying to specify the packages
you wish to verify. A simple use is
<bf>rpm -V</bf> foo which verifies that all the files in the foo package
are as they were when they were originally installed. For example: </p><p><code>bash$ rpm -Vf /bin/vi ...(To verify a package containing particular file)
bash$ rpm -Va ...(To verify ALL installed packages) 
bash$ rpm -Vp foo-1.0-1.i386.rpm ...(To verify an installed package against an RPM package file)</code>
This can be useful if you suspect that your RPM databases are corrupt. </p><p>If everything verified properly there will be no output. If there are any 
discrepancies they will be displayed. The format of the output is a string 
of 8 characters, a possible "c" denoting a configuration file, and then the 
file name. Each of the 8 characters denotes the result of a comparison of one 
attribute of the file to the value of that attribute
recorded in the RPM database. A single "." (period) means the test 
passed. The following characters denote failure of certain tests: 
<code>     5 -- MD5 checksum 
     S -- File size 
     L -- Symbolic link 
     T -- File modification time 
     D -- Device 
     U -- User 
     G -- Group 
     M -- Mode (includes permissions and file type) 
     ? -- Unreadable file </code>
If you see any output, use your best judgment to determine 
if you should remove or reinstall the package, or otherwise fix the problem. </p></sect1></sect><sect><heading>Installing 8000 RPMs</heading><p>Once RPM program is installed, it is a gateway to thousands of RPM packages
which can be easily installed on the system.</p><p>Prepare the rpm directories
<code>bash# su - root
bash# mkdir -p /usr/local/src/redhat/BUILD
bash# mkdir -p /usr/local/src/redhat/RPMS/sparc64
bash# mkdir -p /usr/local/src/redhat/RPMS/noarch
bash# mkdir -p /usr/local/src/redhat/SOURCES
bash# mkdir -p /usr/local/src/redhat/SPECS
bash# mkdir -p /usr/local/src/redhat/SRPMS</code></p><p>You may want to edit the <bf>rpmrc</bf> file. In case of solaris 8,
I had to remove the <bf>-m64</bf> option for gcc, since it was giving compile errors.
To show the values, RPM will use for all of the options that may be set in rpmrc files
(/usr/local/lib/rpm/rpmrc, /usr/lib/rpm/rpmrc, /etc/rpmrc, ent/.rpmrc ), type:
<code>bash$ rpm --showrc | less</code></p><sect1><heading>Bootstrap Programs - The Rocket Soars Up!!<label id="bootstrap"></label></heading><p>Before building rpms you need the following basic programs:
<itemize><item> install program from fileutils*.tar.gz</item><item> patch*.tar.gz</item><item> autoconf*.tar.gz</item><item> automake*.tar.gz</item><item> libtool*.tar.gz</item><item> gcc*.tar.gz</item></itemize>
You should download the tar.gz files or 
<ref id="Unix packages" name="ent"></ref>. I downloaded solaris packages for fileutils.pkg,
patch.pkg, libtool.pkg, gcc and others.
You should install them in a temporary location like $HOME/localtmp
<code>bash# mkdir $HOME/localtmp
bash# cd $HOME/localtmp
bash# gzip -d libtool*.tar.gz
bash# tar -xvf libtool*.tar
bash# ./configure --with-prefix=$HOME/localtmp
bash# make; make install</code>
You should include the temporary location of autoconf by:
<code>bash# PATH=$HOME/localtmp/bin:$PATH
bash# export PATH</code></p></sect1><sect1><heading>Install Foundation RPMs <label id="foundationrpm"></label></heading><p>There are few basic rpms which must be installed before any other rpm is installed.
In this section, foundation rpms are listed which are found by using:
<code>bash# rpm -qR entpackagenameent
bash# rpm -qR textinfo
bash# rpm -qR fileutils
bash# rpm -qR setup</code></p><p>The foundation rpms in the order of dependency are as follows:
<itemize><item> fileutils*.rpm</item><item> grep*.rpm (You may have to edit grep.spec and commentout --without-included-regex)</item><item> gawk*.rpm</item><item> sed*.rpm</item><item> texinfo*.rpm</item><item> zlib*.rpm and zlib-devel</item><item> patch*.rpm</item><item> setup*.rpm</item><item> filesystem*.rpm (You may not want install this if it effects /proc directory)</item><item> textutils*.rpm</item><item> glibc-common*.rpm</item><item> basesystem*.rpm</item><item> mktemp*.rpm</item><item> bash*.rpm</item><item> m4*.rpm (autoconf needs this)</item><item> autoconf </item><item> bison </item><item> binutils ent= 2.9.1.0.25 </item><item> gas, as, ld which are in binutils</item><item> shutils - for 'id' command </item></itemize></p><p>Second stage foundation rpms are as follows.
After installing the foundation rpms, next important rpm is gcc, the order of rpms you need is:
<itemize><item> glibc*.rpm</item><item> binutils*.rpm</item><item> kernel-headers*.rpm</item><item> glibc-devel*.rpm</item><item> gcc*.rpm</item></itemize></p><p>Third stage rpms are as follows:
<itemize><item> popt*.rpm</item><item> rpm*.rpm</item><item> perl*.rpm</item><item> And many others....</item></itemize></p><p>As from previous section you should have exported temp 
location of autoconf, gcc and other programs by:
<code>bash# PATH=$HOME/localtmp/bin:$PATH
bash# export PATH

bash# rpm -i fileutils*.src.rpm
bash# rpm -i zlib*.src.rpm
bash# rpm -i texinfo*.src.rpm

bash# cd /usr/local/src/redhat/SPECS
bash# rpm -ba fileutils.spec</code></p><p>After the build is successful, install it with "nodeps and excludedocs" to minimize
the failures. After substantial installations of many foundation rpms you can "freshen"
the rpms with rpm command.
<code>bash# cd /usr/local/src/redhat/RPMS/sparc64
bash# rpm -i --nodeps --excludedocs fileutils*.rpm</code>
Move on to build and install the next rpm in the list texinfo, zlib, patch,....</p></sect1><sect1><heading>Troubleshoot Building Foundation RPMs <label id="troublefoundation"></label></heading><p>On Solaris 2.8, I encountered following problems which were fixed by 
correcting the spec file:
<itemize><item> <bf>texinfo*.rpm: </bf> 
Edit the file texinfo.spec and change ententspecentinstallentpost, entbuild and entinstall sections:
<code>%define Rpmpath /usr/local
%define __spec_install_post %{Rpmpath}/lib/rpm/brp-strip \; %{Rpmpath}/lib/rpm/brp-strip-comment-note \; rm -f

%build
%define _mandir %{_prefix}/share/man
%define _infodir %{_prefix}/share/info
%configure

%install
#mkdir -p ${RPM_BUILD_ROOT}/{etc,sbin}        .....this line is causing problems
mkdir -p ${RPM_BUILD_ROOT}/etc
mkdir -p ${RPM_BUILD_ROOT}/sbin</code>
<p></p></item><item> <bf>textutils*.rpm: </bf> 
Create a new unix group called 'other'. Type 'groupadd other'
and see 'man groupadd'. Second problem - edit textutils.spec file and in entfiles section replace
hard-coded filenames/pathnames with entententprefixent.
<code>%files
# replace below line
#/usr/bin/*
# with the line given below
%{_prefix}/bin/*</code>
<p></p></item><item> <bf>patch*.rpm: </bf> 
Edit patch.spec file and in entfiles section replace
hard-coded filenames/pathnames with entententprefixent.
<code>%files
# replace below line
#/usr/bin/*
# with the line given below
%{_prefix}/bin/*</code>
<p></p></item><item> <bf>gawk*.rpm: </bf> 
Edit gawk.spec file and in entfiles section and entinstall section replace
hard-coded filenames/pathnames like /usr/something with entententprefixent/something.
<p></p></item><item> <bf>m4*.rpm: </bf> 
Edit m4.spec file and in entbuild section, the configure takes only
--prefix and --exec-prefix. Also comment out autoconf.</item></itemize></p></sect1></sect><sect><heading>Create gcc RPM Package</heading><p>The GNU gcc rpm is the most important rpm package which you should create after
successfully creating rpm of RPM package.
In order to create GNU gcc rpm package, you need to install rpms, unix pkgs or
manual configure and install the following (given in order of dependency) :
<itemize><item> texinfo</item><item> patch</item><item> zlib and zlib-devel</item><item> fileutils ent= 4.0.41</item><item> m4 ent= 1.1 (autoconf needs this) </item><item> autoconf </item><item> bison </item><item> binutils ent= 2.9.1.0.25 </item><item> gas, as, ld which are in binutils</item><item> cpp - manual install gcc </item><item> gawk </item><item> shutils - for 'id' command </item><item> pthreads - Posix threads library </item></itemize>
You should download the tar.gz files or 
<ref id="Unix packages" name="ent"></ref>. I downloaded solaris packages for texinfo.pkd, fileutils.pkg,
patch.pkg, libtool.pkg, gcc and others.
If you download tar.gz source file then you should install them in a temporary 
location like $HOME/localtmp
<code>bash# mkdir $HOME/localtmp
bash# cd $HOME/localtmp
bash# gzip -d libtool*.tar.gz
bash# tar -xvf libtool*.tar
bash# ./configure --with-prefix=$HOME/localtmp
bash# make; make install</code>
You should include the temporary location of autoconf by:
<code>bash# PATH=$HOME/localtmp/bin:$PATH
bash# export PATH</code></p><p>Now you are ready to build gcc rpm:
<code>bash# rpm -i gcc*.src.rpm
bash# cd /usr/local/src/redhat/SPECS
bash# rpm -ba gcc*.spec</code>
On Solaris 2.8 I had to make few changes to gcc*.spec file:
<enum><item> In entbuild section :  
Insert <bf><it>--enable-hacker-mode</it></bf> option for configure command.
This is to correct error 
- "This configuration not supported in solaris 2.8".
If <bf><it>--enable-hacker-mode</it></bf> option does not work then you may have to
comment out gccenttargetplatform within the code  entifarch sparc .... entendif, 
just before the configure command.
<p></p></item><item> In entbuild section :  
For the configure command comment out entententtargetentplatforment, if configure fails.
<p></p></item><item> In entinstall section: Comment out numprocs = $(getconf entNPROCESSORS)
and put numprocs=1. Since my box had 2 cpus I put numprocs=2. The solaris has /usr/bin/getconf
which is different from GNU getconf in glibc.</item></enum>
Setup shared lib in solaris:
<code> 
solaris# cd /var/ld
solaris# man ld.so.1
solaris# man crle
solaris# crle  ent hit return to see config infoent
solaris# crle /usr/lib:/usr/local/lib:/usr/local/pgsql/lib:/usr/local/BerkeleyDB.3.1/lib</code></p><sect1><heading>Solaris Sparc gcc, glibc, kernel-headers and binutils <label id="sparcgcc"></label></heading><p>You can download the source code rpm for sparc from
<url url="http://www.rpmfind.net/linux/rpm2html/search.php?query=sparc" name="sparc-gcc"></url>
or go to <url url="http://www.rpmfind.net" name="ent"></url> and type <bf>sparc</bf> in the search field.
You can also download sparc-glibc, sparc-kernel-headers and sparc-binutils source rpms.
<code>solaris# rpm -i sparc-gcc*.src.rpm
solaris# cd /usr/local/src/redhat/SPECS
solaris# rpm -ba sparc-gcc.spec</code>
You may want to edit sparc-binutils.spec and
in entinstall section: Comment out numprocs = $(getconf entNPROCESSORS)
and put numprocs=1. Since my box had 2 cpus I put numprocs=2. The solaris has /usr/bin/getconf
which is different from GNU getconf in glibc. Also change entfiles section change 
entdoc /usr/man/man1/sparc-linux-ld.1.gz  to
entdoc /usr/man/man1/sparc-linux-ld.1.</p></sect1><sect1><heading>PowerPC gcc, glibc, kernel-headers and binutils <label id="powerpc"></label></heading><p>The PowerPC arch rpms are at <url url="http://penguinppc.org" name="ent"></url>.</p></sect1><sect1><heading>Create glibc RPM <label id="glibc"></label></heading><p>If configure complains that your platform is not supported, then
you may want to edit glibc.spec file and in entconfigure section 
put <it>--enable-hacker-mode</it>, </p><p>For Solaris there is ready-made sparc-glibc*.src.rpm from
<url url="http://www.rpmfind.net/linux/rpm2html/search.php?query=sparc" name="sparc-gcc"></url>
or go to <url url="http://www.rpmfind.net" name="ent"></url> and type <bf>sparc</bf> in the search field.</p><p>The glibc needs the sparc-kernel-headers*.rpm which you can get from
<url url="http://www.rpmfind.net/linux/rpm2html/search.php?query=sparc" name="sparc-gcc"></url>.</p></sect1></sect><sect><heading>Use Debian Packages - Convert deb to rpm<label id="debian"></label></heading><p>Debian Linux is another popular distribution. You can use the debian packages
for Sparc, PowerPC, m68k, MIPS, Alpha, Arm, Intel X86 or Itanium.</p><sect1><heading>Debian Packing Program<label id="debpgm"></label></heading><p></p><p>To build real debs that contain software, you'll need: 
<bf>binutils, cpp, cpio, dpkg-dev, file, gcc, libc6-dev, make, patch, perl dh-make, debhelper, devscripts, fakeroot</bf>
and 
<bf>lintian</bf>
. If your package needs to prompt the user for configuration information when it installs, get 
<bf>debconf</bf>
.</p><p>The main debian programs you need to get are:
<itemize><item> dpkg-dev : This package contains the tools needed to create Debian archives. It also contains the Debian Programmers and Policy manuals. 
<p></p></item><item> debmake : This is a higher level set of tools for creating Debian packages. It makes the whole process tremendously easier. 
<p></p></item><item> debhelper : A collection of programs that can be used in a debian/rules file 
to automate common tasks related to building debian packages. Programs are included 
to install various files into your
package, compress files, fix file permissions, integrate your package with
the debian menu system, suidmanager, doc-base, etc. Most debian packages use 
debhelper as part of their build process.
<p></p></item><item> debconf : Debconf is a configuration management system for debian packages. Packages use Debconf to ask questions when they are installed.
<p></p></item><item> apt-howto : A Guide to APT. 
This manual tries to be a quick but complete source of information about the 
APT system and its features. 
It documents the main uses of APT with many examples. (You may want to edit apt-howto*.sgml and
change debiandoc to linuxdoc and run sgml2html).</item></itemize></p><p>Get these from <url url="http://www.debian.org/distrib/packages" name="ent"></url>, go here and type
in the search box <bf>dpkg-dev</bf> or <bf>apt-howto</bf> and select Stable, Testing 
or Unstable in the distribution.
Download and build on your Unix system (Solaris, AIX, HPUX).</p><p>See 
<url url="http://noframes.linuxjournal.com/articles/misc/0046.html" name="Debian Package Management"></url>
, Debian
<url url="http://www.debian.org/doc/debian-policy" name="Policy Manual"></url>,
Debian<url url="http://www.debian.org/doc/maint-guide" name="New Maintainer's Guide"></url>
and <url url="http://bazar.conectiva.com.br/~godoy/apt-howto" name="apt+rpm howto"></url>.</p></sect1><sect1><heading>Debian to Redhat RPM <label id="deb2rpm"></label></heading><p>To install Debian packages on Sun Solaris 2.8 (Sparc/Ultra-sparc) I downloaded
all the debian packages for sparc from
<url url="http://www.debian.org" name="ent"></url>. Go here and click on distribution-entsparc.
Better still, purchase the Debian binary and source cdrom for Sparc (or for PowerPC, Alpha).
Use 
<bf>alien</bf> program to convert the debian packages to redhat <bf>rpm</bf>.</p><p>Get 
<bf>alien</bf> program
from <url url="http://www.rpmfind.net" name="ent"></url>.
<code>solaris# rpm -i alien*.src.rpm
solaris# rpm -ba alien.spec
solaris# rpm -i alien.sparc.rpm
solaris# alien -r glibc*.deb     (..... this will create the rpm file)
solaris# rpm -i glibc-sparc*.rpm</code>
Convert all debian binary packages to rpm and install on Solaris 2.8 OS.</p><p>Note 
<bf>alien</bf> program
works only for binary debian packages.</p></sect1></sect><sect><heading>Convert RPM to Solaris Package rpm2pkg</heading><p>After building and installing all the RPMs on Solaris (or any Unix), you can
convert those programs to Solaris (or any Unix) packages.</p><p>To convert Redhat rpm to Solaris package do:
<code>bash# mkdir -p  $HOME/tmp/myprogram-1.4/usr/local
bash# cd $HOME/tmp/myprogram-1.4/usr/local
bash# rpm2cpio rpm-4.0.2-8.sparc64.rpm | cpio -dimv 
bash# tar -xvf rpm*.tar.gz
bash# make_package</code></p><p>And run the perl script <bf>makeentpackage</bf> given at
<url url="http://www.sunfreeware.com/pkgadd.html" name="ent"></url></p></sect><sect><heading>Related URLs</heading><p><itemize><item> Main site of RPM <url url="http://www.rpm.org" name="ent"></url>
<p></p></item><item> Maximum RPM book <url url="http://www.rpmdp.org/rpmbook/node1.html" name="ent"></url>
<p></p></item><item> RPM HOWTO <url url="http://linuxdoc.org/HOWTO/RPM-HOWTO/index.html" name="ent"></url>
<p></p></item><item> <url url="http://www.redhat.com/support/manuals/RHL-7-Manual/ref-guide/s1-rpm-using.html" name="RH manual - rpm"></url>
<p></p></item><item> RPM Finder <url url="http://www.rpmfind.net" name="ent"></url>
<p></p></item><item> RPM related sofware <url url="http://rpm.org/software.html" name="ent"></url>
<p></p></item><item> RPM mailing lists <url url="http://rpm.org/mailing_list.html" name="ent"></url>
<p></p></item><item> Sparc, Sun Solaris, Ultra Sparc <url url="http://www.ultralinux.org" name="ent"></url>
<p></p></item><item>The PowerPC arch rpms are at <url url="http://penguinppc.org" name="ent"></url>.</item></itemize></p><p></p><p>Linux goodies main site is at <url url="http://www.milkywaygalaxy.freeservers.com" name="ent"></url> 
Mirror sites are at -
<url url="http://aldev0.webjump.com" name="ent"></url>,
<url url="http://www.angelfire.com/country/aldev0" name="angelfire"></url>,
<url url="http://www.geocities.com/alavoor/index.html" name="geocities"></url>,
<url url="http://aldev0.virtualave.net" name="virtualave"></url>,
<url url="http://aldev0.50megs.com" name="50megs"></url>,
<url url="http://members.theglobe.com/aldev1/index.html" name="theglobe"></url>,
<url url="http://members.nbci.com/alavoor" name="NBCi"></url>,
<url url="http://aldev.terrashare.com" name="Terrashare"></url>,
<url url="http://members.fortunecity.com/aldev" name="Fortunecity"></url>,
<url url="http://aldev.freewebsites.com" name="Freewebsites"></url>,
<url url="http://members.tripod.lycos.com/aldev" name="Tripod"></url>,
<url url="http://members.spree.com/technology/aldev" name="Spree"></url>,
<url url="http://www.escalix.com/freepage/aldev" name="Escalix"></url>,
<url url="http://www.httpcity.com/aldev/index.html" name="Httpcity"></url>,
<url url="http://aldev.freeservers.com" name="Freeservers"></url>.</p></sect><sect><heading>Other Formats of this Document</heading><p>This document is published in 14 different formats namely: DVI, Postscript, 
Latex, Adobe Acrobat PDF,
LyX, GNU-info, HTML, RTF(Rich Text Format), Plain-text, Unix man pages, single 
HTML file, SGML (Linuxdoc format), SGML (Docbook format), and MS WinHelp format.</p><p>This howto document is located at:
<itemize><item> <url url="http://www.linuxdoc.org" name="ent"></url> and click on HOWTOs and search 
for the howto document name using CTRL+f or ALT+f within the web-browser.</item></itemize></p><p>You can also find this document at the following mirrors sites: 
<itemize><item> <url url="http://www.caldera.com/LDP/HOWTO" name="ent"></url></item><item> <url url="http://www.linux.ucla.edu/LDP" name="ent"></url></item><item> <url url="http://www.cc.gatech.edu/linux/LDP" name="ent"></url></item><item> <url url="http://www.redhat.com/mirrors/LDP" name="ent"></url>
</item><item> Other mirror sites near you (network-address-wise) can be found at
<url url="http://www.linuxdoc.org/mirrors.html" name="ent"></url>
select a site and go to directory /LDP/HOWTO/xxxxx-HOWTO.html</item></itemize></p><p></p><p><itemize><item>You can get this HOWTO document as a single file tar ball in HTML, DVI, 
Postscript or SGML formats from -
<url url="ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO/other-formats/" name="ent"></url>
and <url url="http://www.linuxdoc.org/docs.html#howto" name="ent"></url>
<p></p></item><item>Plain text format is in: <url url="ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO" name="ent"></url>
and <url url="http://www.linuxdoc.org/docs.html#howto" name="ent"></url>
<p></p></item><item>Single HTML file format is in: 
<url url="http://www.linuxdoc.org/docs.html#howto" name="ent"></url>
<p> A single HTML file can be created with the command (see man sgml2html) - 
sgml2html -split 0   xxxxhowto.sgml</p><p></p></item><item>Translations to other languages like French, German, Spanish, 
Chinese, and Japanese are in
<url url="ftp://www.linuxdoc.org/pub/Linux/docs/HOWTO" name="ent"></url>
and <url url="http://www.linuxdoc.org/docs.html#howto" name="ent"></url>
Any help from you to translate to other languages is welcome.</item></itemize>
The document is written using a tool called "SGML-Tools" which can be got from: 
<url url="http://www.sgmltools.org" name="ent"></url>
Compiling the source you will get the following commands like:
<itemize><item>sgml2html xxxxhowto.sgml     (to generate html file)</item><item>sgml2html -split 0   xxxxhowto.sgml (to generate a single page html file)</item><item>sgml2rtf  xxxxhowto.sgml     (to generate RTF file)</item><item>sgml2latex xxxxhowto.sgml    (to generate latex file)</item></itemize></p><sect1><heading>Acrobat PDF format <label id="acrobatpdf"></label></heading><p>A PDF file can be generated from postscript file using 
either acrobat <bf>distill</bf> or <bf>Ghostscript</bf>.
And a postscript file is generated
from DVI which in turn is generated from a LaTex file.
You can download distill software from <url url="http://www.adobe.com" name="ent"></url>
and from <url url="http://www.adobe.com/support/downloads/acdunix.htm" name="unix"></url>
and from <url url="http://www.adobe.com:80/support/downloads/acdwin.htm" name="windows"></url>
. Given below 
is a sample session:
<code>bash$ man sgml2latex
bash$ sgml2latex filename.sgml
bash$ man dvips
bash$ dvips -o filename.ps filename.dvi
bash$ distill filename.ps
bash$ man ghostscript
bash$ man ps2pdf
bash$ ps2pdf input.ps output.pdf
bash$ acroread output.pdf ent</code>
Or you can use the Ghostscript command <bf>ps2pdf</bf>.
ps2pdf is a work-alike for nearly all the functionality of 
Adobe's Acrobat Distiller product: it
converts PostScript files to Portable Document Format (PDF) files. 
<bf>ps2pdf</bf> is implemented as a very small command script 
(batch file) that invokes Ghostscript, selecting a special "output device"
called <bf>pdfwrite</bf>. In order to use ps2pdf, the pdfwrite 
device must be included in the makefile when Ghostscript was compiled;
see the documentation on building Ghostscript for details.</p></sect1><sect1><heading>Convert Linuxdoc to Docbook format <label id="linuxdoc2docbook"></label></heading><p>This document is written in linuxdoc SGML format. The Docbook SGML format
supercedes the linuxdoc format and has a lot more features than linuxdoc.
The linuxdoc is very simple and easy to use. To convert linuxdoc SGML 
file to Docbook SGML use the program <bf>ld2db.sh</bf> and some Perl scripts.
The ld2db output is not 100ent clean and you need to use the <bf>cleanentld2db.pl</bf>
Perl script. You may need to manually correct a few lines in the document.
<itemize><item> Download the ld2db program from <url url="http://www.dcs.gla.ac.uk/~rrt/docbook.html" name="ent"></url>
or from <url url="http://www.milkywaygalaxy.freeservers.com" name="Milkyway Galaxy site"></url></item><item> Download the cleanupentld2db.pl perl script from
from <url url="http://www.milkywaygalaxy.freeservers.com" name="Milkyway Galaxy site"></url></item></itemize>
The ld2db.sh is not 100ent clean, so you will get some errors when you run it.
<code>	bash$ ld2db.sh file-linuxdoc.sgml db.sgml
	bash$ cleanup.pl db.sgml ent db_clean.sgml
	bash$ gvim db_clean.sgml 
	bash$ docbook2html db.sgml</code>
And you may have to manually edit some of the minor errors after 
running the Perl script. For example you may need to put closing tag ent
/Paraent for each ent
Listitement</p></sect1><sect1><heading>Convert to MS WinHelp format <label id="mswinhelp"></label></heading><p>You can convert the SGML howto document to a Microsoft Windows Help file, 
First convert the sgml to html using:
<code>	bash$ sgml2html xxxxhowto.sgml     (to generate html file)
	bash$ sgml2html -split 0   xxxxhowto.sgml (to generate a single page html file)</code>
Then use the tool <url url="http://javadocs.planetmirror.com/htmltohlpe.html" name="HtmlToHlp"></url>.
You can also use sgml2rtf and then use the RTF files for generating winhelp files.</p></sect1><sect1><heading>Reading various formats <label id="readformats"></label></heading><p>In order to view the document in dvi format, use the xdvi program. The xdvi
program is located in tetex-xdvi*.rpm package in Redhat Linux which can be
located through ControlPanel ent Applications ent Publishing ent TeX menu buttons.
To read a dvi document give the command:
<tscreen><verb>	xdvi -geometry 80x90 howto.dvi
	man xdvi</verb></tscreen>
And resize the window with the mouse.
To navigate use Arrow keys, Page Up, Page Down keys, also
you can use 'f', 'd', 'u', 'c', 'l', 'r', 'p', 'n' letter
keys to move up, down, center, next page, previous page etc.
To turn off expert menu press 'x'.</p><p>You can read a postscript file using the program 'gv' (ghostview) or 
'ghostscript'.
The ghostscript program is in the ghostscript*.rpm package and the gv 
program is in the gv*.rpm package in Redhat Linux
which can be located through ControlPanel ent Applications ent Graphics menu 
buttons. The gv program is much more user friendly than ghostscript.
Also ghostscript and gv are available on other platforms like OS/2,
Windows 95 and NT. You  can view this document even on those platforms.</p><p><itemize><item>Get ghostscript for Windows 95, OS/2, and for 
all OSes from <url url="http://www.cs.wisc.edu/~ghost" name="ent"></url></item></itemize></p><p>To read a postscript document give the command:
<tscreen><verb>		gv howto.ps
		ghostscript howto.ps</verb></tscreen></p><p>You can read an HTML format document using Netscape Navigator, Microsoft Internet
explorer, Redhat Baron Web browser or any of the 10 other web browsers.</p><p>You can read the latex, LyX output using LyX an X Window front end to LaTex.</p></sect1><sect1><heading>Convert HTML to SGML html2sgml <label id="html2sgml"></label></heading><p>To convert any HTML document to Linuxdoc SGML use the tool 'html2sgml'
from <url url="http://www.abc.se/~m9339/prog/html2sgml.html" name="ent"></url>.</p></sect1></sect><sect><heading>Copyright</heading><p>Copyright policy is GNU/GPL as per LDP (Linux Documentation project).
LDP is a GNU/GPL project.
Additional restrictions are - you must retain the author's name, email address
and this copyright notice on all the copies. If you make any changes 
or additions to this document then you should 
intimate all the authors of this document.</p></sect></article></linuxdoc>

