File enlightenment.spec of Package enlightenment

#
# spec file for package enlightenment
#
# Copyright (c) 2026 xaphir
#
# 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
# temporary license header above specifies otherwise).
#
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#

# ──────────────────────────────────────────────────────────────────
# Build conditionals — BEFORE Name: so they're available everywhere
# ──────────────────────────────────────────────────────────────────
%bcond_without  wayland         # Wayland compositor support (default: on)
%bcond_without  xwayland        # XWayland for legacy X11 apps (default: on)
%bcond_with     connman         # ConnMan network backend (default: off)

# ──────────────────────────────────────────────────────────────────
# Global macro definitions
# ──────────────────────────────────────────────────────────────────
%global         efl_version 1.28.99

# ──────────────────────────────────────────────────────────────────
# PREAMBLE — spec-cleaner canonical ordering
# ──────────────────────────────────────────────────────────────────
Name:           enlightenment
Version:        @SERVICE@
Release:        0
Summary:        Enlightenment Wayland compositor and desktop environment
License:        BSD-2-Clause
%if 0%{?suse_version}
Group:          System/GUI/Other
%endif
URL:            https://www.enlightenment.org/
Source0:        %{name}-%{version}.tar.xz
Source1:        enlightenment.pam
Source2:        system.conf
Source3:        network_manager_wizard.c
# PATCH-FEATURE-OPENSUSE: don't offer updates — package manager handles this
Patch:          dont_offer_updates.patch
# PATCH-FIX-OPENSUSE boo#1003939: auto-detect system language in wizard
Patch:          feature-wizard-auto-lang.patch
# PATCH-FEATURE-OPENSUSE: auto-detect keyboard layout from system
Patch:          feature-wizard-keylayout-from-sys.patch
# PATCH-FEATURE-OPENSUSE: log to systemd journal instead of e log file
Patch:          feature-openSUSE-log-to-journal.patch
# PATCH-FIX-OPENSUSE boo#1170162: disable storage module (security hardening)
Patch:          feature-openSUSE-disable-system-storage.patch

# ──────────────────────────────────────────────────────────────────
# BUILD DEPENDENCIES
# Prefer pkgconfig() for libraries with .pc files — distro-portable.
# Package names for tools, compilers, and packages without .pc files.
# Sorted alphabetically per spec-cleaner convention.
# One dependency per line for clean diffs.
# ──────────────────────────────────────────────────────────────────
BuildRequires:  efl >= %{efl_version}
BuildRequires:  gettext-devel
BuildRequires:  hicolor-icon-theme
BuildRequires:  meson
BuildRequires:  pam-devel
BuildRequires:  pkgconfig(dbus-1)
BuildRequires:  pkgconfig(ecore) >= %{efl_version}
BuildRequires:  pkgconfig(ecore-con) >= %{efl_version}
BuildRequires:  pkgconfig(ecore-evas) >= %{efl_version}
BuildRequires:  pkgconfig(ecore-file) >= %{efl_version}
BuildRequires:  pkgconfig(ecore-ipc) >= %{efl_version}
BuildRequires:  pkgconfig(ecore-x) >= %{efl_version}
BuildRequires:  pkgconfig(eet) >= %{efl_version}
BuildRequires:  pkgconfig(efreet) >= %{efl_version}
BuildRequires:  pkgconfig(efreet-mime) >= %{efl_version}
BuildRequires:  pkgconfig(efreet-trash) >= %{efl_version}
BuildRequires:  pkgconfig(eina) >= %{efl_version}
BuildRequires:  pkgconfig(eio) >= %{efl_version}
BuildRequires:  pkgconfig(eldbus) >= %{efl_version}
BuildRequires:  pkgconfig(elementary) >= %{efl_version}
BuildRequires:  pkgconfig(emotion) >= %{efl_version}
BuildRequires:  pkgconfig(evas) >= %{efl_version}
BuildRequires:  pkgconfig(freetype2)
BuildRequires:  pkgconfig(libexif)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(xcb-keysyms)
BuildRequires:  pkgconfig(xext)
BuildRequires:  pkgconfig(xkbcommon)
# Wayland compositor dependencies
%if %{with wayland}
BuildRequires:  pkgconfig(ecore-wl2)
BuildRequires:  pkgconfig(uuid)
BuildRequires:  pkgconfig(wayland-client)
BuildRequires:  pkgconfig(wayland-egl)
BuildRequires:  pkgconfig(wayland-protocols)
BuildRequires:  pkgconfig(wayland-server)
%endif
%if %{with xwayland}
BuildRequires:  xwayland
%endif
# systemd macro provider
BuildRequires:  systemd-rpm-macros
# openSUSE-specific build tools
%if 0%{?suse_version}
BuildRequires:  fdupes
BuildRequires:  update-desktop-files
%endif

# ──────────────────────────────────────────────────────────────────
# RUNTIME DEPENDENCIES
# Do NOT duplicate automatic shared-library deps detected by RPM.
# Only declare deps RPM cannot auto-detect.
# ──────────────────────────────────────────────────────────────────
# dbus: required for default actions in sysactions.conf
Requires:       dbus-1
# EFL runtime: provides tools and data beyond what soname detection covers
Requires:       efl
Requires:       evas-generic-loaders
# Branding (provides default ibar config)
Requires:       enlightenment-branding = 0.1
# Icon theme that E auto-detects
Requires:       oxygen-icon-theme
# xdg-terminal, xdg-open, xdg-su used in various places
Requires:       xdg-utils
# XWayland for legacy X11 application support
%if %{with xwayland}
Requires:       xwayland
%endif
# Weak dependencies — installed if available, not required
# ddcutil for monitor brightness — dlopened at runtime
%if 0%{?suse_version} > 1500
Recommends:     libddcutil5
%endif
Recommends:     Mesa-dri
Recommends:     NetworkManager
Recommends:     udisks

%{?systemd_requires}

%if 0%{?suse_version}
Requires(post): permissions
Requires(post): update-alternatives
Requires(postun): update-alternatives
%endif

%description
Enlightenment desktop environment built as a Wayland-only DRM compositor
for AMD GPUs. Includes wl_drm output module for direct DRM/KMS rendering,
XWayland support for legacy X11 applications, and all Wayland compositor
modules (desktop shell, text input, virtual keyboard).

Launch from TTY with: E_WL_FORCE=drm enlightenment_start

# ══════════════════════════════════════════════════════════════════
# SUBPACKAGES
# ══════════════════════════════════════════════════════════════════

# ── Development files ─────────────────────────────────────────────
%package devel
Summary:        Enlightenment development files
Requires:       %{name} = %{version}
Requires:       efl-devel
Requires:       pam-devel
Requires:       pkgconfig(dbus-1)

%description devel
Development files for building Enlightenment modules and extensions.

# ── Branding subpackage ──────────────────────────────────────────
%package branding-upstream
Summary:        Enlightenment upstream branding files
Requires:       enlightenment-theme-upstream
Provides:       enlightenment-branding = 0.1
%if 0%{?suse_version}
Supplements:    packageand(enlightenment:branding-upstream)
%endif

%description branding-upstream
Default upstream branding for Enlightenment desktop.

# ══════════════════════════════════════════════════════════════════
# BUILD SECTIONS
# ══════════════════════════════════════════════════════════════════

%prep
%autosetup -p1

# Replace network wizard with NetworkManager version
rm -f src/modules/wizard/page_110.c
cp -v %{SOURCE3} src/modules/wizard/page_110.c

%build
export CFLAGS="%{optflags}"

%meson \
    -Dconnman=%{?with_connman:true}%{!?with_connman:false} \
    -Delput=true \
    -Dpam=true \
    -Dsystemd=true \
    -Dwl=%{?with_wayland:true}%{!?with_wayland:false} \
    -Dwl-buffer=true \
    -Dwl-desktop-shell=true \
    -Dwl-drm=true \
    -Dwl-text-input=true \
    -Dwl-weekeyboard=true \
    -Dwl-wl=true \
    -Dwl-x11=false \
    -Dxwayland=%{?with_xwayland:true}%{!?with_xwayland:false}

%meson_build

%install
%meson_install

# Create Wayland session desktop file
%if 0%{?suse_version} >= 1550
mkdir -p %{buildroot}%{_datadir}/wayland-sessions/
cp %{buildroot}%{_datadir}/xsessions/enlightenment.desktop \
   %{buildroot}%{_datadir}/wayland-sessions/enlightenment-wayland.desktop
%endif

# Remove libtool archives — NEVER ship .la files
find %{buildroot} -name '*.la' -delete

%find_lang enlightenment

%if 0%{?suse_version}
# Remove suid bits (not needed on Linux)
chmod -s %{buildroot}%{_libdir}/enlightenment/utils/enlightenment_ckpasswd
chmod -s %{buildroot}%{_libdir}/enlightenment/utils/enlightenment_sys
%endif

# Install PAM profile
install -Dpm 0644 %{SOURCE1} %{buildroot}%{_sysconfdir}/pam.d/enlightenment

# Install system.conf — move upstream default to doc, install ours
mkdir -p %{buildroot}%{_datadir}/%{name}/doc/
mv %{buildroot}%{_sysconfdir}/enlightenment/system.conf \
   %{buildroot}%{_datadir}/%{name}/doc/
install -Dpm 0644 %{SOURCE2} %{buildroot}%{_sysconfdir}/enlightenment/system.conf

%if 0%{?suse_version}
%suse_update_desktop_file -r -G mixer emixer "AudioVideo;Mixer;"
%fdupes -s %{buildroot}
%endif

# Remove unwanted wizard pages
rm -f %{buildroot}%{_libdir}/enlightenment/modules/wizard/*/page_110.so
rm -f %{buildroot}%{_libdir}/enlightenment/modules/wizard/*/page_180.so

# Remove license/author files from datadir (use %%license instead)
rm -f %{buildroot}%{_datadir}/enlightenment/{COPYING,AUTHORS}

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

# ══════════════════════════════════════════════════════════════════
# SCRIPTLETS
# ══════════════════════════════════════════════════════════════════

%if 0%{?suse_version}
%post
%{_sbindir}/update-alternatives --install %{_datadir}/xsessions/default.desktop \
  default-xsession.desktop %{_datadir}/xsessions/enlightenment.desktop 20
%set_permissions %{_libdir}/enlightenment/utils/enlightenment_system

%postun
if [ ! -f %{_datadir}/xsessions/enlightenment.desktop ] ; then
  %{_sbindir}/update-alternatives --remove default-xsession.desktop \
    %{_datadir}/xsessions/enlightenment.desktop
fi

%verifyscript
%verify_permissions -e %{_libdir}/enlightenment/utils/enlightenment_system
%endif

# ══════════════════════════════════════════════════════════════════
# FILES SECTIONS
# ══════════════════════════════════════════════════════════════════

# ── Main package ──────────────────────────────────────────────────
%files -f enlightenment.lang
%license COPYING
%doc AUTHORS README.md
%{_bindir}/enlightenment*
%{_bindir}/emixer
%{_datadir}/xsessions/enlightenment.desktop
%{_datadir}/xsessions/default.desktop
%if 0%{?suse_version} >= 1550
%dir %{_datadir}/wayland-sessions
%{_datadir}/wayland-sessions/enlightenment-wayland.desktop
%endif
%ghost %{_sysconfdir}/alternatives/default-xsession.desktop
%{_datadir}/enlightenment/
%{_datadir}/applications/*.desktop
%{_libdir}/enlightenment/
%verify(not user group mode) %attr(4755,root,root) %{_libdir}/enlightenment/utils/enlightenment_system
%dir %{_sysconfdir}/enlightenment
%config(noreplace) %{_sysconfdir}/enlightenment/system.conf
%config(noreplace) %{_sysconfdir}/enlightenment/sysactions.conf
%config(noreplace) %{_sysconfdir}/pam.d/enlightenment
%dir %{_sysconfdir}/xdg/menus
%config %{_sysconfdir}/xdg/menus/e-applications.menu
%{_datadir}/icons/hicolor/
%{_datadir}/pixmaps/enlightenment-askpass.png
%{_userunitdir}/enlightenment.service
# Exclude branding file (owned by branding subpackage)
%exclude %{_libdir}/enlightenment/modules/wizard/def-ibar.txt

# ── Branding ─────────────────────────────────────────────────────
%files branding-upstream
%{_libdir}/enlightenment/modules/wizard/def-ibar.txt

# ── Development files ─────────────────────────────────────────────
%files devel
%license COPYING
%{_libdir}/pkgconfig/*.pc
%{_includedir}/enlightenment/

%changelog
openSUSE Build Service is sponsored by