%define	oname	mysql-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"]')
%define rdatadir %(ruby -r rbconfig -e 'print Config::CONFIG["datadir"]')
%define libdir   %(ruby -r rbconfig -e 'print Config::CONFIG["libdir"]')
%define incdir   %(ruby -r rbconfig -e 'print Config::CONFIG["includedir"]')
%define mandir   %(ruby -r rbconfig -e 'print Config::CONFIG["mandir"]')

Name: MySQL-ruby
Summary: mysql module for Ruby
Summary(ja): Ruby 用の MySQL 拡張モジュール
Version: 2.8.2
Release: 1%{?_dist_release}

Group: Development/Libraries
License: distributable
URL: http://www.tmtm.org/mysql/ruby/

Source: http://www.tmtm.org/mysql/ruby/%{oname}-%{version}.tar.gz
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: ruby
BuildRequires: ruby-devel >= 1.8.1
BuildRequires: MySQL-devel
Requires:      libruby >= 1.8.1

%description
This is MySQL Ruby API. This have same function as C API.

%description -l ja
これは MySQL の Ruby API です．MySQL の C API とほぼ同等の機能があります．

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

%build
ruby extconf.rb --with-mysql-config
#  --with-mysql-include-dir=%{_includedir}/mysql \
#  --with-mysql-lib-dir=%{_libdir}/mysql
make

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

# installing binaries ...
make install sitearchdir=$RPM_BUILD_ROOT%{rarchdir}
#_libdir}/ruby

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

%clean
rm -rf $RPM_BUILD_ROOT

%pre

%post

%files -f MySQL-ruby.files
%defattr(-, root, root)
%doc COPYING COPYING.ja README.html README_ja.html tommy.css test.rb

%changelog
* Sat Apr 16 2011 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.8.2-1
- updated to 2.8.2
- built with MySQL-5.1.56

* Fri May 22 2009 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 2.7.6-2
- rebuilt with MySQL-5.1.34.

* Thu Sep 25 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.7.6-1vl5
- new upstream release
- applied new versioning policy
- spec in UTF-8
- built with MySQL-5.0.51a and ruby-1.8.7
- used --with-mysql-config at configure
- removed BuildRequires: MySQL-shared

* Wed Nov 22 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5-0vl3
- rebuilt with MySQL 5.0.27

* Tue Oct 24 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5-0vl2
- rebuilt for Vine Linux 4.0

* Wed Sep 1 2004 Takeyuki FUJIOKA <fuj@rabbix.jp> 2.5-0vl1
- update mysql-ruby-2.5

* Tue Aug 24 2004 Satoshi MACHINO <machino@vinelinux.org> 2.4.5-0vl1
- new upstream version (mysql-ruby-2.4.5)
- adde some defines for ruby in spec file 
- changed to use %%setup -q -n %{oname}-%{over}
- added MySQL-shared in BuildRequires
- build with ruby-1.8.1

* Thu Jun 13 2002 Satoshi MACHINO <machino@vinelinux.org> 2.4.2a-0vl2
- added README.ja

* Thu Apr 04 2002 Satoshi MACHINO <machino@vinelinux.org> 2.4.2a-0vl1
- update mysql-ruby-2.4.2a
- changed License tag from Copylight

* Wed Jan 09 2002 Satoshi MACHINO <machino@vinelinux.org> 2.4.2-0vl1
- update mysql-ruby-2.4.2
- update BuildPreReq's ruby version to 1.6.6-0vl3

* Mon Oct 15 2001 akira yamada <akira@redhat.com> 2.4-0vl1
- new upstream version.
- mysql-ruby-2.3.1-extconf.rb.patch is no longer needed.

* Thu Jul 26 2001 akira yamada <akira@redhat.com>
- rebuild with ruby-devel-1.6.4-0vl3.

* Mon Apr 23 2001 akira yamada <akira@redhat.com>
- new upsteram version 2.3.2a.

* Mon Apr 23 2001 akira yamada <akira@redhat.com>
- Initial packaging.
