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 RPM |
4 |
%if "%{?distro_section}" == "nonfree" |
5 |
%define driver nvidia |
6 |
%else |
7 |
%define driver nouveau |
8 |
%endif |
9 |
|
10 |
Name: bumblebee |
11 |
Summary: Support for NVIDIA Optimus laptops on Linux |
12 |
Group: System/Kernel and hardware |
13 |
Version: 3.2.1 |
14 |
Release: %mkrel 4 |
15 |
License: GPLv3+ |
16 |
URL: https://github.com/Bumblebee-Project/bumblebee |
17 |
# source from git repo git://github.com/Bumblebee-Project/Bumblebee.git |
18 |
Source0: https://github.com/downloads/Bumblebee-Project/Bumblebee/%{name}-%{version}.tar.gz |
19 |
BuildRequires: pkgconfig(x11) |
20 |
BuildRequires: pkgconfig(glib-2.0) |
21 |
BuildRequires: pkgconfig(libbsd) |
22 |
BuildRequires: help2man |
23 |
Requires(pre): rpm-helper |
24 |
Requires(pre): update-alternatives |
25 |
Requires(post): systemd-units |
26 |
Requires(preun):systemd-units |
27 |
Requires: %{name}-bin |
28 |
# Default bumblebee bridge for general use (primus is an alternative bridge, designed for gaming performance) |
29 |
Requires: virtualgl |
30 |
Requires: %mklibname virtualgl |
31 |
Requires: kmod(bbswitch) |
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 integrated graphics. The ability to use discrete |
43 |
graphics depends on the driver: open source nouveau and proprietary nvidia. |
44 |
|
45 |
%if "%{?distro_section}" != "nonfree" |
46 |
%files |
47 |
%doc README.markdown doc/RELEASE_NOTES_3_2_1 |
48 |
%{_sysconfdir}/bash_completion.d/bumblebee |
49 |
%dir %{_sysconfdir}/bumblebee/ |
50 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nouveau |
51 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.nvidia |
52 |
%config(noreplace) %{_sysconfdir}/bumblebee/xorg.conf.d/10-dummy.conf |
53 |
%{_usr}/lib/udev/rules.d/99-bumblebee-nvidia-dev.rules |
54 |
%{_unitdir}/bumblebeed.service |
55 |
%{_bindir}/bumblebee-bugreport |
56 |
%{_mandir}/man1/bumblebeed.1.* |
57 |
%{_mandir}/man1/optirun.1.* |
58 |
|
59 |
%pre |
60 |
%_pre_groupadd %{name} |
61 |
if [ "$1" -eq "1" ];then |
62 |
users=$(getent passwd | awk -F: '$3 >= 500 && $3 < 60000 {print $1}') |
63 |
for user in $users; do |
64 |
gpasswd -a $user bumblebee |
65 |
done |
66 |
/usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf |
67 |
fi |
68 |
|
69 |
%post |
70 |
%_post_service bumblebeed |
71 |
# Simple: still needs this since in release 3 services were not set |
72 |
# enabled and seams that still isnt properly handeled in %%_post_service |
73 |
if [ "$1" -ge "1" ]; then |
74 |
# Enable (but don't start) the unit by default |
75 |
/bin/systemctl enable bumblebeed.service |
76 |
# Start bumblebeed service |
77 |
/bin/systemctl start bumblebeed.service |
78 |
fi |
79 |
|
80 |
%preun |
81 |
%_preun_service bumblebeed |
82 |
|
83 |
%postun |
84 |
# We need this since "%%_postun_groupdel %%{name}" doesnt remove the group if |
85 |
# set to a user |
86 |
if [ "$1" -eq "0" ];then |
87 |
/usr/sbin/groupdel bumblebee |
88 |
fi |
89 |
%endif |
90 |
|
91 |
%package %{driver} |
92 |
Summary: Bumblebee configuration files and binaries for %{driver} driver |
93 |
Group: System/Kernel and hardware |
94 |
Requires: %{name} = %{version} |
95 |
%if "%{?distro_section}" == "nonfree" |
96 |
Requires: nvidia |
97 |
Suggests: primus-nvidia |
98 |
Conflicts: %{name}-nouveau |
99 |
%else |
100 |
Requires: x11-driver-video-nouveau |
101 |
Suggests: primus-nouveau |
102 |
Conflicts: %{name}-nvidia |
103 |
%endif |
104 |
Provides: %{name}-bin = %{version} |
105 |
|
106 |
%description %{driver} |
107 |
Bumblebee configuration files and binaries built against |
108 |
the %{driver} driver. |
109 |
|
110 |
%files %{driver} |
111 |
%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf |
112 |
%{_sbindir}/bumblebeed |
113 |
%{_bindir}/optirun |
114 |
|
115 |
#-------------------------------------------------------------------- |
116 |
%prep |
117 |
%setup -q |
118 |
|
119 |
%build |
120 |
%configure2_5x \ |
121 |
%if "%{?distro_section}" == "nonfree" |
122 |
CONF_DRIVER=nvidia \ |
123 |
CONF_DRIVER_MODULE_NVIDIA=nvidia-current \ |
124 |
%else |
125 |
CONF_DRIVER=nouveau \ |
126 |
%endif |
127 |
%ifarch x86_64 |
128 |
CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current:%{_usr}/lib/nvidia-current \ |
129 |
CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_usr}/lib/nvidia-current/xorg,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/modules,%{_libdir}/xorg/extra-modules,%{_usr}/lib/xorg/extra-modules \ |
130 |
CONF_PRIMUS_LD_PATH=%{_libdir}/primus:%{_usr}/lib/primus |
131 |
%else |
132 |
CONF_LDPATH_NVIDIA=%{_libdir}/nvidia-current \ |
133 |
CONF_MODPATH_NVIDIA=%{_libdir}/nvidia-current/xorg,%{_libdir}/xorg/modules,%{_libdir}/xorg/extra-modules |
134 |
CONF_PRIMUS_LD_PATH=%{_libdir}/primus |
135 |
%endif |
136 |
|
137 |
%make CFLAGS="%{optflags}" |
138 |
|
139 |
%install |
140 |
%if "%{?distro_section}" == "nonfree" |
141 |
install -D -m644 conf/bumblebee.conf %{buildroot}%{_sysconfdir}/bumblebee/bumblebee.conf |
142 |
install -D -m755 bin/bumblebeed %{buildroot}%{_sbindir}/bumblebeed |
143 |
install -D -m755 bin/optirun %{buildroot}%{_bindir}/optirun |
144 |
%else |
145 |
%makeinstall_std |
146 |
mv %{buildroot}/lib %{buildroot}%{_usr}/lib |
147 |
install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service |
148 |
%endif |