%define oname    amstd
%define ruby     /usr/bin/ruby
%define rbindir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["bindir"]')
%define rlibdir  %(%{ruby} -r rbconfig -e 'print Config::CONFIG["rubylibdir"]')
%define rarchdir %(%{ruby} -r rbconfig -e 'print Config::CONFIG["archdir"]')

Summary: Aoki Minero's STandarD library
Name: ruby-%{oname}
Version: 2.0.0
Release: 0vl3
Copyright: LGPL
Group: Development/Libraries
Source: http://www.loveruby.net/archive/amstd/%{oname}-%{version}.tar.gz
URL: http://www.loveruby.net/ja/prog/%{oname}.html
Prefix: /usr
BuildArch: noarch
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: ruby, ruby-devel >= 1.8.0
Requires: libruby >= 1.8.0
Summary(ja): あおきみねろう氏によるRuby用ユーティリティコレクション

%description
Aoki Minero's STandarD library.  This library includes some useful
library. 

%description -l ja
あおきみねろう氏によるユーティリティコレクションamstdです。

%prep

%setup -q -c

%build
cd %{oname}-%{version}
ruby install.rb config \
  --bin-dir=${RPM_BUILD_ROOT}%{rbindir} \
  --rb-dir=${RPM_BUILD_ROOT}%{rlibdir} \
  --so-dir=${RPM_BUILD_ROOT}%{rarchdir}
ruby install.rb setup
cd ..

%install
rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{rbindir}
mkdir -p ${RPM_BUILD_ROOT}%{rlibdir}
mkdir -p ${RPM_BUILD_ROOT}%{rarchdir}

# installing binaries ...
cd %{oname}-%{version}
ruby install.rb install
cd ..

# listing all files in %{oname}-all.files
(find \
  $RPM_BUILD_ROOT%{rbindir} \
  $RPM_BUILD_ROOT%{rlibdir} \
  $RPM_BUILD_ROOT%{rarchdir} \
      -type f -o -type l) | 
 sort | uniq | \
  sed -e "s,^$RPM_BUILD_ROOT,," \
      -e "s,\(/man/man./.*\)$,\1*," \
 > %{oname}-all.files

%clean
rm -rf ${RPM_BUILD_ROOT}
rm -f *.files

#%post -p /sbin/ldconfig -n ruby-%{oname}

#%postun -p /sbin/ldconfig -n ruby-%{oname}

%files -f %{oname}-all.files
%defattr(-, root, root)
%doc %{oname}-%{version}/README.en
%doc %{oname}-%{version}/README.ja
%doc %{oname}-%{version}/manual.rd.ja

%changelog
* Mon Oct 06 2003 akira yamada <akira@vinelinux.org> 2.0.0-0vl3
- build with ruby-1.8.0.

* Thu May 22 2003 IWAI Masaharu <iwai@alib.jp> 2.0.0-0vl2
- rebuild

* Fri Mar 08 2002 akira yamada <akira@vinelinux.org> 2.0.0-0vl1
- new upstream version.
- update location of source and homepage.

* Thu Jul 26 2001 akira yamada <akira@vinelinux.org> 1.9.6-0vl2
- Rebuild with ruby-devel-1.6.4-0vl3.

* Thu Mar 15 2001 akira yamada <akira@vinelinux.org> 1.9.6-0vl1
- Initial packaging.
