197.3. netgen-6.2.2604
Automatic 3D tetrahedral mesh generator (nglib, OpenCASCADE geometry and the Python module FreeCAD's FEM drives)
| Version | 6.2.2604, release 1 |
| Shelf | cad — Mechanical, architectural and 2D CAD, geometry kernels, meshing and FEM |
| Phase | 42_graphics (Graphics Stack), 71 of 189 in build order |
| Licence | LGPL-2.1-only |
| Homepage | https://ngsolve.org/ |
| Build time | 13.7 SBU |
| Installed size | 18.2 MiB in 277 files |
| Recipe | ports/core/cad/netgen/kpkgbuild |
About
Netgen generates tetrahedral volume meshes, and triangle and quadrilateral surface meshes, from CSG, STL and OpenCASCADE geometry. KDOS builds it for FreeCAD, whose FEM workbench meshes parts with it (-DBUILD_FEM_NETGEN=ON in FreeCAD’s build.sh): the port installs nglib, the C++ library, its headers and CMake files, and the netgen Python module that FreeCAD drives. Netgen’s own Tcl/Tk window is not built.
Sources
netgen-6.2.2604.tar.gz(3.2 MiB)
sha2560a614193ee6106c0c276a1516639bef872f2f2371dec159e1b1f6ffcb425954c
upstream: https://github.com/NGSolve/netgen/archive/refs/tags/v6.2.2604.tar.gz
archive copy: sources-1/cad--netgen-6.2.2604.tar.gz
Dependencies
Depends on: cmake, ninja, python3, python3-pybind11, numpy, opencascade, zlib.
Required by (1): freecad.
Optional, off in KDOS
These switches in build.sh turn off a feature whose library is a port here. The recipe may turn each off on purpose, or because the library was not yet a port when the recipe was written; this list cannot tell which.
-DUSE_JPEG=OFF, line 29: libjpeg-turbo (explained with the switches below)-DUSE_NUMA=OFF, line 32: numactl
Patches
build.sh applies these; kpkg applies nothing by itself.
config-no-source-dir.patch— Writes an emptyNETGEN_SOURCE_DIRinto the installedNetgenConfig.cmakeinstead of@PROJECT_SOURCE_DIR@, the build’s source directory, a path under kpkg’s work directory that does not exist on the installed system.version-git.patch— PassesNETGEN_VERSION_GITon to theng_generate_version_filetarget, which rerunscmake/generate_version_file.cmakeat build time with only-DBDIRand so would otherwise callgit describeagain and write the fallback version intonetgen_version.hpp.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/42_graphics/phase.env && kpkg install netgen'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cad/netgen.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/cad/netgen
echo '0a614193ee6106c0c276a1516639bef872f2f2371dec159e1b1f6ffcb425954c netgen-6.2.2604.tar.gz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/netgen
SRC=$SRC_ROOT/netgen-6.2.2604
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf netgen-6.2.2604.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the recipe’s helpers _commit and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/version-git.patch"
patch -p1 -i "$PORT_SRC/config-no-source-dir.patch"
_pybind11_dir=$(python3 -c 'import pybind11; print(pybind11.get_cmake_dir())')
cmake -S . -B build -G Ninja -Wno-dev \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DNETGEN_VERSION_GIT=v$version-0-g$_commit \
-DUSE_SUPERBUILD=OFF \
-DUSE_NATIVE_ARCH=OFF \
-DUSE_GUI=OFF \
-DUSE_PYTHON=ON \
-DPREFER_SYSTEM_PYBIND11=ON \
-Dpybind11_DIR="$_pybind11_dir" \
-DPython3_EXECUTABLE=/usr/bin/python3 \
-DUSE_OCC=ON \
-DUSE_MPI=OFF \
-DUSE_JPEG=OFF \
-DUSE_MPEG=OFF \
-DUSE_CGNS=OFF \
-DUSE_NUMA=OFF \
-DUSE_CCACHE=OFF \
-DINSTALL_PROFILES=OFF \
-DENABLE_UNIT_TESTS=OFF \
-DBUILD_STUB_FILES=OFF \
-DNG_INSTALL_DIR_BIN=bin \
-DNG_INSTALL_DIR_LIB=lib \
-DNG_INSTALL_DIR_CMAKE=lib/cmake/netgen \
-DNG_INSTALL_DIR_INCLUDE=include/netgen \
-DNG_INSTALL_DIR_RES=share
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-DNETGEN_VERSION_GIT=v$version-0-g$_commit— The version string Netgen’s build reads fromgit describewhen it is not given one. The tarball carries no.gitand noversion.txt, so without the switch the configure needs git, finds no repository, and falls back tov6.2.0-0with a warning, and the headers and the Python metadata say 6.2.0. The recipe’s_commitis the commit the release tag points at, and the-0-says the tree is the tag itself, which makes the reported version the short one, the release number.version-git.patchis what makes the build-time step see the value.-DUSE_SUPERBUILD=OFF— Configure and build Netgen directly. The default super-build wraps Netgen in an external project of its own, runsgit submodule update --init --recursivewhen the pybind11 submodule is empty, which it is in the release tarball, and adds a step that checks the submodules on every build. It downloads OpenCASCADE and zlib only underBUILD_OCCandBUILD_ZLIB, both off.-DUSE_NATIVE_ARCH=OFF— Compile without-march=native, which is on by default and would tune the binaries to the processor of the machine that built them. Netgen adds it as aPUBLICoption ofngcore, so it would also reach the compile line of every program that builds against Netgen’s exported CMake targets.-DUSE_GUI=OFF— Build nonetgenGUI and nongguilibrary; that interface is Tcl/Tk with Togl. FreeCAD uses only the library and the Python module.-DUSE_PYTHON=ON,-DPREFER_SYSTEM_PYBIND11=ON,-Dpybind11_DIR="$_pybind11_dir",-DPython3_EXECUTABLE=/usr/bin/python3— Build the Python module against the pybind11 port, found through the CMake directory thatpybind11.get_cmake_dir()reports. The bundled copy,external_dependencies/pybind11, is a git submodule and empty in the release tarball; with the system copy, Netgen also installs no pybind11 headers of its own.-DUSE_OCC=ON— Build the OpenCASCADE geometry kernel interface (libsrc/occ), which meshes OCCT shapes. It is upstream’s default; opencascade is independsfor it.-DUSE_MPI=OFF,-DUSE_CGNS=OFF,-DUSE_NUMA=OFF— Build without MPI parallelization, without CGNS file reading and writing, and without NUMA-aware code.-DUSE_JPEG=OFF,-DUSE_MPEG=OFF— Build without the GUI’s snapshot (libjpeg) and video recording (FFmpeg) features, which have no use withUSE_GUI=OFF.-DUSE_CCACHE=OFF,-DINSTALL_PROFILES=OFF,-DENABLE_UNIT_TESTS=OFF,-DBUILD_STUB_FILES=OFF— Do not launch the compiler through ccache, install no/etc/profile.dscript settingPATHandNETGENDIR, build no Catch unit tests, and do not runpybind11-stubgento write.pyistubs for the Python module.-DNG_INSTALL_DIR_BIN=bin,-DNG_INSTALL_DIR_LIB=lib,-DNG_INSTALL_DIR_CMAKE=lib/cmake/netgen,-DNG_INSTALL_DIR_INCLUDE=include/netgen,-DNG_INSTALL_DIR_RES=share— Netgen’s own install layout, relative to the prefix. The one that differs from upstream’s default is the header directory,include/netgeninstead ofinclude: Netgen installs its headers in subdirectories with names as generic ascore,generalandinclude, which would otherwise sit directly in/usr/include.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/netgen, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf netgen-6.2.2604-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/netgen, and runs the triggers its paths call for.
Contents
Installed libraries: libngcore.so, libnglib.so.
Installed directories: /usr/include/netgen, /usr/lib/cmake/netgen, /usr/lib/python3.14/site-packages/netgen, /usr/lib/python3.14/site-packages/pyngcore, /usr/share/licenses/netgen, /usr/share/netgen.