Skip to the text
KDOS
Menu
kdos.dev KDOS from Scratch KDOS 0.2 · 4dd4a10 · 2026-11-30 Contents Index

105.17. libssh-0.12.2

SSH protocol library (client and server)

Version 0.12.2, release 1
Shelf net-libs — Networking and protocol libraries
Phase 41_system (System), 795 of 1047 in build order
Licence LGPL-2.1-or-later
Homepage https://www.libssh.org/
Build time 0.5 SBU
Installed size 1.0 MiB in 18 files
Recipe ports/core/net-libs/libssh/kpkgbuild

About

libssh is a C library implementing the SSH protocol, client and server, with SFTP and SCP. It is not OpenSSH’s code. wireshark uses it for remote capture over SSH, remmina and krdc for SSH sessions and tunnels, kio-extras for the sftp:/ locations of Dolphin and the file dialogs, and konsole and nbdkit for their SSH support. Cryptography comes from openssl.

Sources

Dependencies

Depends on: cmake, ninja, pkgconf, openssl, zlib, krb5, libfido2.

Required by (6): kio-extras, konsole, krdc, nbdkit, remmina, wireshark.

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.

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 libssh'

What kpkg does

kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/net-libs/libssh.

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/libssh
echo '49560f677d96e3706a904ac2de1116e25f3680937d51e5c92198fcba4a1c1e9f  libssh-0.12.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/libssh
SRC=$SRC_ROOT/libssh-0.12.2
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf libssh-0.12.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:

mkdir build && cd build
cmake .. -G Ninja \
	-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_INSTALL_PREFIX=/usr \
	-DCMAKE_INSTALL_LIBDIR=lib \
	-DBUILD_SHARED_LIBS=ON \
	-DWITH_GSSAPI=ON \
	-DWITH_ZLIB=ON \
	-DWITH_SFTP=ON \
	-DWITH_SERVER=ON \
	-DWITH_GCRYPT=OFF \
	-DWITH_MBEDTLS=OFF \
	-DWITH_NACL=OFF \
	-DWITH_FIDO2=ON \
	-DWITH_PKCS11_URI=OFF \
	-DWITH_PKCS11_PROVIDER=OFF \
	-DWITH_GEX=ON \
	-DWITH_PCAP=ON \
	-DWITH_EXEC=ON \
	-DWITH_SYMBOL_VERSIONING=ON \
	-DWITH_INSECURE_NONE=OFF \
	-DWITH_BLOWFISH_CIPHER=OFF \
	-DWITH_EXAMPLES=OFF \
	-DWITH_INTERNAL_DOC=OFF \
	-DUNIT_TESTING=OFF \
	-DCLIENT_TESTING=OFF \
	-DSERVER_TESTING=OFF \
	-DGSSAPI_TESTING=OFF \
	-DFUZZ_TESTING=OFF \
	-DWITH_BENCHMARKS=OFF
ninja
DESTDIR=$PKG ninja install

The switches, and why each is set:

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/libssh, 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 libssh-0.12.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/libssh, and runs the triggers its paths call for.

Contents

Installed libraries: libssh.so.

Installed directories: /usr/include/libssh, /usr/lib/cmake/libssh, /usr/share/licenses/libssh.

Short descriptions

libssh.pc The SSH Library