1 |
# Package should be built first against core, and then against nonfree |
2 |
# The core build produces the bumblebee and bumblebee-nouveau RPMs, |
3 |
# whereas the nonfree build produces the bumblebee-nvidia-current and -nvidia340 RPMs |
4 |
|
5 |
# Increment bigrel when snapshot changes, snaprel for a new release of the same snapshot |
6 |
%define date 20150120 |
7 |
%define bigrel 15 |
8 |
%define snaprel 1 |
9 |
|
10 |
Name: bumblebee |
11 |
Summary: Daemon managing Nvidia Optimus hybrid graphics cards |
12 |
Group: System/Kernel and hardware |
13 |
Version: 3.2.1 |
14 |
Release: %mkrel %{bigrel}.%{date}.%{snaprel} |
15 |
License: GPLv3+ |
16 |
URL: https://github.com/Bumblebee-Project/bumblebee |
17 |
# Taken from tip of https://github.com/Bumblebee-Project/Bumblebee/tree/develop |
18 |
Source0: %{name}-%{version}+%{date}.tar.xz |
19 |
|
20 |
BuildRequires: pkgconfig(x11) |
21 |
BuildRequires: pkgconfig(glib-2.0) |
22 |
BuildRequires: pkgconfig(libbsd) |
23 |
BuildRequires: help2man |
24 |
Requires(pre): rpm-helper |
25 |
Requires(pre): update-alternatives |
26 |
Requires(post): systemd-units |
27 |
Requires(preun):systemd-units |
28 |
Requires: kmod(bbswitch.ko) |
29 |
Requires: %{name}-bin |
30 |
# VirtualGl is the default bridge for upstream, the alternative being primus |
31 |
# As of now (3.2.1-5) primus shows better performances and compability, so we use it as default |
32 |
Recommends: virtualgl |
33 |
Recommends: %mklibname virtualgl |
34 |
# Files were moved |
35 |
Conflicts: %{name}-nouveau < 3.2.1-15 |
36 |
Conflicts: %{name}-nvidia < 3.2.1-15 |
37 |
|
38 |
%description |
39 |
Bumblebee is an effort to make NVIDIA Optimus enabled laptops work in |
40 |
GNU/Linux systems. These laptops are built in such a way that the NVIDIA |
41 |
graphics card can be used on demand so that battery life is improved and |
42 |
temperature is kept low. |
43 |
|
44 |
It disables the discrete graphics card if no client is detected, and start |
45 |
an X server making use of NVIDIA card if requested then let software GL |
46 |
implementations (such as VirtualGL or primus) copy frames to the visible |
47 |
display that runs on the integrated graphics. The ability to use discrete |
48 |
graphics depends on the driver: open source nouveau and proprietary nvidia. |
49 |
|
50 |
#-------------------------------------------------------------------- |
51 |
|
52 |
%if "%{?distro_section}" != "nonfree" |
53 |
# Core build |
54 |
%files |
55 |
%doc README.markdown doc/RELEASE_NOTES_3_2_1 |
56 |
%{_sysconfdir}/bash_completion.d/bumblebee |
57 |
%{_sysconfdir}/modprobe.d/%{name}.conf |
58 |
%dir %{_sysconfdir}/bumblebee/ |
59 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau |
60 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia |
61 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf |
62 |
%{_udevrulesdir}/99-bumblebee-nvidia-dev.rules |
63 |
%{_unitdir}/bumblebeed.service |
64 |
%{_sbindir}/bumblebeed |
65 |
%{_bindir}/bumblebee-bugreport |
66 |
%{_bindir}/optirun |
67 |
%{_mandir}/man1/bumblebeed.1.* |
68 |
%{_mandir}/man1/optirun.1.* |
69 |
|
70 |
%pre |
71 |
%_pre_groupadd %{name} |
72 |
if [ "$1" -eq "1" ]; then |
73 |
users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') |
74 |
for user in $users; do |
75 |
gpasswd -a $user bumblebee |
76 |
done |
77 |
/usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf |
78 |
fi |
79 |
|
80 |
%post |
81 |
%_post_service bumblebeed |
82 |
# simplew: still needs this since in release 3 services were not set |
83 |
# enabled and seams that still isnt properly handeled in %%_post_service |
84 |
if [ "$1" -ge "1" ]; then |
85 |
# Enable (but don't start) the unit by default |
86 |
/bin/systemctl enable bumblebeed.service |
87 |
# Start bumblebeed service |
88 |
/bin/systemctl start bumblebeed.service |
89 |
fi |
90 |
|
91 |
%preun |
92 |
%_preun_service bumblebeed |
93 |
|
94 |
%postun |
95 |
# We need this since "%%_postun_groupdel %%{name}" doesnt remove the group if |
96 |
# set to a user |
97 |
if [ "$1" -eq "0" ];then |
98 |
/usr/sbin/groupdel bumblebee |
99 |
fi |
100 |
|
101 |
#-------------------------------------------------------------------- |
102 |
|
103 |
%package nouveau |
104 |
Summary: Bumblebee configuration files and binaries for nouveau driver |
105 |
Group: System/Kernel and hardware |
106 |
Requires: %{name} = %{version} |
107 |
Requires: x11-driver-video-nouveau |
108 |
Requires: primus-nouveau |
109 |
Conflicts: %{name}-nvidia |
110 |
Provides: %{name}-bin = %{version} |
111 |
|
112 |
%description nouveau |
113 |
Bumblebee configuration files and binaries built against |
114 |
the nouveau driver. |
115 |
|
116 |
%files nouveau |
117 |
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf |
118 |
|
119 |
#-------------------------------------------------------------------- |
120 |
|
121 |
%else |
122 |
%define debug_package %{nil} |
123 |
|
124 |
# Nonfree build |
125 |
%package nvidia |
126 |
Summary: Bumblebee configuration files and binaries for nvidia-current driver |
127 |
Group: System/Kernel and hardware |
128 |
Requires: %{name} = %{version} |
129 |
Requires: x11-driver-video-nvidia-current |
130 |
Requires: primus-nvidia |
131 |
Conflicts: %{name}-nouveau |
132 |
Provides: %{name}-bin = %{version} |
133 |
|
134 |
%description nvidia |
135 |
Bumblebee configuration files and binaries built against |
136 |
the nvidia-current driver. |
137 |
|
138 |
%files nvidia |
139 |
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf |
140 |
%{_bindir}/nvidia-settings-bumblebee |
141 |
%endif |
142 |
|
143 |
#-------------------------------------------------------------------- |
144 |
|
145 |
%prep |
146 |
%setup -q -n %{name}-%{version}+%{date} |
147 |
|
148 |
%build |
149 |
autoreconf -vfi |
150 |
|
151 |
%configure2_5x \ |
152 |
--with-udev-rules=%{_udevrulesdir} \ |
153 |
CONF_BRIDGE=primus \ |
154 |
%if "%{?distro_section}" == "nonfree" |
155 |
CONF_DRIVER=nvidia \ |
156 |
CONF_DRIVER_MODULE_NVIDIA=nvidia-current \ |
157 |
%else |
158 |
CONF_DRIVER=nouveau \ |
159 |
%endif |
160 |
%ifarch x86_64 |
161 |
CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current:%{_usr}/lib/nvidia-current \ |
162 |
CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_usr}/lib/nvidia-current/xorg,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/modules \ |
163 |
CONF_PRIMUS_LD_PATH=%{_libdir}/primus:%{_usr}/lib/primus |
164 |
%else |
165 |
CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current \ |
166 |
CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_libdir}/xorg/modules \ |
167 |
CONF_PRIMUS_LD_PATH=%{_libdir}/primus |
168 |
%endif |
169 |
|
170 |
%make |
171 |
|
172 |
%install |
173 |
%if "%{?distro_section}" != "nonfree" |
174 |
%makeinstall_std |
175 |
install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service |
176 |
|
177 |
install -d %{buildroot}%{_sysconfdir}/modprobe.d |
178 |
cat << EOF > %{buildroot}%{_sysconfdir}/modprobe.d/%{name}.conf |
179 |
blacklist nvidia-current |
180 |
blacklist nouveau |
181 |
|
182 |
# Map removal of modules to correct command |
183 |
# This allows modprobe -r nvidia to work |
184 |
remove nvidia rmmod nvidia |
185 |
|
186 |
# Needed for bumblebee as it tries to remove nvidia-current, which is the module |
187 |
# load name. The driver is still "nvidia" once loaded, thus the removal fails. |
188 |
remove nvidia-current rmmod nvidia |
189 |
|
190 |
# Switch card off when booting, on when unloading bbswitch (shutdown) |
191 |
options bbswitch load_state=0 unload_state=1 |
192 |
EOF |
193 |
|
194 |
%else |
195 |
install -D -m644 conf/bumblebee.conf %{buildroot}%{_sysconfdir}/bumblebee/bumblebee.conf |
196 |
|
197 |
# Create nvidia-settings launcher script |
198 |
cat << EOF > nvidia-settings-bumblebee |
199 |
#!/bin/sh |
200 |
optirun -b none %{_libdir}/nvidia-current/bin/nvidia-settings -c :8 |
201 |
EOF |
202 |
install -D -m755 nvidia-settings-bumblebee %{buildroot}%{_bindir}/nvidia-settings-bumblebee |
203 |
%endif |