1 |
# Use nouveau driver by default |
2 |
%bcond_with nvidia |
3 |
|
4 |
Name: bumblebee |
5 |
Summary: Support for NVIDIA Optimus laptops on Linux |
6 |
Group: System/Kernel and hardware |
7 |
Version: 3.2.1 |
8 |
Release: %mkrel 3 |
9 |
License: GPLv3+ |
10 |
URL: https://github.com/Bumblebee-Project/bumblebee |
11 |
# source from git repo git://github.com/Bumblebee-Project/Bumblebee.git |
12 |
Source0: https://github.com/downloads/Bumblebee-Project/Bumblebee/%{name}-%{version}.tar.gz |
13 |
BuildRequires: pkgconfig(x11) |
14 |
BuildRequires: pkgconfig(glib-2.0) |
15 |
BuildRequires: pkgconfig(libbsd) |
16 |
BuildRequires: help2man |
17 |
Requires(pre): rpm-helper |
18 |
Requires(pre): update-alternatives |
19 |
Requires(post): systemd-units |
20 |
Requires(preun):systemd-units |
21 |
Requires: virtualgl |
22 |
Requires: %mklibname virtualgl |
23 |
# Suggests: primus |
24 |
%if %{with nvidia} |
25 |
Suggests: x11-driver-video-nvidia-current |
26 |
%else |
27 |
Requires: x11-driver-video-nouveau |
28 |
%endif |
29 |
Requires: kmod(bbswitch) |
30 |
# Seems broken with current kernels (maybe not needed anymore?) |
31 |
# Requires: kmod(acpi_call) |
32 |
|
33 |
%description |
34 |
Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in |
35 |
GNU/Linux systems. These laptops are built in such a way that the NVIDIA |
36 |
graphics card can be used on demand so that battery life is improved and |
37 |
temperature is kept low. |
38 |
|
39 |
It disables the discrete graphics card if no client is detected, and start |
40 |
an X server making use of NVIDIA card if requested then let software GL |
41 |
implementations (such as VirtualGL or primus) copy frames to the visible |
42 |
display that runs on the intergrated graphics. The ability to use discrete |
43 |
graphics depends on the driver: open source nouveau and proprietary nvidia. |
44 |
|
45 |
%files |
46 |
%doc README.markdown doc/RELEASE_NOTES_3_2_1 |
47 |
%{_sysconfdir}/bash_completion.d/bumblebee |
48 |
%dir %{_sysconfdir}/bumblebee/ |
49 |
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf |
50 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf |
51 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau |
52 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia |
53 |
/lib/udev/rules.d/99-bumblebee-nvidia-dev.rules |
54 |
/lib/systemd/system/bumblebeed.service |
55 |
%{_sbindir}/bumblebeed |
56 |
%{_bindir}/optirun |
57 |
%{_bindir}/bumblebee-bugreport |
58 |
%{_mandir}/man1/bumblebeed.1.* |
59 |
%{_mandir}/man1/optirun.1.* |
60 |
|
61 |
%pre |
62 |
%_pre_groupadd %{name} |
63 |
if [ "$1" -eq "1" ];then |
64 |
users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') |
65 |
for user in $users; do |
66 |
gpasswd -a $user bumblebee |
67 |
done |
68 |
/usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf |
69 |
fi |
70 |
|
71 |
%post |
72 |
%_post_service bumblebeed |
73 |
# Simple: still needs this since in release 3 services were not set |
74 |
# enabled and seams that still isnt properly handeled in %%_post_service |
75 |
if [ "$1" -ge "1" ]; then |
76 |
# Enable (but don't start) the unit by default |
77 |
/bin/systemctl enable bumblebeed.service |
78 |
# Start bumblebeed service |
79 |
/bin/systemctl start bumblebeed.service |
80 |
fi |
81 |
|
82 |
%preun |
83 |
%_preun_service bumblebeed |
84 |
|
85 |
%postun |
86 |
# We need this since "%%_postun_groupdel %%{name}" doesnt remove the group if |
87 |
# set to a user |
88 |
if [ "$1" -eq "0" ];then |
89 |
/usr/sbin/groupdel bumblebee |
90 |
fi |
91 |
|
92 |
#-------------------------------------------------------------------- |
93 |
%prep |
94 |
%setup -q |
95 |
|
96 |
%build |
97 |
%configure2_5x \ |
98 |
%if %{with nvidia} |
99 |
CONF_DRIVER=nvidia \ |
100 |
CONF_DRIVER_MODULE_NVIDIA=nvidia-current \ |
101 |
%else |
102 |
CONF_DRIVER=nouveau \ |
103 |
%endif |
104 |
%ifarch x86_64 |
105 |
CONF_LDPATH_NVIDIA=%{_usr}/lib/nvidia-current:%{_libdir}/nvidia-current \ |
106 |
CONF_MODPATH_NVIDIA=%{_usr}/lib/nvidia-current/xorg,%{_libdir}/nvidia-current/xorg,%{_usr}/lib/xorg/modules,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/extra-modules,%{_libdir}/xorg/extra-modules |
107 |
# CONF_PRIMUS_LD_PATH=%%{_usr}/lib/primus:%%{_libdir}/primus |
108 |
%else |
109 |
CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current \ |
110 |
CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_libdir}/xorg/modules,%{_libdir}/xorg/extra-modules |
111 |
# CONF_PRIMUS_LD_PATH=%%{_libdir}/primus |
112 |
%endif |
113 |
|
114 |
%make CFLAGS="%{optflags}" |
115 |
|
116 |
%install |
117 |
%makeinstall_std |
118 |
|
119 |
install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}/lib/systemd/system/bumblebeed.service |