File xf86-video-amdgpu.spec of Package xf86-video-amdgpu

%define realname xf86-video-amdgpu
%define realver  19.1.0
%define srcext   tar.bz2

%define xorg_module_dir %(pkg-config --variable=moduledir xorg-server)
%define pcsc_module_dir %(pkg-config --variable=usbdropdir libpcsclite)

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       MIT
Group:         System/X11/Servers/XF86_4
URL:           https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu
Summary:       Xorg driver for AMD Radeon GPUs using the amdgpu kernel driver

# Build-time parameters
BuildRequires: pkg-config
BuildRequires: pkgconfig(randrproto) pkgconfig(renderproto)
BuildRequires: pkgconfig(videoproto) pkgconfig(xextproto)
BuildRequires: pkgconfig(libdrm) >= 2.4.89
BuildRequires: pkgconfig(libdrm_amdgpu) >= 2.4.76
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(xorg-server) >= 1.13
BuildRequires: pkgconfig(xproto)
BuildRequires: pkgconfig(fontsproto)
BuildRequires: pkgconfig(xf86driproto)
BuildRequires: pkgconfig(damageproto)
BuildRequires: pkgconfig(libudev)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://www.x.org/releases/individual/driver/%{realname}-%{realver}%{?extraver}.%{srcext}
# Fix link failure with gcc 10
Patch:         https://gitlab.freedesktop.org/xorg/driver/xf86-video-amdgpu/-/commit/edcbe5f52ddfceee3d66d69bbcebbceac06b6d0d.patch

%description
amdgpu is an Xorg driver for AMD RADEON-based video cards with
the following features:

  * Support for 8-, 15-, 16-, 24- and 30-bit pixel depths;
  * RandR support up to version 1.4;
  * 3D acceleration;

The amdgpu driver supports SI and newer families' video cards.

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%patch -p1

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}'
%configure \
 --disable-static \
 --with-xorg-module-dir=%{xorg_module_dir} \
 CFLAGS="$_CFLAGS" \
 LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README.md
%{xorg_module_dir}/drivers/amdgpu_drv.so
%exclude %{xorg_module_dir}/drivers/amdgpu_drv.la
%dir %{_datadir}/X11/xorg.conf.d
%dir %{_datadir}/X11
%config %{_datadir}/X11/xorg.conf.d/10-amdgpu.conf
%doc %{_mandir}/man4/amdgpu.4*

%changelog
openSUSE Build Service is sponsored by