42.3. bison-3.8.2
The GNU Bison parser generator
| Version | 3.8.2, release 1 |
| Shelf | toolchain — The native compilers, the linker, the C library, and the LLVM family |
| Phase | 30_foundation (Build Foundation), 21 of 127 in build order |
| Licence | GPL-3.0-or-later |
| Homepage | https://www.gnu.org/software/bison/ |
| Build time | 0.6 SBU |
| Installed size | 2.5 MiB in 92 files |
| Recipe | ports/core/toolchain/bison/kpkgbuild |
About
GNU Bison generates parsers: from a grammar it writes C, C++ or Java code for a deterministic LR or a generalised LR parser. It is a compatible replacement for yacc, and installs a yacc command, a script that runs bison -y, and liby.a, the small library of the main and yyerror that POSIX yacc programs may link.
In KDOS it is a build-time tool for many ports, from linux itself and binutils-avr to mesa, gobject-introspection, nftables, iptables, wireshark, graphviz, doxygen and vala. It is built in 30_foundation with the other build tools.
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
bison-3.8.2.tar.xz(2.7 MiB)
sha2569bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2
upstream: https://mirrors.ocf.berkeley.edu/gnu/bison/bison-3.8.2.tar.xz
archive copy: sources-4/toolchain--bison-3.8.2.tar.xz
Dependencies
Required by (58): acpica, avrdude, bcc, binutils-arm-none-eabi, binutils-avr, binutils-riscv64-unknown-elf, bpftrace, chromium, digikam, doxygen, dtc, gnumeric, gobject-introspection, graphviz, groff, gstreamer, iptables, ispc, iverilog, kdevelop-pg-qt, kholidays, kopeninghours, kosmindoormap, krb5, kseexpr, labplot, lasem, libcue, libnl, libnslog, libpcap, linux, lm-sensors, mesa, mesa-opencl, motif, nftables, ngspice, nsgenbind, octave, openscad, perf, powerman, qgis, qt6-qtwebengine, qucs-s, sc-im, sdcc, solid, thrift, vala, verilator, vice, webkitgtk, webkitgtk6, wine, wireshark, yosys.
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 bison'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/toolchain/bison.
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/toolchain/bison
echo '9bba0214ccf7f1079c5d59210045227bcf619519840ebfa80cd3849cff5a5bf2 bison-3.8.2.tar.xz' | 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/bison
SRC=$SRC_ROOT/bison-3.8.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf bison-3.8.2.tar.xz -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:
./configure --prefix=/usr --disable-nls
make
make DESTDIR=$PKG install
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/bison, 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 bison-3.8.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/bison, and runs the triggers its paths call for.
Contents
Installed programs: bison, yacc.
Installed libraries: liby.a.
Installed directories: /usr/share/bison, /usr/share/doc/bison, /usr/share/licenses/bison.
Short descriptions
bison |
GNU Project parser generator (yacc replacement) |
yacc |
GNU Project parser generator |
Notes
Bison runs m4 every time it generates a parser. configure records the m4 it found as an absolute path, /usr/bin/m4, in the program, so m4 is a run-time dependency as well as a build one: without it Bison cannot generate a parser.