File yast2-theme.spec of Package yast2-theme

#
# spec file for package yast2-theme
#
# Copyright (c) 2011 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/
#

# norootforbuild


Name:           yast2-theme
Version:        2.21.18
Release:        0

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Source0:        yast2-theme-2.21.18.tar.bz2

Prefix:         /usr

Group:          System/YaST
License:        GPL-2.0+
BuildRequires:  fdupes hicolor-icon-theme pkg-config update-desktop-files yast2-devtools yast2-qt-branding-openSUSE
BuildArch:      noarch
Summary:        YaST2 - Theme

%description
Contains the SuSE Linux theme for YaST2.

%package openSUSE
Summary:        YaST2 - Theme (openSUSE)
Version:        2.21.18


Group:          System/YaST
Provides:       yast2_theme = %{version}
Provides:       yast2-theme-UnitedLinux
Provides:       yast2-theme-openSUSE-any
PreReq:         /bin/ln
Requires:       hicolor-icon-theme

%package openSUSE-Crystal
Summary:        YaST2 - Theme (openSUSE)
Version:        2.21.18


Group:          System/YaST
Provides:       yast2_theme = %{version}
Provides:       yast2-theme-openSUSE-any
PreReq:         /bin/ln yast2-theme-openSUSE

%package openSUSE-Oxygen
Summary:        YaST2 - Theme (openSUSE)
Version:        2.21.18


Group:          System/YaST
Provides:       yast2_theme = %{version}
Provides:       yast2-theme-openSUSE-any
PreReq:         /bin/ln yast2-theme-openSUSE
Conflicts:      yast2-theme-openSUSE-Crystal

%package SLE
Summary:        YaST2 - SLE Theme
Version:        2.21.18


Group:          System/YaST
Provides:       yast2_theme = %{version}
Provides:       yast2-theme-NLD = 0.4.5
Obsoletes:      yast2-theme-NLD <= 0.4.5
PreReq:         /bin/ln

%description openSUSE
This package contains the openSUSE theme for YaST2.

%description openSUSE-Crystal
This package contains the openSUSE theme for YaST2.

%description openSUSE-Oxygen
This package contains the openSUSE theme for YaST2.


%description SLE
This package contains the YaST2 theme for the SUSE Linux Enterprise
Family.

%prep
%setup -n yast2-theme-2.21.18

%build
%{prefix}/bin/y2tool y2autoconf
%{prefix}/bin/y2tool y2automake
autoreconf --force --install

export CFLAGS="$RPM_OPT_FLAGS -DNDEBUG"
export CXXFLAGS="$RPM_OPT_FLAGS -DNDEBUG"

%{?suse_update_config:%{suse_update_config -f}}
./configure --libdir=%{_libdir} --prefix=%{prefix} --mandir=%{_mandir}
# V=1: verbose build in case we used AM_SILENT_RULES(yes)
# so that RPM_OPT_FLAGS check works
make %{?jobs:-j%jobs} V=1

%install
make install DESTDIR="$RPM_BUILD_ROOT"
[ -e "%{prefix}/share/YaST2/data/devtools/NO_MAKE_CHECK" ] || Y2DIR="$RPM_BUILD_ROOT/usr/share/YaST2" make check DESTDIR="$RPM_BUILD_ROOT"
for f in `find $RPM_BUILD_ROOT/%{prefix}/share/applications/YaST2/ -name "*.desktop"` ; do
    d=${f##*/}
    %suse_update_desktop_file -d ycc_${d%.desktop} ${d%.desktop}
done

cp -R "$RPM_BUILD_ROOT/%{prefix}/share/doc/packages/yast2-theme" "$RPM_BUILD_ROOT/%{prefix}/share/doc/packages/yast2-theme-openSUSE"
rm -rf "$RPM_BUILD_ROOT/%{prefix}/share/doc/packages/yast2-theme"
# ghost file (not packed in RPM but listed)
cd $RPM_BUILD_ROOT//usr/share/YaST2/theme/
rm -rf openSUSE-current
ln -sn openSUSE openSUSE-current
#
# make icons available to GNOME control center (hicolor theme)
# (bug #166008)
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/22x22/apps
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/32x32/apps
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/48x48/apps
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/64x64/apps
mkdir -p $RPM_BUILD_ROOT/usr/share/icons/hicolor/256x256/apps

cd $RPM_BUILD_ROOT//usr/share/YaST2/theme/openSUSE-current/icons
for dir in 22x22 32x32 48x48 64x64 256x256; do
    cd $RPM_BUILD_ROOT//usr/share/YaST2/theme/openSUSE-current/icons/$dir/apps
    icons=$(ls *.png)
    cd $RPM_BUILD_ROOT/usr/share/icons/hicolor/$dir/apps
    for icon in $icons; do
        ln -s /usr/share/YaST2/theme/openSUSE-current/icons/$dir/apps/$icon .
    done
done
filelist=$(mktemp /tmp/fileListXXXXXX)
cd $RPM_BUILD_ROOT/usr/share/YaST2/theme/openSUSE
files=$(find . -type f)
tfiles=$(cd /usr/share/YaST2/theme/openSUSE && find wizard -type f)
files="$files $tfiles"
for subtheme in Crystal Oxygen ; do
  cd $RPM_BUILD_ROOT/usr/share/YaST2/theme/openSUSE-$subtheme
  for file in $files; do
    mkdir -p $(dirname "$file") || true
    if ! test -f "$file"; then
     ln -s /usr/share/YaST2/theme/openSUSE/$file $file
    fi
  done
done

%fdupes $RPM_BUILD_ROOT/usr/share/YaST2/theme

%clean
rm -rf "$RPM_BUILD_ROOT"
rm -rf $RPM_BUILD_ROOT/usr/share/YaST2/theme

%post openSUSE
cd /usr/share/YaST2/theme
if ! test -d openSUSE-Crystal && ! test -d openSUSE-Oxygen; then
  ln -snf openSUSE openSUSE-current
fi

%post openSUSE-Crystal
cd /usr/share/YaST2/theme
ln -snf openSUSE-Crystal openSUSE-current

%post openSUSE-Oxygen
cd /usr/share/YaST2/theme
ln -snf openSUSE-Oxygen openSUSE-current

%files openSUSE
%defattr(-,root,root)
%dir /usr/share/YaST2/theme
/usr/share/YaST2/theme/openSUSE
/usr/share/icons/hicolor/*/apps/*
%doc %{prefix}/share/doc/packages/yast2-theme-openSUSE
# ghost file (not packed in RPM but listed)
# remove the file when removing the RPM
%ghost /usr/share/YaST2/theme/openSUSE-current

%files openSUSE-Crystal
%defattr(-,root,root)
%dir /usr/share/YaST2/theme
/usr/share/YaST2/theme/openSUSE-Crystal

%files openSUSE-Oxygen
%defattr(-,root,root)
%dir /usr/share/YaST2/theme
/usr/share/YaST2/theme/openSUSE-Oxygen

%files SLE
%defattr(-,root,root)
%dir /usr/share/YaST2/theme
/usr/share/YaST2/theme/SLE

%changelog
openSUSE Build Service is sponsored by