PKGBUILDs/extra/freecad/PKGBUILD
2024-04-16 00:00:47 +00:00

94 lines
3.9 KiB
Bash

# Maintainer: Alexander F. Rødseth <xyproto@archlinux.org>
# Contributor: loqs <bugs-archlinux@entropy-collector.net>
# Contributor: Gabriel Souza Franco <gabrielfrancosouza@gmail.com>
# Contributor: Florian Pritz
# Contributor: Jonas Heinrich <onny@project-insanity.org>
# Contributor: Jordi De Groof <jordi.degroof@gmail.com>
# Contributor: mickele
# Contributor: manwithgrenade
# Contributor: bricem13
# Contributor: gborzi
# Contributor: Adrian Insaurralde
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - remove makedepends on ospray
buildarch=8
highmem=1
pkgname=freecad
pkgver=0.21.2
pkgrel=15
pkgdesc='Feature based parametric 3D CAD modeler'
arch=(x86_64)
url='https://freecadweb.org/'
license=(LGPL)
depends=(boost-libs coin fmt glew jsoncpp libspnav med-openmpi netcdf
opencascade openmpi pugixml pyside6 python-gitpython
python-markdown python-matplotlib python-pip python-pivy python-ply
python-yaml qt6-svg qt6-tools qt6-webengine
xerces-c verdict)
makedepends=(boost cgns cmake eigen git libharu liblas ninja openvdb openvr
pdal postgresql-libs python-mpi4py
shiboken6 swig utf8cpp nlohmann-json)
optdepends=('graphviz: dependency graph support'
'openscad: OpenSCAD support')
source=("git+https://github.com/$pkgname/$pkgname#tag=$pkgver"
freecad-vtk9.3.patch
pyside6.patch
62c3836c.patch
https://github.com/FreeCAD/FreeCAD/commit/6043c904.patch)
b2sums=('b20da85de907a41b14581583f9d69cab8fe79b1bdd50c24fc299c649ef0bfd7723c0b23aebc68ca5bbdee2da22c959004c7b595e19b542b1ec06a7275c0f5ea7'
'f0b5a4648eb4befabb2339bae4e42044e436aa50ad1c2a25b243c965272a217b2c1c69c34d0d20bd01c573008de10f733b74857ffecac502b8558a7095e305e5'
'63bfac252cc813f4e2454b4bbd8b0c55e2882566bd39bf1d0b812bafc305cad6b65293bad4f3c043b58df93a2c685e82e5853059335fe8e90531dcbc23e324e9'
'eb474708c3611293cfe3dfc287418b606f7735f6eb306f44f7394cd7e65256daddcee35984211982f25064e7ec81cc038d4eeb8d34af7399058ecfb6e8e99e9f'
'de4b98c4b488045f9810dce124c271d6f4f629922e026f2d4f1efd6c9060b92309db41f8e0f6ebe5e7a27399911ac908cc8935c2501214326dbb1c4b739d46cc')
prepare() {
patch -d freecad -Np1 -i "$srcdir"/freecad-vtk9.3.patch
patch -d freecad -Np1 -i ../62c3836c.patch # Fix Qt6 issues in addons manager
patch -d freecad -Np1 -i ../pyside6.patch
patch -d freecad -Np1 -i ../6043c904.patch # Fix build with Python 3.12
sed -e 's|Shiboken::Module::getTypes(requiredModule)|reinterpret_cast<PyTypeObject **>(Shiboken::Module::getTypes(requiredModule))|' \
-i freecad/src/Gui/PythonWrapper.cpp # Fix build with PySide 6.7
}
build() {
cmake \
-B build \
-D BUILD_ENABLE_CXX_STD=C++17 \
-D BUILD_FLAT_MESH=ON \
-D FREECAD_QT_VERSION=6 \
-D CMAKE_BUILD_TYPE=Release \
-D CMAKE_C_FLAGS="$CFLAGS -fPIC -w" \
-D CMAKE_CXX_FLAGS="$CXXFLAGS -fPIC -w" \
-D CMAKE_INSTALL_BINDIR=/usr/lib/freecad/bin \
-D CMAKE_INSTALL_DATADIR=/usr/share/freecad \
-D CMAKE_INSTALL_DATAROOTDIR=/usr/share \
-D CMAKE_INSTALL_DOCDIR=/usr/share/freecad/doc \
-D CMAKE_INSTALL_LIBDIR=/usr/lib/freecad/lib \
-D CMAKE_INSTALL_PREFIX=/usr/lib/freecad \
-D FREECAD_USE_EXTERNAL_PIVY=ON \
-D FREECAD_USE_OCC_VARIANT='Official Version' \
-D FREECAD_USE_QT_FILEDIALOG=ON \
-D PYTHON_EXECUTABLE=/usr/bin/python \
-D INSTALL_TO_SITEPACKAGES=ON \
-G Ninja \
-S $pkgname \
-W no-dev
ninja -C build
}
package() {
DESTDIR="$pkgdir" ninja -C build install
# tools
install -Dm755 $pkgname/src/Tools/{$pkgname-thumbnailer,fcinfo} -t "$pkgdir/usr/bin/"
# symlinks
install -d "$pkgdir/usr/bin"
ln -sf /usr/lib/freecad/bin/FreeCAD "$pkgdir/usr/bin/freecad"
ln -sf /usr/lib/freecad/bin/FreeCAD "$pkgdir/usr/bin/FreeCAD"
ln -sf /usr/lib/freecad/bin/FreeCADCmd "$pkgdir/usr/bin/freecadcmd"
ln -sf /usr/lib/freecad/bin/FreeCADCmd "$pkgdir/usr/bin/FreeCADCmd"
}