# Package should be built first against core, and then against nonfree # The core build produces the bumblebee and bumblebee-nouveau RPMs, # whereas the nonfree build produces the bumblebee-nvidia RPM %if "%{?distro_section}" == "nonfree" %define driver nvidia %else %define driver nouveau %endif Name: bumblebee Summary: Support for NVIDIA Optimus laptops on Linux Group: System/Kernel and hardware Version: 3.2.1 Release: %mkrel 5 License: GPLv3+ URL: https://github.com/Bumblebee-Project/bumblebee # source from git repo git://github.com/Bumblebee-Project/Bumblebee.git Source0: https://github.com/downloads/Bumblebee-Project/Bumblebee/%{name}-%{version}.tar.gz BuildRequires: pkgconfig(x11) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(libbsd) BuildRequires: help2man Requires(pre): rpm-helper Requires(pre): update-alternatives Requires(post): systemd-units Requires(preun):systemd-units Requires: %{name}-bin # VirtualGl is the default bridge for upstream, the alternative being primus # As of now (3.2.1-5) primus shows better performances and compability, so we use it as default Suggests: virtualgl Suggests: %mklibname virtualgl Requires: kmod(bbswitch) %description Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in GNU/Linux systems. These laptops are built in such a way that the NVIDIA graphics card can be used on demand so that battery life is improved and temperature is kept low. It disables the discrete graphics card if no client is detected, and start an X server making use of NVIDIA card if requested then let software GL implementations (such as VirtualGL or primus) copy frames to the visible display that runs on the integrated graphics. The ability to use discrete graphics depends on the driver: open source nouveau and proprietary nvidia. %if "%{?distro_section}" != "nonfree" %files %doc README.markdown doc/RELEASE_NOTES_3_2_1 %{_sysconfdir}/bash_completion.d/bumblebee %dir %{_sysconfdir}/bumblebee/ %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia %config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf %{_udevrulesdir}/99-bumblebee-nvidia-dev.rules %{_unitdir}/bumblebeed.service %{_bindir}/bumblebee-bugreport %{_mandir}/man1/bumblebeed.1.* %{_mandir}/man1/optirun.1.* %pre %_pre_groupadd %{name} if [ "$1" -eq "1" ];then users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') for user in $users; do gpasswd -a $user bumblebee done /usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf fi %post %_post_service bumblebeed # Simple: still needs this since in release 3 services were not set # enabled and seams that still isnt properly handeled in %%_post_service if [ "$1" -ge "1" ]; then # Enable (but don't start) the unit by default /bin/systemctl enable bumblebeed.service # Start bumblebeed service /bin/systemctl start bumblebeed.service fi %preun %_preun_service bumblebeed %postun # We need this since "%%_postun_groupdel %%{name}" doesnt remove the group if # set to a user if [ "$1" -eq "0" ];then /usr/sbin/groupdel bumblebee fi %endif %package %{driver} Summary: Bumblebee configuration files and binaries for %{driver} driver Group: System/Kernel and hardware Requires: %{name} = %{version} %if "%{?distro_section}" == "nonfree" Requires: nvidia Requires: primus-nvidia Conflicts: %{name}-nouveau %else Requires: x11-driver-video-nouveau Requires: primus-nouveau Conflicts: %{name}-nvidia %endif Provides: %{name}-bin = %{version} %description %{driver} Bumblebee configuration files and binaries built against the %{driver} driver. %files %{driver} %config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf %{_sbindir}/bumblebeed %{_bindir}/optirun #-------------------------------------------------------------------- %prep %setup -q %build %configure2_5x --with-udev-rules=%{_udevrulesdir} \ CONF_BRIDGE=primus \ %if "%{?distro_section}" == "nonfree" CONF_DRIVER=nvidia \ CONF_DRIVER_MODULE_NVIDIA=nvidia-current \ %else CONF_DRIVER=nouveau \ %endif %ifarch x86_64 CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current:%{_usr}/lib/nvidia-current \ CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_usr}/lib/nvidia-current/xorg,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/modules \ CONF_PRIMUS_LD_PATH=%{_libdir}/primus:%{_usr}/lib/primus %else CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current \ CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_libdir}/xorg/modules \ CONF_PRIMUS_LD_PATH=%{_libdir}/primus %endif %make CFLAGS="%{optflags}" %install %if "%{?distro_section}" == "nonfree" install -D -m644 conf/bumblebee.conf %{buildroot}%{_sysconfdir}/bumblebee/bumblebee.conf install -D -m755 bin/bumblebeed %{buildroot}%{_sbindir}/bumblebeed install -D -m755 bin/optirun %{buildroot}%{_bindir}/optirun %else %makeinstall_std install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service %endif