[packages/draco] - build transcoder
qboosh
qboosh at pld-linux.org
Sat Apr 27 20:22:47 CEST 2024
commit b29a6b49a73453fbc8066b13cbffbc6fd6f5df78
Author: Jakub Bogusz <qboosh at pld-linux.org>
Date: Sat Apr 27 20:05:48 2024 +0200
- build transcoder
draco-c++17-filesystem.patch | 32 ++++++++++++++++++++++++++++++++
draco-tinygltf.patch | 10 ++++++++++
draco.spec | 14 +++++++++-----
3 files changed, 51 insertions(+), 5 deletions(-)
---
diff --git a/draco.spec b/draco.spec
index 58d6b73..b41be18 100644
--- a/draco.spec
+++ b/draco.spec
@@ -1,6 +1,3 @@
-# TODO: finish trancoder:
-# - package tinygltf and pass -DDRACO_TINYGLTF_PATH (or use submodule)
-# - patch to use C++ std::filesystem instead of ghc::filesystem (aka gulrak/filesystem / -DDRACO_FILESYSTEM_PATH)
#
# Conditional build:
%bcond_with transcoder # transcoding support
@@ -16,6 +13,8 @@ Group: Libraries
Source0: https://github.com/google/draco/archive/%{version}/%{name}-%{version}.tar.gz
# Source0-md5: b91def257264152be35c62f82f805d25
Patch0: %{name}-system-gtest.patch
+Patch1: %{name}-c++17-filesystem.patch
+Patch2: %{name}-tinygltf.patch
URL: https://github.com/google/draco
BuildRequires: cmake >= 3.12
BuildRequires: gtest-devel
@@ -23,6 +22,8 @@ BuildRequires: libstdc++-devel
%if %{with transcoder}
BuildRequires: eigen3
BuildRequires: libstdc++-devel >= 6:7
+# 2.8.8 added GetFileSizeInBytes in struct FsCallbacks, tinygltf patch adjusts code for it
+BuildRequires: tinygltf-devel >= 2.8.8
%endif
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
@@ -88,6 +89,8 @@ Statyczna biblioteka draco.
%prep
%setup -q
%patch0 -p1
+%patch1 -p1
+%patch2 -p1
%build
install -d build
@@ -95,8 +98,9 @@ cd build
%cmake .. \
%if %{with transcoder}
-DDRACO_EIGEN_PATH=/usr/include/eigen3 \
- -DDRACO_TINYGLTF_PATH=TODO:TinyGLTF:or_use_submodule \
+ -DDRACO_TINYGLTF_PATH=/usr/include \
-DDRACO_TRANSCODER_SUPPORTED=ON
+# -DDRACO_SIMPLIFIER_SUPPORTED=ON? missing sources as of 1.5.7
%endif
%{__make}
@@ -109,6 +113,7 @@ rm -rf $RPM_BUILD_ROOT
%{__mv} $RPM_BUILD_ROOT%{_bindir}/draco_decoder{-%{version},}
%{__mv} $RPM_BUILD_ROOT%{_bindir}/draco_encoder{-%{version},}
+%{__mv} $RPM_BUILD_ROOT%{_bindir}/draco_transcoder{-%{version},}
%clean
rm -rf $RPM_BUILD_ROOT
@@ -122,7 +127,6 @@ rm -rf $RPM_BUILD_ROOT
%attr(755,root,root) %{_bindir}/draco_decoder
%attr(755,root,root) %{_bindir}/draco_encoder
%if %{with transcoder}
-%attr(755,root,root) %{_bindir}/draco_simplifier
%attr(755,root,root) %{_bindir}/draco_transcoder
%endif
%attr(755,root,root) %{_libdir}/libdraco.so.*.*.*
diff --git a/draco-c++17-filesystem.patch b/draco-c++17-filesystem.patch
new file mode 100644
index 0000000..efd8bba
--- /dev/null
+++ b/draco-c++17-filesystem.patch
@@ -0,0 +1,32 @@
+--- draco-1.5.7/src/draco/io/file_writer_utils.cc.orig 2024-01-17 21:42:36.000000000 +0100
++++ draco-1.5.7/src/draco/io/file_writer_utils.cc 2024-04-27 08:48:56.088378500 +0200
+@@ -8,7 +8,7 @@
+ #include "draco/draco_features.h"
+
+ #ifdef DRACO_TRANSCODER_SUPPORTED
+-#include "ghc/filesystem.hpp"
++#include <filesystem>
+ #endif // DRACO_TRANSCODER_SUPPORTED
+
+ namespace draco {
+@@ -64,8 +64,8 @@ bool CheckAndCreatePathForFile(const std
+ SplitPathPrivate(filename, &path, &basename);
+
+ #ifdef DRACO_TRANSCODER_SUPPORTED
+- const ghc::filesystem::path ghc_path(path);
+- ghc::filesystem::create_directories(ghc_path);
++ const std::filesystem::path ghc_path(path);
++ std::filesystem::create_directories(ghc_path);
+ #endif // DRACO_TRANSCODER_SUPPORTED
+ return DirectoryExists(path);
+ }
+--- draco-1.5.7/cmake/draco_build_definitions.cmake.orig 2024-01-17 21:42:36.000000000 +0100
++++ draco-1.5.7/cmake/draco_build_definitions.cmake 2024-04-27 08:49:54.411395871 +0200
+@@ -70,7 +70,6 @@ macro(draco_set_build_definitions)
+
+ if(DRACO_TRANSCODER_SUPPORTED)
+ draco_setup_eigen()
+- draco_setup_filesystem()
+ draco_setup_tinygltf()
+
+
diff --git a/draco-tinygltf.patch b/draco-tinygltf.patch
new file mode 100644
index 0000000..5f26340
--- /dev/null
+++ b/draco-tinygltf.patch
@@ -0,0 +1,10 @@
+--- draco-1.5.7/src/draco/io/gltf_decoder.cc.orig 2024-01-17 21:42:36.000000000 +0100
++++ draco-1.5.7/src/draco/io/gltf_decoder.cc 2024-04-27 18:13:05.638333081 +0200
+@@ -497,6 +497,7 @@ Status GltfDecoder::LoadFile(const std::
+ // TinyGLTF's ExpandFilePath does not do filesystem i/o, so it's safe to
+ // use in all environments.
+ &tinygltf::ExpandFilePath, &ReadWholeFile, &WriteWholeFile,
++ &tinygltf::GetFileSizeInBytes,
+ reinterpret_cast<void *>(input_files)};
+
+ loader.SetFsCallbacks(fs_callbacks);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/draco.git/commitdiff/b29a6b49a73453fbc8066b13cbffbc6fd6f5df78
More information about the pld-cvs-commit
mailing list