xmake.lua 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. package("pdfio")
  2. set_homepage("https://www.msweet.org/pdfio")
  3. set_description("PDFio is a simple C library for reading and writing PDF files.")
  4. set_license("Apache-2.0")
  5. add_urls("https://github.com/michaelrsweet/pdfio/archive/refs/tags/$(version).tar.gz",
  6. "https://github.com/michaelrsweet/pdfio.git")
  7. add_versions("v1.3.1", "0f2933f2d5d0a8c0152510fe5b565715cee8146f3d0d10024e3c597268928574")
  8. add_versions("v1.3.0", "aae5b4850560869021f6af1700a0681f0d19299554f24abf890a1a78188ddf02")
  9. if is_plat("windows", "mingw") then
  10. add_syslinks("advapi32")
  11. elseif is_plat("linux", "bsd") then
  12. add_syslinks("m")
  13. end
  14. add_deps("zlib")
  15. if on_check then
  16. on_check("android", function (package)
  17. local ndk = package:toolchain("ndk")
  18. local ndk_sdkver = ndk:config("ndk_sdkver")
  19. assert(ndk_sdkver and tonumber(ndk_sdkver) > 21, "package(pdfio): need ndk api level > 21")
  20. end)
  21. end
  22. on_install(function (package)
  23. if package:is_plat("mingw") and package:is_arch("i386") then
  24. io.replace("ttf.c", "typedef __int64 ssize_t;", "", {plain = true})
  25. io.replace("pdfio.h", "typedef __int64 ssize_t;", "", {plain = true})
  26. end
  27. os.cp(path.join(package:scriptdir(), "port", "xmake.lua"), "xmake.lua")
  28. import("package.tools.xmake").install(package)
  29. end)
  30. on_test(function (package)
  31. assert(package:has_cfuncs("pdfioArrayCreate", {includes = "pdfio.h"}))
  32. end)