302.1. baresip-4.11.0
SIP softphone for voice calls
| Version | 4.11.0, release 4 |
| Shelf | chat — Instant messaging, IRC, XMPP, Matrix, fediverse and voice clients, with their protocol and E2E libraries |
| Phase | 44_apps (Applications), 28 of 422 in build order |
| Licence | BSD-3-Clause |
| Homepage | https://github.com/baresip/baresip |
| Build time | 0.4 SBU |
| Installed size | 2.6 MiB in 90 files |
| Recipe | ports/core/chat/baresip/kpkgbuild |
About
baresip is a SIP softphone: it registers with a SIP account and makes and takes voice and video calls, with its features in loadable modules (codecs, audio and video devices, NAT traversal, media encryption, user interfaces). It runs in a terminal, and its desktop entry, Telephone, opens it in one. It is built on libre, the SIP and media library from the same project.
Why it is in KDOS
The comment above it in script/phases/44_apps/packages.d/chat.txt:
VOICE, which is what people default to under stress: this tree carries text, serves documents and stands up a network with no router, and this is the way for two people on it to talk.
Sources
baresip-4.11.0.tar.gz(1.2 MiB)
sha256e170ad5857994dfed0c84c4c04eb904fa410f3ec2d5a6c789b50b3fda47ba98c
upstream: https://github.com/baresip/baresip/archive/refs/tags/v4.11.0.tar.gz
archive copy: sources-1/chat--baresip-4.11.0.tar.gz
Dependencies
Depends on: cmake, ninja, pkgconf, libre, openssl, alsa-lib, pipewire, opus, libvpx, ffmpeg, zlib, sdl2-compat, glib, libsndfile, libpng, fdk-aac, v4l-utils.
Required by: no port names it.
Patches
build.sh applies these; kpkg applies nothing by itself.
default-modules.patch— changes the configuration template insrc/config.cso that theopus,avcodec,vp8,vp9andsdlmodules are loaded instead of commented out. The template is written only when~/.baresip/configdoes not exist; upstream comments these lines out because amoduleline for a module that is not installed is a start-up error, and this port builds and installs all five. Without them a first-run phone negotiates only G.711 and has no video codec and nowhere to show a picture. The camera stays a choice:v4l2is built but its line is left as upstream wrote it, as arex11, which is not built, andfakevideo.
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/44_apps/phase.env && kpkg install baresip'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/chat/baresip.
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/chat/baresip
echo 'e170ad5857994dfed0c84c4c04eb904fa410f3ec2d5a6c789b50b3fda47ba98c baresip-4.11.0.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/baresip
SRC=$SRC_ROOT/baresip-4.11.0
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf baresip-4.11.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/default-modules.patch"
modules=(
account alsa aubridge auconv aufile augain auresamp ausine
avcodec avfilter avformat swscale
cons contact ctrl_dbus ctrl_tcp debug_cmd dtls_srtp echo evdev
fakevideo g711 aac httpd httpreq ice in_band_dtmf l16 menu
mixausrc mixminus mwi natpmp netroam opus opus_multistream pcp
pipewire presence rtcpsummary sdl selfview serreg snapshot sndfile
srtp stdio stun syslog turn uuid v4l2 vidbridge vidinfo vp8 vp9 vumeter
)
mkdir -p build && cd build
cmake .. -G Ninja \
-DCMAKE_POLICY_VERSION_MINIMUM=3.5 \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_INSTALL_LIBDIR=lib \
-DSTATIC=OFF \
-DDEFAULT_AUDIO_DEVICE=pipewire,default \
"-DMODULES=$(IFS=';'; echo "${modules[*]}")"
ninja
DESTDIR=$PKG ninja install
rm -f "$PKG/usr/share/applications/com.github.baresip.desktop"
install -d "$PKG/usr/share/applications"
cat > "$PKG/usr/share/applications/baresip.desktop" <<'EOF'
[Desktop Entry]
Type=Application
Name=Telephone
GenericName=SIP Softphone
Comment=Voice calls over SIP
Exec=baresip
Icon=call-start
Terminal=true
Categories=Network;Telephony;
Keywords=sip;voip;call;phone;telephone;baresip;
EOF
chmod 644 "$PKG/usr/share/applications/baresip.desktop"
The switches, and why each is set:
-DSTATIC=OFF— buildlibbaresipand every module as shared objects, loaded by name from the configuration. It is upstream’s default off Windows, named.-DDEFAULT_AUDIO_DEVICE=pipewire,default— the audio device compiled into the program (default_audio_device()insrc/config.c) instead ofalsa,default. The same value decides the template baresip writes as~/.baresip/configon its first run: with apipewiredevice,module pipewire.sois written uncommented andalsa.soandpulse.socommented out, so calls go to PipeWire, the session’s sound server.-DMODULES— the modules to build, joined from themodulesarray at the top ofbuild.shinto CMake’s;-separated list. Upstream’s default list is every module it has, and each module builds whenever the library it needs is found, so the set would follow whatever happens to be installed in the build root. Naming them fixes it. Left out are the modules for other systems (Android, macOS, Windows, BSD); modules whose library the tree does not carry (AMR, AV1, G.722 and G.722.1, ZRTP, and packet-loss concealment through spandsp; theaptxmodule looks forlibopenaptx, where the tree has thelibfreeaptxfork, andwebrtc_aec, which looks only forwebrtc-audio-processing-1, not the API the webrtc-audio-processing port installs); and modules whose library the tree does carry but this port does not use:gtk,x11,pulse,jack(PipeWire’slibjack; see JACK programs on the host),portaudio,gst,mqttandcodec2.
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/baresip, 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 baresip-4.11.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/baresip, and runs the triggers its paths call for.
Contents
Installed programs: baresip.
Installed libraries: libbaresip.so.
Installed directories: /usr/lib/baresip, /usr/share/baresip, /usr/share/licenses/baresip.
Short descriptions
Notes
A module named in MODULES whose library is missing is still skipped without an error, because each module’s own CMakeLists.txt returns quietly when its find_package fails. So every library a listed module links is in depends, and a module added to the list needs its library added there too.
build.sh deletes upstream’s com.github.baresip.desktop and writes baresip.desktop with Terminal=true: the interface the generated configuration loads is the stdio and menu modules, which read keys from the terminal.