# qcoro 0.12.0 — coroutines C++20 para Qt6 (QCoro6Core/QCoro6DBus). La usan varios componentes de
# plasma-workspace y powerdevil. CMake + Qt6. Molde KF6 (wrapper zig, PREFIX_PATH=/usr). Apagamos
# WebSockets/Quick/QML/Test/examples (módulos Qt no sellados o innecesarios); dejamos Core+DBus+Network.
#   CMakeLists: option QCORO_WITH_QTDBUS(ON en Linux), QTNETWORK(ON), QTWEBSOCKETS(ON), QTQUICK(ON),
#   QML(ON), QTTEST(ON), BUILD_EXAMPLES(ON) → forzamos OFF salvo DBus/Network (qtbase provee ambos).
name    = "qcoro"
version = "0.12.0"

[source]
tarball = "https://github.com/qcoro/qcoro/archive/refs/tags/v0.12.0.tar.gz"
sha256  = "809afafab61593f994c005ca6e242300e1e3e7f4db8b5d41f8c642aab9450fbc"

[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 \
  -DQCORO_BUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF \
  -DQCORO_WITH_QTDBUS=ON -DQCORO_WITH_QTNETWORK=ON \
  -DQCORO_WITH_QTWEBSOCKETS=OFF -DQCORO_WITH_QTQUICK=OFF \
  -DQCORO_WITH_QML=OFF -DQCORO_WITH_QTTEST=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "qtbase", "dbus", "mesa", "libdrm", "libxkbcommon", "wayland"]
