%global date 20240123 %global commit 037189ebbcdb2a0bedd6fe6a8d1ad3910ac6caad %global shortcommit %(c=%{commit}; echo ${c:0:7}) # These libraries are statically linked into libsurvive, are only used by this # project and come from the same upstream %global cnkalman_commit 6b350314225e28d2e4e8daad7d2971d22386f76f %global cnkalman_url https://github.com/cntools/cnkalman %global cnmatrix_commit 5936c62511305227fbd59b2d5a43aaf89ec3a0b6 %global cnmatrix_url https://github.com/cntools/cnmatrix # These are artifacts used by the unit tests %global extras_data_commit 3476af66c488b029e04c74fbb1b57f3b7acb9eb7 %global extras_data_url https://github.com/jdavidberger/libsurvive-extras-data # Tests don't work reliably on i686 %ifarch i686 %bcond tests 0 %else %bcond tests 1 %endif Name: libsurvive Version: 1.01^%{date}git%{shortcommit} Release: %autorelease Summary: Open Source Lighthouse Tracking System License: MIT URL: https://github.com/cntools/libsurvive Source0: %{url}/archive/%{commit}/%{name}-%{commit}.tar.gz Source1: %{cnkalman_url}/archive/%{cnkalman_commit}/cnkalman-%{cnkalman_commit}.tar.gz Source2: %{cnmatrix_url}/archive/%{cnmatrix_commit}/cnmatrix-%{cnmatrix_commit}.tar.gz Source3: %{extras_data_url}/archive/%{extras_data_commit}/libsurvive-extras-data-%{extras_data_commit}.tar.gz # Do not attempt to get the test artifacts from the Internet Patch: libsurvive-no-external-project.patch BuildRequires: cmake BuildRequires: gcc-c++ BuildRequires: systemd-rpm-macros BuildRequires: blas-devel BuildRequires: eigen3-devel # Excluded as it currently breaks the build # BuildRequires: gattlib-devel BuildRequires: lapack-devel BuildRequires: libpcap-devel BuildRequires: libusb1-devel BuildRequires: libX11-devel BuildRequires: openblas-devel BuildRequires: opencv-devel # Excluded as it currently breaks the build # BuildRequires: sciplot-devel BuildRequires: zlib-devel Provides: bundled(cnkalman) = 0.1 Provides: bundled(cnmatrix) = 0.0 Requires: systemd-udev %description Libsurvive is a set of tools and libraries that enable 6 dof tracking on Lighthouse and Vive based systems that is completely Open Source and can run on any device. It currently supports both SteamVR 1.0 and SteamVR 2.0 generation of devices and should support any tracked object commercially available. %package devel Summary: Development files for %{name} Requires: %{name}%{?_isa} = %{version}-%{release} %description devel The %{name}-devel package contains libraries and header files for developing applications that use %{name}. %prep %autosetup -n %{name}-%{commit} -p1 # Extract libraries and test artifacts in the right places tar -xf %SOURCE1 --strip-components 1 -C libs/cnkalman/ tar -xf %SOURCE2 --strip-components 1 -C libs/cnkalman/libs/cnmatrix/ mkdir -p %{_vpath_builddir}/src/test_cases/libsurvive-extras-data/ tar -xf %SOURCE3 --strip-components 1 -C %{_vpath_builddir}/src/test_cases/libsurvive-extras-data/ %build %cmake \ -DLIB_INSTALL_DIR="%{_lib}/" \ -DENABLE_TESTS=ON \ -DUSE_OPENBLAS=ON \ -DUSE_OPENCV=ON %cmake_build %install %cmake_install # The bundled libraries are statically linked and only used within this # project, they don't need to be distributed rm -r %{buildroot}%{_includedir}/{cnkalman,cnmatrix}/ rm %{buildroot}%{_libdir}/pkgconfig/{cnkalman,cnmatrix}.pc rm %{buildroot}%{_prefix}/lib/*.a # Install udev rules install -Dpm0644 -t %{buildroot}%{_udevrulesdir} useful_files/81-vive.rules %if %{with tests} %check %ctest %endif %files %license LICENSE %doc README.md %{_bindir}/sensors-readout %{_bindir}/survive-buttons %{_bindir}/survive-cli %{_bindir}/survive-solver %{_bindir}/survive-websocketd %{_libdir}/%{name}.so.0* %{_libdir}/%{name}/ %{_udevrulesdir}/81-vive.rules %files devel %doc docs/*.md %{_bindir}/api_example %{_includedir}/%{name}/ %{_libdir}/%{name}.so %{_libdir}/pkgconfig/survive.pc %changelog %autochangelog