# Copyright (C) 2001-2004 Daniel Berrange <dan@berrange.com>
#
# $Id: Config-Record.spec.PL,v 1.8 2006/01/27 16:25:50 dan Exp $

use strict;
use warnings;

die unless (scalar @ARGV == 1);

unless (do 'lib/Config/Record.pm')
  {
    if ($@) { die $@ };
    die "lib/Config/Record.pm: $!";
  }

local $/ = undef;
$_ = <DATA>;
s/\@VERSION\@/$Config::Record::VERSION/g;

open SPEC, ">$ARGV[0]" or die "$!";
print SPEC $_;
close SPEC;
__DATA__
# Automatically generated by Config-Record.spec.PL

%define appname Config-Record

# This macro is used for the continuous automated builds. It just
# allows an extra fragment based on the timestamp to be appended
# to the release. This distinguishes automated builds, from formal
# Fedora RPM builds
%define _extra_release %{?dist:%{dist}}%{?extra_release:%{extra_release}}


Summary: Config::Record - Simple configuration records
Name: perl-%{appname}
Version: @VERSION@
Release: 1%{_extra_release}
License: GPLv2+
Group: Applications/Internet
Source: http://www.cpan.org/authors/id/D/DA/DANBERR/%{appname}-%{version}.tar.gz
BuildRoot: /var/tmp/%{appname}-%{version}-root
BuildArchitectures: noarch
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
Config::Record provides a module for loading configuration
records. It supports scalar, array and hash parameters nested
to an arbitrary depth.

%prep
%setup -q -n %{appname}-%{version}


%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
%__make \

%install
rm -rf $RPM_BUILD_ROOT
%__make install \
  PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -name perllocal.pod -exec rm -f {} \;
find $RPM_BUILD_ROOT -name .packlist -exec rm -f {} \;

%check
make test

%clean
rm -rf $RPM_BUILD_ROOT

%files
%defattr(-,root,root)
%doc AUTHORS LICENSE README CHANGES
%{perl_vendorlib}/Config/Record.pm
%{perl_vendorlib}/Config/Record.pod
%{_mandir}/man3/Config::Record.3pm*
