197.4. ifcopenshell-0.8.5
IFC (BIM) toolkit: the C++ parser and OpenCASCADE geometry, IfcConvert and the ifcopenshell Python module FreeCAD's BIM workbench imports
| Version | 0.8.5, release 2 |
| Shelf | cad — Mechanical, architectural and 2D CAD, geometry kernels, meshing and FEM |
| Phase | 42_graphics (Graphics Stack), 72 of 189 in build order |
| Licence | LGPL-3.0-or-later |
| Homepage | https://ifcopenshell.org/ |
| Build time | 29.8 SBU |
| Installed size | 93.9 MiB in 1124 files |
| Recipe | ports/core/cad/ifcopenshell/kpkgbuild |
About
IfcOpenShell reads and writes IFC, the open file format of building information modelling (BIM). The port builds its C++ parser (IfcParse), its geometry library (IfcGeom, on OpenCASCADE), the IfcConvert command, which turns an IFC model into OBJ, glTF, STEP, IGES, SVG, HDF5, XML or another IFC, and the ifcopenshell Python module. FreeCAD’s BIM workbench imports that module to open and edit IFC files natively.
Sources
ifcopenshell-0.8.5.tar.gz(130.7 MiB)
sha256185b97d79c800603685c60abd1497df242050dbb117dcaccbaebdec0cdf25dd5
upstream: https://github.com/IfcOpenShell/IfcOpenShell/archive/refs/tags/ifcopenshell-python-0.8.5.tar.gz
archive copy: sources-1/cad--ifcopenshell-0.8.5.tar.gz
Dependencies
Depends on: cmake, ninja, swig, python3, boost, eigen, opencascade, hdf5, libxml2, nlohmann-json, zlib, numpy, python3-lark, python3-dateutil, python3-typing-extensions, python3-isodate, python3-shapely.
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.
-DWITH_CGAL=OFF, line 38: cgal (explained with the switches below)-DWITH_PROJ=OFF, line 44: proj (explained with the switches below)
Patches
build.sh applies these; kpkg applies nothing by itself.
boost-optional.patch— Adds aprofile_pointconstructor that takes the radius as a plaindouble. With the tree’s Boost,boost::optional’s converting constructor is explicit, so the{{x, y}, {radius}}copy-list-initialization in the profile mappings cannot use it.hdf5-shared.patch— Makescmake/FindHDF5.cmakelink whichever HDF5 C++ target the package exports (hdf5_cpp-static,hdf5_cpp-sharedorhdf5::hdf5_cpp-shared) instead of alwayshdf5_cpp-static; the hdf5 port exports only shared targets.python-version.patch— Sets__version__inifcopenshell/__init__.pyto the release version in place of the0.0.0that upstream’s release script rewrites. FreeCAD’s BIM workbench readsifcopenshell.versionand, below 0.7, offers to download IfcOpenShell from the network instead of using this one. The patch names the version literally, so a version bump must edit it.swig-4.5.patch— Lets the SWIG wrapper compile with this tree’s SWIG. SWIG 4.5 removed the Python 2 compatibility macros the typemaps call, soPyInt_AsLong,PyInt_FromLongandSWIG_Python_str_FromCharbecomePyLong_AsLong,PyLong_FromLongandPyUnicode_FromString. It also constrainsOpaqueCoordinate’s variadic constructor to exactly N arguments convertible toOpaqueNumber*: SWIG returns anOpaqueCoordinatethrough a value wrapper, which the unconstrained constructor would take as one coordinate component and fail to compile, and with the constraint the copy constructor is chosen.
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 ifcopenshell'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cad/ifcopenshell.
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/ifcopenshell
echo '185b97d79c800603685c60abd1497df242050dbb117dcaccbaebdec0cdf25dd5 ifcopenshell-0.8.5.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/ifcopenshell
SRC=$SRC_ROOT/ifcopenshell-0.8.5
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ifcopenshell-0.8.5.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 _tag and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/python-version.patch"
patch -p1 -i "$PORT_SRC/swig-4.5.patch"
patch -p1 -i "$PORT_SRC/boost-optional.patch"
patch -p1 -i "$PORT_SRC/hdf5-shared.patch"
cmake -S cmake -B build -G Ninja -Wno-dev \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR:PATH=lib \
-DCMAKE_INSTALL_INCLUDEDIR:PATH=include/ifcopenshell \
-DBUILD_SHARED_LIBS=ON \
-DVERSION_OVERRIDE=ON \
-DADD_COMMIT_SHA=OFF \
-DUSE_CCACHE=OFF \
-DBUILD_ONLY_COMMON_SCHEMAS=ON \
-DBUILD_IFCGEOM=ON \
-DBUILD_IFCPYTHON=ON \
-DBUILD_CONVERT=ON \
-DBUILD_GEOMSERVER=OFF \
-DBUILD_QTVIEWER=OFF \
-DBUILD_EXAMPLES=OFF \
-DBUILD_DOCUMENTATION=OFF \
-DWITH_OPENCASCADE=ON \
-DWITH_CGAL=OFF \
-DCOLLADA_SUPPORT=OFF \
-DGLTF_SUPPORT=ON \
-DHDF5_SUPPORT=ON \
-DIFCXML_SUPPORT=ON \
-DUSD_SUPPORT=OFF \
-DWITH_PROJ=OFF \
-DWITH_ROCKSDB=OFF \
-DUSE_MMAP=OFF \
-DPYTHON_EXECUTABLE=/usr/bin/python3 \
-DPython_EXECUTABLE=/usr/bin/python3
cmake --build build
DESTDIR=$PKG cmake --install build
The switches, and why each is set:
-S cmake— IfcOpenShell keeps its top-levelCMakeLists.txtin thecmake/directory, not at the root of the source.-DCMAKE_INSTALL_INCLUDEDIR:PATH=include/ifcopenshell— Install the headers underinclude/ifcopenshell. Upstream installs top-level directories namedifcparse,ifcgeomandserializers, which would otherwise sit directly in/usr/include.-DBUILD_SHARED_LIBS=ON— BuildIfcParseandIfcGeomas shared libraries; upstream’s default is static.-DVERSION_OVERRIDE=ON,-DADD_COMMIT_SHA=OFF— Take the version from theVERSIONfile at the root of the source. Without it the libraries are versioned0.8.0, upstream’s hardcoded value, whatever the release.ADD_COMMIT_SHAwould append the git commit and branch, and needs a git checkout the tarball is not.-DUSE_CCACHE=OFF— Do not launch the compiler through ccache, which upstream does by default whenever it is onPATH.-DBUILD_ONLY_COMMON_SCHEMAS=ON— Compile only the schemas upstream calls common, IFC2X3, IFC4 and IFC4X3_ADD2, instead of every schema in its default list. Each schema is several megabytes of generated C++ source and header to compile.-DBUILD_IFCGEOM=ON,-DBUILD_IFCPYTHON=ON,-DBUILD_CONVERT=ON,-DWITH_OPENCASCADE=ON— Build the geometry library, the Python module andIfcConvert, with OpenCASCADE as the geometry kernel. These are upstream’s defaults, stated.-DBUILD_GEOMSERVER=OFF— Build noIfcGeomServer, a program that exposes the IfcOpenShell API through a command interface on its standard input; no port here runs it.-DBUILD_QTVIEWER=OFF,-DBUILD_EXAMPLES=OFF,-DBUILD_DOCUMENTATION=OFF— Build neither upstream’s Qt viewer, nor the examples, nor the documentation.-DWITH_CGAL=OFF— Do not build the CGAL geometry kernel. With CGAL and the Python module both on, the build also compilessvgfill, which needs thesvgpplibrary from a git submodule that the release tarball carries empty. cgal is in the tree; OpenCASCADE is the one kernel.-DCOLLADA_SUPPORT=OFF,-DUSD_SUPPORT=OFF,-DWITH_ROCKSDB=OFF— BuildIfcConvertwithout COLLADA output (OpenCOLLADA) or USD output (Pixar’s USD), and the parser without a RocksDB file backend. None of the three libraries is a port.-DGLTF_SUPPORT=ON— BuildIfcConvert’s glTF output, which uses nlohmann-json. It is off by default.-DHDF5_SUPPORT=ON— Build HDF5 support, the.h5output ofIfcConvertamong it, on hdf5; seehdf5-shared.patch. It is upstream’s default.-DIFCXML_SUPPORT=ON— Read ifcXML, IFC’s XML encoding, through libxml2.-DWITH_PROJ=OFF— Build without PROJ, which adds only Earth-Centered, Earth-Fixed glTF output.-DUSE_MMAP=OFF— Build without the command-line option to parse IFC files from memory-mapped files through Boost.Iostreams.-DPYTHON_EXECUTABLE=/usr/bin/python3,-DPython_EXECUTABLE=/usr/bin/python3— The interpreter the Python module is built for and the schema generator runs on. The project’s CMake files readPYTHON_EXECUTABLE, and the wrapper’s copies it intoPython_EXECUTABLE, the variablefind_package(Python)reads; both are given.
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/ifcopenshell, 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 ifcopenshell-0.8.5-2.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/ifcopenshell, and runs the triggers its paths call for.
Contents
Installed programs: IfcConvert.
Installed libraries: libIfcGeom.so, libIfcParse.so, libSerializers.so, libgeometry_kernel_opencascade.so, libgeometry_serializer.so.
Installed directories: /usr/include/ifcopenshell, /usr/lib/cmake/IfcOpenShell, /usr/lib/python3.14/site-packages/ifcopenshell, /usr/share/licenses/ifcopenshell.