File bumblebee.spec of Package bumblebee

# spec file for package bumblebee
# Copyright (c) 2016 SUSE LINUX 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

Name:           bumblebee
Version:        3.2.1
Release:        0
Summary:        NVidia Optimus support for GNU/Linux aimed at stability
License:        GPL-3.0+
Group:          Hardware/Other
Patch0:         nvidia-uvm-modeset-drm-support.patch
Patch1:         bumblebee-decimal-pciid.patch
BuildRequires:  glib2-devel
BuildRequires:  help2man
BuildRequires:  pciutils
BuildRequires:  pkg-config
BuildRequires:  pwdutils
BuildRequires:  systemd
BuildRequires:  xorg-x11-libX11-devel
Requires:       VirtualGL
Requires:       pciutils
Requires:       primus
Requires:       pwdutils
Requires:       shadow
Requires:       sudo
Requires:       xorg-x11-libX11
Recommends:     bbswitch
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
# Always want 32b version on 64b system
%ifarch x86_64
Recommends:     VirtualGL-32bit
# Always want 32b version on 64b system
%ifarch x86_64
Recommends:     primus-32bit
%if 0%{?suse_version} < 1315
Requires:       module-init-tools
Requires:       kmod-compat

Bumblebee daemon is a rewrite of the original Bumblebee service,
providing an elegant and stable means of managing Optimus hybrid
graphics chipsets. A primary goal of this project is to not only
enable use of the discrete GPU for rendering, but also to enable
smart power management of the dGPU when it's not in use.

%setup -q
# Apply patch to add support for nvidia-uvm
%patch0 -p1
%patch1 -p1

%configure \
	--without-pidfile \
	--with-udev-rules=%{_libexecdir}/udev/rules.d/ \
	CONF_DRIVER_MODULE_NVIDIA=nvidia CONF_LDPATH_NVIDIA=%{_libdir}/nvidia:%{_libexecdir}/nvidia \
	CONF_MODPATH_NVIDIA=%{_libdir}/nvidia/xorg/,%{_libdir}/xorg/modules \

make %{?_smp_mflags}

make DESTDIR=%{buildroot} install %{?_smp_mflags}
install -d 755 %{buildroot}%{_libexecdir}/systemd
install -D -m644 "%{_builddir}/%{name}-%{version}/scripts/systemd/bumblebeed.service" "%{buildroot}%{_libexecdir}/systemd/system/bumblebeed.service"
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rcbumblebeed
# Fix service to run after dkms and modules leading service
sed -i '3i After=dkms.service systemd-modules-load.service' %{buildroot}%{_libexecdir}/systemd/system/bumblebeed.service

getent group bumblebee >/dev/null || groupadd -r bumblebee || :
%service_add_pre bumblebeed.service

%service_add_post bumblebeed.service
# Notify user about the groups
mkdir -p %{_localstatedir}/adm/update-messages
cat > %{_localstatedir}/adm/update-messages/%{name}-%{version}-%{release}-something << EOF
INFO: Please ensure that users using bublebee/video card are in following group(s):
INFO:     gpasswd -a <USER> bumblebee
INFO:   If going to use nvidia binary driver:
INFO:     gpasswd -a <USER> video
INFO: Also ensure the nouveau module is blacklisted (even if you plan to use it):
INFO:     echo "blacklist nouveau" >> /etc/modprobe.d/50-blacklist.conf
INFO:     mkinitrd

%service_del_preun bumblebeed.service

%service_del_postun bumblebeed.service

%doc README.markdown COPYING
%dir %{_sysconfdir}/bumblebee
%config %{_sysconfdir}/bumblebee/xorg.conf.nouveau
%config %{_sysconfdir}/bumblebee/xorg.conf.nvidia
%config %{_sysconfdir}/bumblebee/bumblebee.conf
%dir %{_sysconfdir}/bumblebee/xorg.conf.d
%config %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf
%dir %{_libexecdir}/systemd/system
%config %{_sysconfdir}/bash_completion.d/bumblebee

openSUSE Build Service is sponsored by