xmake.lua 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. package("gdk-pixbuf")
  2. set_homepage("https://docs.gtk.org/gdk-pixbuf/")
  3. set_description("GdkPixbuf is a library that loads image data in various formats and stores it as linear buffers in memory. The buffers can then be scaled, composited, modified, saved, or rendered.")
  4. set_license("LGPL-2.1")
  5. add_urls("https://download.gnome.org/sources/gdk-pixbuf/$(version).tar.xz", {alias = "home", version = function (version)
  6. return format("%d.%d/gdk-pixbuf-%s", version:major(), version:minor(), version)
  7. end, excludes = "*/tests/*"})
  8. add_urls("https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/archive/$(version)/gdk-pixbuf-$(version).tar.gz",
  9. "https://gitlab.gnome.org/GNOME/gdk-pixbuf.git")
  10. add_versions("home:2.42.10", "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b")
  11. add_versions("home:2.42.6", "c4a6b75b7ed8f58ca48da830b9fa00ed96d668d3ab4b1f723dcf902f78bde77f")
  12. add_patches("2.42.6", path.join(os.scriptdir(), "patches", "2.42.6", "macosx.patch"), "ad2705a5a9aa4b90fb4588bb567e95f5d82fccb6a5d463cd07462180e2e418eb")
  13. if is_plat("mingw") and is_subhost("msys") then
  14. add_extsources("pacman::gdk-pixbuf2")
  15. elseif is_plat("linux") then
  16. add_extsources("pacman::gdk-pixbuf2", "apt::libgdk-pixbuf-2.0-dev")
  17. elseif is_plat("macosx") then
  18. add_extsources("brew::gdk-pixbuf")
  19. end
  20. add_includedirs("include", "include/gdk-pixbuf-2.0")
  21. add_deps("meson", "ninja")
  22. add_deps("libpng", "libjpeg-turbo", "glib", "pcre2")
  23. on_load(function (package)
  24. if package:config("shared") then
  25. package:add("deps", "libtiff", {configs = {shared = true}})
  26. else
  27. package:add("deps", "libtiff")
  28. end
  29. end)
  30. if is_plat("windows") then
  31. add_syslinks("iphlpapi", "dnsapi")
  32. add_deps("pkgconf", "libintl")
  33. elseif is_plat("macosx") then
  34. add_frameworks("Foundation", "CoreFoundation", "AppKit")
  35. add_deps("libiconv", {system = true})
  36. add_syslinks("resolv")
  37. elseif is_plat("linux") then
  38. add_deps("libiconv")
  39. end
  40. on_install("windows", "macosx", "linux", function (package)
  41. io.gsub("meson.build", "subdir%('tests'%)", "")
  42. io.gsub("meson.build", "subdir%('fuzzing'%)", "")
  43. io.gsub("meson.build", "subdir%('docs'%)", "")
  44. local configs = {"-Dman=false",
  45. "-Ddocs=false",
  46. "-Dgtk_doc=false",
  47. "-Dpng=enabled",
  48. "-Dtiff=enabled",
  49. "-Djpeg=enabled",
  50. "-Dnative_windows_loaders=false",
  51. "-Dbuiltin_loaders=all",
  52. "-Dgio_sniffing=false",
  53. "-Drelocatable=true",
  54. "-Dintrospection=disabled",
  55. "-Dtests=false",
  56. "-Dinstalled_tests=false"}
  57. table.insert(configs, "-Ddefault_library=" .. (package:config("shared") and "shared" or "static"))
  58. package:addenv("PATH", "bin")
  59. import("package.tools.meson").install(package, configs, {packagedeps = {"libjpeg-turbo", "libpng", "libtiff", "glib", "pcre2", "libintl", "libiconv"}})
  60. end)
  61. on_test(function (package)
  62. assert(package:has_cfuncs("gdk_pixbuf_get_type", {includes = "gdk-pixbuf/gdk-pixbuf.h"}))
  63. end)