File icewm.spec of Package icewm

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


%global lites icewm icewmhint icewmbg icesh icewm-session
Name:           icewm
Version:        1.3.12
Release:        0
Summary:        Window Manager with a Taskbar
License:        LGPL-2.1+
Group:          System/GUI/Other
Url:            http://www.icewm.org/
Source0:        https://github.com/bbidulock/icewm/archive/%{version}.tar.gz
Source1:        icewm.desktop
# PATCH-FIX-OPENSUSE icewm-mate.patch sor.alexei@meowr.ru -- Add MATE Menus support.
Patch0:         icewm-mate.patch
# PATCH-FEATURE-SUSE icewm-susemenu.patch tyang@suse.com -- Add xdg-menu for SLED icewm
Patch1:         icewm-susemenu.patch
# PATCH-FIX-UPSTREAM tweak the desktop session files to work correctly
Patch2:         icewm-session-desktop.patch
# PATCH-FIX-OPENSUSE run shutdown and reboot in background
Patch3:         icewm-exit-fork.patch
Patch99:        icewm-preferences.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libtool
# Needed for documentation.
BuildRequires:  pkg-config
BuildRequires:  sgmltool
BuildRequires:  update-alternatives
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pkgconfig(fontconfig)
BuildRequires:  pkgconfig(fribidi)
BuildRequires:  pkgconfig(gdk-pixbuf-xlib-2.0)
BuildRequires:  pkgconfig(ice)
BuildRequires:  pkgconfig(sm)
BuildRequires:  pkgconfig(sndfile)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xrandr)
Requires:       alsa-utils
Requires:       desktop-data
Requires:       icewm-bin
Requires:       icewm-configuration-files
Requires:       xdg-menu
%if 0%{?suse_version} > 1315
Requires:       xterm-bin
%else
Requires:       xterm
%endif
# If you have the choice, prefer the big one.
Recommends:     icewm-default
Recommends:     icewm-lang = %{version}
Provides:       icewm-gnome = %{version}
Obsoletes:      icewm-gnome < %{version}
Provides:       windowmanager

%description
A window manager for the X Window System that can emulate the look
of Windows '95, OS/2 Warp 3, OS/2 Warp 4, and Motif and tries to
take the best features from those systems. IceWM features multiple
workspaces, opaque move and resize, a taskbar, a window list,
mailbox status, and a digital clock. It is fast and small.

%package config-upstream
Summary:        Window Manager with a Taskbar -- Default configuration
Group:          System/GUI/Other
Provides:       icewm-configuration-files = %{version}
BuildArch:      noarch

%description config-upstream
A window manager for the X Window System that can emulate the look
of Windows '95, OS/2 Warp 3, OS/2 Warp 4, and Motif and tries to
take the best features from those systems. IceWM features multiple
workspaces, opaque move and resize, a taskbar, a window list,
mailbox status, and a digital clock. It is fast and small.

Configuration files from upstream provider without suse branding

%package default
Summary:        Window Manager with a Taskbar -- Default Version
Group:          System/GUI/Other
Requires:       adwaita-icon-theme
Requires:       icewm
Requires:       update-alternatives
Recommends:     icewm-lang
Provides:       icewm-bin

%description default
A window manager for the X Window System that can emulate the look
of Windows '95, OS/2 Warp 3, OS/2 Warp 4, and Motif and tries to
take the best features from those systems. IceWM features multiple
workspaces, opaque move and resize, a taskbar, a window list,
mailbox status, and a digital clock. It is fast and small.

%package lite
Summary:        Window Manager with a Taskbar -- Lite Version
Group:          System/GUI/Other
Requires:       icewm
Requires:       update-alternatives
Recommends:     icewm-lang
Provides:       icewm-bin

%description lite
A window manager for the X Window System that can emulate the look
of Windows '95, OS/2 Warp 3, OS/2 Warp 4, and Motif and tries to
take the best features from those systems. IceWM features multiple
workspaces, opaque move and resize, a taskbar, a window list,
mailbox status, and a digital clock. It is fast and small.

%lang_package

%prep
%setup -q
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1
# Do not require needlessly new gettext.
sed -i 's/0.19.6/0.18.3/g' configure.ac

%build
autoreconf -fi
# Build the Lite version
%configure \
  --disable-silent-rules             \
  --with-cfgdir=%{_sysconfdir}/icewm \
  --enable-i18n                      \
  --disable-nls                      \
  --disable-guievents                \
  --disable-winmenu                  \
  --without-icesound                 \
  --enable-lite                      \
  --enable-taskbar                   \
  --disable-menus-fdo                \
  --disable-menus-mate               \
  --disable-fribidi
make %{?_smp_mflags}
# Grab the lite content.
mkdir lite
for file in %{lites}; do
    mv -f src/$file lite/$file-lite
done
make %{?_smp_mflags} clean
# Configure for full deployment.
%configure \
  --docdir=%{_docdir}/%{name}        \
  --disable-silent-rules             \
  --with-cfgdir=%{_sysconfdir}/icewm \
  --with-icesound=alsa               \
  --enable-i18n                      \
  --enable-nls                       \
  --enable-corefonts                 \
  --enable-guievents                 \
  --enable-antialiasing              \
  --enable-gradients                 \
  --enable-shaped-decorations        \
  --enable-menus-fdo                 \
  --enable-i18n
make %{?_smp_mflags}
# Patch generated lib/preferences file.
patch -p1 -i %{PATCH99}
# And use proper branding
%if 0%{?is_opensuse}
wallpaper="openSUSEdefault"
%else
wallpaper="SLEdefault"
%endif
sed -i \
    -e "s:BRANDING_PICTURE:/usr/share/wallpapers/$wallpaper/contents/images/1920x1080.jpg:" \
    src/preferences

%install
%make_install

# First just remove GNOME WM setter as we don't have GNOME 2 anyway.
rm -f %{buildroot}%{_bindir}/icewm-set-{gnomewm,matewm}

mkdir -p %{buildroot}%{_sysconfdir}/icewm/
for cfgfile in keys menu preferences toolbar winoptions ; do
    mv -f %{buildroot}%{_datadir}/icewm/$cfgfile \
      %{buildroot}%{_sysconfdir}/icewm/
done
%find_lang icewm
ln -sf icewm.html %{buildroot}/%{_docdir}/icewm/index.html

# Install the xsession desktop file.
install -Dm 0644 %{SOURCE1} %{buildroot}%{_datadir}/xsessions/icewm.desktop

mkdir -p %{buildroot}%{_sysconfdir}/alternatives/
for file in %{lites}; do
    mv -f lite/$file-lite %{buildroot}%{_prefix}/bin
    mv -f %{buildroot}%{_bindir}/$file %{buildroot}%{_bindir}/$file-default

    # Dummy.
    touch %{buildroot}%{_sysconfdir}/alternatives/$file
    ln -s %{_sysconfdir}/alternatives/$file %{buildroot}%{_bindir}/$file
done

%suse_update_desktop_file %{buildroot}%{_datadir}/xsessions/icewm.desktop
# Link duplicate theme icons to save some space.
%fdupes %{buildroot}%{_datadir}/icewm/themes/

%post lite
%{_sbindir}/update-alternatives \
  --install %{_bindir}/icewm       icewm         %{_bindir}/icewm-lite 0       \
  --slave %{_bindir}/icewmhint     icewmhint     %{_bindir}/icewmhint-lite     \
  --slave %{_bindir}/icewmbg       icewmbg       %{_bindir}/icewmbg-lite       \
  --slave %{_bindir}/icesh         icesh         %{_bindir}/icesh-lite         \
  --slave %{_bindir}/icewm-session icewm-session %{_bindir}/icewm-session-lite

%preun lite
if [ "$1" = 0 ] ; then
    %{_sbindir}/update-alternatives --remove icewm %{_bindir}/icewm-lite
fi

%post default
%{_sbindir}/update-alternatives \
  --install %{_bindir}/icewm       icewm         %{_bindir}/icewm-default 100     \
  --slave %{_bindir}/icewmhint     icewmhint     %{_bindir}/icewmhint-default     \
  --slave %{_bindir}/icewmbg       icewmbg       %{_bindir}/icewmbg-default       \
  --slave %{_bindir}/icesh         icesh         %{_bindir}/icesh-default         \
  --slave %{_bindir}/icewm-session icewm-session %{_bindir}/icewm-session-default

%preun default
if [ "$1" = 0 ] ; then
    %{_sbindir}/update-alternatives --remove icewm %{_bindir}/icewm-default
fi

%files
%defattr(-,root,root)
%doc %{_docdir}/icewm
%{_datadir}/icewm/
%{_datadir}/xsessions/*
%{_mandir}/man1/icewm.1%{?ext_man}

%files config-upstream
%defattr(-,root,root)
%dir %{_sysconfdir}/icewm/
%config %{_sysconfdir}/icewm/*

%files lang -f icewm.lang
%defattr(-,root,root)

%files default
%defattr(-,root,root)
%ghost %{_sysconfdir}/alternatives/icewm
%ghost %{_sysconfdir}/alternatives/icewmhint
%ghost %{_sysconfdir}/alternatives/icewmbg
%ghost %{_sysconfdir}/alternatives/icesh
%ghost %{_sysconfdir}/alternatives/icewm-session
%{_bindir}/icewm-default
%{_bindir}/icewmhint-default
%{_bindir}/icewmbg-default
%{_bindir}/icehelp
%{_bindir}/icesh-default
%{_bindir}/icewmtray
%{_bindir}/icewm-session-default
%{_bindir}/icesound
%{_bindir}/icewm
%{_bindir}/icewmhint
%{_bindir}/icewmbg
%{_bindir}/icesh
%{_bindir}/icewm-session
%{_bindir}/icewm-menu-fdo
%{_datadir}/applications/icewm.desktop

%files lite
%defattr(-,root,root)
%ghost %{_sysconfdir}/alternatives/icewm
%ghost %{_sysconfdir}/alternatives/icewmhint
%ghost %{_sysconfdir}/alternatives/icewmbg
%ghost %{_sysconfdir}/alternatives/icesh
%ghost %{_sysconfdir}/alternatives/icewm-session
%{_bindir}/icewm-lite
%{_bindir}/icewmhint-lite
%{_bindir}/icewmbg-lite
%{_bindir}/icesh-lite
%{_bindir}/icewm-session-lite
%{_bindir}/icewm
%{_bindir}/icewmhint
%{_bindir}/icewmbg
%{_bindir}/icesh
%{_bindir}/icewm-session

%changelog
openSUSE Build Service is sponsored by