@c -*-texinfo-*-
@node HOWTO Create RPM, HOWTO Setting the CRYSTAL environment variable, HOWTO CS Project DevCPP, Making Own Projects
@subsection Creating Crystal Space @sc{rpm}'s
@cindex @sc{rpm}
@cindex Package, @sc{rpm} 
@cindex @file{cs.spec}

@noindent
@emph{Written by Vincent Knecht @email{vknecht@@club-internet.fr}.}
@noindent
@emph{Last updated 19 March 2006.}

@subsubheading Creating Crystal Space @sc{rpm} Packages

It is possible to build Crystal Space @sc{rpm}'s. This is useful if you want to
distribute pre-built Crystal Space packages, or if you want to install Crystal
Space on your machine using the normal package management facilities of your
host.  For this purpose, @file{CS/scripts/rpm/cs.spec} file is provided with
Crystal Space.

@subsubheading Configure to Build @sc{rpm} Packages

Building @sc{rpm} packages involves a few settings, which are covered at
the following page:

@noindent
@uref{http://qa.mandriva.com/twiki/bin/view/Main/RpmHowTo#Preliminary_tasks}

@subsubheading Building Your Own @sc{rpm}'s From Source Archive 

Once you've set your system to build @sc{rpm} packages as a regular user,
perform the following steps:

@enumerate
@item
Get Crystal Space sources archive (@pxref{Where to Get}) and put it in your
@file{rpm/SOURCES/} directory.

@item
Go into your @file{rpm/SPECS} directory.

@item
Extract the @file{CS/scripts/rpm/cs.spec} file, and put it in your
@file{rpm/SPECS/} directory. You can also get the latest @file{cs.spec} file
at
@uref{http://svn.sourceforge.net/viewcvs.cgi/*checkout*/crystal/CS/trunk/scripts/rpm/cs.spec}

@example
cd /home/user/rpm/SPECS
tar xvjf /home/user/rpm/SOURCES/cs-current-snapshot.tar.bz2 \
     CS/scripts/rpm/cs.spec
mv CS/scripts/rpm/cs.spec /home/user/rpm/SPECS
rm -rf CS
@end example

@item
Verify the source archive filename you downloaded is set in accordance with the
filename part of the @sc{url} in @samp{Source:} line of @file{cs.spec},
otherwise @command{rpm} won't be able to do his job.

@item
Build the @sc{rpm}'s.

@itemize @bullet
@item
To build binary @sc{rpm}'s only, issue @command{rpmbuild -bb cs.spec}
@item
To build source @sc{rpm}'s as well, issue @command{rpmbuild -ba cs.spec}
@end itemize
@end enumerate

Build options are specified by using @command{--with} switch. The following
values are supported:

@itemize @bullet
@item
@command{--with perl} to build with Perl support.
@item
@command{--with debug} to build with debugging support.
@item
@command{--with shared} to build with shared libraries.
@end itemize

So, to build all packages, with Perl support, use:

@example
rpmbuild -ba cs.spec --with perl
@end example

The binary @sc{rpm}'s should be under @file{rpm/RPMS/}, and the source @sc{rpm}
in @file{rpm/SRPMS/}.

The process creates four Crystal Space binary @sc{rpm} packages:

@itemize @bullet
@item
@samp{crystalspace} base package. It provides plugins, data and configuration
files.
@item
@samp{crystalspace-devel} development package. It provides headers and static
libraries needed for development.
@item
@samp{crystalspace-demos} demonstration package. It provides applications
showing Crystal Space capabilities.
@item
@samp{crystalspace-doc} documentation package. It provides @sc{api} and user
manual documentation in @sc{html} format.
@item
@samp{crystalspace-utils} utilities package. It provides executables, data
(especially map files) and configuration files.
@end itemize
