# kcalc 25.04.3 — la calculadora de KDE (release-service). 4ta APP del escritorio.
# Patrón KF6 app (dynamic, wrapper zig, ECM). Su lib interna `knumber` usa GMP+MPFR+MPC (aritmética de
# enteros/floats/complejos de precisión arbitraria); knumber_complex.cpp incluye <mpc.h> siempre ⇒ mpc
# es build-dep duro (además de gmp/mpfr ya sellados). find_package(MPC) por módulo bundleado
# (cmake/modules/FindMPC.cmake) localiza mpc.h/libmpc en /usr (deps materializadas).
name    = "kcalc"
version = "25.04.3"
license = "GPL-2.0-or-later"

[source]
tarball = "https://download.kde.org/stable/release-service/25.04.3/src/kcalc-25.04.3.tar.xz"
sha256  = "1b6f52ff6950a5c7f6754bb41fd036af4a016939227b2f4351f3836ba705348b"

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

[build.phases]
configure = '''
rm -rf po doc appiumtests
# KF6DocTools opcional (no REQUIRED) → nada de doc. BUILD_TESTING=OFF cubre autotests/knumber/tests.
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
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", "qtdeclarative",
  "gmp", "mpfr", "mpc",
  "kcoreaddons", "kconfig", "kconfigwidgets", "kcolorscheme", "kcodecs", "kguiaddons", "ki18n",
  "kwidgetsaddons", "kxmlgui", "kcrash", "knotifications", "kiconthemes", "karchive", "sonnet",
  "kwindowsystem", "kglobalaccel", "kauth", "solid", "attica", "kcompletion", "kitemviews",
  "kjobwidgets", "kservice", "kdbusaddons", "icu4c",
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi",
  "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image", "xcb-util-renderutil"]
