File goldendict.spec of Package goldendict

%define realname goldendict
%define majorver 1.0
%define realver  %{majorver}.1

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1
License:       GPL
Group:         Productivity/Office/Dictionary
URL:           http://goldendict.org/
Summary:       Feature-rich dictionary lookup program

# Build-time parameters
%if 0%{?suse_version}
BuildRequires: update-desktop-files
%endif
BuildRequires: gcc-c++
BuildRequires: libqt4-devel libzip-devel libogg-devel libvorbis-devel hunspell-devel
BuildRequires: libQtWebKit-devel phonon-devel
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://citylan.dl.sourceforge.net/project/goldendict/goldendict/%{majorver}/%{realname}-%{realver}%{?extraver:%{extraver}}-src.tar.bz2

%description
A feature-rich dictionary lookup program, supporting multiple dictionaries'
formats, perfect article rendering with the complete markup, illustrations
and other content retained, and allowing to type in words without any accents
or correct case.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -c -n %{realname}-%{realver}%{?extraver:%{extraver}}-src
sed -ri 's|\$\$PREFIX/share/apps/goldendict/|%{_datadir}/%{name}/|' %{name}.pro

%build
export PATH=$PATH:%{_libdir}/qt4/bin
qmake %{name}.pro \
 PREFIX=%{_prefix} \
 QMAKE_CFLAGS="%{optflags}" \
 QMAKE_CXXFLAGS="%{optflags}" \
 QMAKE_LFLAGS="-Wl,--as-needed -Wl,--strip-all"
%__make %{_smp_mflags}

%install
%__strip -R .comment -R .gnu.version %{name}
%__install -D -m755 %{name} %{buildroot}%{_bindir}/%{name}
%__install -D -m644 redist/%{name}.desktop %{buildroot}%{_datadir}/applications/%{name}.desktop
%__install -D -m644 redist/icons/%{name}.png %{buildroot}%{_datadir}/pixmaps/%{name}.png
%__install -d -m755 %{buildroot}%{_datadir}/goldendict/
%__install -d -m755 %{buildroot}%{_datadir}/goldendict/locale/
%__install -d -m755 %{buildroot}%{_datadir}/goldendict/flags/
%__install -d -m755 %{buildroot}%{_datadir}/goldendict/icons/
%__install -m644 locale/*.qm %{buildroot}%{_datadir}/goldendict/locale/
%__install -m644 flags/*.png %{buildroot}%{_datadir}/goldendict/flags/
%__install -m644 icons/*.png %{buildroot}%{_datadir}/goldendict/icons/
%if 0%{?suse_version}
%suse_update_desktop_file -r %{name} Office Dictionary Qt
%endif

%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc LICENSE.txt
%{_bindir}/%{name}
%{_datadir}/pixmaps/%{name}.png
%{_datadir}/applications/%{name}.desktop
%dir %{_datadir}/goldendict/
%{_datadir}/goldendict/*
openSUSE Build Service is sponsored by