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.0.1 |
8 |
Release: %mkrel 2 |
9 |
License: GPLv3+ |
10 |
URL: https://github.com/Bumblebee-Project/bumblebee |
11 |
# source from git repo git://github.com/Bumblebee-Project/Bumblebee.git |
12 |
# we need to change to develop branch to allow changing to nouveau without |
13 |
# using nvidia paths |
14 |
Source0: https://github.com/downloads/Bumblebee-Project/Bumblebee/%{name}-%{version}.tar.gz |
15 |
BuildRequires: pkgconfig(x11) |
16 |
BuildRequires: pkgconfig(glib-2.0) |
17 |
BuildRequires: pkgconfig(libbsd) |
18 |
BuildRequires: help2man |
19 |
Requires(pre): update-alternatives |
20 |
Requires(post): systemd-units |
21 |
Requires(preun):systemd-units |
22 |
Requires(pre): rpm-helper |
23 |
Requires: virtualgl |
24 |
Requires: %mklibname virtualgl |
25 |
%if %{with nvidia} |
26 |
Suggests: x11-driver-video-nvidia-current |
27 |
%else |
28 |
Requires: x11-driver-video-nouveau |
29 |
%endif |
30 |
Requires: kmod(bbswitch) |
31 |
# Seems broken with current kernels (maybe not needed anymore?) |
32 |
#Requires: kmod(acpi_call) |
33 |
|
34 |
%description |
35 |
Bumblebee daemon is a rewrite of the original Bumblebee service, providing |
36 |
an elegant and stable means of managing Optimus hybrid graphics chip sets. |
37 |
A primary goal of this project is to not only enable use of the discrete |
38 |
GPU for rendering, but also to enable smart power management of the dGPU |
39 |
when it's not in use. |
40 |
|
41 |
%files |
42 |
%doc README.markdown doc/RELEASE_NOTES_3_0_1 |
43 |
%{_sysconfdir}/bash_completion.d/bumblebee |
44 |
%dir %{_sysconfdir}/bumblebee/ |
45 |
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf |
46 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau |
47 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia |
48 |
/lib/systemd/system/bumblebeed.service |
49 |
%{_sbindir}/bumblebeed |
50 |
%{_bindir}/optirun |
51 |
%{_bindir}/bumblebee-bugreport |
52 |
%{_mandir}/man1/bumblebeed.1.* |
53 |
%{_mandir}/man1/optirun.1.* |
54 |
|
55 |
%pre |
56 |
%_pre_groupadd %{name} |
57 |
if [ "$1" -eq "1" ];then |
58 |
users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') |
59 |
for user in $users; do |
60 |
gpasswd -a $user bumblebee |
61 |
done |
62 |
/usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf |
63 |
fi |
64 |
|
65 |
%post |
66 |
%_post_service bumblebeed |
67 |
# Simple: still needs this since in release 3 services were not set |
68 |
# enabled and seams that still isnt properly handeled in %%_post_service |
69 |
if [ "$1" -ge "1" ]; then |
70 |
# Enable (but don't start) the unit by default |
71 |
/bin/systemctl enable bumblebeed.service |
72 |
# Start bumblebeed service |
73 |
/bin/systemctl start bumblebeed.service |
74 |
fi |
75 |
|
76 |
%preun |
77 |
%_preun_service bumblebeed |
78 |
|
79 |
%postun |
80 |
# We need this since "%%_postun_groupdel %%{name}" doesnt remove the group if |
81 |
# set to a user |
82 |
if [ "$1" -eq "0" ];then |
83 |
/usr/sbin/groupdel bumblebee |
84 |
fi |
85 |
|
86 |
# Simple: we need to ensure bumblebee group isn't removed when upgrading |
87 |
# This doesnt need exist for Mageia 2 |
88 |
%triggerpostun -- %{name} < 3.0-9 |
89 |
%_pre_groupadd %{name} |
90 |
users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') |
91 |
for user in $users; do |
92 |
gpasswd -a $user bumblebee |
93 |
done |
94 |
|
95 |
#-------------------------------------------------------------------- |
96 |
%prep |
97 |
%setup -q |
98 |
|
99 |
%build |
100 |
%configure2_5x \ |
101 |
%if %{with nvidia} |
102 |
CONF_DRIVER=nvidia \ |
103 |
CONF_DRIVER_MODULE_NVIDIA=nvidia-current \ |
104 |
%else |
105 |
CONF_DRIVER=nouveau \ |
106 |
%endif |
107 |
%ifarch x86_64 |
108 |
CONF_LDPATH_NVIDIA=%{_usr}/lib/nvidia-current:%{_libdir}/nvidia-current \ |
109 |
CONF_MODPATH_NVIDIA=%{_usr}/lib/nvidia-current/xorg,%{_libdir}/nvidia-current/xorg,%{_usr}/lib/xorg/modules,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/extra-modules,%{_usr}/xorg/extra-modules |
110 |
%else |
111 |
CONF_LDPATH_NVIDIA=%{_usr}/lib/nvidia-current \ |
112 |
CONF_MODPATH_NVIDIA=%{_usr}/lib/nvidia-current/xorg,%{_usr}/lib/xorg/modules,%{_usr}/lib/xorg/extra-modules |
113 |
%endif |
114 |
|
115 |
%make CFLAGS="%{optflags}" |
116 |
|
117 |
%install |
118 |
%makeinstall_std |
119 |
|
120 |
install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}/lib/systemd/system/bumblebeed.service |