sci-libs/ondselsolver: add 1.0.1_p20241127

Fix broken mangling so all tests pass.

Closes: https://bugs.gentoo.org/947934
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/40110
Signed-off-by: Nowa Ammerlaan <nowa@gentoo.org>
This commit is contained in:
Paul Zander
2025-01-12 23:05:38 +01:00
committed by Nowa Ammerlaan
parent 016cca6369
commit b0e9736af2
4 changed files with 279 additions and 0 deletions

View File

@@ -1 +1,2 @@
DIST ondselsolver-1.0.1_p20241024.tar.gz 4668075 BLAKE2B 82e13168b2f6d988e411613584d9bb943afd9df73716a467d2681658d530e71173abcb31e432075dce8ebc1f0276ecb2b7b837bf057fb68f654c972e2d77f5b5 SHA512 918542fca4bfcb952d6d9500a0f3721549810dd2cde9adfb352d9301e0e1bf0fe1100a301316f15a6dcd18e36d371c58ba4a41b8f8e0878a77db4cbf054a095a
DIST ondselsolver-1.0.1_p20241127.tar.gz 4669048 BLAKE2B 6f6c4f9468b2474890b05ca394947aa91bc1780e1ef922bba40144a30c247db32d7a5de469ed27e426209013b07a137522bad9c220d9e1862f7e946696974b0b SHA512 3504a6ab379f2d9d943a1a6da8f79abffebd7fe45fd3258f0bfeb0a789d73a2b68714c10e77e48987514c8acb23800412c10daa0046ed82dab4a2aab569851ff

View File

@@ -0,0 +1,70 @@
From 432aa45ca37ecc3e15a8fb4a62ebf85b0a189775 Mon Sep 17 00:00:00 2001
From: Paul Zander <negril.nx+gentoo@gmail.com>
Date: Sat, 11 Jan 2025 00:14:18 +0100
Subject: [PATCH] include cstdint [gcc15]
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
diff --git a/OndselSolver/Constraint.h b/OndselSolver/Constraint.h
index 119b627..a7409a8 100644
--- a/OndselSolver/Constraint.h
+++ b/OndselSolver/Constraint.h
@@ -8,6 +8,7 @@
#pragma once
+#include <cstdint>
#include <memory>
#include "enum.h"
diff --git a/OndselSolver/DirectionCosineConstraintIqcJqc.h b/OndselSolver/DirectionCosineConstraintIqcJqc.h
index 5d68fcd..c81a41f 100644
--- a/OndselSolver/DirectionCosineConstraintIqcJqc.h
+++ b/OndselSolver/DirectionCosineConstraintIqcJqc.h
@@ -9,6 +9,7 @@
#pragma once
#include "DirectionCosineConstraintIqcJc.h"
+#include <cstdint>
namespace MbD {
class DirectionCosineConstraintIqcJqc : public DirectionCosineConstraintIqcJc
diff --git a/OndselSolver/DispCompIecJecO.h b/OndselSolver/DispCompIecJecO.h
index 74a1ca4..da3243a 100644
--- a/OndselSolver/DispCompIecJecO.h
+++ b/OndselSolver/DispCompIecJecO.h
@@ -9,6 +9,7 @@
#pragma once
#include "KinematicIeJe.h"
+#include <cstdint>
namespace MbD {
class DispCompIecJecO : public KinematicIeJe
diff --git a/OndselSolver/FullMatrix.h b/OndselSolver/FullMatrix.h
index 1013791..90e54aa 100644
--- a/OndselSolver/FullMatrix.h
+++ b/OndselSolver/FullMatrix.h
@@ -9,6 +9,7 @@
#pragma once
#include <cmath>
+#include <cstdint>
#include <memory>
#include "RowTypeMatrix.h"
diff --git a/OndselSolver/NewtonRaphson.h b/OndselSolver/NewtonRaphson.h
index 9d9fb19..bf0c517 100644
--- a/OndselSolver/NewtonRaphson.h
+++ b/OndselSolver/NewtonRaphson.h
@@ -8,6 +8,7 @@
#pragma once
+#include <cstdint>
#include <memory>
#include <vector>
--
2.47.1

View File

@@ -0,0 +1,173 @@
From 71c1f42d85ee1819741786255dc8876047398e8e Mon Sep 17 00:00:00 2001
From: Paul Zander <negril.nx+gentoo@gmail.com>
Date: Sun, 12 Jan 2025 19:22:48 +0100
Subject: [PATCH] properly demangle typenames
Signed-off-by: Paul Zander <negril.nx+gentoo@gmail.com>
diff --git a/OndselSolver/ASMTItem.cpp b/OndselSolver/ASMTItem.cpp
index a18e7c9..9d5383a 100644
--- a/OndselSolver/ASMTItem.cpp
+++ b/OndselSolver/ASMTItem.cpp
@@ -12,6 +12,7 @@
#include "ASMTAssembly.h"
#include "Constant.h"
#include <algorithm>
+#include "Demangle.h"
using namespace MbD;
@@ -41,9 +42,7 @@ void MbD::ASMTItem::noop()
std::string MbD::ASMTItem::classname()
{
- std::string str = typeid(*this).name();
- auto answer = str.substr(11, str.size() - 11);
- return answer;
+ return demangle(typeid(*this).name());
}
void MbD::ASMTItem::setName(const std::string& str)
diff --git a/OndselSolver/ASMTJoint.cpp b/OndselSolver/ASMTJoint.cpp
index 40edd52..bb710e3 100644
--- a/OndselSolver/ASMTJoint.cpp
+++ b/OndselSolver/ASMTJoint.cpp
@@ -9,6 +9,7 @@
#include "ASMTJoint.h"
#include "Joint.h"
+#include "Demangle.h"
using namespace MbD;
@@ -47,9 +48,7 @@ void MbD::ASMTJoint::storeOnLevel(std::ofstream& os, size_t level)
void MbD::ASMTJoint::storeOnTimeSeries(std::ofstream& os)
{
- std::string label = typeid(*this).name();
- label = label.substr(15, label.size() - 15);
- os << label << "Series\t" << fullName("") << std::endl;
+ os << demangle(typeid(*this).name()) << "Series\t" << fullName("") << std::endl;
ASMTItemIJ::storeOnTimeSeries(os);
}
diff --git a/OndselSolver/Array.h b/OndselSolver/Array.h
index 636e9a5..e270795 100644
--- a/OndselSolver/Array.h
+++ b/OndselSolver/Array.h
@@ -16,6 +16,7 @@
#include "Numeric.h"
#include <limits>
+#include "Demangle.h"
//#include "Symbolic.h"
namespace MbD {
@@ -51,10 +52,7 @@ namespace MbD {
void atitimes(size_t i, double factor);
virtual std::ostream& printOn(std::ostream& s) const {
- std::string str = typeid(*this).name();
- auto classname = str.substr(11, str.size() - 11);
- s << classname << std::endl;
- return s;
+ return s << demangle(typeid(*this).name()) << std::endl;
}
friend std::ostream& operator<<(std::ostream& s, const Array& array)
{
diff --git a/OndselSolver/Demangle.h b/OndselSolver/Demangle.h
new file mode 100644
index 0000000..810936d
--- /dev/null
+++ b/OndselSolver/Demangle.h
@@ -0,0 +1,39 @@
+#ifndef DEMANGLE_H
+#define DEMANGLE_H 1
+#include <string>
+
+#ifdef _WIN32
+#include <typeinfo>
+namespace {
+std::string demangle(const char* mangled_name) noexcept {
+ return mangled_name;
+}
+}
+#else // __linux__
+#include <cxxabi.h>
+namespace {
+std::string demangle(const char* mangled_name) noexcept {
+ int error = 0;
+ char *demang_name = abi::__cxa_demangle(mangled_name, 0, 0, &error);
+
+ switch (error) {
+ case 0:
+ break;
+ case -1:
+ return "memory allocation failed";
+ case -2:
+ return "not a valid mangled name";
+ case -3:
+ return "invalid arguments";
+ default:
+ return "__cxa_demangle failed";
+ }
+
+ std::string name(demang_name);
+ free(demang_name);
+
+ return name.substr(name.find_last_of("::") + 1);
+}
+}
+#endif // __linux__
+#endif
diff --git a/OndselSolver/Item.cpp b/OndselSolver/Item.cpp
index 4435d5d..120cd3c 100644
--- a/OndselSolver/Item.cpp
+++ b/OndselSolver/Item.cpp
@@ -15,6 +15,7 @@
#include "Item.h"
#include "System.h"
#include "Symbolic.h"
+#include "Demangle.h"
using namespace MbD;
@@ -44,10 +45,7 @@ void Item::initialize()
std::ostream& Item::printOn(std::ostream& s) const
{
- std::string str = typeid(*this).name();
- auto classname = str.substr(11, str.size() - 11);
- s << classname << std::endl;
- return s;
+ return s << demangle(typeid(*this).name()) << std::endl;
}
void Item::initializeLocally()
diff --git a/OndselSolver/Symbolic.cpp b/OndselSolver/Symbolic.cpp
index 75bcbb6..4961964 100644
--- a/OndselSolver/Symbolic.cpp
+++ b/OndselSolver/Symbolic.cpp
@@ -15,6 +15,7 @@
#include "Product.h"
#include "Sum.h"
#include "Power.h"
+#include "Demangle.h"
using namespace MbD;
@@ -160,10 +161,7 @@ bool Symbolic::isConstant()
std::ostream& Symbolic::printOn(std::ostream& s) const
{
- std::string str = typeid(*this).name();
- auto classname = str.substr(11, str.size() - 11);
- s << classname;
- return s;
+ return s << demangle(typeid(*this).name());
}
std::shared_ptr<std::vector<Symsptr>> Symbolic::getTerms()
--
2.48.0

View File

@@ -0,0 +1,35 @@
# Copyright 1999-2025 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit cmake
COMMIT=07785b7576a0655660badd845f06ed286208da1a
DESCRIPTION="Assembly Constraints and Multibody Dynamics code"
HOMEPAGE="https://github.com/Ondsel-Development/OndselSolver/"
SRC_URI="https://github.com/Ondsel-Development/OndselSolver/archive/${COMMIT}.tar.gz -> ${P}.tar.gz"
S="${WORKDIR}/OndselSolver-${COMMIT}"
LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64"
IUSE="test"
RESTRICT="!test? ( test )"
DEPEND="test? ( dev-cpp/gtest )"
PATCHES=(
"${FILESDIR}/${PN}-1.0.1_p20241024-system-gtest.patch"
"${FILESDIR}/${PN}-1.0.1-properly-demangle-typenames.patch"
)
src_configure() {
local mycmakeargs=(
-DONDSELSOLVER_BUILD_TESTS=$(usex test)
)
cmake_src_configure
}