# kpipewire 6.7.2 — captura de streams PipeWire para Plasma (KPipeWire + **KPipeWireRecord**).
# Campaña KDE (ADR 0011): es el último blocker de spectacle, que linkea `K::KPipeWireRecord` de forma
# INCONDICIONAL (src/CMakeLists.txt:101). También lo usan la compartición de pantalla y los portales.
#
# Deps REQUIRED (pkg_check_modules): libpipewire-0.3 (receta pipewire) + libavcodec/libavutil/libavformat/
# libavfilter (receta ffmpeg) + gbm (mesa) + EGL (mesa). Qt6: DBus OpenGL Quick (+GuiPrivate). KF6: I18n
# CoreAddons.
name    = "kpipewire"
version = "6.7.2"

[source]
tarball = "https://download.kde.org/stable/plasma/6.7.2/kpipewire-6.7.2.tar.xz"
sha256  = "68bd246f4d403d3d7f49bd2ffcd4e0d12bc55fa81554533f750ac2e4bb5aa61e"

[build]
compiler = "zig-cc"
target   = "x86_64-linux-musl"
link     = "dynamic"
flags    = []

[build.phases]
configure = '''
rm -rf po
ZW="$PWD/.zwrap"; mkdir -p "$ZW"
cat > "$ZW/cc"  <<'W'
#!/bin/sh
a=""; for x in "$@"; do [ "$x" = "-Wl,--fatal-warnings" ] && continue; a="$a $x"; done
exec /opt/zig/zig cc -mcpu=baseline $a
W
cat > "$ZW/cxx" <<'W'
#!/bin/sh
a=""; for x in "$@"; do [ "$x" = "-Wl,--fatal-warnings" ] && continue; a="$a $x"; done
exec /opt/zig/zig c++ -mcpu=baseline $a
W
chmod +x "$ZW/cc" "$ZW/cxx"
cmake -B build -G Ninja -Wno-dev \
  -DCMAKE_C_COMPILER="$ZW/cc" -DCMAKE_CXX_COMPILER="$ZW/cxx" -DCMAKE_ASM_COMPILER="$ZW/cc" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DCMAKE_INTERPROCEDURAL_OPTIMIZATION=OFF -DBUILD_TESTING=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools",
  "gettext-tiny", "mesa", "libdrm", "libxkbcommon", "wayland", "wayland-protocols",
  "plasma-wayland-protocols", "qtwayland", "qtdeclarative",
  "pipewire", "ffmpeg", "libva", "alsa-lib", "libsndfile", "pulseaudio",
  "glib-shared", "pcre2-shared", "libffi", "libudev-zero", "expat",
  "ki18n", "kcoreaddons", "kwayland", "zlib-shared", "libepoxy",
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi",
  "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image", "xcb-util-renderutil"]
