LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File gamemode.spec of Package gamemode-git (Project home:malkavi)

%define name gamemode
%define release 2
%define gamemodetar gamemode-dev-%{version}
%define libversion 0

Summary: Optimise Linux system performance on demand
Name: %{name}
Version: 0
Release: %{release}
Source0: %{gamemodetar}.tar.gz
Source1: gamemode-rpmlintrc

License: BSD 3
Group:          Development/Libraries/C and C++
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot
Prefix: %{_prefix}

Vendor: Marc Di Luzio (Feral Interactive)
Url: https://github.com/FeralInteractive/gamemode

# Common build dependencies
%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
BuildRequires:  gcc5			>= 4.9
BuildRequires:  gcc5-c++		>= 4.9
%else
BuildRequires:  gcc			>= 4.9
BuildRequires:  gcc-c++		>= 4.9
%endif
BuildRequires:  desktop-file-utils
BuildRequires:  update-desktop-files
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(libsystemd)
BuildRequires:  ninja
BuildRequires:  meson >= 0.36
BuildRequires:  git-core

# Needed to workaround "directories not owned by a package" issue
BuildRequires:  hicolor-icon-theme
BuildRequires:  polkit
BuildRequires:  systemd-devel
BuildRequires:  systemd-rpm-macros

%description
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

The design has a clear-cut abstraction between the host daemon and library (gamemoded and libgamemode), and the client loaders (libgamemodeauto and gamemode_client.h) that allows for safe use without worrying about whether the daemon is installed or running. This design also means that while the host library currently relies on systemd for exchanging messages with the daemon, it's entirely possible to implement other internals that still work with the same clients.

GameMode was designed primarily as a stop-gap solution to problems with the Intel and AMD CPU powersave or ondemand governors, but is intended to be expanded beyond just CPU governor states, as there are a wealth of automation tasks one might want to apply.

Issues with GameMode should be reported here (https://github.com/FeralInteractive/gamemode) in the issues section, and not reported to Feral directly.

%package -n gamemoded
Summary:        The GameMode daemon required by GameMode enabled games
Recommends:     libgamemode%{libversion}
Suggests:       libgamemodeauto%{libversion}
%{?systemd_requires}

%description -n gamemoded
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

The GameMode needs to be running for games to be able request game mode.
It should be running within a users session. First, enable it:

    systemctl --user enable gamemoded

Then, start it as follows:

    systemctl --user start gamemoded


%package -n libgamemode%{libversion}
Summary:        GameMode client library
Requires:       gamemoded

%description -n libgamemode%{libversion}
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

Libgamemode is the client library used by games or libgamemodeauto to talk to the GameMode daemon.


%package -n libgamemodeauto%{libversion}
Summary:        Helper library allowing to equip any game with GameMode support
Requires:       libgamemode%{libversion}

%description -n libgamemodeauto%{libversion}
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

Libgamemodeauto allows you to use GameMode with any Game by preloading it into the game.

    LD_PRELOAD=%{_libdir}/libgamemodeauto.so.0 ./game

For Steam games this can be done by editing the launch options:

    LD_PRELOAD=$LD_PRELOAD:%{_libdir}/libgamemodeauto.so.0 %%command%%


%package -n libgamemode-devel
Summary:        Headers for compiling games using GameMode
Group:          Development/Libraries/C and C++
Requires:       libgamemode%{libversion}

%description -n libgamemode-devel
GameMode is a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS.

This package contains the headers required to compile games with built-in GameMode support.

%prep
%setup -n %{gamemodetar}

%build
%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
export CC=gcc-5  # gcc4.8 does not work because of https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58016
export CXX=g++-5
%endif
##%ameson --prefix=/usr -Dwith-systemd-user-unit-dir=%{_userunitdir}
##%ameson_build
##%if 0%{?sle_version} == 120300 && 0%{?is_opensuse}
##CC=gcc-5 CXX=g++-5 meson --prefix=/usr build -Dwith-systemd-user-unit-dir=%{_userunitdir}
##%else
meson --prefix=/usr build -Dwith-systemd-user-unit-dir=%{_userunitdir}
##%endif
ninja -C build

%check
##%ameson_test

%install
##%meson_install
DESTDIR=%{buildroot} ninja -C build install
##sed -i -e 's/yes/auth_admin_keep/g' %{buildroot}/usr/share/polkit-1/actions/com.feralinteractive.GameMode.policy

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%icon_theme_cache_post
%desktop_database_post
##%service_user_pre gamemoded.service

%post -n gamemoded
%systemd_user_post gamemoded.service

%preun -n gamemoded
%systemd_user_preun gamemoded.service

%postun -n gamemoded
%icon_theme_cache_postun
%desktop_database_postun
%systemd_user_postun gamemoded.service

%post -n libgamemode%{libversion} -p /sbin/ldconfig

%postun -n libgamemode%{libversion} -p /sbin/ldconfig

%post -n libgamemodeauto%{libversion} -p /sbin/ldconfig

%postun -n libgamemodeauto%{libversion} -p /sbin/ldconfig


%files -n gamemoded
%defattr(-,root,root)
%{_bindir}/gamemoded
%{_bindir}/gamemoderun 
%defattr(-,root,root)
%{_prefix}/libexec
%{_prefix}/libexec/cpugovctl
%{_datadir}/polkit-1/actions/com.feralinteractive.GameMode.policy
%{_datadir}/dbus-1/services/com.feralinteractive.GameMode.service
%{_userunitdir}/gamemoded.service
%{_mandir}/*/*

%files -n libgamemode%{libversion}
%defattr(-,root,root)
%{_libdir}/libgamemode.so
%{_libdir}/libgamemode.so.*

%files -n libgamemodeauto%{libversion}
%defattr(-,root,root)
%{_libdir}/libgamemodeauto.so
%{_libdir}/libgamemodeauto.so.*

%files -n libgamemode-devel
%defattr(-,root,root)
%{_includedir}/gamemode_client.h
%{_libdir}/pkgconfig/gamemode-auto.pc
%{_libdir}/pkgconfig/gamemode.pc