# ark 25.04.3 — el gestor de archivos comprimidos de KDE. 5ta APP del escritorio.
# Patrón KF6 app (dynamic, wrapper zig, ECM). Motor: libarchive (tar/gz/bz2/xz/zstd/7z/iso) + libzip
# (ZIP nativo). find_package(LibArchive) usa el FindLibArchive.cmake de cmake; LibZip vía su config
# cmake instalado. KF6DocTools se degrada a opcional (evita docbook).
name    = "ark"
version = "25.04.3"

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

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

[build.phases]
configure = '''
rm -rf po doc
# KF6DocTools está en el COMPONENTS REQUIRED → sacarlo, borrar doc y la macro kdoctools_install (queda
# indefinida sin el framework).
sed -i 's/\bDocTools\b//' CMakeLists.txt
sed -i '/add_subdirectory(doc)/d' CMakeLists.txt
sed -i '/kdoctools_install/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",
  "libarchive", "libzip", "zlib-shared", "bzip2-shared", "xz-shared", "zstd", "openssl",
  "kconfig", "kcrash", "kdbusaddons", "kfilemetadata", "ki18n", "kio", "kservice", "kparts",
  "kwidgetsaddons", "kwindowsystem", "kiconthemes", "kpty",
  "kcoreaddons", "kcompletion", "kcodecs", "kcolorscheme", "kconfigwidgets", "kxmlgui", "kguiaddons",
  "kitemviews", "kjobwidgets", "sonnet", "karchive", "kbookmarks", "solid", "attica", "kglobalaccel",
  "kauth", "icu4c", "knotifications", "ktextwidgets", "kirigami", "kpackage",
  "libX11", "xorgproto", "libXau", "libXdmcp", "libXext", "libXrender", "libXfixes", "libXi",
  "libxcb", "xcb-util", "xcb-util-keysyms", "xcb-util-wm", "xcb-util-image", "xcb-util-renderutil"]
