87.4. boost-1.92.0
Boost C++ libraries — the headers and the compiled components the catalogue links
| Version | 1.92.0, release 4 |
| Shelf | devlibs — General-purpose C and C++ utility libraries with no domain |
| Phase | 41_system (System), 244 of 1047 in build order |
| Licence | BSL-1.0 |
| Homepage | https://www.boost.org |
| Build time | 5.8 SBU |
| Installed size | 160.9 MiB in 16606 files |
| Recipe | ports/core/devlibs/boost/kpkgbuild |
About
Boost is the large collection of peer-reviewed C++ libraries that much C++ software is written against. Most of it is headers only; the rest is compiled libraries, and this port builds the compiled components that the catalogue’s consumers require, as shared libraries, together with all the headers and Boost’s CMake package files. Its dependents run from KDE programs (krita, digikam, kdevelop) and office software (the document-import libraries librevenge and liborcus, abiword, gnucash) through CAD and fabrication (freecad, kicad, openscad, prusaslicer) to radio (gnuradio, wsjtx) and games (wesnoth).
Sources
boost-1.92.0.tar.bz2(189.8 MiB)
sha2565c1d40cb8e19adbf740a4ec2da35b3e58f3f5804b1dce44deb53df72193cbc6c
upstream: https://archives.boost.io/release/1.92.0/source/boost_1_92_0.tar.bz2
archive copy: sources-1/devlibs--boost-1.92.0.tar.bz2
Dependencies
Depends on: zlib, bzip2, zstd, xz, icu, python3, numpy.
Required by (66): abiword, ardour, calligra, celestia, cgal, cppcheck, curaengine, digikam, fcitx5-chinese-addons, freecad, gnucash, gnuradio, gqrx, gr-funcube, gr-iqbal, gr-osmosdr, ifcopenshell, inkscape, js8call, kactivitymanagerd, kdevelop, kdiff3, kgraphviewer, kicad, kig, krita, ktorrent, lager, ledger, lib2geom, libcdr, libetonyek, libime, libixion, libkleo, libktorrent, libnest2d, liborcus, librecad, librevenge, libtorrent-rasterbar, libvisio, libwpd, linuxcnc, mdds, mkvtoolnix, mumble, nextpnr, openscad, organicmaps, poppler, prjtrellis, prusaslicer, python3-pynest2d, qbittorrent, quassel, rocs, sdcc, sdrangel, srecord, strawberry, thrift, uhd, wesnoth, wsjtx, zanshin.
Patches
build.sh applies these; kpkg applies nothing by itself.
musl-filesystem-locale.patch— Convert paths with Boost.Filesystem's UTF-8 codecvt facet on Linux without glibcBoost.Filesystem builds its path locale on Linux as std::locale(""). On musl, libstdc++ uses its generic locale model, whose codecvt converts through the C library's current locale whatever the C++ locale's name, and that is "C" until the program calls setlocale, so the characters of a UTF-8 path above U+007F would not be decoded. Linux without glibc now gets the UTF-8 codecvt facet the BSDs, macOS, Solaris and Haiku get; file names there are UTF-8 in any case.
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/41_system/phase.env && kpkg install boost'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/devlibs/boost.
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/devlibs/boost
echo '5c1d40cb8e19adbf740a4ec2da35b3e58f3f5804b1dce44deb53df72193cbc6c boost-1.92.0.tar.bz2' | 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/boost
SRC=$SRC_ROOT/boost-1.92.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf boost-1.92.0.tar.bz2 -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 _uver and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
patch -p1 -i "$PORT_SRC/musl-filesystem-locale.patch"
./bootstrap.sh --prefix=/usr --libdir=/usr/lib \
--with-icu=/usr \
--with-python=/usr/bin/python3 \
--with-libraries=iostreams,system,filesystem,regex,date_time,test,program_options,thread,atomic,charconv,chrono,container,locale,random,coroutine,context,graph,process,log,nowide,serialization,stacktrace,python
cat > user-config.jam <<JAM
using gcc : : $CXX : <cflags>"$CFLAGS" <cxxflags>"$CXXFLAGS" <linkflags>"$LDFLAGS" ;
JAM
./b2 \
--user-config=user-config.jam \
--prefix=/usr \
--libdir=/usr/lib \
staging-prefix=$PKG/usr \
--with-iostreams \
--with-system \
--with-filesystem \
--with-regex \
--with-date_time \
--with-test \
--with-program_options \
--with-thread \
--with-atomic \
--with-charconv \
--with-chrono \
--with-container \
--with-locale \
--with-random \
--with-coroutine \
--with-context \
--with-graph \
--with-process \
--with-log \
--with-nowide \
--with-serialization \
--with-stacktrace \
--with-python \
boost.stacktrace.backtrace=off \
variant=release \
link=shared \
threading=multi \
install
test "$(grep -rl /var/cache/kpkg "$PKG/usr/lib/cmake" | wc -l)" = 0
test -e "$PKG/usr/lib/libboost_regex.so"
The switches, and why each is set:
--with-libraries(tobootstrap.sh) and the matching--with-iostreams…--with-python(tob2) — The compiled components to build: iostreams, system, filesystem, regex, date_time, test, program_options, thread, atomic, charconv, chrono, container, locale, random, coroutine, context, graph, process, log, nowide, serialization, stacktrace and python. They are the components the consumers ask for withfind_package(Boost … REQUIRED COMPONENTS …).bootstrap.shwrites its list intoproject-config.jamas the default set, and any--with-*onb2’s command line replaces that set whole, so theb2list is the one that decides what is built.--with-icu=/usr— Build Boost.Regex’s and Boost.Locale’s ICU support against icu.--with-python=/usr/bin/python3— Buildboost_pythonandboost_numpyfor the system python3;boost_numpyneeds numpy.--user-config=user-config.jam— b2 reads no compiler flags from the environment.build.shwrites auser-config.jamwhoseusing gccline carries the tree’s$CXX,CFLAGS,CXXFLAGSandLDFLAGS, and points b2 at it.staging-prefix=$PKG/usr— Install into the package while every path written into the installed files, Boost’s CMake configuration among them, still names--prefix=/usr.boost.stacktrace.backtrace=off— Build noboost_stacktrace_backtrace, the stack trace backend over libbacktrace, which it links statically. b2 otherwise builds it whenever its probe links a libbacktrace; the tree carries none of its own, and the other backends (boost_stacktrace_basic,_addr2line,_noop) are built.variant=release,link=shared,threading=multi— Optimised, shared, thread-safe libraries only.
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/boost, 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 boost-1.92.0-4.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/boost, and runs the triggers its paths call for.
Contents
Installed libraries: libboost_atomic.so, libboost_charconv.so, libboost_chrono.so, libboost_container.so, libboost_context.so, libboost_coroutine.so, libboost_date_time.so, libboost_exception.a, libboost_filesystem.so, libboost_graph.so, libboost_iostreams.so, libboost_locale.so, libboost_log.so, libboost_log_setup.so, libboost_math_c99.so, libboost_math_c99f.so, libboost_math_c99l.so, libboost_math_tr1.so, libboost_math_tr1f.so, libboost_math_tr1l.so, libboost_nowide.so, libboost_numpy314.so, libboost_prg_exec_monitor.so, libboost_process.so, libboost_program_options.so, libboost_python314.so, libboost_random.so, libboost_regex.so, libboost_serialization.so, libboost_stacktrace_addr2line.so, libboost_stacktrace_basic.so, libboost_stacktrace_dump.so, libboost_stacktrace_from_exception.so, libboost_stacktrace_noop.so, libboost_test_exec_monitor.a, libboost_thread.so, libboost_unit_test_framework.so, libboost_wserialization.so.
Installed directories: /usr/include/boost, /usr/lib/cmake/Boost-1.92.0, /usr/lib/cmake/boost_atomic-1.92.0, /usr/lib/cmake/boost_charconv-1.92.0, /usr/lib/cmake/boost_chrono-1.92.0, /usr/lib/cmake/boost_container-1.92.0, /usr/lib/cmake/boost_context-1.92.0, /usr/lib/cmake/boost_coroutine-1.92.0, /usr/lib/cmake/boost_date_time-1.92.0, /usr/lib/cmake/boost_exception-1.92.0, /usr/lib/cmake/boost_filesystem-1.92.0, /usr/lib/cmake/boost_graph-1.92.0, /usr/lib/cmake/boost_headers-1.92.0, /usr/lib/cmake/boost_iostreams-1.92.0, /usr/lib/cmake/boost_locale-1.92.0, /usr/lib/cmake/boost_log-1.92.0, /usr/lib/cmake/boost_log_setup-1.92.0, /usr/lib/cmake/boost_math-1.92.0, /usr/lib/cmake/boost_math_c99-1.92.0, /usr/lib/cmake/boost_math_c99f-1.92.0, /usr/lib/cmake/boost_math_c99l-1.92.0, /usr/lib/cmake/boost_math_tr1-1.92.0, /usr/lib/cmake/boost_math_tr1f-1.92.0, /usr/lib/cmake/boost_math_tr1l-1.92.0, /usr/lib/cmake/boost_nowide-1.92.0, /usr/lib/cmake/boost_numpy-1.92.0, /usr/lib/cmake/boost_prg_exec_monitor-1.92.0, /usr/lib/cmake/boost_process-1.92.0, /usr/lib/cmake/boost_program_options-1.92.0, /usr/lib/cmake/boost_python-1.92.0, /usr/lib/cmake/boost_random-1.92.0, /usr/lib/cmake/boost_regex-1.92.0, /usr/lib/cmake/boost_regex_old-1.92.0, /usr/lib/cmake/boost_serialization-1.92.0, /usr/lib/cmake/boost_stacktrace_addr2line-1.92.0, /usr/lib/cmake/boost_stacktrace_basic-1.92.0, /usr/lib/cmake/boost_stacktrace_dump-1.92.0, /usr/lib/cmake/boost_stacktrace_from_exception-1.92.0, /usr/lib/cmake/boost_stacktrace_noop-1.92.0, /usr/lib/cmake/boost_system-1.92.0, /usr/lib/cmake/boost_test_exec_monitor-1.92.0, /usr/lib/cmake/boost_thread-1.92.0, /usr/lib/cmake/boost_unit_test_framework-1.92.0, /usr/lib/cmake/boost_wserialization-1.92.0, /usr/share/boost_predef, /usr/share/licenses/boost.
Notes
b2 probes at configure time and builds Boost.Regex’s and Boost.Locale’s ICU support only when it can link ICU, and boost_numpy only when the configured Python imports numpy; a failed probe skips the part without an error. Both are in depends for that reason: a build root that happened to lack either would produce a different Boost without a word.
After the install build.sh checks that no file under /usr/lib/cmake names /var/cache/kpkg, kpkg’s work area, so a staging path written into Boost’s CMake configuration stops the build instead of reaching every consumer’s find_package(Boost). It also checks that libboost_regex.so is in the package.
Removing a component from the list breaks every consumer that asks for it, because its find_package(Boost … REQUIRED COMPONENTS …) then fails at configure time.