%define sover 44
Summary: International Components for Unicode
Summary(ja): ユニコード用国際化コンポーネント
Name: icu
Version: 4.4
Release: 2%{?_dist_release}
Group:   Development/Tools
License: MIT
URL:     http://icu-project.org/

Source0: http://download.icu-project.org/files/icu4c/4.0.1/icu4c-4_4-src.tgz
Source1: http://download.icu-project.org/files/icu4c/4.0.1/icu4c-4_4-docs.zip

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: gcc-c++
BuildRequires: unzip perl 
#Requires: libicu%{sover} = %{version}
Requires: libicu = %{version}-%{release}

%description
ICU is a C++ and C library that provides robust and full-featured Unicode
support. This package contains the Unicode character database and derived
properties, along with converters and time zones data.

#package -n libicu%{sover}
%package -n libicu
Summary: International Components for Unicode (library)
Summary(ja): ユニコード用国際化コンポーネント (ライブラリ)
Group: System Environment/Libraries
Provides: libicu%{sover} = %{version}-%{release}

#description -n libicu%{sover}
%description -n libicu
ICU is a C++ and C library that provides robust and full-featured Unicode
support. This package contains the runtime libraries for ICU. It does not
contain any of the data files needed at runtime.

%package -n libicu-devel
Summary: Header files, libraries and development documentation for libicu
Summary(ja): libicu 用のヘッダファイル、ライブラリおよび開発用ドキュメント
Group: Development/Libraries
Requires: libicu = %{version}-%{release}

%description -n libicu-devel
This package contains the header files, static libraries for %{name}. 
If you like to develop programs using %{name}, you will need to install 
%{name}-devel.

%package -n libicu-doc
Summary: Documentation for International Components for Unicode
Summary(ja): ユニコード用国際化コンポーネントのドキュメント
Group: Applications/Documentation

%description -n libicu-doc
This package contains the development documentation for %{name}. 

%prep
%setup -q -n %{name}
find . -name CVS -o -name .cvsignore | xargs -r rm -rf
perl -pi -e 's/^(HAVE_DOT\b.*=).*$/$1 YES/' source/Doxyfile.in

mkdir docs
pushd docs
unzip %{SOURCE1}
popd

%build
cd source
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
export CXXFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
%configure --disable-static --with-data-packaging=library --disable-samples 
make

%install
rm -rf $RPM_BUILD_ROOT
make -C source install DESTDIR=$RPM_BUILD_ROOT
cp -pR ./source/tools/ctestfw/libicutest.so* $RPM_BUILD_ROOT/%{_libdir}
chmod +x $RPM_BUILD_ROOT%{_libdir}/*.so.*

%check || :
make -C source check

%clean
rm -rf $RPM_BUILD_ROOT

%post -n libicu -p /sbin/ldconfig

%postun -n libicu -p /sbin/ldconfig

%files
%defattr(-, root, root, 0755)
%doc license.html readme.html
%{_bindir}/derb
%{_bindir}/genbrk
%{_bindir}/gencfu
%{_bindir}/gencnval
%{_bindir}/genctd
%{_bindir}/genrb
%{_bindir}/icuinfo
%{_bindir}/makeconv
%{_bindir}/pkgdata
%{_bindir}/uconv
%{_sbindir}/*
%{_mandir}/man?/*
%exclude %{_mandir}/man1/icu-config.1*

%files -n libicu
%defattr(-, root, root, 0755)
%{_libdir}/*.so.*

%files -n libicu-devel
%defattr(-, root, root, 0755)
%{_bindir}/icu-config
%{_includedir}/layout
%{_includedir}/unicode
%{_libdir}/*.so
#{_libdir}/*.a
%{_libdir}/%{name}
%{_mandir}/man1/icu-config.1*
%dir %{_datadir}/icu/
%dir %{_datadir}/icu/4.4
%{_datadir}/icu/4.4/config
%{_datadir}/icu/4.4/install-sh
%{_datadir}/icu/4.4/mkinstalldirs
%doc %{_datadir}/icu/4.4/license.html

%files -n libicu-doc
%defattr(-,root,root,-)
%doc docs/*

%changelog
* Tue Apr 13 2010 Shu KONNO <owa@bg.wakwak.com> 4.4-2
- install libicutest.so*

* Sat Apr 10 2010 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.4-1
- new upstream release
- built with new toolchain

* Sun Mar 22 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.0.1-1vl5
- new upstream release
- updated URL

* Sun Sep 28 2008 Shu KONNO <owa@bg.wakwak.com> 3.6-1vl5
- applied new versioning policy, spec in utf-8

* Tue Sep  4 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 3.6-0vl1
- updated to 3.6
- removed ".so ver" from libicu package name
- changed Group to Development/Tools
- changed libicu-doc Group to Applications/Documentation

* Tue Mar 28 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 3.4.1-0vl1
- updated to 3.4.1

* Sun Jul 31 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 3.2-3vl1
- updated to 3.2 based on Fedora extra
- new subpackage libicu-doc for API document 

* Sat Oct 23 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 3.0-0vl1
- Build for Vine Linux
- add developers document to devel package
- add Japanese summary

* Wed Feb 25 2004 Dag Wieers <dag@wieers.com> - 2.6.2-1
- Fixed a typo in the dependencies "libuci" should be "libicu". (Daniel Demus)

* Wed Feb 25 2004 Dag Wieers <dag@wieers.com> - 2.6.2-0
- Initial package. (using DAR)