43.7. ninja-1.13.2
Low-level build system that runs generated build files
| Version | 1.13.2, release 1 |
| Shelf | buildtools — Build systems and build helpers |
| Phase | 30_foundation (Build Foundation), 61 of 127 in build order |
| Licence | Apache-2.0 |
| Homepage | https://ninja-build.org/ |
| Build time | 0.7 SBU |
| Installed size | 497.4 KiB in 4 files |
| Recipe | ports/core/buildtools/ninja/kpkgbuild |
About
Ninja is the low-level build tool that runs the build files meson and CMake write. A large share of the tree’s ports is configured by one of those two and then compiled by ninja, so it is one of the build tools 30_foundation installs first, ahead of every shelf section of the phase list. Once /usr/bin/ninja exists, script/env/chroot.env puts script/bin first on PATH, and the ninja wrapper there adds -j$KDOS_JOBS to any call that names no job count, or under a jobserver hands ninja the jobserver’s FIFO instead; see The phase environment.
The port builds ninja from nothing: configure.py --bootstrap compiles a first ninja binary directly with the C++ compiler, then has that binary build the final one. configure.py writes no install rule, so build.sh copies the program and the bash and zsh completions into place itself.
Why it is in KDOS
The comment above the 24 ports from fortify-headers to musl-utils in script/phases/30_foundation/packages.txt is quoted in The build foundation.
Sources
ninja-1.13.2.tar.gz(285.5 KiB)
sha256974d6b2f4eeefa25625d34da3cb36bdcebe7fbce40f4c16ac0835fd1c0cbae17
upstream: https://github.com/ninja-build/ninja/archive/v1.13.2/ninja-1.13.2.tar.gz
archive copy: sources-1/buildtools--ninja-1.13.2.tar.gz
Dependencies
Depends on: python3.
Required by (968): accessibility-inspector, accountsservice, aisleriot, akonadi, akonadi-calendar, akonadi-calendar-tools, akonadi-contacts, akonadi-import-wizard, akonadi-mime, akonadi-search, akonadiconsole, akregator, alembic, alligator, amiberry, aml, analitza, android-tools, angelfish, appstream, aptdec, arianna, ark, arpack-ng, artikulate, assimp, attica, audacious, audacious-plugins, audacity, audex, audiocd-kio, audiotube, aurorae, avogadrolibs, avrdude, ayatana-ido, babl, baloo, baloo-widgets, baresip, basu, bcc, black-hole-solver, blender, blinken, bluedevil, bluez-qt, bolt, bomber, bovo, bpftrace, breeze, breeze-gtk, breeze-icons, brlaser, brotli, c-ares, c-blosc, calendarsupport, calindori, calligra, cantor, capstone, castxml, ccache, celestia, celestia-content, celluloid, cereal, ceres-solver, cgal, chromaprint, chromium, clamav, cm256cc, cmark, codec2, coeurl, coin, compiler-rt, converseen, coolprop, cpp-utilities, cppcheck, cppzmq, cspice, cubicsdr, curaengine, cxx-rust-cssparser, darktable, dav1d, dcmtk, ddnet, deja-dup, devilutionx, digikam, dino, discover, dolphin, dolphin-plugins, dosbox-staging, draco, dragon, dsda-doom, dsdcc, duckdb, dwarves, eigen, elisa, elogind, embree, endless-sky, eventviews, exiv2, extra-cmake-modules, falkon, fast-double-parser, fcitx5-configtool, fcitx5-gtk, fcitx5-qt, ffmpegthumbs, fheroes2, filelight, flameshot, flare-engine, flare-game, flashrom, fltk, fluidsynth, font-manager, fprintd, frameworkintegration, francis, freecad, freecell-solver, freeciv, freeglut, freerdp, frei0r-plugins, ft2-clone, furnace, fuse, futuresql, fwupd, fwupd-efi, fzssh, gcompris, gdal, gegl, geos, gexiv2, gflags, ggmorse, ghostwriter, gimagereader, gimp, gl2ps, glaxnimate, glew, glfw, glm, glmark2, glog, glslang, glu, gmsh, gn, gnome-disk-utility, gnome-mahjongg, gnome-mines, gnome-sudoku, gnucash, gnuradio, gobject-introspection, goldendict-ng, gpgmepp, gqrx, gr-funcube, gr-iqbal, gr-osmosdr, granatier, grantlee-editor, grantleetheme, graphite2, gstreamer, gtest, gthumb, gtk-doc, gtk-vnc, gumbo-parser, gvfs, gwenview, handbrake, haruna, hatari, hdf5, hicolor-icon-theme, highs, highway, horizon-eda, hydrogen, ifcopenshell, iio-sensor-proxy, iir1, imath, imhex, immer, impression, incidenceeditor, inih, iniparser, inkscape, inspectrum, intel-gmmlib, intel-media-driver, ioquake3, iputils, iso-codes, isoimagewriter, ispc, itinerary, jasper, js8call, json-c, jsoncpp, juk, k3b, kaccounts-integration, kaccounts-providers, kactivitymanagerd, kaddressbook, kajongg, kalarm, kalgebra, kalk, kalm, kalzium, kamera, kamoso, kanagram, kapman, kapptemplate, karchive, kasts, kate, katomic, kauth, kbackup, kblackbox, kblocks, kbookmarks, kbounce, kbreakout, kbruch, kcachegrind, kcalc, kcalendarcore, kcalutils, kcharselect, kclock, kcm-kdos-firewall, kcm-kdos-health, kcm-kdos-look, kcmutils, kcodecs, kcolorchooser, kcolorpicker, kcolorscheme, kcompletion, kconfig, kconfigwidgets, kcontacts, kcoreaddons, kcrash, kcron, kdav, kdbusaddons, kddockwidgets, kde-cli-tools, kde-dev-scripts, kde-dev-utils, kde-gtk-config, kde-inotify-survey, kdebugsettings, kdeclarative, kdeconnect, kdecoration, kded, kded-kdos, kdeedu-data, kdegraphics-mobipocket, kdegraphics-thumbnailers, kdenetwork-filesharing, kdenlive, kdepim-addons, kdepim-runtime, kdeplasma-addons, kdesdk-kio, kdesdk-thumbnailers, kdesu, kdev-php, kdev-python, kdevelop, kdevelop-pg-qt, kdf, kdiagram, kdialog, kdiamond, kdiff3, kdnssd, kdoctools, kdominate, kdos-discover, kdos-installer-gui, kdos-kwin-motion, kdos-transcribe, kdos-welcome, kdsingleapplication, kdsoap, kdsoap-ws-discovery-client, keditbookmarks, keepassxc, keepsecret, keysmith, kfilemetadata, kfind, kfourinline, kgeography, kget, kglobalaccel, kglobalacceld, kgoldrunner, kgpg, kgraphviewer, kguiaddons, khangman, khealthcertificate, khelpcenter, kholidays, ki18n, kicad, kicad-footprints, kicad-symbols, kicad-templates, kiconthemes, kidentitymanagement, kidletime, kig, kigo, killbots, kimageannotator, kimageformats, kimagemapeditor, kimap, kinfocenter, kio, kio-admin, kio-extras, kio-fuse, kio-gdrive, kio-library, kio-zeroconf, kirigami, kirigami-addons, kirigami-app-components, kirigami-gallery, kiriki, kitemmodels, kitemviews, kiten, kitinerary, kjobwidgets, kjumpingcube, kldap, kleopatra, klettres, klickety, klines, klog, kmahjongg, kmail, kmail-account-wizard, kmailtransport, kmbox, kmenuedit, kmime, kmines, kmix, kmouth, kmplot, knavalbattle, knetwalk, knewstuff, knights, knighttime, knotifications, knotifyconfig, kodi, koko, kolf, kollision, kolourpaint, kompare, kongress, konqueror, konquest, konsole, kontact, kontactinterface, kontrast, konversation, kopeninghours, koreader, korganizer, kosmindoormap, kpackage, kparts, kpat, kpeople, kpimtextedit, kpipewire, kpkpass, kplotting, kpmcore, kpty, kpublictransport, kqtquickcharts, kquickcharts, kquickimageeditor, krdc, krdp, krecorder, kreversi, krfb, krita, kruler, krunner, ksanecore, kscreen, kscreenlocker, kseexpr, kservice, kshisen, ksirk, ksmtp, ksnakeduel, kspaceduel, ksquares, ksshaskpass, kstatusnotifieritem, ksudoku, ksvg, ksystemlog, ksystemstats, ksystemstats-kdos, kteatime, ktextaddons, ktexteditor, ktexttemplate, ktextwidgets, ktimer, ktnef, ktorrent, ktouch, ktrip, ktuberling, kturtle, kubrick, kunifiedpush, kunitconversion, kup, kwallet, kwallet-pam, kwalletmanager, kwave, kwayland, kweather, kweathercore, kwidgetsaddons, kwin, kwin-effect-kdos-keys, kwin-script-kdos-runraise, kwin-script-kdos-window-memory, kwindowsystem, kwordquiz, kwrited, kxmlgui, labplot, lager, lagrange, layer-shell-qt, ledger, lib2geom, lib3mf, libaccounts-glib, libad9361, libarcus, libayatana-appindicator, libayatana-indicator, libbluray, libcacard, libcamera, libcerf, libclc, libcue, libdab, libdbusmenu-lxqt, libdbusmenu-qt5, libdecor, libdvdcss, libdvdnav, libdvdread, libebml, libebur128, libei, libevdev, libfprint, libftdi, libggml, libgit2, libgme, libgravatar, libgusb, libharu, libical, libiio, libinmarsatc, libjaylink, libjpeg-turbo, libjxl, libkcddb, libkdcraw, libkdegames, libkdepim, libkeduvocdocument, libkexiv2, libkgapi, libkleo, libkmahjongg, libkomparediff2, libksane, libkscreen, libksieve, libksysguard, libktorrent, liblc3, liblxi, libmad, libmatroska, libmed, libmt32emu, libmusicbrainz5, libmysofa, libnfs, libnice, libnvme, libosinfo, libpciaccess, libpeas, libphonenumber, libplacebo, libplasma, libpoly, libproxy, libpulse, libqaccessibilityclient, libquotient, libre, librecad, librepcb, libretro-mgba, librist, libsavitar, libsigmf, libsoundio, libspatialaudio, libspatialindex, libspng, libsrt, libsrtp, libssh, libtiff, libtorrent-rasterbar, libudfread, libva, libva-intel-driver, libva-utils, libvirt, libvirt-glib, libvncserver, libwacom, libwebp, libwebsockets, libxfce4util, libxmp, lilv, limesuite, limesuite-gui, liquid-dsp, lite-xl, llama.cpp, llvm, llvm21, lmms, lokalize, lskat, luanti, lv2, lxi-tools, mailcommon, mailimporter, manifold, marble, markdownpart, massif-visualizer, mbedtls, mbelib, mbox-importer, merkuro, mesa-demos, meshoptimizer, meson, messagelib, mgba, milkytracker, milou, mimetreeparser, miniupnpc, minizip-ng, minuet, mlt, modemmanager-qt, mpd, mpv, mpvqt, mtxclient, mumble, musescore, musl-locales, ndctl, neochat, netgen, networkmanager-qt, nextpnr, nheko, nng, numpy, nvme-cli, nvtop, obs-studio, ocean-sound-theme, oidn, okular, olm, onetbb, onnxruntime, openal-soft, openbabel, opencascade, opencc, opencl-clhpp, opencl-headers, opencolorio, opencpn, opencsg, opencv, openfpgaloader, openh264, openimageio, openmp, openrct2, openscad, opensubdiv, opentimelineio, openttd, openvdb, optipng, orc, orca, orcaslicer, organicmaps, osinfo-db-tools, oxygen, oxygen-sounds, p11-kit, palapeli, pam, pandas, parley, partitionmanager, pdal, pdf4qt, pdfium, phodav, phonon, phonon-backend-vlc, physfs, picmi, picolibc-arm-none-eabi, picolibc-riscv64-unknown-elf, pim-data-exporter, pim-sieve-editor, pimcommon, pioneer, piper, pipewire, pivy, pixman, plasma-activities, plasma-activities-stats, plasma-browser-integration, plasma-camera, plasma-desktop, plasma-disks, plasma-integration, plasma-keyboard, plasma-nm, plasma-pa, plasma-phonebook, plasma-sdk, plasma-setup, plasma-systemmonitor, plasma-thunderbolt, plasma-vault, plasma-wayland-protocols, plasma-welcome, plasma-workspace, plasma-workspace-wallpapers, plasma5support, plasmatube, plasmoid-kdos-checklist, plasmoid-kdos-privacy, plutosvg, plutovg, poco, podofo, polkit-kde-agent-1, polkit-qt6, poppler, portsmf, powder-toy, powerdevil, poxml, ppsspp, print-manager, prison, prjtrellis, proj, prusaslicer, pt2-clone, ptouch-print, pulseaudio-qt, purpose, pystring, python3-cairo, python3-contourpy, python3-dbus, python3-gobject, python3-iminuit, python3-meson-python, python3-nanobind, python3-pikepdf, python3-pyatspi, python3-pybind11, python3-pyside6, python3-pyuvula, python3-pyzmq, python3-scikit-build-core, qbittorrent, qca, qca-qt5, qcad, qcoro, qemu, qgis, qgpgme, qmapshack, qmlkonsole, qownnotes, qpdf, qqc2-breeze-style, qqc2-desktop-style, qrca, qrupdate, qt-creator, qt5ct, qt6-qt3d, qt6-qt5compat, qt6-qtbase, qt6-qtcharts, qt6-qtconnectivity, qt6-qtdeclarative, qt6-qtgraphs, qt6-qthttpserver, qt6-qtimageformats, qt6-qtlanguageserver, qt6-qtlocation, qt6-qtmqtt, qt6-qtmultimedia, qt6-qtnetworkauth, qt6-qtpositioning, qt6-qtquick3d, qt6-qtremoteobjects, qt6-qtscxml, qt6-qtsensors, qt6-qtserialport, qt6-qtshadertools, qt6-qtspeech, qt6-qtsvg, qt6-qttools, qt6-qttranslations, qt6-qtvirtualkeyboard, qt6-qtwayland, qt6-qtwebchannel, qt6-qtwebengine, qt6-qtwebsockets, qt6-qtwebview, qtforkawesome, qtkeychain, qtspell, qtutilities, quassel, quazip, qucs-s, qv4l2, rapidjson, rawtherapee, re2, remmina, resources, rhythmbox, rinutils, rizin, rkward, rocs, rtaudio, rttr, satdump, scipy, sdcv, sddm, sddm-kcm, sdl12-compat, sdl2-compat, sdl2-image, sdl2-mixer, sdl2-net, sdl2-ttf, sdl3, sdl3-image, sdl3-mixer, sdl3-ttf, sdrangel, sdrpp, selenium-webdriver-at-spi, serd, serialdv, sgp4, shaderc, shapelib, shared-mime-info, shotcut, signon-kwallet-extension, skanlite, skanpage, skladnik, snappy, solid, solvespace, sonnet, sonnet-qt5, soqt, sord, spdlog, spectacle, spice, spice-gtk, spice-protocol, spirv-headers, spirv-llvm-translator, spirv-tools, sqlitebrowser, sratom, srb2, stellarium, step, stlink, stlink-gui, strawberry, suil, suitesparse, sundials, supertux, supertuxkart, svgpart, swayimg, sweeper, switcheroo-control, syncthingtray, syndication, syntax-highlighting, systemsettings, taglib, taskwarrior, telly-skout, tenacity, tesseract, texstudio, threadweaver, thrift, timewarrior, tinyxml2, tio, tokodon, tomlplusplus, totem-pl-parser, translatelocally, transmission, turnstile, uhd, umbrello, union, uriparser, usbredir, utfcpp, v4l-utils, vidstab, virt-manager, vte3, vtk, vulkan-loader, vulkan-tools, warzone2100, wayland-utils, waylandpp, waypipe, webkitgtk, webkitgtk6, webp-pixbuf-loader, webrtc-audio-processing, wesnoth, widelands, wireplumber, wireshark, wlvncc, woff2, wsjtx, wxwidgets, xdg-desktop-portal-kde, xdg-user-dirs, xerces-c, xfburn, xsettingsd, xsimd, yakuake, yaml-cpp, yosys, z3, zanshin, zeal, zenity, zig, zint, zix, zlib-ng, zug, zziplib.
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/30_foundation/phase.env && kpkg install ninja'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/buildtools/ninja.
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/buildtools/ninja
echo '974d6b2f4eeefa25625d34da3cb36bdcebe7fbce40f4c16ac0835fd1c0cbae17 ninja-1.13.2.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/ninja
SRC=$SRC_ROOT/ninja-1.13.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf ninja-1.13.2.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 five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
env -u CFLAGS CXXFLAGS="$CXXFLAGS -g0" python3 ./configure.py --bootstrap
install -Dm755 ninja $PKG/usr/bin/ninja
install -Dm644 misc/bash-completion $PKG/usr/share/bash-completion/completions/ninja
install -Dm644 misc/zsh-completion $PKG/usr/share/zsh/site-functions/_ninja
The switches, and why each is set:
--bootstrap— Build ninja without an installed ninja.configure.pyruns the compiler itself for a first binary, then rebuilds ninja with it. Python 3 is the only other tool it needs, which is whypython3is the port’s one dependency.env -u CFLAGS—configure.pyappends bothCFLAGSandCXXFLAGSto its compile and link lines, and ninja is written entirely in C++. UnsettingCFLAGSkeeps the tree’s C-only-std=gnu11off a C++ compile line and stops the release flags appearing twice;CXXFLAGSalone carries them.-g0—configure.pyalways compiles with-g.-g0comes after it on the line and cancels it, so the binary carries no debug information, like every other release build in the tree.
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/ninja, 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 ninja-1.13.2-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/ninja, and runs the triggers its paths call for.
Contents
Installed programs: ninja.
Installed directories: /usr/share/licenses/ninja.