Sophie

Sophie

distrib > Mageia > 8 > armv7hl > by-pkgid > 174bc69579dfaf5f1ed2946c0b0a0a03 > files > 2

bumblebee-nvidia390-3.2.1-18.20210112.1.mga8.nonfree.src.rpm

# Package should be built in nonfree only, as it only provides features for nvidia390

# Increment bigrel when snapshot changes, rel for a new release of the same snapshot
%define date    20210112
%define bigrel  18
%define rel 1

%define real_name bumblebee

Name:           bumblebee-nvidia390
Version:        3.2.1
Release:        %mkrel %{bigrel}.%{date}.%{rel}
Summary:        Daemon managing Nvidia Optimus hybrid graphics cards for GeForce 420 and later
Group:          System/Kernel and hardware
License:        GPLv3+
URL:            https://github.com/Bumblebee-Project/bumblebee
# Taken from tip of https://github.com/Bumblebee-Project/Bumblebee/tree/develop
# git archive --format=tar.xz -o %%{real_name}-%%{version}+%%{date}.tar.xz --prefix=%%{real_name}-%%{version}+%%{date}/ develop
Source0:        %{real_name}-%{version}+%{date}.tar.xz

ExclusiveArch:  %{ix86} x86_64

BuildRequires:  help2man
BuildRequires:  pkgconfig(x11)
BuildRequires:  pkgconfig(glib-2.0)
BuildRequires:  pkgconfig(libbsd)
BuildRequires:  pkgconfig(libkmod)

Requires(pre):  rpm-helper
Requires(pre):  update-alternatives
Requires(post): systemd-units
Requires(preun):systemd-units

Requires:       kmod(bbswitch.ko)

Requires:       x11-driver-video-nvidia390
Requires:       primus-nvidia390

# 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
Recommends:     virtualgl
Recommends:     %mklibname virtualgl

Provides:       bumblebee-bin

Conflicts:      bumblebee
Conflicts:      bumblebee-nvidia

%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.

This package only provides features for using the proprietary nvidia drivers.
Users of the libre nouveau driver should prefer using DRI PRIME over
Bumblebee: https://nouveau.freedesktop.org/wiki/Optimus

This package provides Bumblebee configuration files and binaries built
against the nvidia390 driver for GeForce 420 and later cards.

%files
%doc README.install.urpmi README.markdown doc/RELEASE_NOTES_3_2_1
%{_sysconfdir}/bash_completion.d/optirun
%{_sysconfdir}/modprobe.d/%{real_name}.conf
%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
%{_sbindir}/bumblebeed
%{_bindir}/bumblebee-bugreport
%{_bindir}/optirun
%{_mandir}/man1/optirun.1.*
%{_mandir}/man8/bumblebeed.8.*

%config(noreplace) %{_sysconfdir}/bumblebee/bumblebee.conf
%{_bindir}/nvidia-settings-bumblebee

%pre
%_pre_groupadd %{real_name}
if [ "$1" -eq "1" ]; then
  /usr/sbin/update-alternatives --set gl_conf %{_sysconfdir}/ld.so.conf.d/GL/standard.conf
fi

%post
%_post_service bumblebeed
# simplew: 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

#--------------------------------------------------------------------

%prep
%setup -q -n %{real_name}-%{version}+%{date}

%build
autoreconf -vfi

%configure \
    --with-udev-rules=%{_udevrulesdir} \
    CONF_BRIDGE=primus \
    CONF_DRIVER=nvidia \
    CONF_DRIVER_MODULE_NVIDIA=nvidia390 \
%ifarch x86_64
    CONF_LDPATH_NVIDIA=%{_libdir}:%{_usr}/lib \
    CONF_MODPATH_NVIDIA=%{_libdir}/nvidia390/xorg,%{_usr}/lib/nvidia390/xorg,%{_libdir}/xorg/modules,%{_usr}/lib/xorg/modules \
    CONF_PRIMUS_LD_PATH=%{_libdir}/primus:%{_usr}/lib/primus
%else
    CONF_LDPATH_NVIDIA=%{_libdir} \
    CONF_MODPATH_NVIDIA=%{_libdir}/nvidia390/xorg,%{_libdir}/xorg/modules \
    CONF_PRIMUS_LD_PATH=%{_libdir}/primus
%endif

%make_build

%install
%make_install
install -D -m644 scripts/systemd/bumblebeed.service %{buildroot}%{_unitdir}/bumblebeed.service

install -d %{buildroot}%{_sysconfdir}/modprobe.d
cat << EOF > %{buildroot}%{_sysconfdir}/modprobe.d/%{real_name}.conf
blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist nvidia390
blacklist nouveau

# Map removal of modules to correct command
# This allows modprobe -r nvidia to work
remove nvidia rmmod nvidia

# Needed for bumblebee as it tries to remove nvidia390, which is the module
# load name. The driver is still "nvidia" once loaded, thus the removal fails.
remove nvidia390 rmmod nvidia

# Switch card off when booting, on when unloading bbswitch (shutdown)
options bbswitch load_state=0 unload_state=1
EOF

# Tell users to add themselves to the bumblebee group on new installs
cat << EOF > README.install.urpmi

To be able to use bumblebee via the 'optirun' or 'primusrun' commands,
user accounts must be part of the "bumblebee" group.

You can add yourself (or any user) to the "bumblebee" group with:
  # gpasswd -a <username> bumblebee

For more information, please refer to https://wiki.mageia.org/en/Bumblebee.
EOF

install -D -m644 conf/bumblebee.conf %{buildroot}%{_sysconfdir}/bumblebee/bumblebee.conf

# Create nvidia-settings launcher script
cat << EOF > nvidia-settings-bumblebee
#!/bin/sh
optirun -b none %{_bindir}/nvidia-settings -c :8
EOF
install -D -m755 nvidia-settings-bumblebee %{buildroot}%{_bindir}/nvidia-settings-bumblebee

rm -rf %{buildroot}%{_docdir}/bumblebee


%changelog
* Thu Feb 04 2021 daviddavid <daviddavid> 3.2.1-18.20210112.1.mga8
+ Revision: 1674792
- update to latest git snapshot: 3.2.1+git20210112
- fix nvidia libraries path and nvidia-settings binary path

* Fri Feb 21 2020 umeabot <umeabot> 3.2.1-18.20161107.3.mga8.nonfree
+ Revision: 1548604
- Mageia 8 Mass Rebuild
+ wally <wally>
- replace deprecated %%configure2_5x

* Fri Mar 29 2019 daviddavid <daviddavid> 3.2.1-18.20161107.2.mga7.nonfree
+ Revision: 1380996
- drop aarch64 and arm support, nvidia390 driver is only available on x86 and x86_64 arches

* Thu Mar 28 2019 daviddavid <daviddavid> 3.2.1-18.20161107.1.mga7.nonfree
+ Revision: 1380800
- initial package bumblebee-nvidia390