dev-cpp/tinygltf: new package, add 2.9.6

Signed-off-by: Nguyen Dinh Dang Duong <dangduong31205@gmail.com>
This commit is contained in:
Nguyen Dinh Dang Duong
2025-07-11 01:35:58 +07:00
parent e7525dbf87
commit bc808a3f3f
4 changed files with 153 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
DIST glTF-Sample-Models-d7a3cc8e51d7c573771ae77a57f16b0662a905c6.tar.gz 1181935486 BLAKE2B 4282f5b5e2d56677a907b91b73791bc34dfcdbf931088f315adb938f4c74ffaaa7c9ef9c9018c7e39fbe617b336cc0b09ded87f9f9a567affc1bf25da5929713 SHA512 38e1af72f5748356098d2b948fe19442c200c1b824276bad0f1406f0ee4eb62126891049c0ae795127a92d364a47fd8ec8d29f211a5b19d263a78124aff3c11d
DIST tinygltf-2.9.6.tar.gz 5904733 BLAKE2B 52012d3ca8cc6661e470c544ad64c6e2761ea39b712da15ca53b19131795220d4be5375697eb935e8b38c025f03e5243e8e1c99c04a5464e130589ee946afb22 SHA512 89397dc2c8884a54ea0c370251449459a200057b5e470210c4468f43c4623947500630b1a67ff6319e0998e648487367398f134711bc7d2c42ebdbd7097770b3

View File

@@ -0,0 +1,41 @@
From ea07b73401b604adefa99b5d11c391d10cbb29c4 Mon Sep 17 00:00:00 2001
From: Nguyen Dinh Dang Duong <dangduong31205@gmail.com>
Date: Wed, 9 Jul 2025 16:56:20 +0700
Subject: [PATCH] Use nlohmann and stb packages instead of bundled ones
---
tiny_gltf.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/tiny_gltf.h b/tiny_gltf.h
index 7612804..b536faa 100644
--- a/tiny_gltf.h
+++ b/tiny_gltf.h
@@ -1712,7 +1712,7 @@ class TinyGLTF {
#ifndef TINYGLTF_NO_INCLUDE_JSON
#ifndef TINYGLTF_USE_RAPIDJSON
-#include "json.hpp"
+#include <nlohmann/json.hpp>
#else
#ifndef TINYGLTF_NO_INCLUDE_RAPIDJSON
#include "document.h"
@@ -1731,13 +1731,13 @@ class TinyGLTF {
#ifndef TINYGLTF_NO_STB_IMAGE
#ifndef TINYGLTF_NO_INCLUDE_STB_IMAGE
-#include "stb_image.h"
+#include <stb/stb_image.h>
#endif
#endif
#ifndef TINYGLTF_NO_STB_IMAGE_WRITE
#ifndef TINYGLTF_NO_INCLUDE_STB_IMAGE_WRITE
-#include "stb_image_write.h"
+#include <stb/stb_image_write.h>
#endif
#endif
--
2.50.0

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="person">
<email>parona@protonmail.com</email>
<name>Alfred Wingate</name>
</maintainer>
<maintainer type="person">
<email>dangduong31205@gmail.com</email>
<name>Nguyen Dinh Dang Duong</name>
</maintainer>
<upstream>
<remote-id type="github">syoyo/tinygltf</remote-id>
</upstream>
</pkgmetadata>

View File

@@ -0,0 +1,95 @@
# Copyright 2024-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
PYTHON_COMPAT=( python3_{11..14} )
inherit cmake edo python-any-r1
DESCRIPTION="Header only C++11 tiny glTF 2.0 library"
HOMEPAGE="https://github.com/syoyo/tinygltf"
SAMPLE_MODELS="d7a3cc8e51d7c573771ae77a57f16b0662a905c6"
SRC_URI="
https://github.com/syoyo/tinygltf/archive/refs/tags/v${PV}.tar.gz
-> ${P}.tar.gz
test? (
https://github.com/KhronosGroup/glTF-Sample-Models/archive/${SAMPLE_MODELS}.tar.gz
-> glTF-Sample-Models-${SAMPLE_MODELS}.tar.gz
)
"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64"
IUSE="examples test"
RESTRICT="!test? ( test )"
PATCHES=(
"${FILESDIR}/0001-Use-nlohmann-and-stb-packages-instead-of-bundled-one.patch"
)
RDEPEND="
dev-libs/stb
dev-cpp/nlohmann_json
examples? (
media-libs/glew:=
media-libs/glfw
media-libs/glu
virtual/opengl
)
"
DEPEND="
${RDEPEND}
"
BDEPEND="
test? (
${PYTHON_DEPS}
)
"
pkg_setup() {
use test && python-any-r1_pkg_setup
}
src_prepare() {
cmake_src_prepare
if use test; then
mv -T "${WORKDIR}/glTF-Sample-Models-${SAMPLE_MODELS}" "${WORKDIR}/glTF-Sample-Models" || die
fi
sed -i -e 's/clang++/$(CXX)/' tests/Makefile || die
sed -i \
-e "s|^sample_model_dir = \".*\"|sample_model_dir = \"${WORKDIR}/glTF-Sample-Models\"|" \
-e "s|\"./loader_example\"|\"${BUILD_DIR}/loader_example\"|" \
test_runner.py || die
}
src_configure() {
local mycmakeargs=(
-DTINYGLTF_BUILD_LOADER_EXAMPLE=$(usex test)
-DTINYGLTF_BUILD_GL_EXAMPLES=$(usex examples)
-DTINYGLTF_BUILD_VALIDATOR_EXAMPLE=$(usex examples)
-DTINYGLTF_BUILD_BUILDER_EXAMPLE=$(usex examples)
-DTINYGLTF_HEADER_ONLY=OFF
-DTINYGLTF_INSTALL=ON
-DTINYGLTF_INSTALL_VENDOR=OFF
)
#use examples && mycmakeargs+=( -DOpenGL_GL_PREFERENCE=GLVND )
cmake_src_configure
}
src_test() {
# unit tests
pushd tests >/dev/null || die
emake
edo ./tester
edo ./tester_noexcept
popd >/dev/null || die
# glTF parsing tests
edo "${EPYTHON}" test_runner.py
}