-
-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* libvips: add package * remove tools, test. fuzz * add packagedeps * add more configs, improve windows build * add more configs * fix macosx frameworks, disable unsupported deps * add missing config, fix glib missing syslinks * add v8.15.2 * use xmake-io/xmake#4987 * use xmake-io/xmake#4990
- Loading branch information
1 parent
684dccf
commit ee1035b
Showing
2 changed files
with
144 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
package("libvips") | ||
set_homepage("https://libvips.github.io/libvips/") | ||
set_description("A fast image processing library with low memory needs.") | ||
set_license("LGPL-2.1") | ||
|
||
add_urls("https://github.com/libvips/libvips/archive/refs/tags/$(version).tar.gz", | ||
"https://github.com/libvips/libvips.git") | ||
|
||
add_versions("v8.15.2", "8c3ece7be367636fd676573a8ff22170c07e95e81fd94f2d1eb9966800522e1f") | ||
add_versions("v8.15.1", "5701445a076465a3402a135d13c0660d909beb8efc4f00fbbe82392e243497f2") | ||
|
||
add_configs("c++", { description = "Build C++ API", default = true, type = "boolean" }) | ||
add_configs("deprecated", { description = "Build deprecated components", default = false, type = "boolean" }) | ||
add_configs("dynamic_modules", { description = "Build dynamic modules", default = false, type = "boolean" }) | ||
add_configs("introspection", { description = "Build GObject introspection data", default = false, type = "boolean" }) | ||
add_configs("vapi", { description = "Build VAPI", default = false, type = "boolean" }) | ||
|
||
add_configs("nsgif", { description = "Build with nsgif", default = false, type = "boolean" }) | ||
add_configs("ppm", { description = "Build with ppm", default = false, type = "boolean" }) | ||
add_configs("analyze", { description = "Build with analyze", default = false, type = "boolean" }) | ||
add_configs("radiance", { description = "Build with radiance", default = false, type = "boolean" }) | ||
|
||
local deps = { | ||
"cfitsio", | ||
"fftw", | ||
"fontconfig", | ||
"libarchive", | ||
"libheif", | ||
"libimagequant", | ||
"libjpeg", | ||
"libjxl", | ||
"lcms", | ||
"imagemagick", | ||
"matio", | ||
"openexr", | ||
"openjpeg", | ||
"poppler", | ||
"libpng", | ||
"libspng", | ||
"libtiff", | ||
"libwebp", | ||
"zlib", | ||
} | ||
|
||
local unsupported_deps = { | ||
"cgif", | ||
"exif", | ||
"nifti", | ||
"openslide", | ||
"highway", | ||
"orc", | ||
"pangocairo", | ||
"pdfium", | ||
"quantizr", | ||
"rsvg", | ||
} | ||
|
||
for _, dep in ipairs(deps) do | ||
add_configs(dep, { description = "Build with " .. dep, default = false, type = "boolean"}) | ||
end | ||
|
||
for _, dep in ipairs(unsupported_deps) do | ||
add_configs(dep, { description = "Build with " .. dep, default = false, type = "boolean", readonly = true}) | ||
end | ||
|
||
add_deps("meson", "ninja") | ||
add_deps("glib", "expat") | ||
if is_plat("windows") then | ||
add_deps("pkgconf") | ||
end | ||
|
||
if is_plat("mingw") and is_subhost("msys") then | ||
add_extsources("pacman::libvips") | ||
elseif is_plat("linux") then | ||
add_extsources("apt::libvips", "pacman::libvips") | ||
elseif is_plat("macosx") then | ||
add_extsources("brew::vips") | ||
end | ||
|
||
on_load(function (package) | ||
for _, dep in ipairs(deps) do | ||
if package:config(dep) then | ||
package:add("deps", dep) | ||
end | ||
end | ||
end) | ||
|
||
on_install("windows", "macosx", "linux", "cross", function (package) | ||
io.replace("meson.build", "subdir('tools')", "", {plain = true}) | ||
io.replace("meson.build", "subdir('test')", "", {plain = true}) | ||
io.replace("meson.build", "subdir('fuzz')", "", {plain = true}) | ||
|
||
local configs = {"-Dexamples=false"} | ||
table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static")) | ||
|
||
local configs_map = { | ||
["c++"] = "cplusplus", | ||
["dynamic_modules"] = "modules", | ||
["libarchive"] = "archive", | ||
["libheif"] = "heif", | ||
["libimagequant"] = "imagequant", | ||
["libjpeg"] = "jpeg", | ||
["libjxl"] = "jpeg-xl", | ||
["imagemagick"] = "magick", | ||
["libpng"] = "png", | ||
["libspng"] = "spng", | ||
["libtiff"] = "tiff", | ||
["libwebp"] = "webp", | ||
} | ||
|
||
table.join2(deps, unsupported_deps) | ||
-- workaround meson option type | ||
table.insert(deps, "dynamic_modules") | ||
table.insert(deps, "introspection") | ||
for name, enabled in table.orderpairs(package:configs()) do | ||
if not package:extraconf("configs", name, "builtin") then | ||
local enabled_string | ||
if table.contains(deps, name) then | ||
enabled_string = (enabled and "enabled" or "disabled") | ||
else | ||
enabled_string = (enabled and "true" or "false") | ||
end | ||
|
||
if configs_map[name] then | ||
name = configs_map[name] | ||
end | ||
table.insert(configs, "-D" .. name .. "=" .. enabled_string) | ||
end | ||
end | ||
|
||
import("package.tools.meson").install(package, configs, { | ||
packagedeps = {"libintl", "libiconv"}, | ||
prefix = path.unix(package:installdir()) -- after xmake v2.9.1 | ||
}) | ||
end) | ||
|
||
on_test(function (package) | ||
assert(package:has_cfuncs("vips_image_new_from_file", {includes = "vips/vips.h"})) | ||
end) |