File qsanguosha.spec of Package QSanguosha

#
# spec file for package qsanguosha
#
# 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:           qsanguosha
Version:        20150123
Release:        0
License:        GPL-3.0+
Summary:        Open Sanguosha in Qt
Url:            https://github.com/Mogara/QSanguosha.git
Group:          Amusements/Games/Board/Card
Source:         QSanguosha-%{version}.tar.xz
Source1:        icons.tar.gz
Source2:        qsanguosha.desktop
Patch1:         fix-lrelease-qt5.patch
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  hicolor-icon-theme
BuildRequires:  libfmodex-devel
BuildRequires:  libqt5-qtbase-devel
BuildRequires:  libqt5-qttools-devel
BuildRequires:  libqt5-qtquick1-devel
BuildRequires:  lua-devel
BuildRequires:  plib-devel
BuildRequires:  swig
Requires:	google-droid-fonts
Provides:       sanguosha = %{version}
Obsoletes:      sanguosha < %{version}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Summary(zh_CN):	太阳神三国杀
Summary(zh_TW): 太陽神三國殺

%description
An open source online version of the famous board game Sanguosha.

%description -l zh_CN
知名卡牌游戏三国杀的一个开源在线版本。

%description -l zh_TW
知名卡牌遊戲三國殺的一個開源在線版本。

%prep
%setup -q -n QSanguosha-%{version}

%patch1 -p0

%build
# generate sanguosha_wrap.cxx
pushd swig
swig -c++ -lua sanguosha.i
popd

qmake-qt5
make %{?_smp_mflags}
ls -l

# translations
lrelease-qt5 QSanguosha.pro

%install
install -d %{buildroot}/opt/qsanguosha
install -d %{buildroot}%{_datadir}/applications
install -d %{buildroot}%{_datadir}/icons/hicolor
cp -r QSanguosha %{buildroot}/opt/qsanguosha/qsanguosha
cp -r acknowledgement %{buildroot}/opt/qsanguosha/
cp -r audio %{buildroot}/opt/qsanguosha/
cp -r backdrop %{buildroot}/opt/qsanguosha/
cp -r diy %{buildroot}/opt/qsanguosha/
cp -r doc %{buildroot}/opt/qsanguosha/
cp -r etc %{buildroot}/opt/qsanguosha/
cp -r extension-doc %{buildroot}/opt/qsanguosha/
cp -r font %{buildroot}/opt/qsanguosha/
cp -r image %{buildroot}/opt/qsanguosha/
cp -r lang %{buildroot}/opt/qsanguosha/
cp -r lua %{buildroot}/opt/qsanguosha/
rm -rf %{buildroot}/opt/qsanguosha/lua/clib
cp -r sanguosha.qm %{buildroot}/opt/qsanguosha/
cp -r sanguosha.qss %{buildroot}/opt/qsanguosha/
cp -r scenarios %{buildroot}/opt/qsanguosha/
cp -r skins %{buildroot}/opt/qsanguosha/

# icons
cp -r %{SOURCE1} ./
tar -xzf icons.tar.gz
rm -rf icons.tar.gz
for i in 16 22 24 32 48 64 128 256
do
	mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps
	cp -r icons/sgs_${i}x${i}x32.png %{buildroot}%{_datadir}/icons/hicolor/${i}x${i}/apps/%{name}.png
done

# desktopfile
cp -r %{SOURCE2} %{buildroot}%{_datadir}/applications/

%fdupes %{buildroot}

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig 

%files
%defattr(-,root,root)
%doc gpl-3.0.txt README.markdown
/opt/qsanguosha
%{_datadir}/applications/qsanguosha.desktop
%{_datadir}/icons/hicolor/*/apps/qsanguosha.png

%changelog