Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

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

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.

Patches

build.sh applies these; kpkg applies nothing by itself.

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:

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.