105.28. libsmi-0.5.0
SNMP MIB and SMI module library — smilint, smidump, smiquery and the IETF and IANA MIBs
| Version | 0.5.0, release 1 |
| Shelf | net-libs — Networking and protocol libraries |
| Phase | 41_system (System), 806 of 1047 in build order |
| Licence | TCL AND BSD-3-Clause |
| Homepage | https://www.ibr.cs.tu-bs.de/projects/libsmi/ |
| Build time | 0.6 SBU |
| Installed size | 19.2 MiB in 471 files |
| Recipe | ports/core/net-libs/libsmi/kpkgbuild |
About
libsmi reads SNMP MIB modules written in SMIv1, SMIv2, SMIng and YANG, and gives programs a parsed view of their objects and types. The package also installs command-line tools such as smilint, smidump and smiquery, and MIB collections that include the IETF and IANA modules. wireshark links it to name OIDs and decode values in SNMP traffic.
Sources
libsmi-0.5.0.tar.gz(4.6 MiB)
sha256f21accdadb1bb328ea3f8a13fc34d715baac6e2db66065898346322c725754d3
upstream: https://www.ibr.cs.tu-bs.de/projects/libsmi/download/libsmi-0.5.0.tar.gz
archive copy: sources-3/net-libs--libsmi-0.5.0.tar.gzgcc14-declarations.patch
sha256f356dbf0af0e6a4e3dedbf2a79a751a147ab12cd54d45f0e136e15b03543b81f
archive copy: sources-3/net-libs--gcc14-declarations.patch
Dependencies
Depends on: pkgconf.
Required by (1): wireshark.
Patches
build.sh applies these; kpkg applies nothing by itself.
gcc14-declarations.patch— Add the declarations C99 and later require before a call:lib/error.hincludessmi-check.h,lib/parser-yang.yand the shippedlib/parser-yang.cincludeyang-check.h, andlib/yang-data.hdeclarescreateIdentifierRef(). GCC 14 makes an implicit function declaration an error, so without them the library does not compile.
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 libsmi'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/libsmi.
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/net-libs/libsmi
echo 'f21accdadb1bb328ea3f8a13fc34d715baac6e2db66065898346322c725754d3 libsmi-0.5.0.tar.gz' | sha256sum -c -
echo 'f356dbf0af0e6a4e3dedbf2a79a751a147ab12cd54d45f0e136e15b03543b81f gcc14-declarations.patch' | 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/libsmi
SRC=$SRC_ROOT/libsmi-0.5.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libsmi-0.5.0.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:
patch -p1 -i "$PORT_SRC/gcc14-declarations.patch"
touch lib/parser-smi.c lib/parser-smi.tab.h lib/parser-sming.c lib/parser-sming.tab.h \
lib/parser-yang.c lib/parser-yang.tab.h
touch lib/scanner-smi.c lib/scanner-sming.c lib/scanner-yang.c
./configure \
--prefix=/usr \
--libdir=/usr/lib \
--sysconfdir=/etc \
--mandir=/usr/share/man \
--disable-static
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/libsmi, 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 libsmi-0.5.0-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/libsmi, and runs the triggers its paths call for.
Contents
Installed programs: smicache, smidiff, smidump, smilint, smiquery, smistrip, smixlate.
Installed libraries: libsmi.so.
Installed directories: /usr/share/licenses/libsmi, /usr/share/mibs, /usr/share/pibs, /usr/share/yang.
Short descriptions
smicache |
caching method for use with libsmi |
smidiff |
check differences between a pair of SMI or SPPI modules |
smidump |
dump SMI or SPPI modules in various formats |
smilint |
syntax and semantic checks of SMIv1/v2 and SPPI modules |
smiquery |
query single information from SMI MIB modules |
smistrip |
extract MIB or PIB modules from text files, like RFCs or I-Ds |
smixlate |
translate SMI/SPPI identifiers |
libsmi.pc |
SMI parser library |
Notes
The release tarball ships the bison parsers and flex scanners already generated. The patch touches parser-yang.y, which makes it newer than parser-yang.c, and make would then try to run bison; neither bison nor flex is in depends. So build.sh touches every generated parser, header and scanner after patching, making them newer than their .y and .l sources, and the shipped files, with the patch applied to parser-yang.c as well, are compiled as they are.