media-libs/opencollada: fix build with gcc15/cmake4

Closes: https://bugs.gentoo.org/880407
Signed-off-by: Alexey Sokolov <alexey+gentoo@asokolov.org>
Part-of: https://github.com/gentoo/gentoo/pull/42034
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Alexey Sokolov
2025-05-11 19:32:57 +01:00
committed by Sam James
parent cee0924dd2
commit 772cd4c633
3 changed files with 135 additions and 0 deletions

View File

@@ -0,0 +1,11 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,7 +18,7 @@ if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
endif()
endif()
-cmake_minimum_required(VERSION 2.6)
+cmake_minimum_required(VERSION 2.6...4.0)
#-----------------------------------------------------------------------------

View File

@@ -0,0 +1,39 @@
https://bugs.gentoo.org/880407
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -288,7 +288,6 @@ add_subdirectory(common/libftoa)
add_subdirectory(${EXTERNAL_LIBRARIES}/UTF)
add_subdirectory(common/libBuffer)
add_subdirectory(${EXTERNAL_LIBRARIES}/MathMLSolver)
-add_subdirectory(${EXTERNAL_LIBRARIES}/zlib)
# building OpenCOLLADA libs
add_subdirectory(COLLADABaseUtils)
--- a/DAEValidator/CMakeLists.txt
+++ b/DAEValidator/CMakeLists.txt
@@ -80,11 +80,8 @@ if (NOT LIBXML2_FOUND)
else ()
list(APPEND Libraries ${LIBXML2_LIBRARIES})
endif ()
-if (USE_STATIC)
- list(APPEND Libraries zlib_static)
- else ()
- list(APPEND Libraries zlib_shared)
- endif ()
+find_package(ZLIB REQUIRED)
+list(APPEND Libraries ZLIB::ZLIB)
if (WIN32)
list(APPEND Libraries ws2_32.lib)
endif ()
@@ -208,10 +205,3 @@ else ()
include_directories(${LIBXML2_INCLUDE_DIR})
endif ()
-# zlib
-if (USE_STATIC)
- add_dependencies(DAEValidatorExecutable zlib_static)
-else ()
- add_dependencies(DAEValidatorExecutable zlib_shared)
-endif ()
-include_directories("../Externals/zlib/include")

View File

@@ -0,0 +1,85 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake edos2unix flag-o-matic
DESCRIPTION="Stream based read/write library for COLLADA files"
HOMEPAGE="http://www.opencollada.org/"
SRC_URI="https://github.com/KhronosGroup/OpenCOLLADA/archive/v${PV}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/OpenCOLLADA-${PV}"
LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~x86"
IUSE="static-libs"
RDEPEND="
dev-libs/libpcre:=
dev-libs/libxml2:=
dev-libs/zziplib
media-libs/lib3ds
sys-libs/zlib
"
DEPEND="${RDEPEND}"
BDEPEND="
app-admin/chrpath
virtual/pkgconfig
"
PATCHES=(
"${FILESDIR}/${P}-fix-null-conversion.patch"
"${FILESDIR}/${P}-cmake-fixes.patch"
"${FILESDIR}/${PN}-1.6.63-pcre-fix.patch"
"${FILESDIR}/${PN}-1.6.68-gcc13.patch"
"${FILESDIR}/${PN}-1.6.68-werror.patch"
"${FILESDIR}/${PN}-1.6.68-cmake4.patch"
"${FILESDIR}/${PN}-1.6.68-unbundle-zlib.patch"
)
src_prepare() {
edos2unix CMakeLists.txt
cmake_src_prepare
# Remove bundled depends that have portage equivalents
rm -rv Externals/{expat,lib3ds,LibXML,pcre,zlib,zziplib} || die
# Remove unused build systems
rm -v Makefile scripts/{unixbuild.sh,vcproj2cmake.rb} || die
find "${S}" -name SConscript -delete || die
}
src_configure() {
# bug 619670
append-cxxflags -std=c++14
local mycmakeargs=(
-DUSE_SHARED=ON
-DUSE_STATIC=$(usex static-libs)
-DUSE_LIBXML=ON
)
cmake_src_configure
}
src_install() {
cmake_src_install
newenvd - 99opencollada <<- _EOF_
LDPATH=/usr/$(get_libdir)/opencollada
_EOF_
# Remove insecure DAEValidator RUNPATH and install DAEValidator library
dolib.so "${BUILD_DIR}/lib/libDAEValidatorLibrary.so"
chrpath -d "${BUILD_DIR}/bin/DAEValidator" || die
dobin "${BUILD_DIR}/bin/DAEValidator"
dobin "${BUILD_DIR}/bin/OpenCOLLADAValidator"
# Need to be in same directory as above binaries
docinto "/usr/bin"
dodoc "${BUILD_DIR}/bin/COLLADAPhysX3Schema.xsd"
dodoc "${BUILD_DIR}/bin/collada_schema_1_4_1.xsd"
dodoc "${BUILD_DIR}/bin/collada_schema_1_5.xsd"
}