%define oname uconv

Name: ruby-uconv
Version: 0.4.12
Release: 1%{?_dist_release}
License: distributable
Group: Development/Languages
Source: http://www.yoshidam.net/%{oname}-%{version}.tar.gz
URL: http://www.yoshidam.net/Ruby_ja.html#uconv
Prefix: /usr
BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildPreReq: ruby, ruby-devel >= 1.6.4-0vl3, diffutils
Summary: library for Ruby that converts UTF-8/16, UCS-4 <-> EUC-JP/Shift_JIS
Summary(ja): UTF-8/16, UCS-4とEUC-JP/Shift_JISを相互変換するRubyライブラリ

%description
Uconv module provides the methods to convert UTF-16, UTF-8 or UCS-4 into 
EUC-JP or CP932, and EUC-JP or CP932 into UTF-16, UTF-8 or UCS-4.

%description -l ja
UTF-16, UTF-8, UCS-4 と EUC-JP, Shift_JIS を相互に変換します.実際
Shift_JIS を使うのは Windows の場合が多いので,Windows で使われている
Shift_JIS の変種である CP932 に対応しています.

%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} sitelibdir=${RPM_BUILD_ROOT}%{rlibdir}
cd ..

(find \
  $RPM_BUILD_ROOT%{_libdir} \
      -type f -o -type l) | 
 sort | sed -e "s,^$RPM_BUILD_ROOT,," > ruby-uconv.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-uconv.files
rm -rf tmp
rm -rf ${RPM_BUILD_ROOT}

%pre

%post

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

%changelog
* Fri Jul 10 2009 Daisuke SUZUKI <daisuke@linux.or.jp> 0.4.12-1
- new versioning policy

* Wed Feb 09 2005 Satoshi MACHINO <machino@vinelinux.org> 0.4.12-0vl2
- fixed %files
        --added uconv.so
        --removed samples (don't include in sourcce)
 
* Wed Feb 09 2005 Satoshi MACHINO <machino@vinelinux.org> 0.4.12-0vl0.31
- rebuilt for VineLinux3.1(VinePlus)
- changed to License from Copylight

* Tue Feb 08 2005 Satoshi MACHINO <machino@vinelinux.org> 0.4.12-0vl1
- new upstream release

* Tue Feb 12 2002 akira yamada <akira@vinelinux.org> 0.4.9-0vl1
- new upstream release.

* Tue Dec 11 2001 akira yamada <akira@vinelinux.org> 0.4.8-0vl1
- new upstream release.

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