package created using the webbuild interface [release 2.5.1-1mamba;Mon May 06 2024]

This commit is contained in:
Silvan Calarco 2024-05-06 10:27:45 +02:00
parent 2345e0ffbd
commit 30f4a11cf7
4 changed files with 219 additions and 0 deletions

View File

@ -1,2 +1,4 @@
# openvr
Open VR hardware access library.

View File

@ -0,0 +1,110 @@
From 54a58e479f4d63e62e9118637cd92a2013a4fb95 Mon Sep 17 00:00:00 2001
From: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
Date: Thu, 15 Aug 2019 16:07:01 +0200
Subject: [PATCH 1/2] cmake: Add option to build with system jsoncpp.
This patch adds the CMake build option `USE_SYSTEM_JSONCPP`,
which instead of using the internal `jsoncpp.cpp` links against
the system installed jsoncpp library.
This results in a `libopenvr_api.so` that is only 115K instead of 301K
on my system.
Distributions like Debian will prefer this behaviour, since it will give
them the possibility to maintain version and security issues for jsoncpp
in one place.
This behaviour can be enabled by
```
cmake -DUSE_SYSTEM_JSONCPP=True .
```
When the flag is not set, the build will behave like it did before.
I tested this patch using the system wide jsoncpp successfully
with xrdesktop.
---
CMakeLists.txt | 1 +
src/CMakeLists.txt | 12 +++++++++++-
2 files changed, 12 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8956cdad..1150c53d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -28,6 +28,7 @@ option(BUILD_UNIVERSAL "Builds the shared or framework as a universal (fat, 32-
option(BUILD_OSX_I386 "Builds the shared or framework as a 32-bit binary, even on a 64-bit platform" OFF)
option(USE_LIBCXX "Uses libc++ instead of libstdc++" ON)
option(USE_CUSTOM_LIBCXX "Uses a custom libc++" OFF)
+option(USE_SYSTEM_JSONCPP "Uses the system installed jsoncpp." OFF)
add_definitions( -DVR_API_PUBLIC )
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index b83710af..a7b64db9 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -34,8 +34,14 @@ endif()
# Set the source group and files.
set(CORE_FILES
openvr_api_public.cpp
- jsoncpp.cpp
)
+
+if(NOT USE_SYSTEM_JSONCPP)
+ set(JSON_CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../thirdparty/jsoncpp)
+ include_directories(${JSON_CPP_DIR})
+ list(APPEND CORE_FILES ${JSON_CPP_DIR}/jsoncpp.cpp)
+endif()
+
set(VRCORE_FILES
vrcore/dirtools_public.cpp
vrcore/envvartools_public.cpp
@@ -100,6 +106,10 @@ if(USE_CUSTOM_LIBCXX)
set(EXTRA_LIBS ${EXTRA_LIBS} c++ c++abi)
endif()
+if(USE_SYSTEM_JSONCPP)
+ list(APPEND EXTRA_LIBS jsoncpp)
+endif()
+
target_link_libraries(${LIBNAME} ${EXTRA_LIBS} ${CMAKE_DL_LIBS})
target_include_directories(${LIBNAME} PUBLIC ${OPENVR_HEADER_DIR})
From a7a6995d1d6f9ee1a17a3741661156f9706c40ce Mon Sep 17 00:00:00 2001
From: Lubosz Sarnecki <lubosz.sarnecki@collabora.com>
Date: Thu, 15 Aug 2019 15:05:34 +0200
Subject: [PATCH 2/2] thirdparty: Move jsoncpp to thridparty directory.
Even though the previous patch in this patch set enabled the build with
a system wide jsoncpp and worked for me, it still left the internal
jsoncpp includes in the include path, since the includes were placed
in `CMAKE_CURRENT_SOURCE_DIR`. This could cause problems on other systems
when trying to build with a system wide jsoncpp.
In order to remove the internal json.h from the include path,
I moved all jsoncpp files into a thridparty directory amd include
it in the case of `USE_SYSTEM_JSONCPP` not being set.
---
{src => thirdparty/jsoncpp}/json/json-forwards.h | 0
{src => thirdparty/jsoncpp}/json/json.h | 0
{src => thirdparty/jsoncpp}/jsoncpp.cpp | 0
3 files changed, 0 insertions(+), 0 deletions(-)
rename {src => thirdparty/jsoncpp}/json/json-forwards.h (100%)
rename {src => thirdparty/jsoncpp}/json/json.h (100%)
rename {src => thirdparty/jsoncpp}/jsoncpp.cpp (100%)
diff --git a/src/json/json-forwards.h b/thirdparty/jsoncpp/json/json-forwards.h
similarity index 100%
rename from src/json/json-forwards.h
rename to thirdparty/jsoncpp/json/json-forwards.h
diff --git a/src/json/json.h b/thirdparty/jsoncpp/json/json.h
similarity index 100%
rename from src/json/json.h
rename to thirdparty/jsoncpp/json/json.h
diff --git a/src/jsoncpp.cpp b/thirdparty/jsoncpp/jsoncpp.cpp
similarity index 100%
rename from src/jsoncpp.cpp
rename to thirdparty/jsoncpp/jsoncpp.cpp

View File

@ -0,0 +1,23 @@
From 0fa21ba17748efcca1816536e27bdca70141b074 Mon Sep 17 00:00:00 2001
From: Christoph Haag <haagch@frickel.club>
Date: Tue, 25 Jul 2017 02:07:09 +0200
Subject: [PATCH] Use correct definition for vsprintf_s
defining it to sprintf actually segfaults in a release build.
---
samples/shared/compat.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/samples/shared/compat.h b/samples/shared/compat.h
index 154f8b07..28002d99 100644
--- a/samples/shared/compat.h
+++ b/samples/shared/compat.h
@@ -12,7 +12,7 @@
#include <unistd.h>
#define sprintf_s snprintf
-#define vsprintf_s sprintf
+#define vsprintf_s vsprintf
#define _stricmp strcmp
#define stricmp strcmp
#define strnicmp strncasecmp

84
openvr.spec Normal file
View File

@ -0,0 +1,84 @@
Name: openvr
Version: 2.5.1
Release: 1mamba
Summary: Open VR hardware access library
Group: System/Libraries
Vendor: openmamba
Distribution: openmamba
Packager: Silvan Calarco <silvan.calarco@mambasoft.it>
URL: https://www.steamvr.com/en/
Source: https://github.com/ValveSoftware/openvr.git/v%{version}/openvr-%{version}.tar.bz2
Patch0: openvr-2.5.1-pr-use-system-jsoncpp.patch
Patch1: openvr-2.5.1-pr-use_correct_definition_of_vsprintf_s.patch
License: BSD
## AUTOBUILDREQ-BEGIN
BuildRequires: glibc-devel
BuildRequires: libgcc
BuildRequires: libstdc++6-devel
## AUTOBUILDREQ-END
BuildRequires: cmake
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
%description
Open VR hardware access library.
%package -n lib%{name}
Group: System/Libraries
Summary: Open VR hardware access library
%description -n lib%{name}
Open Virtual Reality library.
This package contains shared libraries for %{name}.
%package -n lib%{name}-devel
Group: Development/Libraries
Summary: Development files for %{name}
Requires: lib%{name} = %{?epoch:%epoch:}%{version}-%{release}
%description -n lib%{name}-devel
This package contains libraries and header files for developing applications that use %{name}.
%debug_package
%prep
%setup -q
%patch 0 -p1 -b .pr-use-system-jsoncpp
%patch 1 -p1 -b .pr-use_correct_definition_of_vsprintf_s
sed -i "s|DESTINATION lib)|DESTINATION %{_lib})|" src/CMakeLists.txt
%build
%cmake \
-DBUILD_SHARED=1
# FIXME:
# -DUSE_SYSTEM_JSONCPP=True
%cmake_build
%install
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%cmake_install
%clean
[ "%{buildroot}" != / ] && rm -rf "%{buildroot}"
%post -n lib%{name} -p /sbin/ldconfig
%postun -n lib%{name} -p /sbin/ldconfig
%files -n lib%{name}
%defattr(-,root,root)
%{_libdir}/libopenvr_api.so
%doc LICENSE
%files -n lib%{name}-devel
%defattr(-,root,root)
%dir %{_includedir}/openvr
%{_includedir}/openvr/*
%{_datadir}/pkgconfig/openvr.pc
%doc README.md
%changelog
* Mon May 06 2024 Silvan Calarco <silvan.calarco@mambasoft.it> 2.5.1-1mamba
- package created using the webbuild interface