File draco.spec of Package draco

#
# spec file for package draco
#
# Copyright (c) 2023 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   ver   %(printf '%{version}' | awk -F\+ '{print $1}')
%define build_gtest 1
Name:           draco
Version:        @SERVICE@
Release:        0
Summary:        Library for compressing and decompressing 3D geometric meshes and point clouds
License:        Apache-2.0
Group:          Productivity/Archiving/Compression
URL:            https://google.github.io/draco
Source0:        %{name}-%{version}.tar.xz
Source1:        %{name}.rpmlintrc
Patch1:         0001-%{name}-install-cmake.patch
BuildRequires:  cmake
BuildRequires:  gcc-c++
BuildRequires:  help2man
BuildRequires:  pkgconfig
%if %{build_gtest}
BuildRequires:  pkgconfig(gtest)
%endif

%description
Draco is a library for compressing and decompressing 3D geometric meshes
and point clouds. It is intended to improve the storage and transmission of
3D graphics.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{name} = %{version}-%{release}
Requires:       %{name}-devel-static = %{version}-%{release}
 
%description    devel
%{summary}.
 
%package        devel-static
Summary:        Static Draco libraries
Group:          Development/Libraries/C and C++

%description    devel-static
This package includes the static Draco libraries.

%prep
%autosetup -p1

%build
%cmake \
%if %{build_gtest}
    -DDRACO_TESTS=ON
%endif

%cmake_build

%install
sed -i "s|/home/abuild/rpmbuild/BUILD/%{name}-%{version}/src/draco||" *build/cmake_install.cmake
%cmake_install

# Create missing man files downstream
install -dm 0755 %{buildroot}%{_mandir}/man1
LD_LIBRARY_PATH=%{buildroot}%{_libdir} help2man -N --version-string=%{ver} \
    -o %{buildroot}%{_mandir}/man1/%{name}_decoder-%{ver}.1 \
    %{buildroot}%{_bindir}/%{name}_decoder
LD_LIBRARY_PATH=%{buildroot}%{_libdir} help2man -N --version-string=%{ver} \
    -o %{buildroot}%{_mandir}/man1/%{name}_encoder-%{ver}.1 \
    %{buildroot}%{_bindir}/%{name}_encoder

%if %{build_gtest}
%check
%if 0%{?sle_version} || 0%{?suse_version} || 0%{?mageia}
build/draco_tests
%endif
%if 0%{?fedora}
redhat-linux-build/draco_tests
%endif
%endif

%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%files
%doc AUTHORS README.md
%{_bindir}/%{name}_decoder
%{_bindir}/%{name}_decoder-*
%{_bindir}/%{name}_encoder
%{_bindir}/%{name}_encoder-*
%{_libdir}/lib%{name}.so.*
%{_mandir}/man?/%{name}_decoder-*.?%{?ext_man}
%{_mandir}/man?/%{name}_encoder-*.?%{?ext_man}
%license LICENSE

%files devel
%{_includedir}/%{name}/
%{_datadir}/cmake/%{name}/
%{_libdir}/lib%{name}.so
%{_libdir}/pkgconfig/%{name}.pc

%files devel-static
%{_libdir}/lib%{name}.a

%changelog
openSUSE Build Service is sponsored by