%define oname xmlparser
%define libdir  %(ruby -r rbconfig -e 'print Config::CONFIG["libdir"]')
%define archdir %(ruby -r rbconfig -e 'print Config::CONFIG["archdir"]')

Name: ruby-xmlparser
Version: 0.6.1
Release: 0vl2
Copyright: distributable
Group: Development/Languages
Source: http://www.yoshidam.net/%{oname}-%{version}.tar.gz
URL: http://www.yoshidam.net/Ruby.html#xmlparser
Prefix: /usr
BuildRoot: %{_tmppath}/%{oname}-%{version}-root
BuildPreReq: ruby, ruby-devel >= 1.6.4-0vl3, diffutils
BuildRequires: expat-devel
Summary: The interface of expat for the scripting language Ruby.
Summary(ja): Ruby�Ѥ�expat���󥿥ե�����

%description
This is the module to access to James Clark's XML Parser Toolkit "expat"
<URL:http://www.jclark.com/xml/expat.html> from Ruby.

%description -l ja
Ruby����James Clark��XML�ѡ����ġ��륭�åȤǤ���expat�����Ѥ��뤿���
���饹�饤�֥��Ǥ���

%prep

%setup -q -c

%build
cd %{oname}
ruby extconf.rb
make
cd ..

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}

# installing binaries ...
cd %{oname}
make install DESTDIR=${RPM_BUILD_ROOT}
cd ..

(find \
  $RPM_BUILD_ROOT%{_libdir} \
      -type f -o -type l) | 
 sort | sed -e "s,^$RPM_BUILD_ROOT,," > ruby-xmlparser.files

# fixing `#!' paths
mkdir -p tmp/samples
(cd %{oname}/samples && tar cf - .) | (cd tmp/samples && tar xf -)
for f in `find tmp/samples -type f`
do
  cp -p $f $f.n
  sed -e 's,^#![ 	]*\([^ 	]*\)/\(ruby\|with\|perl\|env\),#!/usr/bin/\2,' < $f > $f.n
  if cmp -s $f $f.n
  then
    rm -f $f.n
  else
    mv -f $f.n $f
  fi
done

%clean
rm -f ruby-xmlparser.files
rm -rf tmp
rm -rf ${RPM_BUILD_ROOT}

%pre

%post

%files -f ruby-xmlparser.files
%defattr(-, root, root)
%doc %{oname}/README
%doc %{oname}/README.ja
%doc %{oname}/Encodings
%doc tmp/samples

%changelog
* Sun Oct 14 2001 akira yamada <akira@vinelinux.org> 0.6.1-0vl2
- fixed shbang line of sample scripts.

* Sun Oct 14 2001 akira yamada <akira@vinelinux.org> 0.6.1-0vl1
- Initial packaging.