File pekwm.spec of Package pekwm

#
# spec file for package pekwm
#
# Copyright (c) 2024 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define session_dir %{_datadir}/xsessions
Name:           pekwm
Version:        0.3.0
Release:        0
Summary:        Light and highly configurable window manager
License:        GPL-2.0-only
Group:          System/GUI/Other
URL:            https://www.pekwm.se/
Source0:        https://github.com/pekdon/pekwm/releases/download/release-%{version}/%{name}-%{version}.tar.gz
Source1:        %{name}.desktop
BuildRequires:  cmake
BuildRequires:  ed
BuildRequires:  fdupes
BuildRequires:  gcc-c++
BuildRequires:  libjpeg-devel
BuildRequires:  libpng-devel
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(pango)
BuildRequires:  pkgconfig(pangocairo)
BuildRequires:  pkgconfig(pangoxft)
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xft)
BuildRequires:  pkgconfig(xinerama)
BuildRequires:  pkgconfig(xpm)
BuildRequires:  pkgconfig(xrandr)
Recommends:     xdg-menu
Suggests:       pekwm-theme-adriano
Provides:       windowmanager

%description
pekwm is a window manager that once up on a time was based on the aewm++ window
manager, but it has evolved enough that it no longer resembles aewm++ at all.
It has a much expanded feature-set, including window grouping (similar to ion,
pwm, or fluxbox), autoproperties, xinerama, keygrabber that supports keychains,
and much more.

- Lightweight and Unobtrusive, a window manager shouldn't be noticed.
- Very configurable, we all work and think in different ways.
- Automatic properties, for all the lazy people, make things appear as they
  should when starting applications.
- Chainable Keygrabber, usability for everyone.

%prep
%autosetup

%build
%cmake \
 -DCMAKE_INSTALL_SYSCONFDIR=%{_prefix}%{_sysconfdir}
%cmake_build

%install
%cmake_install

install -Dpm 0644 %{SOURCE1} %{buildroot}%{session_dir}/%{name}.desktop

START="`grep -n Separator %{buildroot}%{_prefix}%{_sysconfdir}/pekwm/menu | sed -n '1 s|^\([0-9]\+\):.*|\1|p'`"
START="`expr $START + 1`"
END="`grep -n Separator %{buildroot}%{_prefix}%{_sysconfdir}/pekwm/menu | sed -n '2 s|^\([0-9]\+\):.*|\1|p'`"
END="`expr $END - 1`"
echo -E "${START},${END} d
${START} i
	Entry = \"\" { Actions = \"Dynamic %{_bindir}/xdg_menu --format pekwm 2> /dev/null | sed 's|^Submenu\ =\ .*|Dynamic\ {|'\" }
.
w
q
" | ed %{buildroot}%{_prefix}%{_sysconfdir}/pekwm/menu

# Fix rpmlint warning "non-executable-script"
chmod 755 %{buildroot}%{_prefix}%{_sysconfdir}/pekwm/start

# Prepare contrib directory for %%doc
find contrib/CMakeLists.txt -type f | xargs rm -rf || true
find contrib/lobo/CMakeLists.txt -type f | xargs rm -rf || true
mv contrib/lobo/* contrib/
rm -rf contrib/lobo
find contrib/pekwm_autoprop.pl -type f | xargs chmod 0644 || true
find contrib/pekwm_menu_config.pl -type f | xargs chmod 0644 || true

%fdupes -s %{buildroot}

%files
%license LICENSE
%doc AUTHORS NEWS.md README.md contrib/
%if 0%{?sle_version} >= 150100 && 0%{?is_opensuse}
%dir %{_prefix}%{_sysconfdir}
%endif
%{_prefix}%{_sysconfdir}/pekwm/
%{_bindir}/pekwm*
%{_datadir}/pekwm/
%{_mandir}/man1/pekwm*.1%{?ext_man}
%{session_dir}/%{name}.desktop

%changelog
openSUSE Build Service is sponsored by