%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

Summary:        International Components for Unicode
Summary(ja):    ユニコード用国際化コンポーネント
Name:           icu
Version:        72.1
Release:        1%{?_dist_release}
Group:          programming
Vendor:         Project Vine
Distribution:   Vine Linux

%define sover   %(echo %{version} | cut -d . -f 1)
%define minorver %(echo %{version} | cut -d . -f 2)

License:        MIT
URL:            http://icu-project.org/
Source0:        https://github.com/unicode-org/icu/releases/download/release-%{sover}-%{minorver}/icu4c-%{sover}_%{minorver}-src.tgz
Source1:        https://github.com/unicode-org/icu/releases/download/release-%{sover}-%{minorver}/icu4c-%{sover}_%{minorver}-docs.zip

BuildRoot:      %{_tmppath}/%{name}-%{version}-root
BuildRequires:  gcc-c++
BuildRequires:  unzip perl
Requires:       libicu%{sover} = %{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}
Summary: International Components for Unicode (library)
Summary(ja): ユニコード用国際化コンポーネント (ライブラリ）
Group: system
Provides: libicu = %{version}-%{release}

%description -n libicu%{sover}
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: programming
Requires: libicu%{sover} = %{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: documentation
BuildArch: noarch
Requires: libicu%{sover} = %{version}-%{release}

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


# compat32
%if %{build_compat32}
%package -n compat32-libicu%{sover}
Summary: International Components for Unicode (library)
Summary(ja): ユニコード用国際化コンポーネント (ライブラリ）
Group: system,legacy
Provides: compat32-libicu = %{version}-%{release}

%description -n compat32-libicu%{sover}
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.
%endif


%debug_package


%prep
%setup -q -n icu

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 %{?_smp_mflags}


%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.*


%ifarch x86_64
%check
%make_build -C source check
%endif


%clean
rm -rf $RPM_BUILD_ROOT


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

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

%files -n libicu-devel
%license LICENSE
%defattr(-, root, root, 0755)
%{_bindir}/icu-config
%{_includedir}/unicode
%{_libdir}/*.so
%{_libdir}/%{name}
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man1/icu-config.1*
%{_datadir}/%{name}

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

%if %{build_compat32}
%files -n compat32-libicu%{sover}
%license LICENSE
%defattr(-, root, root, 0755)
%{_libdir}/*.so.*
%endif


%changelog
* Wed Oct 19 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 72.1-1
- updated to 72.1.

* Fri Oct 29 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 70.1-1
- updated to 70.1.

* Thu Apr 08 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 69.1-1
- updated to 69.1.
- dropped ldconfig scriptlets.

* Fri Apr 24 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 67.1-1
- updated to 67.1.

* Thu Mar 19 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 66.1-1
- updated to 66.1.

* Sun Oct 13 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 65.1-2
- made to build compat32-* package.

* Sun Oct 13 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 65.1-1
- updated to 65.1.

* Fri Aug 30 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 60.3-1
- updated to 60.3.
- disabled tests on i686.

* Mon Jan 08 2018 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 60.2-1
- updated to 60.2.

* Tue Jun 28 2016 Yoji TOYODA <bsyamato@sea.plala.or.jp> 56.1-2
- rebuild with gcc-5.4.0

* Thu Oct 29 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 56.1-1
- update to 56.1

* Sun Oct 26 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 54.1-1
- update to 54.1

* Mon Dec 30 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 52.1-1
- new upstream release

* Sat Oct 26 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 51.2-1
- update to 51.2

* 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)
