add poppler and jasper (#370)
* update libraw * add poppler * add jasper * add version detection for jasper * fix package name inconsistencypull/371/head
parent
62029d11ff
commit
e138bd65fd
5 changed files with 108 additions and 4 deletions
@ -0,0 +1,36 @@ |
||||
package("jasper") |
||||
|
||||
set_homepage("https://www.ece.uvic.ca/~frodo/jasper/") |
||||
set_description("Official Repository for the JasPer Image Coding Toolkit") |
||||
set_license("BSD-2-Clause") |
||||
|
||||
add_urls("https://github.com/jasper-software/jasper/archive/refs/tags/version-$(version).tar.gz") |
||||
add_versions("2.0.28", "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88") |
||||
|
||||
add_deps("cmake", "libjpeg") |
||||
if not is_plat("macosx") then |
||||
add_deps("freeglut") |
||||
end |
||||
on_install("windows", "macosx", "linux", function (package) |
||||
io.replace("build/cmake/modules/JasOpenGL.cmake", "find_package(GLUT", "find_package(FreeGLUT", {plain = true}) |
||||
local configs = {"-DJAS_ENABLE_PROGRAMS=OFF", "-DJAS_ENABLE_DOC=OFF"} |
||||
local vs_sdkver = get_config("vs_sdkver") |
||||
if vs_sdkver then |
||||
local build_ver = string.match(vs_sdkver, "%d+%.%d+%.(%d+)%.?%d*") |
||||
assert(tonumber(build_ver) >= 18362, "Jasper requires Windows SDK to be at least 10.0.18362.0") |
||||
table.insert(configs, "-DCMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION=" .. vs_sdkver) |
||||
table.insert(configs, "-DCMAKE_SYSTEM_VERSION=" .. vs_sdkver) |
||||
end |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DJAS_ENABLE_SHARED=" .. (package:config("shared") and "ON" or "OFF")) |
||||
if package:config("pic") ~= false then |
||||
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") |
||||
end |
||||
|
||||
-- warning: only works on windows sdk 10.0.18362.0 and later |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cfuncs("jas_image_decode", {includes = "jasper/jasper.h"})) |
||||
end) |
@ -0,0 +1,43 @@ |
||||
package("poppler") |
||||
|
||||
set_homepage("https://poppler.freedesktop.org/") |
||||
set_description("Poppler, a PDF rendering library") |
||||
set_license("GPL-2.0") |
||||
|
||||
add_urls("https://poppler.freedesktop.org/poppler-$(version).tar.xz") |
||||
add_versions("21.03.0", "fd51ead4aac1d2f4684fa6e7b0ec06f0233ed21667e720a4e817e4455dd63d27") |
||||
|
||||
local libnames = {"splash", "glib", "qt5", "qt6"} |
||||
for _, libname in ipairs(libnames) do |
||||
add_configs(libname, {description = "Enable " .. libname .. " for use.", default = (libname == "splash"), type = "boolean"}) |
||||
end |
||||
|
||||
add_deps("cmake") |
||||
add_deps("libtiff", "openjpeg", "lcms", "libjpeg", "libpng", "bzip2", "zlib") |
||||
add_deps("freetype", {configs = {woff2 = false, png = false, bzip2 = false}}) |
||||
if is_plat("linux") then |
||||
add_deps("fontconfig", "expat") |
||||
end |
||||
|
||||
add_includedirs("include") |
||||
add_includedirs("include/poppler") |
||||
|
||||
on_install("windows", "macosx", "linux", function (package) |
||||
io.replace("CMakeLists.txt", "if(MSVC)\n", "if(MSVC)\nadd_definitions(-D_BASETSD_H)\n", {plain = true}) |
||||
io.replace("CMakeLists.txt", "add_subdirectory(test)", "", {plain = true}) |
||||
io.replace("CMakeLists.txt", "set(ENABLE_LIBPNG ON)\n", "set(ENABLE_LIBPNG ON)\ninclude_directories(SYSTEM ${PNG_INCLUDE_DIRS})\n", {plain = true}) |
||||
local configs = {"-DENABLE_UNSTABLE_API_ABI_HEADERS=ON", "-DBUILD_GTK_TESTS=OFF", "-DBUILD_QT5_TESTS=OFF", "-DBUILD_QT6_TESTS=OFF", "-DBUILD_CPP_TESTS=OFF", "-DENABLE_CPP=OFF", "-DENABLE_UTILS=OFF"} |
||||
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release")) |
||||
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF")) |
||||
for _, libname in ipairs(libnames) do |
||||
table.insert(configs, "-DENABLE_" .. libname:upper() .. "=" .. (package:config(libname) and "ON" or "OFF")) |
||||
end |
||||
if package:config("pic") ~= false then |
||||
table.insert(configs, "-DCMAKE_POSITION_INDEPENDENT_CODE=ON") |
||||
end |
||||
import("package.tools.cmake").install(package, configs) |
||||
end) |
||||
|
||||
on_test(function (package) |
||||
assert(package:has_cxxtypes("PDFDocBuilder", {configs = {languages = "c++11"}, includes = "PDFDocBuilder.h"})) |
||||
end) |
Loading…
Reference in new issue