# solid 6.27.0 — KDE Frameworks 6 (Capa 2, ADR 0011). Patrón KF6: dynamic, wrapper zig que filtra
# -Wl,--fatal-warnings (ECM lo agrega, zig lo rechaza), CMAKE_PREFIX_PATH=/usr, ECM + qttools + dbus.
name    = "solid"
version = "6.27.0"

[source]
tarball = "https://download.kde.org/stable/frameworks/6.27/solid-6.27.0.tar.xz"
sha256  = "70a9ee69b4357ebf83cc87aa61db6fdff8c96a59e24f9572e51716f1d3c579fe"

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

[build.phases]
configure = '''
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 -DBUILD_PYTHON_BINDINGS=OFF \
  -DCMAKE_AUTOMOC_MOC_OPTIONS=-D__linux__=1
'''
# ↑ moc_predefs FIX: CMake no setea CMAKE_CXX_COMPILER_PREDEFINES_COMMAND para zig-as-clang ⇒ el
# moc_predefs.h que alimenta a moc queda VACÍO ⇒ moc no ve __linux__ ⇒ toma la rama #else (no-Linux)
# de fstabwatcher.h y genera onFileChanged, pero el COMPILADOR sí define __linux__ y usa onMountChanged
# ⇒ "no member named onFileChanged". Darle -D__linux__=1 a moc realinea Q_OS_LINUX. Patrón KF6 para
# cualquier framework con slots/signals moc detrás de #ifdef Q_OS_LINUX.
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
# libudev-zero: solid hace find_package(UDev REQUIRED) en Linux (enumera dispositivos). Provee
# libudev.so soberano sin udevd (lee /sys+/dev directo), coherente con arje-init sin systemd.
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "extra-cmake-modules", "qttools", "qtdeclarative", "flex", "bison", "util-linux", "mesa", "libdrm", "libxkbcommon", "wayland", "libudev-zero"]
