package("libtiff") set_homepage("http://www.simplesystems.org/libtiff/") set_description("TIFF Library and Utilities.") set_urls("https://gitlab.com/libtiff/libtiff/-/archive/$(version)/libtiff-$(version).tar.gz", "https://gitlab.com/libtiff/libtiff.git") add_versions("v4.1.0", "fddd8838e7e57ba20a93b17706c3f9fe68c8711a6321f04b9ce9a9c24196ac74") add_versions("v4.2.0", "f87463ac8984b43e8dd84a04c14816f5f217796d9f1f459756239c499857e75a") add_deps("zlib", "libjpeg") add_deps("cmake") on_install("windows", "mingw", "macosx", "linux", "bsd", function (package) local configs = {"-Dzstd=OFF", "-Dlzma=OFF", "-Dwebp=OFF", "-Djpeg12=OFF", "-Djbig=OFF", "-Dpixarlog=OFF"} table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) if package:config("pic") ~= false then table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") end io.replace("CMakeLists.txt", "add_subdirectory(contrib)", "", {plain = true}) io.replace("CMakeLists.txt", "add_subdirectory(man)", "", {plain = true}) io.replace("CMakeLists.txt", "add_subdirectory(html)", "", {plain = true}) io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true}) io.replace("CMakeLists.txt", "add_subdirectory(tools)", "", {plain = true}) import("package.tools.cmake").install(package, configs) end) on_test(function (package) assert(package:has_cfuncs("TIFFOpen", {includes = "tiffio.h"})) end)