backports/freecad: new aport

This commit is contained in:
Antoine Martin 2023-05-15 15:50:40 -04:00 committed by Antoine Martin
parent b719cfbc29
commit 9b33be18a3
6 changed files with 287 additions and 0 deletions

103
backports/freecad/APKBUILD Normal file
View file

@ -0,0 +1,103 @@
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=freecad
pkgver=0.20.2
pkgrel=4
pkgdesc="Free and open source 3D parametric modeler"
url="https://freecadweb.org/"
license="LGPL-2.0-or-later"
arch="x86_64" # dependency OpenCascade is only x86_64
depends="
graphviz
hdf5
opencascade
py3-matplotlib
py3-numpy
py3-pivy
py3-ply
py3-pyside2
py3-six
py3-yaml
python3
"
makedepends="
boost-dev
cmake
coin-dev
doxygen
eigen-dev
freeimage-dev
glu-dev
hdf5-dev
libmedc-dev
libshiboken2-dev
libtbb-dev
opencascade-dev
py3-pyside2-dev
python3-dev
shiboken2
qt5-qtsvg-dev
qt5-qtwebengine-dev
qt5-qtxmlpatterns-dev
samurai
swig
vtk-dev
xerces-c-dev
"
checkdepends="xvfb-run mesa mesa-dri-gallium font-opensans"
source="https://github.com/FreeCAD/FreeCAD/archive/$pkgver/freecad-$pkgver.tar.gz
$pkgname-python3.11-1.patch::https://github.com/FreeCAD/FreeCAD/commit/fe02d63c8c9b1280978be841d04e68a0a55cceb9.patch
numpy-1.20.patch
no-execinfo.patch
no-workaround-spnav.patch
resourceDirectory.patch
tests.patch
"
builddir="$srcdir/FreeCAD-$pkgver"
build() {
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_FLAGS="$CFLAGS -fPIC -w" \
-DCMAKE_CXX_FLAGS="$CXXFLAGS -fPIC -w" \
-DCMAKE_INSTALL_PREFIX=/usr/lib/freecad \
-DCMAKE_INSTALL_DATADIR=/usr/share/freecad \
-DCMAKE_INSTALL_DATAROOTDIR=/usr/share \
-DCMAKE_INSTALL_DOCDIR=/usr/share/freecad/doc \
-DBUILD_ENABLE_CXX_STD=C++17 \
-DBUILD_QT5=ON \
-DFREECAD_USE_EXTERNAL_PIVY=ON \
-DFREECAD_USE_OCC_VARIANT="Official Version" \
-DFREECAD_USE_QT_FILEDIALOG=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3
cmake --build build
}
check() {
DESTDIR=test_install cmake --install build
mkdir -p test_install/usr/bin
ln -s ../lib/freecad/bin/FreeCAD test_install/usr/bin/FreeCAD
ln -s ../lib/freecad/bin/FreeCADCmd test_install/usr/bin/FreeCADCmd
LD_LIBRARY_PATH="$PWD"/test_install/usr/lib/freecad/lib \
xvfb-run "$PWD"/test_install/usr/bin/FreeCAD -t 0
}
package() {
DESTDIR="$pkgdir" cmake --install build
# FreeCAD does not initialize correctly when binaries
# are located under /usr/bin; thus, symlinks are necessary.
install -d "$pkgdir"/usr/bin
ln -s /usr/lib/freecad/bin/FreeCAD "$pkgdir"/usr/bin/FreeCAD
ln -s /usr/lib/freecad/bin/FreeCADCmd "$pkgdir"/usr/bin/FreeCADCmd
}
sha512sums="
c3acd77dd2bb9a2a23ac354da3b6102effb89c95d675e91421d65486414dfe8cc0188a7212245e0deb63f17b9c5df76133017be09e4cd14b833be8cbec52a08d freecad-0.20.2.tar.gz
75a237f7ed7a89a98c0e5bdb3d3f0788749602daf718089aa0814e05f93ced1e15ad5867c7c87f170b48c5984f9ace1bbc95c4f386ce72bfb8d616323b47f1e5 freecad-python3.11-1.patch
80b08b031810fce7b6d698c662f64fa4f8a904f283f46b478b1d718529164c0ee61ce190f633abf04e03212720480f3f0603b0c1e160af79d7b6bb82da3bd0e4 numpy-1.20.patch
73aaba7015dce7048eb7d2456131b5b5ba4673cc980503331987be54d99daed5f61db015ca33d7d2ef0f02bd3192da8ce122c103c3b93f9959927deb4f0b933e no-execinfo.patch
15696bdaaf77482f1b5d3806535a8004c8cec7d598d62092d9f0394b4ca9e2ad6cedd77c4b86a83a06324d16678c1c6bbf3a390b807729717a2f513e858afd50 no-workaround-spnav.patch
8ba13b17bad66316757d180c1b9e9e72a24382627eac7c43a2264b3b5101e6e8f701775f2b805ed733f500fbcd8b0e8e422ec58a9ab3d948d613b666157d4c52 resourceDirectory.patch
5db19e0aa2ca1fd21f4c56afc9db54390a799262aaa0a741704c2c304b0068fd6ca1dcc086465e12e9c0cfe06aac750aaf9b8f5f4db324539af4dd3394803ff9 tests.patch
"

View file

@ -0,0 +1,46 @@
diff --git a/src/3rdParty/salomesmesh/src/DriverSTL/Basics_Utils.cpp b/src/3rdParty/salomesmesh/src/DriverSTL/Basics_Utils.cpp
index 23c5083..54c7ecf 100644
--- a/src/3rdParty/salomesmesh/src/DriverSTL/Basics_Utils.cpp
+++ b/src/3rdParty/salomesmesh/src/DriverSTL/Basics_Utils.cpp
@@ -29,7 +29,6 @@
#ifndef WIN32
#include <unistd.h>
#include <sys/stat.h>
-#include <execinfo.h>
#endif
@@ -109,20 +108,7 @@ namespace Kernel_Utils
#ifndef WIN32
void print_traceback()
{
- void *array[50];
- size_t size;
- char **strings;
- size_t i;
-
- size = backtrace (array, 40);
- strings = backtrace_symbols (array, size);
-
- for (i = 0; i < size; i++)
- {
- std::cerr << strings[i] << std::endl;
- }
-
- free (strings);
+ std::cerr << "there is no backtrace." << std::endl;
}
#else
#if (_MSC_VER >= 1400) // Visual Studio 2005
diff --git a/src/App/Application.cpp b/src/App/Application.cpp
index 3081623..ba3525f 100644
--- a/src/App/Application.cpp
+++ b/src/App/Application.cpp
@@ -1732,7 +1732,6 @@ static void freecadNewHandler ()
#endif
#if defined(FC_OS_LINUX)
-#include <execinfo.h>
#include <dlfcn.h>
#include <cxxabi.h>

View file

@ -0,0 +1,69 @@
Patch-Source: https://github.com/FreeCAD/FreeCAD/commit/7b377a216b9185960e4cee980a6504dc1a755f50
fixes stderr reassignment
--
From 7b377a216b9185960e4cee980a6504dc1a755f50 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Wed, 29 Jun 2022 15:19:18 +0200
Subject: [PATCH] Gui: remove workaround for spnav 0.23 due to build failure
with musl libc
---
src/Gui/3Dconnexion/GuiNativeEventLinux.cpp | 27 ---------------------
1 file changed, 27 deletions(-)
diff --git a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
index 7f0ddd75d262..455ece0b36bd 100644
--- a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
+++ b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
@@ -21,42 +21,17 @@
***************************************************************************/
#include <FCConfig.h>
-#include <cstdio>
#include "GuiNativeEventLinux.h"
#include "GuiApplicationNativeEventAware.h"
#include <Base/Console.h>
-#include <Base/FileInfo.h>
#include <QMainWindow>
#include <QSocketNotifier>
#include <spnav.h>
-namespace {
-class RedirectStdErr
-{
-public:
- RedirectStdErr()
- : fi(Base::FileInfo::getTempFileName())
- , file(stderr)
- {
- stderr = fopen(fi.filePath().c_str(), "w");
- }
- ~RedirectStdErr()
- {
- fclose(stderr);
- fi.deleteFile();
- stderr = file;
- }
-
-private:
- Base::FileInfo fi;
- FILE* file;
-};
-}
-
Gui::GuiNativeEvent::GuiNativeEvent(Gui::GUIApplicationNativeEventAware *app)
: GuiAbstractNativeEvent(app)
{
@@ -72,8 +47,6 @@ Gui::GuiNativeEvent::~GuiNativeEvent()
void Gui::GuiNativeEvent::initSpaceball(QMainWindow *window)
{
- // tmp. redirect stderr to a file to suppress an error message from spnav_open()
- RedirectStdErr err;
Q_UNUSED(window)
if (spnav_open() == -1) {
Base::Console().Log("Couldn't connect to spacenav daemon. Please ignore if you don't have a spacemouse.\n");

View file

@ -0,0 +1,25 @@
Patch-Source: https://github.com/FreeCAD/FreeCAD/commit/8b0df1dc936b544091f6a2d68df1c1a14ae3de5b
--
From 8b0df1dc936b544091f6a2d68df1c1a14ae3de5b Mon Sep 17 00:00:00 2001
From: lorenz <looooo@users.noreply.github.com>
Date: Tue, 27 Dec 2022 04:59:35 +0100
Subject: [PATCH] FEM: femmesh: fix AttributeError: module 'numpy' has no
attribute 'int'
---
src/Mod/Fem/femmesh/meshtools.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Mod/Fem/femmesh/meshtools.py b/src/Mod/Fem/femmesh/meshtools.py
index dd8671b..d2e2b0a 100644
--- a/src/Mod/Fem/femmesh/meshtools.py
+++ b/src/Mod/Fem/femmesh/meshtools.py
@@ -485,7 +485,7 @@ def get_femelement_sets(
# fem_objects = FreeCAD FEM document objects
# get femelements for reference shapes of each obj.References
count_femelements = 0
- referenced_femelements = np.zeros((max(femelement_table.keys())+1,),dtype=np.int)
+ referenced_femelements = np.zeros((max(femelement_table.keys())+1,),dtype=int)
has_remaining_femelements = None
for fem_object_i, fem_object in enumerate(fem_objects):
obj = fem_object["Object"]

View file

@ -0,0 +1,11 @@
--- ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake.orig
+++ ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
@@ -23,7 +23,7 @@
"Path to the directory containing PyCXX's cxxextensions.c source file")
# used as compiler defines
- set(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
+ set(RESOURCEDIR "../../share/freecad")
set(LIBRARYDIR "${CMAKE_INSTALL_LIBDIR}")
set(DOCDIR "${CMAKE_INSTALL_DOCDIR}")

View file

@ -0,0 +1,33 @@
--- ./src/Mod/Mesh/App/MeshTestsApp.py.orig
+++ ./src/Mod/Mesh/App/MeshTestsApp.py
@@ -423,30 +423,6 @@
self.planarMesh = []
FreeCAD.newDocument("MeshTest")
- def testRayPick(self):
- if not FreeCAD.GuiUp:
- return
- self.planarMesh.append( [-16.097176,-29.891157,15.987688] )
- self.planarMesh.append( [-16.176304,-29.859991,15.947966] )
- self.planarMesh.append( [-16.071451,-29.900553,15.912505] )
- self.planarMesh.append( [-16.092241,-29.893408,16.020439] )
- self.planarMesh.append( [-16.007210,-29.926180,15.967641] )
- self.planarMesh.append( [-16.064457,-29.904951,16.090832] )
- planarMeshObject = Mesh.Mesh(self.planarMesh)
-
- from pivy import coin; import FreeCADGui
- Mesh.show(planarMeshObject)
- view=FreeCADGui.ActiveDocument.ActiveView.getViewer()
- rp=coin.SoRayPickAction(view.getSoRenderManager().getViewportRegion())
- rp.setRay(coin.SbVec3f(-16.05,16.0,16.0),coin.SbVec3f(0,-1,0))
- rp.apply(view.getSoRenderManager().getSceneGraph())
- pp=rp.getPickedPoint()
- self.assertTrue(pp != None)
- det=pp.getDetail()
- self.assertTrue(det.getTypeId() == coin.SoFaceDetail.getClassTypeId())
- det=coin.cast(det, det.getTypeId().getName().getString())
- self.assertTrue(det.getFaceIndex() == 1)
-
def testPrimitiveCount(self):
if not FreeCAD.GuiUp:
return