File opencc.spec of Package opencc

#
# spec file for package opencc
#
# Copyright (c) 2015 SUSE LINUX 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:        1.0.3
Release:        0
Summary:        Open Chinese Convert
License:        Apache-2.0
Group:          System/I18n/Chinese
Url:            https://github.com/BYVoid/OpenCC
Source:         https://bintray.com/artifact/download/byvoid/%{name}/%{name}-%{version}.tar.gz
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkg-config
BuildRequires:  python-base
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 libopencc2
Summary:        Open Chinese Convert
Group:          System/Libraries
Requires:       %{name}-data

%description -n libopencc2
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 ..
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 libopencc2 -p /sbin/ldconfig

%postun -n libopencc2 -p /sbin/ldconfig

%files 
%defattr(-,root,root)
%doc AUTHORS NEWS.md LICENSE README.md
%{_bindir}/%{name}
%{_bindir}/%{name}_dict
%{_bindir}/%{name}_phrase_extract
# %{_mandir}/man1/%{name}.1.gz
# %{_mandir}/man1/%{name}_dict.1.gz

%files data
%defattr(-,root,root)
%{_datadir}/%{name}/

%files -n libopencc2
%defattr(-,root,root)
%{_libdir}/libopencc.so.2
%{_libdir}/libopencc.so.1.0.0

%files devel
%defattr(-,root,root)
%{_includedir}/%{name}/
%{_libdir}/libopencc.so
%{_libdir}/pkgconfig/opencc.pc

%changelog
openSUSE Build Service is sponsored by