File opencc.spec of Package opencc
#
# spec file for package opencc
#
# Copyright (c) 2013 SUSE LINUX Products GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/
#
Name: opencc
Version: 0.4.3
Release: 0
Summary: Open Chinese Convert
License: Apache-2.0
Group: System/I18n/Chinese
Url: http://code.google.com/p/opencc
Source: https://opencc.googlecode.com/files/%{name}-%{version}.tar.gz
BuildRequires: cmake
BuildRequires: gettext
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%description
OpenCC is an opensource project for conversion between Traditional
Chinese and Simplified Chinese, which supports phrase-level conversion
and regional idioms among Mainland China, Taiwan and Hong kong.
%package -n libopencc1
Summary: Open Chinese Convert
Group: System/Libraries
Requires: %{name}-data
%description -n libopencc1
OpenCC is an opensource project for conversion between Traditional
Chinese and Simplified Chinese, which supports phrase-level conversion
and regional idioms among Mainland China, Taiwan and Hong kong.
This package provides shared libraries of OpenCC.
%package data
Summary: Dictionaries for Open Chinese Convert
Group: System/I18n/Chinese
%description data
OpenCC is an opensource project for conversion between Traditional
Chinese and Simplified Chinese, which supports phrase-level conversion
and regional idioms among Mainland China, Taiwan and Hong kong.
This package provides dictionaries and patterns used by libraries/
binaries of OpenCC.
%package devel
Summary: Open Chinese Convert
Group: Development/Libraries/C and C++
Requires: %{name} = %{version}
%description devel
OpenCC is an opensource project for conversion between Traditional
Chinese and Simplified Chinese, which supports phrase-level conversion
and regional idioms among Mainland China, Taiwan and Hong kong.
This package provides development headers for OpenCC.
%prep
%setup -q
%build
mkdir -pv build
pushd build
cmake -DCMAKE_INSTALL_PREFIX=%{_prefix} -DCMAKE_BUILD_TYPE=Release -DENABLE_GETTEXT:BOOL=ON ..
make
%install
pushd build
%makeinstall
#fix libraries
%if %{_lib} == lib64
mkdir -pv %{buildroot}%{_prefix}/lib64/pkgconfig/
mv %{buildroot}%{_prefix}/lib/pkgconfig/* %{buildroot}%{_libdir}/pkgconfig/
mv %{buildroot}%{_prefix}/lib/libopencc.* %{buildroot}%{_libdir}
rm -rf %{buildroot}%{_libdir}/libopencc.a
%else
rm -rf %{buildroot}%{_prefix}/lib/libopencc.a
%endif
strip %{buildroot}%{_libdir}/libopencc.so.1.0.0
popd
%find_lang %{name}
%post -n libopencc1 -p /sbin/ldconfig
%postun -n libopencc1 -p /sbin/ldconfig
%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS NEWS.md LICENSE README.md
%{_bindir}/%{name}
%{_bindir}/%{name}_dict
%{_mandir}/man1/%{name}.1.gz
%{_mandir}/man1/%{name}_dict.1.gz
%files data
%defattr(-,root,root)
%{_datadir}/%{name}/
%files -n libopencc1
%defattr(-,root,root)
%{_libdir}/libopencc.so.1
%{_libdir}/libopencc.so.1.0.0
%files devel
%defattr(-,root,root)
%{_includedir}/%{name}/
%{_libdir}/libopencc.so
%{_libdir}/pkgconfig/opencc.pc
%changelog