File ptex.spec of Package ptex

#
# spec file for package ptex
#
# 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/
#


%define libver 2.4
%define libname libPtex2_4

Name:           ptex
Version:        2.4.1
Release:        0
Summary:        Per-Face Texture Mapping for Production Rendering
License:        BSD-3-Clause
Group:          Productivity/Graphics/Other
URL:            https://github.com/wdas/ptex
Source:         %{name}-v%{version}.tar.xz
BuildRequires:  cmake
BuildRequires:  doxygen
BuildRequires:  gcc-c++
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(zlib)

%description
Ptex is a texture mapping system developed by Walt Disney Animation Studios for production-quality rendering:
No UV assignment is required! Ptex applies a separate texture to each face of a subdivision or polygon mesh.
The Ptex file format can efficiently store hundreds of thousands of texture images in a single file.
The Ptex API provides cached file I/O and high-quality filtering - everything that is needed to easily add
Ptex support to a production-quality renderer or texture authoring application.

%package devel
Summary:        Development files for the Ptex library
Group:          Development/Libraries/Other
Requires:       %{libname} = %{version}

%description devel
Development files for Walt Disney Animation Studios Ptex library.

%package devel-static
Summary:        Static Ptex library
Group:          Development/Libraries/Other
Requires:       %{name}-devel = %{version}

%description devel-static
Walt Disney Animation Studios Ptex static library.

%package -n %{libname}
Summary:        Shared library providing Ptex texture mapping system
Group:          System/Libraries

%description -n %{libname}
Ptex is a texture mapping system.

This package contains the shared library.

%package doc
Summary:        Documentation files for the Ptex library
Group:          Development/Libraries/Other

%description doc
Documentation files for Walt Disney Animation Studios Ptex library.

%prep
%setup -q -n %{name}-v%{version}

%build
%global _lto_cflags %{_lto_cflags} -ffat-lto-objects
export CXXFLAGS="${optflags}"
echo %{version} > version
%cmake -DCMAKE_VERBOSE_MAKEFILE=ON
%make_build

%install
%cmake
%make_install

# Create a pkgconfig file
mkdir -p %{buildroot}%{_libdir}/pkgconfig
cat > %{buildroot}%{_libdir}/pkgconfig/Ptex.pc << EOF
# pkg-config configuration for Ptex
prefix=%{_prefix}
libdir=%{_libdir}
includedir=\${prefix}/include

Name: Ptex
Description: Per-Face Texture Mapping for Production Rendering
Version: %{version}
Libs: -L\${libdir} -llibPtex -pthread -lpthread
Libs.private: -lz
Cflags: -I\${includedir} -pthread
EOF

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files
#%doc src/doc/README
%license LICENSE
%{_bindir}/ptxinfo

%files -n %{libname}
%{_libdir}/*.so.*

%files doc
%dir %{_datadir}/doc/packages/ptex
%doc %{_datadir}/doc/packages/ptex/*

%files devel
%{_includedir}/*
%{_libdir}/pkgconfig/Ptex.pc
%{_libdir}/*.so
%dir %{_datadir}/cmake/Ptex
%{_datadir}/cmake/Ptex/*

%files devel-static
%{_libdir}/libPtex.a

%changelog
openSUSE Build Service is sponsored by