# exiv2 0.28.5 — lectura/escritura de metadatos de imagen EXIF/IPTC (libexiv2.so). Campaña KDE (ADR 0011):
# gwenview lo exige TYPE REQUIRED (soporte de metadatos de imagen).
#
# CMake + wrapper zig. Minimal: sólo PNG(zlib). XMP(expat+brotli), BMFF/Brotli, inih y NLS OFF ⇒ única dep
# runtime = libz.so (zlib-shared). Sin CLI ni samples.
name    = "exiv2"
version = "0.28.5"

[source]
tarball = "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.28.5.tar.gz"
sha256  = "e1671f744e379a87ba0c984617406fdf8c0ad0c594e5122f525b2fb7c28d394d"

[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_CXX_FLAGS="-Wno-error=date-time" \
  -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_PREFIX_PATH=/usr \
  -DBUILD_SHARED_LIBS=ON -DEXIV2_ENABLE_PNG=ON \
  -DEXIV2_ENABLE_XMP=OFF -DEXIV2_ENABLE_BMFF=OFF -DEXIV2_ENABLE_BROTLI=OFF \
  -DEXIV2_ENABLE_INIH=OFF -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_WEBREADY=OFF \
  -DEXIV2_BUILD_SAMPLES=OFF -DEXIV2_BUILD_EXIV2_COMMAND=OFF -DEXIV2_BUILD_UNIT_TESTS=OFF
'''
compile = "cmake --build build"
install = "DESTDIR=/out cmake --install build"

[deps]
build = ["cmake", "samurai", "python3", "pkgconf", "zlib-shared"]
