## ------------------------------------------------------------
## stub RPM spec file for novi.
## There's a chicken-and-egg scenario concerning spec files and
## autoconf; this file is generated by autoconf and the maintainer
## (manually) copies it over to novi.spec for automated rebuilding
## via "rpmbuild -t."  
## We use autoconf to generate this file as a convenience, to make
## sure the version numbers and such are (automatically) updated
## with every release.
## ------------------------------------------------------------

%define	product_name			novi
%define	product_version			1.1.5
%define rpm_release				1

%define	product_nameversion		%{product_name}-%{product_version}
%define	product_source_dir		%{product_nameversion}
%define	product_tarball			%{product_nameversion}.tar.bz2

## CUSTOM RPM BUILDERS: change this macro to move novi's install path.
%define	install_prefix			/usr
%define doc_dir					%{install_prefix}/share/doc/%{product_nameversion}

BuildRoot:						%{_tmppath}/%{product_nameversion}-build-root-xxxxx

BuildRequires: beecrypt-devel
BuildRequires: elfutils-devel
BuildRequires: elfutils-libelf-devel
BuildRequires: expat-devel
BuildRequires: libselinux-devel
BuildRequires: popt
BuildRequires: rpm-devel
BuildRequires: rpm-libs
BuildRequires: zlib-devel

## ------------------------------------------------------------

Name: %{product_name}
Version: %{product_version}
Release: %{rpm_release}
License: Apache 2.0
URL: http://www.ExMachinaTech.net
Vendor: Ethan McCallum, ExMachinaTech.net
Source0: %{product_tarball}

Group: Utilities

Summary: find the latest-version RPMs in a tree

%description

novi searches directories for the latest-version RPMs of each product.

In turn, this data can be used to:

- see what are the latest RPMs on your system

- fold the latest RPMs into a Kickstart tree, such that you can
  build systems with the updates already applied

This process is described in much greater (and better) detail in the
following article on the O'Reilly Network:

"Pre-Patched Kickstart Installs"
http://www.linuxdevcenter.com/pub/a/linux/2005/02/17/kickstart_updates.html

## ------------------------------------------------------------

%prep

umask 022
cd ${RPM_BUILD_DIR}
rm -rf ${RPM_BUILD_DIR}/%{product_nameversion}
tar jxf ${RPM_SOURCE_DIR}/%{product_tarball}

cd %{product_source_dir}

./configure --prefix=%{install_prefix}


## ------------------------------------------------------------

%build
umask 022

cd ${RPM_BUILD_DIR}/%{product_source_dir}

make

## ------------------------------------------------------------

%install
umask 022

## RPM_BUILD_ROOT is created for us by RPM.
## if it already exists, the build process will fail
rm -rf ${RPM_BUILD_ROOT}

cd ${RPM_BUILD_DIR}/%{product_source_dir}

make install ALT_ROOT_DIR=${RPM_BUILD_ROOT}

mkdir -p ${RPM_BUILD_ROOT}/%{doc_dir}

for FILE in EXAMPLES.TXT FAQ.TXT INSTALL.TXT LICENSE README.TXT WISHLIST.TXT doc/novi.1.html doc/novi_examples.1.html ; do
	cp ${FILE} ${RPM_BUILD_ROOT}/%{doc_dir}
done

## ------------------------------------------------------------

%clean
rm -rf ${RPM_BUILD_ROOT}

## ------------------------------------------------------------

%files

%defattr( 0444 , root , root )

%dir  %attr( -    , root , root ) %{install_prefix}

%dir  %attr( -    , root , root ) %{install_prefix}/bin
      %attr( 0555 , root , root ) %{install_prefix}/bin/novi

%dir  %attr( -    , root , root ) %{install_prefix}/man

%dir  %attr( -    , root , root ) %{install_prefix}/man/man1
      %attr( 0444 , root , root ) %{install_prefix}/man/man1/novi.1.gz
      %attr( 0444 , root , root ) %{install_prefix}/man/man1/novi_examples.1.gz

%dir  %attr( 0555 , root , root ) %{doc_dir}
      %attr( 0444 , root , root ) %{doc_dir}/EXAMPLES.TXT
      %attr( 0444 , root , root ) %{doc_dir}/FAQ.TXT
      %attr( 0444 , root , root ) %{doc_dir}/INSTALL.TXT
      %attr( 0444 , root , root ) %{doc_dir}/LICENSE
      %attr( 0444 , root , root ) %{doc_dir}/README.TXT
      %attr( 0444 , root , root ) %{doc_dir}/WISHLIST.TXT
      %attr( 0444 , root , root ) %{doc_dir}/novi.1.html
      %attr( 0444 , root , root ) %{doc_dir}/novi_examples.1.html


## ------------------------------------------------------------

## EOF novi.spec
