File openvr.spec of Package openvr

#
# spec file for package openvr
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define so_ver 2_5_1
Name:           openvr
Version:        2.5.1
Release:        0
Summary:        Virtual reality SDK
License:        BSD-3-Clause
Group:          Development/Libraries/C and C++
URL:            https://github.com/ValveSoftware/openvr
Source:         https://github.com/ValveSoftware/openvr/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz
# PATCH-FIX-OPENSUSE install-library.patch -- Install library in suffixed directory
Patch0:         install-library.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkg-config

%package devel
Summary:        Development files for VR API
Group:          Development/Libraries/C and C++
Requires:       libopenvr_api%{so_ver}

%package -n libopenvr_api%{so_ver}
Summary:        SDK API library
Group:          System/Libraries

%description
OpenVR is an API and runtime that allows access to VR hardware from multiple vendors
without requiring that applications have specific knowledge of the hardware they are
targeting.

%description devel
OpenVR is an API and runtime that allows access to VR hardware from multiple vendors
without requiring that applications have specific knowledge of the hardware they are
targeting.

%description -n libopenvr_api%{so_ver}
OpenVR is an API and runtime that allows access to VR hardware from multiple vendors
without requiring that applications have specific knowledge of the hardware they are
targeting.

%prep
%autosetup -p1

rm -rfv ./lib ./bin

%build
export CFLAGS="-flto -Wl,-flto"
%cmake -DBUILD_SHARED=ON -DBUILD_UNIVERSAL=OFF -DUSE_LIBCXX=OFF
%cmake_build

%install
%cmake_install

%post -n libopenvr_api%{so_ver} -p /sbin/ldconfig
%postun -n libopenvr_api%{so_ver} -p /sbin/ldconfig

%files devel
%license LICENSE
%{_includedir}/openvr
%{_libdir}/libopenvr_api.so
%{_datadir}/pkgconfig/openvr.pc

%files -n libopenvr_api%{so_ver}
%{_libdir}/libopenvr_api.so.*

%changelog
openSUSE Build Service is sponsored by