# libtiff-shared 4.7.0 — variante DINÁMICA (libtiff.so, NEEDED libz.so/libjpeg.so) para la isla GNOME.
# gtk4 EXIGE libtiff-4 (meson.build:450, sin required:false ⇒ no se puede quitar). El canónico es
# BUILD_SHARED_LIBS=OFF: su libtiff.a arrastra zlib/jpeg como cadena estática que gtk4 (dinámico) no
# resuelve ('undefined inflate'). La .so lo resuelve por NEEDED. Ver [[gnome-introspection-dinamica]].
name    = "libtiff-shared"
version = "4.7.0"

[source]
tarball = "https://download.osgeo.org/libtiff/tiff-4.7.0.tar.gz"
sha256  = "67160e3457365ab96c5b3286a0903aa6e78bdc44c4bc737d2e486bcecb6ba976"

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

[build.phases]
# --undefined-version: el version-script de libtiff.so nombra símbolos Windows-only (TIFFOpenWExt) que
# en musl no se compilan; lld lo trata como error salvo con este flag (lo hace laxo, estándar en cross).
configure = "cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_SHARED_LINKER_FLAGS=-Wl,--undefined-version -Dtiff-tools=OFF -Dtiff-tests=OFF -Dtiff-contrib=OFF -Dtiff-docs=OFF -Dzlib=ON -Djpeg=ON -Dlzma=OFF -Dzstd=OFF -Dwebp=OFF -Djbig=OFF -Dlerc=OFF -Dlibdeflate=OFF -Dcxx=OFF"
compile   = "cmake --build build --target tiff"
install   = "DESTDIR=/out cmake --install build"

# zlib-shared/libjpeg-turbo-shared: la .so de tiff los enlaza por NEEDED (libz.so/libjpeg.so).
[deps]
build = ["cmake", "zlib-shared", "libjpeg-turbo-shared"]
