File plasma5-SLE.spec of Package plasma5-SLE
#
# spec file for package plasma5-SLE
#
# 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 plasma_version 5.12.5
Name: plasma5-SLE
Version: 15.0~git20180504T125857~b35c1c4
Release: 0
Summary: openSUSE KDE Extension
License: GPL-2.0+ AND CC-BY-SA-4.0
Group: System/GUI/KDE
Url: https://github.com/openSUSE/plasma-openSUSE
# We use diffs to be as close to upstream as possible and get
# fixes directly. For files that diverge too much from upstream,
# the .tar is the right place.
Source: plasma-opensuse-%{version}.tar.xz
# Diff between /usr/share/plasma/look-and-feel/org.kde.breeze.desktop
# and /usr/share/plasma/look-and-feel/org.openSUSE.desktop
Source2: lookandfeel.diff
# Diff between /usr/share/sddm/themes/breeze-openSUSE
# and /usr/share/sddm/themes/breeze
Source3: sddmtheme.diff
# Diff between /usr/share/plasma/layout-templates/org.kde.plasma.desktop.defaultPanel/contents
# and /usr/share/plasma/layout-templates/org.opensuse.desktop.defaultPanel/contents
Source4: panel.diff
# Diff between /usr/share/plasma/shells/org.kde.plasma.desktop/contents/layout.js
# and /usr/share/plasma/look-and-feel/org.openSUSE.desktop/contents/layouts/org.kde.plasma.desktop-layout.js
Source5: layout.diff
# sddm theme preview picture
#Source6: preview.png
Source7: suselogo.svgz
Source8: background.png
#Source9: SLE.diff
# sddm background image
Source10: sddm-background.jpg
# suse logo for sddm
Source11: suse.svg
# Show suse logo in sddm login screen
#Source12: add-suse-logo.patch
# Script to update all .diff files from a system with this package installed
Source100: update_diffs.sh
BuildRequires: breeze5-icons
BuildRequires: fdupes
BuildRequires: kf5-filesystem
BuildRequires: oxygen5-icon-theme
BuildRequires: plasma5-desktop >= %{plasma_version}
BuildRequires: plasma5-desktop-branding-upstream >= %{plasma_version}
#!BuildIgnore: kwin5
BuildRequires: plasma5-workspace >= %{plasma_version}
BuildRequires: plasma5-workspace-branding-upstream >= %{plasma_version}
BuildRequires: rsync
BuildRequires: wallpaper-branding-SLE
BuildArch: noarch
%description
This package contains the standard SLE desktop and extensions.
%package -n plasma5-workspace-branding-SLE
Summary: SLE branded KDE settings
Group: System/GUI/KDE
Requires: plasma5-defaults-SLE
Requires: plasma5-workspace >= %{plasma_version}
Requires: wallpaper-branding-SLE
Supplements: packageand(plasma5-workspace:branding-SLE)
Provides: plasma5-workspace-branding = %{plasma_version}
%if 0%{?suse_version} >= 1315 && 0%{?suse_version} != 1320
Provides: kdebase4-SLE = 43
Provides: kdebase4-SLE-lang = 43
Provides: kdebase4-runtime-branding-SLE = 43
Provides: kdebase4-workspace-branding-SLE = 43
Obsoletes: kdebase4-SLE < 43
Obsoletes: kdebase4-SLE-lang < 43
Obsoletes: kdebase4-runtime-branding-SLE < 43
Obsoletes: kdebase4-workspace-branding-SLE < 43
%else
Conflicts: kdebase4-SLE
Conflicts: kdebase4-workspace-branding-SLE
%endif
%description -n plasma5-workspace-branding-SLE
This package does not contain anything by itself, but pulls in
default settings and extensions for the standard SLE
desktop.
%package -n plasma5-defaults-SLE
Summary: Default settings for KDE Plasma 5
Group: System/GUI/KDE
Requires: plasma5-theme-SLE
%description -n plasma5-defaults-SLE
This package changes the default settings of Plasma 5.
%package -n plasma5-theme-SLE
Summary: Plasma 5 theme for SLE
Group: System/GUI/KDE
Requires: wallpaper-branding-SLE
Requires(pre): coreutils
Conflicts: kdebase4-SLE < 43
Conflicts: kdebase4-workspace-branding-SLE < 43
Provides: plasma5-desktop-branding-SLE = 43
Obsoletes: plasma5-desktop-branding-SLE < 43
%description -n plasma5-theme-SLE
This package contains the Plasma 5 Look-and-feel package for SLE.
%package -n sddm-theme-SLE
Summary: SDDM theme for SLE
Group: System/GUI/KDE
Requires: libqt5-qtquickcontrols
Requires: plasma-framework-components
Requires: plasma5-workspace
Requires: wallpaper-branding-SLE
%description -n sddm-theme-SLE
This package contains a version of the Breeze SDDM theme customized
for SLE.
%prep
%setup -q -n plasma-opensuse-%{version}
%build
%install
# Defaults
cp -a config-files/* %{buildroot}
%fdupes %{buildroot}/%{_kf5_plasmadir}/desktoptheme
# copy kdeglobals to /etc/kde4/share/config/, to make Firefox the default browser for KDE4 as well (boo#997199)
# necessary at least until mozilla-kde4-integration has been ported to KF5, as Firefox currently checks the KDE4 settings whether it is the default browser
mkdir -p %{buildroot}/%{_sysconfdir}/kde4/share/config/
cp %{buildroot}/%{_kf5_configdir}/kdeglobals %{buildroot}/%{_sysconfdir}/kde4/share/config/
# Look-and-feel package (copy over everything that is not already in the .tar, then apply patch)
rsync -av --ignore-existing %{_kf5_plasmadir}/look-and-feel/org.kde.breeze.desktop/ %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/
pushd %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/
patch -p2 -i %{SOURCE2}
popd
# We use a .json file, breeze has its .desktop file, only keep ours
rm %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/metadata.desktop
# Same for the SDDM theme
rsync -av --ignore-existing %{_datadir}/sddm/themes/breeze/ %{buildroot}%{_datadir}/sddm/themes/breeze-openSUSE/
pushd %{buildroot}%{_datadir}/sddm/themes/breeze-openSUSE
patch -p2 -i %{SOURCE3}
popd
cp -R %{_kf5_plasmadir}/layout-templates/org.kde.plasma.desktop.defaultPanel/contents %{buildroot}%{_kf5_plasmadir}/layout-templates/org.opensuse.desktop.defaultPanel/contents
pushd %{buildroot}%{_kf5_plasmadir}/layout-templates/org.opensuse.desktop.defaultPanel/contents
patch -p3 -i %{SOURCE4}
popd
# Single file for the layout, so we can use patch -o
mkdir -p %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/contents/layouts/
patch -o %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/contents/layouts/org.kde.plasma.desktop-layout.js -i %{SOURCE5} %{_kf5_plasmadir}/shells/org.kde.plasma.desktop/contents/layout.js
chmod 644 %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/contents/layouts/org.kde.plasma.desktop-layout.js
# components was a symlink before, but this package contains it as a directory.
# RPM does not like that, so we keep it as a symlink but change the target
mv %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/contents/{components,components-real}
ln -s components-real %{buildroot}%{_kf5_plasmadir}/look-and-feel/org.openSUSE.desktop/contents/components
# Now, let's change openSUSE references to SUSE
pushd %{buildroot}%{_kf5_plasmadir}/look-and-feel/
mv org.openSUSE.desktop com.SUSE.desktop
sed -i 's|org.openSUSE.desktop|com.SUSE.desktop|' com.SUSE.desktop/metadata.json
sed -i 's|Default openSUSE KDE Desktop|Default SUSE KDE Desktop|' com.SUSE.desktop/metadata.json
sed -i 's|"Name": "openSUSE"|"Name": "SUSE"|' com.SUSE.desktop/metadata.json
sed -i 's|name=openSUSE|name=SUSE|' com.SUSE.desktop/contents/defaults
sed -i 's|org.opensuse.desktop.defaultPanel|com.SUSE.desktop.defaultPanel|' com.SUSE.desktop/contents/layouts/org.kde.plasma.desktop-layout.js
sed -i 's|images/bulb.png|images/background.png|' com.SUSE.desktop/contents/splash/Splash.qml
sed -i 's|x: parent.width \* 0.65|x: 0|' com.SUSE.desktop/contents/splash/Splash.qml
cp %{SOURCE7} com.SUSE.desktop/contents/splash/images/suselogo.svgz
cp %{SOURCE8} com.SUSE.desktop/contents/splash/images/background.png
popd
pushd %{buildroot}%{_kf5_plasmadir}/layout-templates/
mv org.opensuse.desktop.defaultPanel com.SUSE.desktop.defaultPanel
sed -i 's|org.opensuse.desktop.defaultPanel|com.SUSE.desktop.defaultPanel|' com.SUSE.desktop.defaultPanel/metadata.json
sed -i 's|Default openSUSE Panel|Default SUSE Panel|' com.SUSE.desktop.defaultPanel/metadata.json
sed -i 's|http://opensuse.org/|https://packagehub.suse.com/|' com.SUSE.desktop.defaultPanel/metadata.json
popd
pushd %{buildroot}%{_kf5_sharedir}/sddm/themes/
mv breeze-openSUSE breeze-SLE
sed -i 's|for openSUSE|for SLE|' breeze-SLE/metadata.desktop
popd
# Change color schemes
pushd %{buildroot}%{_kf5_sharedir}/color-schemes
mv OpenSUSEdark.colors SUSEdark.colors
mv OpenSUSEdarkalternate.colors SUSEdarkalternate.colors
mv openSUSE.colors SUSE.colors
sed -i 's|openSUSE|SUSE|' SUSE*.colors
popd
# Change desktop themes
pushd %{buildroot}%{_kf5_plasmadir}/desktoptheme/
mv openSUSEdefault SUSEdefault
mv openSUSElight SUSElight
mv openSUSEdark SUSEdark
mv openSUSE SUSE
sed -i 's|Name=openSUSE|Name=SUSE|' SUSE*/colors
sed -i 's|\(Name=.*\)openSUSE|\1SUSE|' SUSE*/metadata.desktop
sed -i 's|\(Comment=.*\)openSUSE theme|\1SUSE theme|' SUSE*/metadata.desktop
sed -i 's|X-KDE-PluginInfo-Name=openSUSE|X-KDE-PluginInfo-Name=SUSE|' SUSE*/metadata.desktop
sed -i 's|defaultWallpaperTheme=openSUSEdefault|defaultWallpaperTheme=SLEdefault|' SUSE*/metadata.desktop
popd
# Change default configuration files
sed -i 's|LookAndFeelPackage=org.openSUSE.desktop|LookAndFeelPackage=com.SUSE.desktop|' %{buildroot}/etc/xdg/kdeglobals
sed -i 's|Homepage=http://www.opensuse.org/|Homepage=http://www.suse.com/|' %{buildroot}/etc/xdg/kickoffrc
sed -i 's|usersWallpapers=/usr/share/wallpapers/openSUSEdefault/|usersWallpapers=/usr/share/wallpapers/SLEdefault/|' %{buildroot}/etc/xdg/plasmarc
sed -i 's|name=openSUSE|name=SUSE|' %{buildroot}/etc/xdg/plasmarc
# And apply other changes to the look and feel components
#pushd %{buildroot}%{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/
#ln -s ../../org.kde.breeze.desktop/contents/components .
#patch -p0 < %%{SOURCE9}
#popd
ln -sf /usr/share/wallpapers/SLEdefault/contents/images/1920x1080.jpg %{buildroot}%{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/components-real/artwork/1920x1080.jpg
ln -sf /usr/share/wallpapers/SLEdefault/contents/images/1920x1080.jpg %{buildroot}%{_kf5_sharedir}/sddm/themes/breeze-SLE/components/artwork/1920x1080.jpg
%pre -n plasma5-theme-SLE
# RPM does not like to overwrite a directory with a symlink (KUF and 42.2 Beta 3 have the directory)
if [ -d %{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/components ] && \
! [ -L %{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/components ]; then
mv %{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/{components,components-real}
ln -s components-real %{_kf5_plasmadir}/look-and-feel/com.SUSE.desktop/contents/components
fi
%files -n plasma5-workspace-branding-SLE
%doc COPYING
%files -n plasma5-defaults-SLE
%doc COPYING
%config %{_kf5_configdir}/*rc
%config %{_kf5_configdir}/kdeglobals
%config %{_sysconfdir}/kde4/
%files -n sddm-theme-SLE
%doc COPYING
%{_kf5_sharedir}/sddm/themes
%files -n plasma5-theme-SLE
%doc COPYING
%{_kf5_plasmadir}/
%{_kf5_servicesdir}/
%{_kf5_sharedir}/color-schemes/
%{_kf5_sharedir}/icons/*/*/*/*.*
%changelog