dev-libs/collada-dom: fix build with clang & assorted other problems

Fixes from upstream PRs and a fork to fix building with clang,
C++ conformance issues and cmake4.

Closes: https://bugs.gentoo.org/864355
Closes: https://bugs.gentoo.org/958019
Closes: https://bugs.gentoo.org/968501
Signed-off-by: Holger Hoffstätte <holger@applied-asynchrony.com>
Part-of: https://github.com/gentoo/gentoo/pull/45691
Closes: https://github.com/gentoo/gentoo/pull/45691
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Holger Hoffstätte
2026-02-08 17:01:39 +01:00
committed by Sam James
parent 18d0de11ad
commit 56fbf7edb9
5 changed files with 226 additions and 0 deletions

View File

@@ -0,0 +1,43 @@
# Copyright 1999-2026 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake flag-o-matic
if [[ ${PV} == *9999 ]]; then
inherit git-r3
EGIT_REPO_URI="https://github.com/rdiankov/collada-dom"
else
SRC_URI="https://github.com/rdiankov/collada-dom/archive/v${PV}.tar.gz -> ${P}.tar.gz"
KEYWORDS="~amd64 ~arm ~arm64 ~hppa ~ppc ~ppc64 ~x86"
fi
DESCRIPTION="COLLADA Document Object Model (DOM) C++ Library"
HOMEPAGE="https://github.com/rdiankov/collada-dom"
LICENSE="MIT"
SLOT="0/25"
RDEPEND="
dev-libs/boost:=
dev-libs/libxml2:=
dev-libs/libpcre[cxx]
virtual/minizip:="
DEPEND="${RDEPEND}"
BDEPEND="virtual/pkgconfig"
PATCHES=(
"${FILESDIR}"/${P}-boost-1.{85,89}.patch # bugs 932316, 968458
"${FILESDIR}"/${P}-fPIC-for-clang.patch # bug 968501
"${FILESDIR}"/${P}-fix-int-return-type.patch
"${FILESDIR}"/${P}-unique_ptr.patch
"${FILESDIR}"/${P}-cmake4.patch
)
src_configure() {
# bug 618960
append-cxxflags -std=c++14
cmake_src_configure
}

View File

@@ -0,0 +1,20 @@
https://github.com/Gepetto/collada-dom/commit/f6c6a2bea63c637937959e863673a89c91ffb629
From: Guilhem Saurel <guilhem.saurel@laas.fr>
Date: Wed, 8 Oct 2025 09:59:04 +0200
Subject: [PATCH] CMake: bump cmake_minimum_required to 3.10, fix for CMake v4
---
CMakeLists.txt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9764534..43601f6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-cmake_minimum_required (VERSION 2.6.0)
+cmake_minimum_required (VERSION 3.10)
project (collada-dom)
set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS TRUE )

View File

@@ -0,0 +1,28 @@
https://github.com/rdiankov/collada-dom/pull/44
From: lenik terenin <lenik@lazydroid.com>
Date: Thu, 14 Nov 2024 14:59:37 +0900
Subject: [PATCH] enable "-fPIC" for CLANG toolchain
---
CMakeLists.txt | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20635b2..9764534 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -183,7 +183,12 @@ foreach(ldir ${Boost_LIBRARY_DIRS})
set(COLLADA_DOM_BOOST_LIB_DIRS "${COLLADA_DOM_BOOST_LIB_DIRS} -L${ldir}")
endforeach()
-if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)
+set(COMPILER_IS_CLANG FALSE)
+if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
+ set(COMPILER_IS_CLANG TRUE)
+endif()
+
+if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX OR COMPILER_IS_CLANG)
set(EXTRA_COMPILE_FLAGS "${COLLADA_DOM_EXTERNAL_FLAGS} -DCOLLADA_DOM_NAMESPACE -fPIC")
else()
set(EXTRA_COMPILE_FLAGS "${COLLADA_DOM_EXTERNAL_FLAGS} -DCOLLADA_DOM_NAMESPACE")

View File

@@ -0,0 +1,42 @@
https://github.com/rdiankov/collada-dom/pull/40
From: Atsushi Watanabe <atsushi.w@ieee.org>
Date: Fri, 20 Jan 2023 14:59:45 +0900
Subject: [PATCH] Fix int return type
NULL is std::nullptr_t since gcc11 and not implicitly casted.
---
dom/src/dae/daeDom.cpp | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dom/src/dae/daeDom.cpp b/dom/src/dae/daeDom.cpp
index 916116e..c5312af 100644
--- a/dom/src/dae/daeDom.cpp
+++ b/dom/src/dae/daeDom.cpp
@@ -111,7 +111,7 @@ daeInt getDomAnyID(DAE& dae)
return ColladaDOM141::domAny::ID();
}
#endif
- return NULL;
+ return 0;
}
daeInt getDomSourceID(DAE& dae)
@@ -126,7 +126,7 @@ daeInt getDomSourceID(DAE& dae)
return ColladaDOM141::domSource::ID();
}
#endif
- return NULL;
+ return 0;
}
daeInt getDomCOLLADAID(const char* specversion)
@@ -141,7 +141,7 @@ daeInt getDomCOLLADAID(const char* specversion)
return ColladaDOM141::domCOLLADA::ID();
}
#endif
- return NULL;
+ return 0;
}
void copyElementAny(daeElementRef dstAny, daeElement* srcAny)

View File

@@ -0,0 +1,93 @@
https://github.com/Gepetto/collada-dom/commit/5adebc004f9ee7bb0fc1f498205cf5449812ced1
From: Tan Li Boon <undisputed.seraphim@gmail.com>
Date: Sat, 13 Nov 2021 10:06:46 +0900
Subject: [PATCH] collada-dom: Replace deprecated auto_ptr with unique_ptr
---
dom/include/dae.h | 2 +-
dom/include/dae/daeErrorHandler.h | 2 +-
dom/include/dae/daeWin32Platform.h | 2 +-
dom/src/dae/daeErrorHandler.cpp | 2 +-
dom/test/1.4/domTest.cpp | 2 +-
dom/test/1.5/domTest.cpp | 2 +-
6 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dom/include/dae.h b/dom/include/dae.h
index e53388b..b041e55 100644
--- a/dom/include/dae.h
+++ b/dom/include/dae.h
@@ -290,7 +290,7 @@ class DLLSPEC DAE
daeSidRefCache sidRefCache;
daeString COLLADA_VERSION, COLLADA_NAMESPACE; // dynamic
- std::auto_ptr<charEncoding> localCharEncoding;
+ std::unique_ptr<charEncoding> localCharEncoding;
static charEncoding globalCharEncoding;
};
diff --git a/dom/include/dae/daeErrorHandler.h b/dom/include/dae/daeErrorHandler.h
index 6ffab01..8b02c15 100644
--- a/dom/include/dae/daeErrorHandler.h
+++ b/dom/include/dae/daeErrorHandler.h
@@ -55,7 +55,7 @@ class DLLSPEC daeErrorHandler {
private:
static daeErrorHandler *_instance;
- static std::auto_ptr<daeErrorHandler> _defaultInstance;
+ static std::unique_ptr<daeErrorHandler> _defaultInstance;
};
#endif
diff --git a/dom/include/dae/daeWin32Platform.h b/dom/include/dae/daeWin32Platform.h
index e501597..e97822c 100644
--- a/dom/include/dae/daeWin32Platform.h
+++ b/dom/include/dae/daeWin32Platform.h
@@ -38,7 +38,7 @@ typedef int intptr_t;
// GCC doesn't understand "#pragma warning"
#ifdef _MSC_VER
-// class 'std::auto_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'daeErrorHandler'
+// class 'std::unique_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'daeErrorHandler'
#pragma warning(disable: 4251)
// warning C4100: 'profile' : unreferenced formal parameter
#pragma warning(disable: 4100)
diff --git a/dom/src/dae/daeErrorHandler.cpp b/dom/src/dae/daeErrorHandler.cpp
index 264c343..e38c9da 100644
--- a/dom/src/dae/daeErrorHandler.cpp
+++ b/dom/src/dae/daeErrorHandler.cpp
@@ -10,7 +10,7 @@
#include <modules/stdErrPlugin.h>
daeErrorHandler *daeErrorHandler::_instance = NULL;
-std::auto_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
+std::unique_ptr<daeErrorHandler> daeErrorHandler::_defaultInstance(new stdErrPlugin);
daeErrorHandler::daeErrorHandler() {
}
diff --git a/dom/test/1.4/domTest.cpp b/dom/test/1.4/domTest.cpp
index 28aefa5..5e38019 100644
--- a/dom/test/1.4/domTest.cpp
+++ b/dom/test/1.4/domTest.cpp
@@ -368,7 +368,7 @@ DefineTest(tinyXmlLoad) {
// saved document, and make sure the results are the same.
DAE dae;
CheckResult(dae.open(seymourOrig));
- auto_ptr<daeTinyXMLPlugin> tinyXmlPlugin(new daeTinyXMLPlugin);
+ unique_ptr<daeTinyXMLPlugin> tinyXmlPlugin(new daeTinyXMLPlugin);
dae.setIOPlugin(tinyXmlPlugin.get());
CheckResult(dae.writeTo(seymourOrig, seymourTinyXml));
CheckResult(dae.open(seymourTinyXml));
diff --git a/dom/test/1.5/domTest.cpp b/dom/test/1.5/domTest.cpp
index 0ba3449..1d4b7b5 100644
--- a/dom/test/1.5/domTest.cpp
+++ b/dom/test/1.5/domTest.cpp
@@ -371,7 +371,7 @@ DefineTest(tinyXmlLoad) {
// saved document, and make sure the results are the same.
DAE dae;
CheckResult(dae.open(seymourOrig));
- auto_ptr<daeTinyXMLPlugin> tinyXmlPlugin(new daeTinyXMLPlugin);
+ unique_ptr<daeTinyXMLPlugin> tinyXmlPlugin(new daeTinyXMLPlugin);
dae.setIOPlugin(tinyXmlPlugin.get());
CheckResult(dae.writeTo(seymourOrig, seymourTinyXml));
CheckResult(dae.open(seymourTinyXml));