xmake.lua 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("giflib")
  2. set_homepage("https://sourceforge.net/projects/giflib/")
  3. set_description("A library for reading and writing gif images.")
  4. set_license("MIT")
  5. add_urls("https://github.com/xmake-mirror/giflib/releases/download/$(version)/giflib-$(version).tar.gz",
  6. "https://downloads.sourceforge.net/project/giflib/giflib-$(version).tar.gz")
  7. add_versions("5.2.2", "be7ffbd057cadebe2aa144542fd90c6838c6a083b5e8a9048b8ee3b66b29d5fb")
  8. add_versions("5.2.1", "31da5562f44c5f15d63340a09a4fd62b48c45620cd302f77a6d9acf0077879bd")
  9. add_patches("5.2.1", "patches/5.2.1/unistd.h.patch", "0f1f7b9a295c9965529608f7e9d810b7f7a2642b3b18910402d5d7ce8b86fc13")
  10. add_configs("utils", {description = "Build utility binaries.", default = true, type = "boolean"})
  11. on_load(function (package)
  12. if package:config("utils") and package:is_plat("windows") then
  13. package:add("deps", "cgetopt")
  14. end
  15. end)
  16. on_install(function (package)
  17. local utils = package:config("utils")
  18. if utils and package:is_plat("windows") then
  19. -- fix unresolved external symbol snprintf before vs2013
  20. for _, file in ipairs({"gif2rgb.c", "gifbuild.c", "gifclrmp.c", "giffix.c", "giftext.c", "giftool.c"}) do
  21. io.replace(file, "snprintf", "_snprintf", {plain = true})
  22. end
  23. end
  24. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  25. import("package.tools.xmake").install(package, {utils = utils})
  26. if utils then
  27. package:addenv("PATH", "bin")
  28. end
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cfuncs("GifMakeMapObject", {includes = "gif_lib.h"}))
  32. end)