File cinnamon.spec of Package cinnamon

#
# spec file for package cinnamon
#
# Copyright (c) 2018 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 __requires_exclude typelib\\((Cinnamon|St)\\)
%define __provides_exclude typelib\\(.*\\)
%define _name   Cinnamon
%define _version 3.6.0
Name:           cinnamon
Version:        3.6.7
Release:        0
Summary:        GNU/Linux Desktop featuring a traditional layout
License:        GPL-2.0-or-later AND LGPL-2.1-only
Group:          System/GUI/Other
URL:            https://github.com/linuxmint/Cinnamon
Source:         https://github.com/linuxmint/%{_name}/archive/%{version}.tar.gz#/%{_name}-%{version}.tar.gz
# Some documentation for people writing branding packages, shipped in the branding-upstream package.
Source1:        README.Gsettings-overrides
# PATCH-FIX-OPENSUSE cinnamon-wheel-and-sbin-path sor.alexei@meowr.ru -- Make full sbin paths and use wheel as a sudo group.
Patch0:         %{name}-wheel-and-sbin-path.patch
# PATCH-FIX-UPSTREAM cinnamon-network-user-connections.patch joss@debian.org -- Do not ask password everytime for wireless networks at login.
Patch1:         %{name}-network-user-connections.patch
# PATCH-FIX-OPENSUSE cinnamon-settings-native.patch sor.alexei@meowr.ru -- Remove foreign configuration tools and add openSUSE's native.
Patch2:         %{name}-settings-native.patch
# PATCH-FIX-OPENSUSE cinnamon-settings-xscreensaver-path.patch boo#960165 sor.alexei@meowr.ru -- Fix xscreensaver configs path.
Patch3:         %{name}-settings-xscreensaver-path.patch
# PATCH-FEATURE-OPENSUSE cinnamon-favourite-applications.patch sor.alexei@meowr.ru -- Remove mintinstall from favourites and add YaST.
Patch4:         %{name}-favourite-applications.patch
# PATCH-FIX-OPENSUSE cinnamon-fix-typelib-false-positive.patch sor.alexei@meowr.ru -- Avoid any false positives in typelib detection.
Patch5:         %{name}-fix-typelib-false-positive.patch
# PATCH-FIX-OPENSUSE cinnamon-no-gksu-requirement.patch sor.alexei@meowr.ru -- Don't require gksu.
Patch6:         %{name}-no-gksu-requirement.patch
# PATCH-FIX-UPSTREAM cinnamon-settings-fix-symlink-vuln.patch CVE-2018-13054 bsc#1083067 matthias.gerstner@suse.com -- Fix symlink attack vulnerability (commit 66e54f4).
Patch7:         %{name}-settings-fix-symlink-vuln.patch
# PATCH-FEATURE-OPENSUSE cinnamon-fallback-icewm.patch sor.alexei@meowr.ru -- Use IceWM as fallback.
Patch8:         %{name}-fallback-icewm.patch
BuildRequires:  autoconf
BuildRequires:  autoconf-archive
BuildRequires:  automake
# For gnome-background-properties.
BuildRequires:  desktop-data-openSUSE-extra
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  gtk-doc
# For distributor.svg.
BuildRequires:  hicolor-icon-theme-branding-openSUSE
BuildRequires:  intltool
BuildRequires:  libtool
BuildRequires:  pkgconfig
BuildRequires:  python3-devel
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(cinnamon-desktop) >= %{_version}
BuildRequires:  pkgconfig(cjs-1.0)
BuildRequires:  pkgconfig(gnome-bluetooth-1.0)
BuildRequires:  pkgconfig(gobject-introspection-1.0)
BuildRequires:  pkgconfig(gstreamer-1.0)
BuildRequires:  pkgconfig(libcinnamon-menu-3.0)
BuildRequires:  pkgconfig(libcroco-0.6)
BuildRequires:  pkgconfig(libmuffin) >= %{_version}
BuildRequires:  pkgconfig(libnm-glib)
BuildRequires:  pkgconfig(libnm-util)
BuildRequires:  pkgconfig(libsoup-2.4)
BuildRequires:  pkgconfig(libstartup-notification-1.0)
BuildRequires:  pkgconfig(polkit-agent-1)
Requires:       %{name}-gschemas = %{version}
Requires:       adwaita-icon-theme
Requires:       cinnamon-control-center-common >= %{_version}
Requires:       cinnamon-screensaver >= %{_version}
Requires:       cinnamon-session >= %{_version}
Requires:       cinnamon-settings-daemon >= %{_version}
Requires:       cjs >= %{_version}
Requires:       cups-pk-helper
Requires:       gettext-runtime
Requires:       glib2-tools
Requires:       iso-country-flags-png
Requires:       libcinnamon-desktop-data >= %{_version}
# gkbd-capplet / gkbd-keyboard-display.
Requires:       libgnomekbd
Requires:       muffin >= %{_version}
Requires:       nemo
Requires:       pkgconfig
Requires:       polkit-gnome
Requires:       python3-gobject
Requires:       v4l-tools
Requires:       wget
Requires:       xdg-utils
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends:     %{name}-lang
Recommends:     blueberry
Recommends:     cinnamon-themes
Recommends:     gnome-terminal
Recommends:     gnome-themes-standard
Recommends:     icewm
# cinnamon-2d was last used in openSUSE 13.2.
Provides:       %{name}-2d = %{version}
Obsoletes:      %{name}-2d < %{version}
# cinnamon-menu-editor was last used in openSUSE 13.2.
Provides:       %{name}-menu-editor = %{version}
Obsoletes:      %{name}-menu-editor < %{version}
# cinnamon-settings was last used in openSUSE 13.2.
Provides:       %{name}-settings = %{version}
Obsoletes:      %{name}-settings < %{version}
# typelib-1_0-Cinnamon-0_1 was last used in openSUSE Leap 42.1.
Provides:       typelib-1_0-Cinnamon-0_1 = %{version}
Obsoletes:      typelib-1_0-Cinnamon-0_1 < %{version}
%if 0%{?suse_version} >= 1500
BuildRequires:  python2-devel
Requires:       NetworkManager-applet
Requires:       python2-Pillow
Requires:       python2-cairo
Requires:       python2-dbus-python
Requires:       python2-gobject
Requires:       python2-gobject-cairo
Requires:       python2-pexpect
Requires:       python2-pyinotify
Requires:       python2-python-pam
Requires:       python3-dbus-python
%else
BuildRequires:  python-devel
Requires:       NetworkManager-gnome
Requires:       dbus-1-python
Requires:       dbus-1-python3
Requires:       python-Pillow
Requires:       python-cairo
Requires:       python-gobject
Requires:       python-gobject-cairo
Requires:       python-pam
Requires:       python-pexpect
Requires:       python-pyinotify
%endif
%if 0%{?suse_version} >= 1500 || 0%{?sle_version} >= 120200
Requires:       python3-gobject-Gdk
%if 0%{?suse_version} >= 1500
Requires:       python2-gobject-Gdk
%else
Requires:       python-gobject-Gdk
%endif
%endif

%description
Cinnamon is a modern Linux desktop which provides advanced innovative
features and a traditional user experience. It's easy to use,
powerful and flexible.

%package gschemas
Summary:        GNU/Linux Desktop featuring a traditional layout -- GSchemas
Group:          System/Libraries
Requires:       %{name}-gschemas-branding = %{version}
%glib2_gsettings_schema_requires

%description gschemas
This package provides GSettings schemas for
Cinnamon Desktop Environment.

%package gschemas-branding-upstream
Summary:        Upstream definitions of default settings and applications
Group:          System/Libraries
Requires:       %{name}-gschemas = %{version}
Requires:       libgnomesu
Supplements:    packageand(%{name}-gschemas:branding-upstream)
Conflicts:      otherproviders(%{name}-gschemas-branding)
Provides:       %{name}-gschemas-branding = %{version}
# cinnamon-branding-upstream was last used in openSUSE Leap 42.2.
Provides:       %{name}-branding-upstream = %{version}
Obsoletes:      %{name}-branding-upstream < %{version}
BuildArch:      noarch
#BRAND: A /usr/share/glib-2.0/schemas/$NAME.gschema.override file can
#BRAND: be used to override the default value for GSettings keys. See
#BRAND: README.Gsettings-overrides for more details. The branding
#BRAND: package should then have proper Requires for features changed
#BRAND: with such an override file.

%description gschemas-branding-upstream
This package provides upstream defaults for settings stored with
GSettings and applications used by the MIME system.

%prep
%setup -q -n %{_name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1
%patch6 -p1
%patch7 -p1
%patch8 -p1
cp -a %{SOURCE1} .

%build
NOCONFIGURE=1 ./autogen.sh
%configure \
  --disable-schemas-compile \
  --enable-gtk-doc          \
  --with-ca-certificates=%{_sysconfdir}/ssl/ca-bundle.pem
make %{?_smp_mflags} V=1

%install
%make_install

# Non-executable in /usr/bin/ is unacceptable.
chmod a+x %{buildroot}%{_bindir}/%{name}-file-dialog

# We should own this directory.
mkdir -p %{buildroot}%{_libdir}/%{name}/extensions/

# Provide all GNOME compatible backgrounds (including openSUSE branding) to Cinnamon.
ln -s gnome-background-properties \
  %{buildroot}%{_datadir}/cinnamon-background-properties

dirname $(find %{buildroot}%{_datadir} -type f -name '*.py') | sort -u | while read dir; do
    # Compile Python bytecode.
    %py_compile .
done

mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
touch %{buildroot}%{_sysconfdir}/alternatives/default-xsession.desktop
ln -s %{_sysconfdir}/alternatives/default-xsession.desktop \
  %{buildroot}%{_datadir}/xsessions/default.desktop

find %{buildroot} -type f -name "*.la" -delete -print
%fdupes %{buildroot}%{_datadir}/

%suse_update_desktop_file %{name}-settings
%suse_update_desktop_file %{name}-settings-users
%suse_update_desktop_file %{name}-menu-editor
%suse_update_desktop_file %{buildroot}%{_datadir}/applications/%{name}.desktop
%suse_update_desktop_file %{buildroot}%{_datadir}/applications/%{name}2d.desktop
%suse_update_desktop_file %{buildroot}%{_datadir}/applications/%{name}-killer-daemon.desktop
%suse_update_desktop_file %{buildroot}%{_datadir}/xsessions/%{name}.desktop
%suse_update_desktop_file %{buildroot}%{_datadir}/xsessions/%{name}2d.desktop

%post
/sbin/ldconfig
%{_sbindir}/update-alternatives --install %{_datadir}/xsessions/default.desktop \
  default-xsession.desktop %{_datadir}/xsessions/%{name}.desktop 20
%if 0%{?suse_version} < 1500
%desktop_database_post
%icon_theme_cache_post
%endif

%postun
/sbin/ldconfig
if [ ! -f %{_datadir}/xsessions/%{name}.desktop ]; then
    %{_sbindir}/update-alternatives --remove default-xsession.desktop \
      %{_datadir}/xsessions/%{name}.desktop
fi
%if 0%{?suse_version} < 1500
%desktop_database_postun
%icon_theme_cache_postun
%endif

%if 0%{?suse_version} < 1500
%post gschemas
%glib2_gsettings_schema_post

%postun gschemas
%glib2_gsettings_schema_postun
%endif

%files
%license COPYING
%doc AUTHORS README.rst debian/changelog
%dir %{_sysconfdir}/xdg/menus/
%config %{_sysconfdir}/xdg/menus/%{name}-applications.menu
%config %{_sysconfdir}/xdg/menus/%{name}-applications-merged
%ghost %{_sysconfdir}/alternatives/default-xsession.desktop
%{_bindir}/%{name}*
%{_bindir}/xlet-settings
%{_libexecdir}/%{name}*/
%dir %{_libdir}/%{name}/
%{_libdir}/%{name}/*.so
%{_libdir}/%{name}/extensions/
# Note the requirements exclude list above.
%{_libdir}/%{name}/Cinnamon-0.1.typelib
%{_libdir}/%{name}/St-1.0.typelib
%{_datadir}/%{name}/
%{_datadir}/%{name}-background-properties
%exclude %{_datadir}/%{name}/theme/menu*.svg
%{_datadir}/%{name}-session/
%{_datadir}/xsessions/*.desktop
%{_datadir}/applications/%{name}*.desktop
%{_datadir}/icons/hicolor/*/apps/*.*
%{_datadir}/icons/hicolor/*/*/cs-*.*
%{_datadir}/icons/hicolor/*/*/pan-*.*
%{_datadir}/icons/hicolor/*/actions/*-lock-*.*
%{_datadir}/icons/hicolor/*/actions/list-edit-*.*
%{_datadir}/icons/hicolor/*/devices/audio-*.*
%{_datadir}/icons/hicolor/*/devices/bluetooth.*
%{_datadir}/icons/hicolor/*/devices/cpu*.*
%{_mandir}/man?/*%{name}*.?%{?ext_man}
%{_datadir}/dbus-1/services/org.Cinnamon.*.service
%{_datadir}/polkit-1/actions/org.cinnamon.settings-users.policy
%dir %{_datadir}/desktop-directories/
%{_datadir}/desktop-directories/%{name}-*.directory
%{_datadir}/gtk-doc/*

%files gschemas
%{_datadir}/glib-2.0/schemas/org.cinnamon.gschema.xml

%files gschemas-branding-upstream
%doc README.Gsettings-overrides
%{_datadir}/%{name}/theme/menu*.svg

%changelog