File treeland.spec of Package treeland

#
# spec file for package treeland
#
# 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    sover    0

Name:           treeland
Version:        0.7.4
Release:        0
Summary:        A wayland wm of deepin
License:        Apache-2.0 OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
URL:            https://github.com/linuxdeepin/treeland
Group:          System/GUI/Other
Source0:        https://github.com/linuxdeepin/treeland/archive/%{version}/%{name}-%{version}.tar.gz
Source99:       treeland-rpmlintrc
BuildRequires:  chrpath
BuildRequires:  dtk6core
BuildRequires:  extra-cmake-modules
BuildRequires:  fdupes
BuildRequires:  login_defs
BuildRequires:  systemd
BuildRequires:  systemd-rpm-macros
BuildRequires:  cmake(DDM)
BuildRequires:  cmake(Qt6XcbQpaPrivate)
BuildRequires:  cmake(Qt6WaylandCompositorPrivate)
BuildRequires:  cmake(Qt6WaylandClientPrivate)
BuildRequires:  cmake(TreelandProtocols)
BuildRequires:  pkgconfig(dtk6core)
BuildRequires:  pkgconfig(dtk6declarative)
BuildRequires:  pkgconfig(dtk6systemsettings)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  pkgconfig(jemalloc)
BuildRequires:  pkgconfig(pam)
BuildRequires:  pkgconfig(xau)
BuildRequires:  pkgconfig(xcb)
BuildRequires:  pkgconfig(xkbcommon)
BuildRequires:  pkgconfig(Qt6Concurrent)
BuildRequires:  pkgconfig(Qt6Core)
BuildRequires:  pkgconfig(Qt6DBus)
BuildRequires:  pkgconfig(Qt6Gui)
BuildRequires:  pkgconfig(Qt6Qml)
BuildRequires:  pkgconfig(Qt6Quick)
BuildRequires:  pkgconfig(Qt6QuickControls2)
BuildRequires:  pkgconfig(Qt6Linguist)
BuildRequires:  pkgconfig(Qt6Test)
BuildRequires:  pkgconfig(Qt6QuickTest)
BuildRequires:  pkgconfig(Qt6ShaderTools)
BuildRequires:  pkgconfig(Qt6Xml)
BuildRequires:  pkgconfig(Qt6WaylandClient)
BuildRequires:  pkgconfig(Qt6Widgets)
BuildRequires:  pkgconfig(wayland-protocols)
BuildRequires:  pkgconfig(wayland-scanner)
BuildRequires:  pkgconfig(wlroots-0.19)
BuildRequires:  pkgconfig(wlr-protocols)
Recommends:     %{name}-lang
Requires(post): update-alternatives
ExcludeArch:    s390 s390x
%{?systemd_ordering}

%description
DDM is a fork of SDDM. And use single compositor and session management functionality.

%package -n libwaylibserver%{sover}
Summary:        Waylib libraries
Group:          System/Libraries

%description -n libwaylibserver%{sover}
Waylib is a Wayland compositor development library, based on qwlroots, provides
a Qt-style development interface. It is designed to be deeply integrated with
QtQuick, taking advantage of QtQuick's Scene Graphics model to simplify the
complexity of window management. In waylib, it is possible to attach one or
multiple Wayland Outputs to a QQuickWindow, and a corresponding Wayland Surface
can be attached to a QQuickItem, allowing it to be mixed with QtQuick's graphics
components and supporting QRHI for OpenGL and Vulkan compatibility in a single
piece of code.

%package -n waylib-devel
Summary:        Development tools for waylib
Group:          Development/Languages/C and C++
Requires:       libwaylibserver%{sover} = %{version}

%description -n waylib-devel
The waylib-devel package contains the header files and developer docs for
waylib.

%package -n libqwlroots%{sover}
Summary:        Libraries for qwlroots
Group:          System/Libraries

%description -n libqwlroots%{sover}
Qwlroots is a binding of wlroots, which provides a Qt style development
interface. It aims to simplify wlroots API calling methods with Qt, and serve
the needs of calling wlroots within Qt projects. In qwlroots, each wlroots
struct is wrapped as a C++ class with its corresponding functions. At the same
time, wl_singals in Wayland are wrapped as Qt signals.

%package -n qwlroots-devel
Summary:        Development tools for qwlroots
Group:          Development/Libraries/C and C++
Requires:       qwlroots-devel-static = %{version}-%{release}

%description -n qwlroots-devel
The qwlroots-devel package contains the header files qwlroots.

%package devel
Summary:        Development headers for treeland
Group:          Development/Languages/C and C++
Requires:       %{name} = %{version}-%{release}

%description devel
The treeland-devel package contains the header files and developer
docs for treeland.

%lang_package

%prep
%autosetup -p1

%build
%cmake_qt6 -DLOGIN_DEFS_PATH=%{_distconfdir}/login.defs \
           -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir} \
           -DCMAKE_INSTALL_FULL_SYSCONFDIR=%{_distconfdir} \
           -DCMAKE_SHARED_LINKER_FLAGS="%{?build_ldflags} -Wl,--as-needed -Wl,-z,now" \
           -DBUILD_SHARED_LIBS=ON
%{qt6_build}

%install
%{qt6_install}

mkdir -p %{buildroot}%{_sysconfdir}/alternatives
touch %{buildroot}%{_sysconfdir}/alternatives/default-waylandsession.desktop
ln -sf %{_sysconfdir}/alternatives/default-waylandsession.desktop \
%{buildroot}%{_datadir}/wayland-sessions/default.desktop

chrpath --delete %{buildroot}%{_bindir}/%{name}
# chrpath --delete %{buildroot}%{_datadir}/%{name}/qml/Treeland/Treeland/Plugins/*/*.so
# chrpath --delete %{buildroot}%{_datadir}/%{name}/qml/Treeland/Treeland/liblibtreelandplugin.so
# install -d %{buildroot}%{_datadir}/qt6/
# mv %{buildroot}%{_datadir}/%{name}/qml %{buildroot}%{_datadir}/qt6/
# mkdir %{buildroot}%{_datadir}/%{name}/qml
# ln -sf %{_datadir}/qt6/qml/Treeland %{buildroot}%{_datadir}/%{name}/qml/

%fdupes %{buildroot}%{_datadir}
%fdupes %{buildroot}%{_includedir}

%pre
%service_add_pre %{name}.service

%post
%{_sbindir}/update-alternatives --install %{_datadir}/wayland-sessions/default.desktop \
  default-waylandsession.desktop %{_datadir}/wayland-sessions/treeland.desktop 25
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun
[ -f %{_datadir}/wayland-sessions/treeland.desktop ] || %{_sbindir}/update-alternatives \
  --remove default-waylandsession.desktop %{_datadir}/wayland-sessions/treeland.desktop
%service_del_postun %{name}.service

%post -n libwaylibserver%{sover} -p /sbin/ldconfig
%postun -n libwaylibserver%{sover} -p /sbin/ldconfig

%post -n libqwlroots%{sover} -p /sbin/ldconfig
%postun -n libqwlroots%{sover} -p /sbin/ldconfig

%files
%doc README.md README.zh_CN.md
%license LICENSES/*.txt
#%dir %{_sysconfdir}/xdg-desktop-portal
#%config %{_sysconfdir}/xdg-desktop-portal/dde-portals.conf
%{_bindir}/%{name}
%{_bindir}/%{name}-user-wrapper
%{_bindir}/%{name}.sh
%{_libexecdir}/%{name}-*
%{_libdir}/libtreeland*
%{_libdir}/%{name}
# %dir %{_datadir}/qt6
# %dir %{_datadir}/qt6/qml
# %{_datadir}/qt6/qml/*
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/shortcuts
# %{_datadir}/%{name}/qml
%dir %{_datadir}/wayland-sessions
%ghost %{_datadir}/wayland-sessions/default.desktop
%{_datadir}/wayland-sessions/%{name}.desktop
%{_datadir}/wayland-sessions/treeland-user.desktop
%dir %{_datadir}/dsg
%dir %{_datadir}/dsg/configs
%dir %{_datadir}/dsg/configs/org.deepin.treeland
%{_datadir}/dsg/configs/org.deepin.treeland/org.deepin.treeland.json
%{_datadir}/dbus-1/system.d/org.deepin.compositor1.conf
%{_unitdir}/treeland.service
%{_userunitdir}/treeland.service
%{_userunitdir}/%{name}-*
%{_userunitdir}/dde-session-*
%ghost %{_sysconfdir}/alternatives/default-waylandsession.desktop

%files lang
%{_datadir}/%{name}/translations

%files -n libwaylibserver%{sover}
%{_libdir}/libwaylibserver.so.*

%files -n waylib-devel
%{_libdir}/libwaylibserver.so
%{_libdir}/pkgconfig/waylibserver.pc
%{_libdir}/cmake/Waylib
%{_libdir}/cmake/WaylibServer
%{_includedir}/waylibserver

%files -n libqwlroots%{sover}
%{_libdir}/libqwlroots.so.*

%files -n qwlroots-devel
%doc README.md README.zh_CN.md
%license LICENSES/*.txt
%{_libdir}/libqwlroots.so
%{_includedir}/qwlroots
%{_libdir}/pkgconfig/qwlroots.pc

%files devel
%{_includedir}/%{name}
%{_libdir}/cmake/%{name}
%{_libdir}/cmake/Treeland

%changelog

openSUSE Build Service is sponsored by