File onboard.spec of Package onboard

#
# spec file for package onboard
#
# Copyright (c) 2017 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/
#


%define series 1.4
Name:           onboard
Version:        1.4.1
Release:        0
Summary:        Simple on-screen Keyboard
License:        BSD-3-Clause and GPL-3.0+
Group:          System/X11/Utilities
Url:            https://launchpad.net/onboard
Source:         http://launchpad.net/%{name}/%{series}/%{version}/+download/%{name}-%{version}.tar.gz
Source1:        %{name}-defaults.conf
BuildRequires:  fdupes
BuildRequires:  gcc-c++
# Needed for typelib() - Requires.
BuildRequires:  gobject-introspection
BuildRequires:  intltool
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(dconf)
BuildRequires:  pkgconfig(gdk-3.0)
BuildRequires:  pkgconfig(hunspell)
BuildRequires:  pkgconfig(libcanberra)
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(python3)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xi)
BuildRequires:  pkgconfig(xkbfile)
BuildRequires:  pkgconfig(xtst)
BuildRequires:  python3-distutils-extra
BuildRequires:  python3-setuptools
BuildRequires:  sound-theme-freedesktop
BuildRequires:  update-desktop-files
Requires:       dbus-1-python3
Requires:       gdk-pixbuf-loader-rsvg
Requires:       gsettings-backend-dconf
Requires:       hicolor-icon-theme
Requires:       iso-codes
Requires:       mousetweaks
Requires:       python3-cairo
Requires:       python3-gobject-cairo
Requires:       python3-virtkey
Requires:       xdg-utils
Recommends:     %{name}-data
Recommends:     %{name}-lang
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%glib2_gsettings_schema_requires
%if 0%{?suse_version} > 1320
Requires:       python3-gobject-Gdk
%endif
%if 0%{?leap_version} >= 420200
Requires:       python3-gobject-Gdk
%endif

%description
An onscreen keyboard useful for tablet PC users and for mobility impaired users.

%lang_package

%package data
Summary:        Simple On-screen Keyboard
Group:          Productivity/Office/Dictionary
Requires:       %{name} == %{version}
BuildArch:      noarch

%description data
Language model files for the word suggestion feature of Onboard

%package -n gnome-shell-extension-%{name}
Summary:        GNOME Shell Extension for the on-screen keyboard Onboard
Group:          System/GUI/GNOME
Requires:       %{name} == %{version}
Requires:       gnome-shell >= 3.16
Supplements:    packageand(%{name}:gnome-shell)
BuildArch:      noarch

%description -n gnome-shell-extension-%{name}
This package hides the official GNOME3 keyboard and provides an icon to
show/hide Onboard. It is only an initial extension that does not show
Onboard for activities and passwords, yet.

%prep
%setup -q

%build

%install
python3 ./setup.py install -O1 \
    --prefix=%{_prefix} \
    --root=%{buildroot}
install -Dm 0644 %{S:1} %{buildroot}%{_datadir}/%{name}/
rm -rf %{buildroot}%{_datadir}/icons/hicolor/28x28
rm -rf %{buildroot}%{_datadir}/icons/ubuntu-mono-*
rm -rf %{buildroot}%{_datadir}/doc/%{name}
rm -rf %{buildroot}%{_datadir}/gnome
install -dm 0755 %{buildroot}%{_datadir}/help/C/%{name}
cp -a help/C/* %{buildroot}%{_datadir}/help/C/%{name}/

# fix wrong permissions
chmod 0755 %{buildroot}%{_datadir}/%{name}/layoutstrings.py
grep -rl '^#!' %{buildroot}%{python3_sitearch}/Onboard/ | xargs chmod 0755

%suse_update_desktop_file -i -r %{name} Utility Accessibility
%suse_update_desktop_file -i -r %{name}-settings Settings HardwareSettings

%fdupes -s %{buildroot}%{_datadir}/%{name}/models/
%fdupes %{buildroot}%{python3_sitearch}/Onboard/

%find_lang %{name} %{?no_lang_C}

%post
%glib2_gsettings_schema_post
%icon_theme_cache_post

%postun
%glib2_gsettings_schema_postun
%icon_theme_cache_postun

%files
%defattr(-,root,root)
%doc AUTHORS CHANGELOG COPYING* HACKING NEWS README *.example
%doc %{_datadir}/help/C/%{name}
%{_sysconfdir}/xdg/autostart/%{name}-autostart.desktop
%{_bindir}/%{name}
%{_bindir}/%{name}-settings
%{python3_sitearch}/Onboard/
%{python3_sitearch}/%{name}-*-py%{py3_ver}.egg-info
%{_datadir}/applications/%{name}.desktop
%{_datadir}/applications/%{name}-settings.desktop
%{_datadir}/dbus-1/services/org.%{name}.Onboard.service
%{_datadir}/glib-2.0/schemas/org.%{name}.gschema.xml
%dir %{_datadir}/icons/HighContrast/
%dir %{_datadir}/icons/HighContrast/symbolic/
%dir %{_datadir}/icons/HighContrast/symbolic/apps/
%{_datadir}/icons/HighContrast/symbolic/apps/%{name}.??g
%{_datadir}/icons/hicolor/*/apps/%{name}*.??g
%{_mandir}/man?/%{name}*.?%{?ext_man}
%{_datadir}/%{name}
%exclude %{_datadir}/%{name}/models
%{_datadir}/sounds/freedesktop/stereo/%{name}-key-feedback.oga

%files lang -f %{name}.lang
%defattr(-,root,root)

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

%files -n gnome-shell-extension-%{name}
%defattr(-,root,root)
%dir %{_datadir}/gnome-shell
%dir %{_datadir}/gnome-shell/extensions
%{_datadir}/gnome-shell/extensions/Onboard_Indicator@%{name}.org

%changelog
openSUSE Build Service is sponsored by