%global commit 8f3d307b6aabbc2cd8444c6e5a4360f3bf2915ec %global shortcommit %(c=%{commit}; echo ${c:0:7}) # For SELinux %global modulename bumblebee-extra Name: bumblebee Version: 3.2.1 Release: 6.git%{shortcommit}%{?dist} Summary: Daemon to support NVIDIA Optimus via VirtualGL License: GPLv3+ URL: https://github.com/Bumblebee-Project/Bumblebee Source0: https://github.com/Bumblebee-Project/Bumblebee/archive/%{commit}/Bumblebee-%{shortcommit}.tar.gz Source1: bumblebee-blacklist.conf Source2: %{modulename}.te Patch0: 0001-xorg.conf.nvidia-Treat-ABI-mismatch-as-warning.patch Patch1: 0002-bumblebee-bugreport-Add-support-for-Fedora.patch Patch2: 0003-libglvnd.patch Patch3: 0004-Add-configure-script.patch Patch4: 0005-udev-don-t-create-device-files.patch Patch5: 0006-module-Log-kmod-errors-while-unloading.patch Patch6: 0007-module-Retry-unload-if-refcount-is-non-zero.patch BuildRequires: gcc BuildRequires: help2man BuildRequires: systemd BuildRequires: kmod-devel BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(x11) Requires: VirtualGL Requires(pre): shadow-utils Requires: %{name}-selinux = %{version}-%{release} Recommends: bbswitch-kmod Recommends: primus %{?systemd_requires} %description 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. %package selinux Summary: SELinux policies for bumblebee BuildRequires: selinux-policy-devel Requires(post): libselinux-utils Requires(post): policycoreutils Requires(post): policycoreutils-python-utils Requires(post): selinux-policy-base >= %{_selinux_policy_version} BuildArch: noarch %description selinux SELinux policy module for use with bumblebee. %prep %autosetup -p1 -n Bumblebee-%{commit} %build # Touch auto-generated files so we can build without autotools installed touch configure.ac aclocal.m4 Makefile.in configure # Despite what configure.ac says, omitting CONF_DRIVER_MODULE_NVIDIA is not the # same as setting it to 'nvidia'. It needs to be set in order for the # proprietary driver to have a higher priority than nouveau. See src/driver.c # for the driver handling logic. %configure \ CONF_PRIMUS_LD_PATH=%{_prefix}/lib64/primus:%{_prefix}/lib/primus \ CONF_LDPATH_NVIDIA=%{_prefix}/lib64:%{_prefix}/lib \ CONF_MODPATH_NVIDIA=%{_libdir}/nvidia/xorg,%{_libdir}/xorg/modules \ CONF_DRIVER_MODULE_NVIDIA=nvidia \ --with-udev-rules=%{_udevrulesdir} \ --without-pidfile %make_build # Build SELinux module cp %{SOURCE2} . make -f %{_datadir}/selinux/devel/Makefile %{modulename}.pp bzip2 -9 %{modulename}.pp %install %make_install \ completiondir=%{_datadir}/bash-completion/completions # Install systemd unit install -d -m 0755 %{buildroot}%{_unitdir} install -m 0644 scripts/systemd/bumblebeed.service \ %{buildroot}%{_unitdir}/ # Install modprobe blacklist install -d -m 0755 %{buildroot}%{_prefix}/lib/modprobe.d install -m 0644 %{SOURCE1} \ %{buildroot}%{_prefix}/lib/modprobe.d/bumblebee.conf # Install SELinux module install -d -p %{buildroot}%{_datadir}/selinux/packages install -p -m 0644 %{modulename}.pp.bz2 \ %{buildroot}%{_datadir}/selinux/packages/ %pre getent group bumblebee >/dev/null || groupadd -r bumblebee %post %systemd_post bumblebeed.service %preun %systemd_preun bumblebeed.service %postun # Don't restart the daemon since the discrete GPU might be in use %systemd_postun bumblebeed.service %post selinux %selinux_modules_install %{_datadir}/selinux/packages/%{modulename}.pp.bz2 %postun selinux if [ "${1}" -eq 0 ]; then %selinux_modules_uninstall %{modulename} fi %files %doc %{_docdir}/%{name}/ %license COPYING %dir %{_sysconfdir}/bumblebee/ %dir %{_sysconfdir}/bumblebee/xorg.conf.d/ %config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia %{_bindir}/bumblebee-bugreport %{_bindir}/optirun %{_sbindir}/bumblebeed %{_prefix}/lib/modprobe.d/bumblebee.conf %{_unitdir}/bumblebeed.service %{_udevrulesdir}/99-bumblebee-nvidia-dev.rules %{_datadir}/bash-completion/completions/optirun %{_mandir}/man8/bumblebeed.8* %{_mandir}/man1/optirun.1* %files selinux %{_datadir}/selinux/packages/%{modulename}.pp.bz2 %changelog * Sun Aug 04 2019 Andrew Gunnerson - 3.2.1-4 - Add gcc to build dependencies * Sat Aug 03 2019 Elia Geretto - 3.2.1-3 - Add support for AlwaysUnloadKernelDriver * Mon Dec 25 2017 Andrew Gunnerson - 3.2.1-2 - Add -selinux subpackage that allows bumblebeed to write to /proc/acpi/bbswitch * Mon Dec 25 2017 Andrew Gunnerson - 3.2.1-1 - Initial release - Based on Arch Linux package