File adriconf.spec of Package adriconf

%define realname adriconf
%define realver  2.7.0
%define srcext   tar.bz2

%bcond_without ninja

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

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?dist}
License:       GPL-3.0
Group:         Hardware/Other
URL:           https://gitlab.freedesktop.org/mesa/adriconf
Summary:       Advanced DRI Configurator

# Build-time parameters
BuildRequires: cmake >= 3.8
BuildRequires: pkg-config
BuildRequires: gcc-c++
%if %{with ninja}
BuildRequires: ninja
%endif
BuildRequires: pkgconfig(opengl)
BuildRequires: pkgconfig(atkmm-2.36)
BuildRequires: pkgconfig(gtkmm-4.0)
BuildRequires: pkgconfig(pugixml)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(gbm)
BuildRequires: pkgconfig(libpci)
BuildRequires: pkgconfig(egl)
BuildRequires: gettext%{?suse_version:-runtime}
BuildRoot:     %{_tmppath}/%{name}-root
Source0:       https://gitlab.freedesktop.org/mesa/adriconf/-/archive/v%{version}/%{realname}-v%{version}%{?extraver}.%{srcext}

%description
adriconf (Advanced DRI CONFigurator) is a GUI tool used to configure open source
graphics drivers. It works by setting options and writing them to the standard
drirc file used by the Mesa drivers.

The main features of the tool are:

  * Automatic removal of invalid and unsupported options.
  * Options whose value is identical to the system-wide value or the driver's
    default value will be ignored.
  * System-wide application options with redundant options will be removed
    automatically.

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

%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
_CMAKE_ARGS=(
 -DCMAKE_INSTALL_PREFIX=%{_prefix}
 -DCMAKE_INSTALL_SYSCONFDIR=%{_sysconfdir}
 -DCMAKE_BUILD_TYPE=Release
 -DCMAKE_CXX_FLAGS_RELEASE="$_CFLAGS"
 -DCMAKE_C_FLAGS_RELEASE="$_CFLAGS"
 -DCMAKE_EXE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_MODULE_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_SHARED_LINKER_FLAGS_RELEASE="$_LDFLAGS"
 -DCMAKE_VERBOSE_MAKEFILE=YES
)
# XGL
%{__mkdir} build
cd build
cmake .. \
 "${_CMAKE_ARGS[@]}" \
 \
%if %{with ninja}
 -G Ninja \
%endif
 -DENABLE_UNIT_TESTS=NO
%if %{with ninja}
ninja -v %{?_smp_mflags}
%else
%{__make} %{?_smp_mflags}
%endif

%install
%if %{with ninja}
DESTDIR=%{buildroot} ninja -v -C build install
%else
%{__make} -C build install DESTDIR=%{buildroot}
%endif
%find_lang %{name}

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

%files -f %{name}.lang
%defattr(-,root,root)
%license LICENSE
%doc AUTHORS README.md
%{_bindir}/adriconf

%changelog
openSUSE Build Service is sponsored by