File vrpn.spec of Package vrpn

#
# spec file for package vrpn
#
# Copyright (c) 2022 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/
#


Name:           vrpn
Version:        07.36
Release:        0
Summary:        Virtual Reality Peripheral Network
License:        BSL-1.0
Group:          Development/Libraries/C and C++
URL:            https://github.com/vrpn/vrpn/wiki
Source0:        https://github.com/vrpn/vrpn/archive/v%{version}/%{name}-%{version}.tar.gz
# PATCH-FEATURE-OPENSUSE -- setting the sover allows us to build the libraries as shared ones
Patch5:         set-soversion.patch
# PATCH-FIX-OPENSUSE python-install-path.patch -- Install python modules in site-packages not dist-packages
Patch6:         python-install-path.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  pkgconfig
BuildRequires:  wiiuse-devel
BuildRequires:  pkgconfig(bluez)
BuildRequires:  pkgconfig(hidapi-libusb)
BuildRequires:  pkgconfig(libusb-1.0)
BuildRequires:  pkgconfig(python3)

%description
The Virtual-Reality Peripheral Network (VRPN) is a set of classes
within a library and a set of servers that are designed to implement a
network-transparent interface between application programs and the set
of physical devices (tracker, etc.) used in a virtual-reality (VR)
system. The idea is to have a PC or other host at each VR station that
controls the peripherals (tracker, button device, haptic device,
analog inputs, sound, etc). VRPN provides connections between the
application and all of the devices using the appropriate
class-of-service for each type of device sharing this link. The
application remains unaware of the network topology. Note that it is
possible to use VRPN with devices that are directly connected to the
machine that the application is running on, either using separate
control programs or running all as a single program.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}
Requires:       gpsnmea-devel = %{version}
Requires:       libvrpn_timecode_generator0 = %{version}
Requires:       quat-devel = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%package -n libquat0
Summary:        Library for quaternion, vector and matrix routines
Group:          System/Libraries

%description -n libquat0
quatlib is a library of routines that implements a grab-bag of
useful routines for dealing with quaternions, vectors, and matrices.

%package -n quat-devel
Summary:        C Header for quatlib
Group:          Development/Libraries/C and C++
Requires:       libquat0 = %{version}

%description -n quat-devel
quatlib is a library of routines that implements a grab-bag of
useful routines for dealing with quaternions, vectors, and matrices.

%package -n libgpsnmea0
Summary:        Library for parsing NMEA streams
Group:          System/Libraries

%description -n libgpsnmea0
gpsnmea is a library for parsing NMEA streams.

%package -n gpsnmea-devel
Summary:        C Header for libgpsnmea
Group:          Development/Libraries/C and C++
Requires:       libgpsnmea0 = %{version}

%description -n gpsnmea-devel
gpsnmea is a library for parsing NMEA streams.

%package -n libvrpn0
Summary:        Client library for Virtual Reality Peripheral Network
Group:          System/Libraries

%description -n libvrpn0
The package contains the shared client library for the
Virtual Reality Peripheral Network.

%package -n libvrpnserver0
Summary:        Server library for Virtual Reality Peripheral Network
Group:          System/Libraries

%description -n libvrpnserver0
The package contains the shared server library for the
Virtual Reality Peripheral Network.

%package -n libvrpn_timecode_generator0
Summary:        Timecode generation library for Virtual Reality Peripheral Network
Group:          System/Libraries

%description -n libvrpn_timecode_generator0
The package contains the shared server timecode generation library for the
Virtual Reality Peripheral Network.

%prep
%setup -q
%autopatch -p1
sed -i -e '1 s@.*@set(PYTHONSITEARCHDIR %{python_sitearch})\n\0@' python/CMakeLists.txt

%build
%cmake \
       -DVRPN_BUILD_PYTHON_HANDCODED_3X:BOOL=ON \
       -DVRPN_USE_WIIUSE:BOOL=ON \
       -DVRPN_USE_LOCAL_HIDAPI:BOOL=OFF \
       -DVRPN_USE_HID:BOOL=ON \
       -DVRPN_GPL_SERVER:BOOL=ON \
       -DVRPN_USE_WIIUSE:BOOL=ON \
       -DBUILD_TESTING:BOOL=OFF
%cmake_build

%install
%cmake_install
find %{buildroot} -type f -name "*.la" -delete -print

%post   -n libgpsnmea0    -p /sbin/ldconfig
%post   -n libquat0       -p /sbin/ldconfig
%post   -n libvrpn0       -p /sbin/ldconfig
%post   -n libvrpnserver0 -p /sbin/ldconfig
%post   -n libvrpn_timecode_generator0 -p /sbin/ldconfig
%postun -n libgpsnmea0    -p /sbin/ldconfig
%postun -n libquat0       -p /sbin/ldconfig
%postun -n libvrpn0       -p /sbin/ldconfig
%postun -n libvrpnserver0 -p /sbin/ldconfig
%postun -n libvrpn_timecode_generator0 -p /sbin/ldconfig

%files
%doc README README.Legal ChangeLog
%exclude %{_bindir}/c_interface_example
%{_bindir}/run_auxiliary_logger
%{_bindir}/vrpn_average_analogs
%{_bindir}/vrpn_log_devices
%{_bindir}/vrpn_print_messages
%{_bindir}/vrpn_print_devices
%{_bindir}/vrpn_print_performance
%{_bindir}/vrpn_streamPrint
%{_bindir}/vrpn_server
%{_datadir}/%{name}-%{version}
%config %{_sysconfdir}/vrpn.cfg
%{python_sitearch}/*vrpn*

%files devel
%{_includedir}/vrpn_*.h
%{_libdir}/libvrpn*.so

%files -n gpsnmea-devel
%{_includedir}/latLonCoord.h
%{_includedir}/nmeaParser.h
%{_includedir}/utmCoord.h
%{_libdir}/libgpsnmea.so

%files -n libgpsnmea0
%{_libdir}/libgpsnmea.so.0

%files -n quat-devel
%doc quat/Readme
%{_includedir}/quat.h
%{_libdir}/libquat.so

%files -n libquat0
%{_libdir}/libquat.so.0

%files -n libvrpn0
%{_libdir}/libvrpn.so.0

%files -n libvrpnserver0
%{_libdir}/libvrpnserver.so.0

%files -n libvrpn_timecode_generator0
%{_libdir}/libvrpn_timecode_generator.so.0

%changelog
openSUSE Build Service is sponsored by