include("site.inc"); $template = new Page; $template->initCommon(); $template->displayHeader(); ?>
After providing information about the package, you need to define the build stages, as described in Chapters 10 and 12.
The build preparation section sets the stage for the build. Usually this section has a %setup command. For example:
%prep
%setup -q
The build section describes how to build the library or application. In most cases, the majority of the instructions are in the Makefile created by the prep section, leaving a build section something like the following:
%build
%configure
make
After building, the installation section holds the commands to install the library or application. For example:
%install
rm -rf %{buildroot}
%makeinstall
The clean up section usually calls the make clean command to clean up the built files. For example:
%clean
rm -rf %{buildroot}
RPM packages can run scripts prior to installation with %pre, and after installation with %post. You can also run scripts prior to an uninstall with %preun and after an uninstall with %postun. For example:
%post
/sbin/chkconfig --add ypbind
%preun
if [ "$1" = 0 ] ; then
/sbin/service ypbind stop > /dev/null 2>&1
/sbin/chkconfig --del ypbind
fi
exit 0
%postun
if [ "$1" -ge 1 ]; then
/sbin/service ypbind condrestart > /dev/null 2>&1
fi
exit 0